@@ -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(); |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
136 | - * Gets all the spotter information based on the latest data entry |
|
137 | - * |
|
138 | - * @return Array the spotter information |
|
139 | - * |
|
140 | - */ |
|
136 | + * Gets all the spotter information based on the latest data entry |
|
137 | + * |
|
138 | + * @return Array the spotter information |
|
139 | + * |
|
140 | + */ |
|
141 | 141 | public function getLiveSpotterData($limit = '', $sort = '', $filter = array()) |
142 | 142 | { |
143 | 143 | global $globalDBdriver, $globalLiveInterval; |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
183 | - * Gets Minimal Live Spotter data |
|
184 | - * |
|
185 | - * @return Array the spotter information |
|
186 | - * |
|
187 | - */ |
|
183 | + * Gets Minimal Live Spotter data |
|
184 | + * |
|
185 | + * @return Array the spotter information |
|
186 | + * |
|
187 | + */ |
|
188 | 188 | public function getMinLiveSpotterData($filter = array()) |
189 | 189 | { |
190 | 190 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
224 | - * Gets Minimal Live Spotter data since xx seconds |
|
225 | - * |
|
226 | - * @return Array the spotter information |
|
227 | - * |
|
228 | - */ |
|
224 | + * Gets Minimal Live Spotter data since xx seconds |
|
225 | + * |
|
226 | + * @return Array the spotter information |
|
227 | + * |
|
228 | + */ |
|
229 | 229 | public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false) |
230 | 230 | { |
231 | 231 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
311 | - * Gets number of latest data entry |
|
312 | - * |
|
313 | - * @return String number of entry |
|
314 | - * |
|
315 | - */ |
|
311 | + * Gets number of latest data entry |
|
312 | + * |
|
313 | + * @return String number of entry |
|
314 | + * |
|
315 | + */ |
|
316 | 316 | public function getLiveSpotterCount($filter = array()) |
317 | 317 | { |
318 | 318 | global $globalDBdriver, $globalLiveInterval; |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
342 | - * Gets all the spotter information based on the latest data entry and coord |
|
343 | - * |
|
344 | - * @return Array the spotter information |
|
345 | - * |
|
346 | - */ |
|
342 | + * Gets all the spotter information based on the latest data entry and coord |
|
343 | + * |
|
344 | + * @return Array the spotter information |
|
345 | + * |
|
346 | + */ |
|
347 | 347 | public function getLiveSpotterDatabyCoord($coord, $filter = array()) |
348 | 348 | { |
349 | 349 | global $globalDBdriver, $globalLiveInterval; |
@@ -368,11 +368,11 @@ discard block |
||
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
371 | - * Gets all the spotter information based on the latest data entry and coord |
|
372 | - * |
|
373 | - * @return Array the spotter information |
|
374 | - * |
|
375 | - */ |
|
371 | + * Gets all the spotter information based on the latest data entry and coord |
|
372 | + * |
|
373 | + * @return Array the spotter information |
|
374 | + * |
|
375 | + */ |
|
376 | 376 | public function getMinLiveSpotterDatabyCoord($coord, $filter = array()) |
377 | 377 | { |
378 | 378 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -437,11 +437,11 @@ discard block |
||
437 | 437 | } |
438 | 438 | |
439 | 439 | /** |
440 | - * Gets all the spotter information based on a user's latitude and longitude |
|
441 | - * |
|
442 | - * @return Array the spotter information |
|
443 | - * |
|
444 | - */ |
|
440 | + * Gets all the spotter information based on a user's latitude and longitude |
|
441 | + * |
|
442 | + * @return Array the spotter information |
|
443 | + * |
|
444 | + */ |
|
445 | 445 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
446 | 446 | { |
447 | 447 | $Spotter = new Spotter($this->db); |
@@ -451,98 +451,98 @@ discard block |
||
451 | 451 | return false; |
452 | 452 | } |
453 | 453 | } |
454 | - if ($lng != '') |
|
455 | - { |
|
456 | - if (!is_numeric($lng)) |
|
457 | - { |
|
458 | - return false; |
|
459 | - } |
|
460 | - } |
|
461 | - |
|
462 | - if ($radius != '') |
|
463 | - { |
|
464 | - if (!is_numeric($radius)) |
|
465 | - { |
|
466 | - return false; |
|
467 | - } |
|
468 | - } |
|
454 | + if ($lng != '') |
|
455 | + { |
|
456 | + if (!is_numeric($lng)) |
|
457 | + { |
|
458 | + return false; |
|
459 | + } |
|
460 | + } |
|
461 | + |
|
462 | + if ($radius != '') |
|
463 | + { |
|
464 | + if (!is_numeric($radius)) |
|
465 | + { |
|
466 | + return false; |
|
467 | + } |
|
468 | + } |
|
469 | 469 | $additional_query = ''; |
470 | - if ($interval != '') |
|
471 | - { |
|
472 | - if (!is_string($interval)) |
|
473 | - { |
|
474 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
475 | - return false; |
|
476 | - } else { |
|
477 | - if ($interval == '1m') |
|
478 | - { |
|
479 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
480 | - } else if ($interval == '15m'){ |
|
481 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
482 | - } |
|
483 | - } |
|
484 | - } else { |
|
485 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
486 | - } |
|
487 | - |
|
488 | - $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 |
|
470 | + if ($interval != '') |
|
471 | + { |
|
472 | + if (!is_string($interval)) |
|
473 | + { |
|
474 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
475 | + return false; |
|
476 | + } else { |
|
477 | + if ($interval == '1m') |
|
478 | + { |
|
479 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
480 | + } else if ($interval == '15m'){ |
|
481 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
482 | + } |
|
483 | + } |
|
484 | + } else { |
|
485 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
486 | + } |
|
487 | + |
|
488 | + $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 |
|
489 | 489 | WHERE spotter_live.latitude <> '' |
490 | 490 | AND spotter_live.longitude <> '' |
491 | 491 | ".$additional_query." |
492 | 492 | HAVING distance < :radius |
493 | 493 | ORDER BY distance"; |
494 | 494 | |
495 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
495 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
496 | 496 | |
497 | - return $spotter_array; |
|
498 | - } |
|
497 | + return $spotter_array; |
|
498 | + } |
|
499 | 499 | |
500 | 500 | |
501 | - /** |
|
502 | - * Gets all the spotter information based on a particular callsign |
|
503 | - * |
|
504 | - * @return Array the spotter information |
|
505 | - * |
|
506 | - */ |
|
501 | + /** |
|
502 | + * Gets all the spotter information based on a particular callsign |
|
503 | + * |
|
504 | + * @return Array the spotter information |
|
505 | + * |
|
506 | + */ |
|
507 | 507 | public function getLastLiveSpotterDataByIdent($ident) |
508 | 508 | { |
509 | 509 | $Spotter = new Spotter($this->db); |
510 | 510 | date_default_timezone_set('UTC'); |
511 | 511 | |
512 | 512 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
513 | - $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'; |
|
513 | + $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'; |
|
514 | 514 | |
515 | 515 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
516 | 516 | |
517 | 517 | return $spotter_array; |
518 | 518 | } |
519 | 519 | |
520 | - /** |
|
521 | - * Gets all the spotter information based on a particular callsign |
|
522 | - * |
|
523 | - * @return Array the spotter information |
|
524 | - * |
|
525 | - */ |
|
520 | + /** |
|
521 | + * Gets all the spotter information based on a particular callsign |
|
522 | + * |
|
523 | + * @return Array the spotter information |
|
524 | + * |
|
525 | + */ |
|
526 | 526 | public function getDateLiveSpotterDataByIdent($ident,$date) |
527 | 527 | { |
528 | 528 | $Spotter = new Spotter($this->db); |
529 | 529 | date_default_timezone_set('UTC'); |
530 | 530 | |
531 | 531 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
532 | - $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'; |
|
532 | + $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'; |
|
533 | 533 | |
534 | - $date = date('c',$date); |
|
534 | + $date = date('c',$date); |
|
535 | 535 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
536 | 536 | |
537 | 537 | return $spotter_array; |
538 | 538 | } |
539 | 539 | |
540 | - /** |
|
541 | - * Gets last spotter information based on a particular callsign |
|
542 | - * |
|
543 | - * @return Array the spotter information |
|
544 | - * |
|
545 | - */ |
|
540 | + /** |
|
541 | + * Gets last spotter information based on a particular callsign |
|
542 | + * |
|
543 | + * @return Array the spotter information |
|
544 | + * |
|
545 | + */ |
|
546 | 546 | public function getLastLiveSpotterDataById($id) |
547 | 547 | { |
548 | 548 | $Spotter = new Spotter($this->db); |
@@ -553,12 +553,12 @@ discard block |
||
553 | 553 | return $spotter_array; |
554 | 554 | } |
555 | 555 | |
556 | - /** |
|
557 | - * Gets last spotter information based on a particular callsign |
|
558 | - * |
|
559 | - * @return Array the spotter information |
|
560 | - * |
|
561 | - */ |
|
556 | + /** |
|
557 | + * Gets last spotter information based on a particular callsign |
|
558 | + * |
|
559 | + * @return Array the spotter information |
|
560 | + * |
|
561 | + */ |
|
562 | 562 | public function getDateLiveSpotterDataById($id,$date) |
563 | 563 | { |
564 | 564 | $Spotter = new Spotter($this->db); |
@@ -571,21 +571,21 @@ discard block |
||
571 | 571 | return $spotter_array; |
572 | 572 | } |
573 | 573 | |
574 | - /** |
|
575 | - * Gets altitude information based on a particular callsign |
|
576 | - * |
|
577 | - * @return Array the spotter information |
|
578 | - * |
|
579 | - */ |
|
574 | + /** |
|
575 | + * Gets altitude information based on a particular callsign |
|
576 | + * |
|
577 | + * @return Array the spotter information |
|
578 | + * |
|
579 | + */ |
|
580 | 580 | public function getAltitudeLiveSpotterDataByIdent($ident) |
581 | 581 | { |
582 | 582 | |
583 | 583 | date_default_timezone_set('UTC'); |
584 | 584 | |
585 | 585 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
586 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
586 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
587 | 587 | |
588 | - try { |
|
588 | + try { |
|
589 | 589 | |
590 | 590 | $sth = $this->db->prepare($query); |
591 | 591 | $sth->execute(array(':ident' => $ident)); |
@@ -598,12 +598,12 @@ discard block |
||
598 | 598 | return $spotter_array; |
599 | 599 | } |
600 | 600 | |
601 | - /** |
|
602 | - * Gets all the spotter information based on a particular id |
|
603 | - * |
|
604 | - * @return Array the spotter information |
|
605 | - * |
|
606 | - */ |
|
601 | + /** |
|
602 | + * Gets all the spotter information based on a particular id |
|
603 | + * |
|
604 | + * @return Array the spotter information |
|
605 | + * |
|
606 | + */ |
|
607 | 607 | public function getAllLiveSpotterDataById($id,$liveinterval = false) |
608 | 608 | { |
609 | 609 | global $globalDBdriver, $globalLiveInterval; |
@@ -631,18 +631,18 @@ discard block |
||
631 | 631 | return $spotter_array; |
632 | 632 | } |
633 | 633 | |
634 | - /** |
|
635 | - * Gets all the spotter information based on a particular ident |
|
636 | - * |
|
637 | - * @return Array the spotter information |
|
638 | - * |
|
639 | - */ |
|
634 | + /** |
|
635 | + * Gets all the spotter information based on a particular ident |
|
636 | + * |
|
637 | + * @return Array the spotter information |
|
638 | + * |
|
639 | + */ |
|
640 | 640 | public function getAllLiveSpotterDataByIdent($ident) |
641 | 641 | { |
642 | 642 | date_default_timezone_set('UTC'); |
643 | 643 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
644 | 644 | $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
645 | - try { |
|
645 | + try { |
|
646 | 646 | |
647 | 647 | $sth = $this->db->prepare($query); |
648 | 648 | $sth->execute(array(':ident' => $ident)); |
@@ -656,23 +656,23 @@ discard block |
||
656 | 656 | |
657 | 657 | |
658 | 658 | /** |
659 | - * Deletes all info in the table |
|
660 | - * |
|
661 | - * @return String success or false |
|
662 | - * |
|
663 | - */ |
|
659 | + * Deletes all info in the table |
|
660 | + * |
|
661 | + * @return String success or false |
|
662 | + * |
|
663 | + */ |
|
664 | 664 | public function deleteLiveSpotterData() |
665 | 665 | { |
666 | 666 | global $globalDBdriver; |
667 | 667 | if ($globalDBdriver == 'mysql') { |
668 | 668 | //$query = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date"; |
669 | 669 | $query = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date'; |
670 | - //$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)"; |
|
670 | + //$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)"; |
|
671 | 671 | } else { |
672 | 672 | $query = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date"; |
673 | 673 | } |
674 | 674 | |
675 | - try { |
|
675 | + try { |
|
676 | 676 | |
677 | 677 | $sth = $this->db->prepare($query); |
678 | 678 | $sth->execute(); |
@@ -684,18 +684,18 @@ discard block |
||
684 | 684 | } |
685 | 685 | |
686 | 686 | /** |
687 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
688 | - * |
|
689 | - * @return String success or false |
|
690 | - * |
|
691 | - */ |
|
687 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
688 | + * |
|
689 | + * @return String success or false |
|
690 | + * |
|
691 | + */ |
|
692 | 692 | public function deleteLiveSpotterDataNotUpdated() |
693 | 693 | { |
694 | 694 | global $globalDBdriver, $globalDebug; |
695 | 695 | if ($globalDBdriver == 'mysql') { |
696 | 696 | //$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'; |
697 | - $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 2000 OFFSET 0"; |
|
698 | - try { |
|
697 | + $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 2000 OFFSET 0"; |
|
698 | + try { |
|
699 | 699 | |
700 | 700 | $sth = $this->db->prepare($query); |
701 | 701 | $sth->execute(); |
@@ -703,8 +703,8 @@ discard block |
||
703 | 703 | return "error"; |
704 | 704 | } |
705 | 705 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
706 | - $i = 0; |
|
707 | - $j =0; |
|
706 | + $i = 0; |
|
707 | + $j =0; |
|
708 | 708 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
709 | 709 | foreach($all as $row) |
710 | 710 | { |
@@ -712,20 +712,20 @@ discard block |
||
712 | 712 | $j++; |
713 | 713 | if ($j == 30) { |
714 | 714 | if ($globalDebug) echo "."; |
715 | - try { |
|
715 | + try { |
|
716 | 716 | |
717 | 717 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
718 | 718 | $sth->execute(); |
719 | 719 | } catch(PDOException $e) { |
720 | 720 | return "error"; |
721 | 721 | } |
722 | - $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
723 | - $j = 0; |
|
722 | + $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
723 | + $j = 0; |
|
724 | 724 | } |
725 | 725 | $query_delete .= "'".$row['flightaware_id']."',"; |
726 | 726 | } |
727 | 727 | if ($i > 0) { |
728 | - try { |
|
728 | + try { |
|
729 | 729 | |
730 | 730 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
731 | 731 | $sth->execute(); |
@@ -736,9 +736,9 @@ discard block |
||
736 | 736 | return "success"; |
737 | 737 | } elseif ($globalDBdriver == 'pgsql') { |
738 | 738 | //$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"; |
739 | - //$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"; |
|
740 | - $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 2000 OFFSET 0)"; |
|
741 | - try { |
|
739 | + //$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"; |
|
740 | + $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 2000 OFFSET 0)"; |
|
741 | + try { |
|
742 | 742 | |
743 | 743 | $sth = $this->db->prepare($query); |
744 | 744 | $sth->execute(); |
@@ -782,17 +782,17 @@ discard block |
||
782 | 782 | } |
783 | 783 | |
784 | 784 | /** |
785 | - * Deletes all info in the table for an ident |
|
786 | - * |
|
787 | - * @return String success or false |
|
788 | - * |
|
789 | - */ |
|
785 | + * Deletes all info in the table for an ident |
|
786 | + * |
|
787 | + * @return String success or false |
|
788 | + * |
|
789 | + */ |
|
790 | 790 | public function deleteLiveSpotterDataByIdent($ident) |
791 | 791 | { |
792 | 792 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
793 | 793 | $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
794 | 794 | |
795 | - try { |
|
795 | + try { |
|
796 | 796 | |
797 | 797 | $sth = $this->db->prepare($query); |
798 | 798 | $sth->execute(array(':ident' => $ident)); |
@@ -804,17 +804,17 @@ discard block |
||
804 | 804 | } |
805 | 805 | |
806 | 806 | /** |
807 | - * Deletes all info in the table for an id |
|
808 | - * |
|
809 | - * @return String success or false |
|
810 | - * |
|
811 | - */ |
|
807 | + * Deletes all info in the table for an id |
|
808 | + * |
|
809 | + * @return String success or false |
|
810 | + * |
|
811 | + */ |
|
812 | 812 | public function deleteLiveSpotterDataById($id) |
813 | 813 | { |
814 | 814 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
815 | 815 | $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
816 | 816 | |
817 | - try { |
|
817 | + try { |
|
818 | 818 | |
819 | 819 | $sth = $this->db->prepare($query); |
820 | 820 | $sth->execute(array(':id' => $id)); |
@@ -827,11 +827,11 @@ discard block |
||
827 | 827 | |
828 | 828 | |
829 | 829 | /** |
830 | - * Gets the aircraft ident within the last hour |
|
831 | - * |
|
832 | - * @return String the ident |
|
833 | - * |
|
834 | - */ |
|
830 | + * Gets the aircraft ident within the last hour |
|
831 | + * |
|
832 | + * @return String the ident |
|
833 | + * |
|
834 | + */ |
|
835 | 835 | public function getIdentFromLastHour($ident) |
836 | 836 | { |
837 | 837 | global $globalDBdriver, $globalTimezone; |
@@ -857,14 +857,14 @@ discard block |
||
857 | 857 | $ident_result = $row['ident']; |
858 | 858 | } |
859 | 859 | return $ident_result; |
860 | - } |
|
860 | + } |
|
861 | 861 | |
862 | 862 | /** |
863 | - * Check recent aircraft |
|
864 | - * |
|
865 | - * @return String the ident |
|
866 | - * |
|
867 | - */ |
|
863 | + * Check recent aircraft |
|
864 | + * |
|
865 | + * @return String the ident |
|
866 | + * |
|
867 | + */ |
|
868 | 868 | public function checkIdentRecent($ident) |
869 | 869 | { |
870 | 870 | global $globalDBdriver, $globalTimezone; |
@@ -890,14 +890,14 @@ discard block |
||
890 | 890 | $ident_result = $row['flightaware_id']; |
891 | 891 | } |
892 | 892 | return $ident_result; |
893 | - } |
|
893 | + } |
|
894 | 894 | |
895 | 895 | /** |
896 | - * Check recent aircraft by id |
|
897 | - * |
|
898 | - * @return String the ident |
|
899 | - * |
|
900 | - */ |
|
896 | + * Check recent aircraft by id |
|
897 | + * |
|
898 | + * @return String the ident |
|
899 | + * |
|
900 | + */ |
|
901 | 901 | public function checkIdRecent($id) |
902 | 902 | { |
903 | 903 | global $globalDBdriver, $globalTimezone; |
@@ -923,14 +923,14 @@ discard block |
||
923 | 923 | $ident_result = $row['flightaware_id']; |
924 | 924 | } |
925 | 925 | return $ident_result; |
926 | - } |
|
926 | + } |
|
927 | 927 | |
928 | 928 | /** |
929 | - * Check recent aircraft by ModeS |
|
930 | - * |
|
931 | - * @return String the ModeS |
|
932 | - * |
|
933 | - */ |
|
929 | + * Check recent aircraft by ModeS |
|
930 | + * |
|
931 | + * @return String the ModeS |
|
932 | + * |
|
933 | + */ |
|
934 | 934 | public function checkModeSRecent($modes) |
935 | 935 | { |
936 | 936 | global $globalDBdriver, $globalTimezone; |
@@ -960,11 +960,11 @@ discard block |
||
960 | 960 | } |
961 | 961 | |
962 | 962 | /** |
963 | - * Gets the aircraft data from the last 20 seconds |
|
964 | - * |
|
965 | - * @return Array the spotter data |
|
966 | - * |
|
967 | - */ |
|
963 | + * Gets the aircraft data from the last 20 seconds |
|
964 | + * |
|
965 | + * @return Array the spotter data |
|
966 | + * |
|
967 | + */ |
|
968 | 968 | public function getRealTimeData($q = '') |
969 | 969 | { |
970 | 970 | global $globalDBdriver; |
@@ -1006,16 +1006,16 @@ discard block |
||
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | /** |
1009 | - * Adds a new spotter data |
|
1010 | - * |
|
1011 | - * @param String $flightaware_id the ID from flightaware |
|
1012 | - * @param String $ident the flight ident |
|
1013 | - * @param String $aircraft_icao the aircraft type |
|
1014 | - * @param String $departure_airport_icao the departure airport |
|
1015 | - * @param String $arrival_airport_icao the arrival airport |
|
1016 | - * @return String success or false |
|
1017 | - * |
|
1018 | - */ |
|
1009 | + * Adds a new spotter data |
|
1010 | + * |
|
1011 | + * @param String $flightaware_id the ID from flightaware |
|
1012 | + * @param String $ident the flight ident |
|
1013 | + * @param String $aircraft_icao the aircraft type |
|
1014 | + * @param String $departure_airport_icao the departure airport |
|
1015 | + * @param String $arrival_airport_icao the arrival airport |
|
1016 | + * @return String success or false |
|
1017 | + * |
|
1018 | + */ |
|
1019 | 1019 | 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 = '') |
1020 | 1020 | { |
1021 | 1021 | global $globalURL, $globalArchive, $globalDebug; |
@@ -1158,10 +1158,10 @@ discard block |
||
1158 | 1158 | $arrival_airport_country = ''; |
1159 | 1159 | |
1160 | 1160 | |
1161 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1162 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1163 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1164 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1161 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1162 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1163 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1164 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1165 | 1165 | |
1166 | 1166 | $query = ''; |
1167 | 1167 | if ($globalArchive) { |
@@ -1182,10 +1182,10 @@ discard block |
||
1182 | 1182 | return "error : ".$e->getMessage(); |
1183 | 1183 | } |
1184 | 1184 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1185 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
1186 | - $SpotterArchive = new SpotterArchive($this->db); |
|
1187 | - $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, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1188 | - if ($globalDebug) echo $result.')'; |
|
1185 | + if ($globalDebug) echo '(Add to SBS archive : '; |
|
1186 | + $SpotterArchive = new SpotterArchive($this->db); |
|
1187 | + $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, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1188 | + if ($globalDebug) echo $result.')'; |
|
1189 | 1189 | } elseif ($globalDebug && $putinarchive !== true) { |
1190 | 1190 | echo '(Not adding to archive)'; |
1191 | 1191 | } elseif ($globalDebug && $noarchive === true) { |
@@ -868,7 +868,6 @@ discard block |
||
868 | 868 | * This tells SimplePie to ignore any file errors and fall back to cache |
869 | 869 | * instead. This only works if caching is enabled and cached content |
870 | 870 | * still exists. |
871 | - |
|
872 | 871 | * @param bool $enable Force use of cache on fail. |
873 | 872 | */ |
874 | 873 | public function force_cache_fallback($enable = false) |
@@ -1663,7 +1662,7 @@ discard block |
||
1663 | 1662 | // Now also do feed discovery, but if microformats were found don't |
1664 | 1663 | // overwrite the current value of file. |
1665 | 1664 | $discovered = $locate->find($this->autodiscovery, |
1666 | - $this->all_discovered_feeds); |
|
1665 | + $this->all_discovered_feeds); |
|
1667 | 1666 | if ($microformats) |
1668 | 1667 | { |
1669 | 1668 | if ($hub = $locate->get_rel_link('hub')) |
@@ -1928,8 +1927,8 @@ discard block |
||
1928 | 1927 | { |
1929 | 1928 | // sanitize encodes ampersands which are required when used in a url. |
1930 | 1929 | return str_replace('&', '&', |
1931 | - $this->sanitize($this->permanent_url, |
|
1932 | - SIMPLEPIE_CONSTRUCT_IRI)); |
|
1930 | + $this->sanitize($this->permanent_url, |
|
1931 | + SIMPLEPIE_CONSTRUCT_IRI)); |
|
1933 | 1932 | } |
1934 | 1933 | } |
1935 | 1934 | else |
@@ -1937,8 +1936,8 @@ discard block |
||
1937 | 1936 | if ($this->feed_url !== null) |
1938 | 1937 | { |
1939 | 1938 | return str_replace('&', '&', |
1940 | - $this->sanitize($this->feed_url, |
|
1941 | - SIMPLEPIE_CONSTRUCT_IRI)); |
|
1939 | + $this->sanitize($this->feed_url, |
|
1940 | + SIMPLEPIE_CONSTRUCT_IRI)); |
|
1942 | 1941 | } |
1943 | 1942 | } |
1944 | 1943 | return null; |
@@ -2597,8 +2596,8 @@ discard block |
||
2597 | 2596 | } |
2598 | 2597 | |
2599 | 2598 | if (isset($this->data['headers']['link']) && |
2600 | - preg_match('/<([^>]+)>; rel='.preg_quote($rel).'/', |
|
2601 | - $this->data['headers']['link'], $match)) |
|
2599 | + preg_match('/<([^>]+)>; rel='.preg_quote($rel).'/', |
|
2600 | + $this->data['headers']['link'], $match)) |
|
2602 | 2601 | { |
2603 | 2602 | return array($match[1]); |
2604 | 2603 | } |
@@ -3937,112 +3936,112 @@ discard block |
||
3937 | 3936 | */ |
3938 | 3937 | class SimplePie_Cache_Memcached implements SimplePie_Cache_Base |
3939 | 3938 | { |
3940 | - /** |
|
3941 | - * Memcached instance |
|
3942 | - * @var Memcached |
|
3943 | - */ |
|
3944 | - protected $cache; |
|
3945 | - |
|
3946 | - /** |
|
3947 | - * Options |
|
3948 | - * @var array |
|
3949 | - */ |
|
3950 | - protected $options; |
|
3951 | - |
|
3952 | - /** |
|
3953 | - * Cache name |
|
3954 | - * @var string |
|
3955 | - */ |
|
3956 | - protected $name; |
|
3957 | - |
|
3958 | - /** |
|
3959 | - * Create a new cache object |
|
3960 | - * @param string $location Location string (from SimplePie::$cache_location) |
|
3961 | - * @param string $name Unique ID for the cache |
|
3962 | - * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data |
|
3963 | - */ |
|
3964 | - public function __construct($location, $name, $type) { |
|
3965 | - $this->options = array( |
|
3966 | - 'host' => '127.0.0.1', |
|
3967 | - 'port' => 11211, |
|
3968 | - 'extras' => array( |
|
3969 | - 'timeout' => 3600, // one hour |
|
3970 | - 'prefix' => 'simplepie_', |
|
3971 | - ), |
|
3972 | - ); |
|
3973 | - $this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location)); |
|
3974 | - |
|
3975 | - $this->name = $this->options['extras']['prefix'] . md5("$name:$type"); |
|
3976 | - |
|
3977 | - $this->cache = new Memcached(); |
|
3978 | - $this->cache->addServer($this->options['host'], (int)$this->options['port']); |
|
3979 | - } |
|
3980 | - |
|
3981 | - /** |
|
3982 | - * Save data to the cache |
|
3983 | - * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property |
|
3984 | - * @return bool Successfulness |
|
3985 | - */ |
|
3986 | - public function save($data) { |
|
3987 | - if ($data instanceof SimplePie) { |
|
3988 | - $data = $data->data; |
|
3989 | - } |
|
3990 | - |
|
3991 | - return $this->setData(serialize($data)); |
|
3992 | - } |
|
3993 | - |
|
3994 | - /** |
|
3995 | - * Retrieve the data saved to the cache |
|
3996 | - * @return array Data for SimplePie::$data |
|
3997 | - */ |
|
3998 | - public function load() { |
|
3999 | - $data = $this->cache->get($this->name); |
|
4000 | - |
|
4001 | - if ($data !== false) { |
|
4002 | - return unserialize($data); |
|
4003 | - } |
|
4004 | - return false; |
|
4005 | - } |
|
4006 | - |
|
4007 | - /** |
|
4008 | - * Retrieve the last modified time for the cache |
|
4009 | - * @return int Timestamp |
|
4010 | - */ |
|
4011 | - public function mtime() { |
|
4012 | - $data = $this->cache->get($this->name . '_mtime'); |
|
4013 | - return (int) $data; |
|
4014 | - } |
|
4015 | - |
|
4016 | - /** |
|
4017 | - * Set the last modified time to the current time |
|
4018 | - * @return bool Success status |
|
4019 | - */ |
|
4020 | - public function touch() { |
|
4021 | - $data = $this->cache->get($this->name); |
|
4022 | - return $this->setData($data); |
|
4023 | - } |
|
4024 | - |
|
4025 | - /** |
|
4026 | - * Remove the cache |
|
4027 | - * @return bool Success status |
|
4028 | - */ |
|
4029 | - public function unlink() { |
|
4030 | - return $this->cache->delete($this->name, 0); |
|
4031 | - } |
|
4032 | - |
|
4033 | - /** |
|
4034 | - * Set the last modified time and data to Memcached |
|
4035 | - * @return bool Success status |
|
4036 | - */ |
|
4037 | - private function setData($data) { |
|
4038 | - |
|
4039 | - if ($data !== false) { |
|
4040 | - $this->cache->set($this->name . '_mtime', time(), (int)$this->options['extras']['timeout']); |
|
4041 | - return $this->cache->set($this->name, $data, (int)$this->options['extras']['timeout']); |
|
4042 | - } |
|
4043 | - |
|
4044 | - return false; |
|
4045 | - } |
|
3939 | + /** |
|
3940 | + * Memcached instance |
|
3941 | + * @var Memcached |
|
3942 | + */ |
|
3943 | + protected $cache; |
|
3944 | + |
|
3945 | + /** |
|
3946 | + * Options |
|
3947 | + * @var array |
|
3948 | + */ |
|
3949 | + protected $options; |
|
3950 | + |
|
3951 | + /** |
|
3952 | + * Cache name |
|
3953 | + * @var string |
|
3954 | + */ |
|
3955 | + protected $name; |
|
3956 | + |
|
3957 | + /** |
|
3958 | + * Create a new cache object |
|
3959 | + * @param string $location Location string (from SimplePie::$cache_location) |
|
3960 | + * @param string $name Unique ID for the cache |
|
3961 | + * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data |
|
3962 | + */ |
|
3963 | + public function __construct($location, $name, $type) { |
|
3964 | + $this->options = array( |
|
3965 | + 'host' => '127.0.0.1', |
|
3966 | + 'port' => 11211, |
|
3967 | + 'extras' => array( |
|
3968 | + 'timeout' => 3600, // one hour |
|
3969 | + 'prefix' => 'simplepie_', |
|
3970 | + ), |
|
3971 | + ); |
|
3972 | + $this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location)); |
|
3973 | + |
|
3974 | + $this->name = $this->options['extras']['prefix'] . md5("$name:$type"); |
|
3975 | + |
|
3976 | + $this->cache = new Memcached(); |
|
3977 | + $this->cache->addServer($this->options['host'], (int)$this->options['port']); |
|
3978 | + } |
|
3979 | + |
|
3980 | + /** |
|
3981 | + * Save data to the cache |
|
3982 | + * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property |
|
3983 | + * @return bool Successfulness |
|
3984 | + */ |
|
3985 | + public function save($data) { |
|
3986 | + if ($data instanceof SimplePie) { |
|
3987 | + $data = $data->data; |
|
3988 | + } |
|
3989 | + |
|
3990 | + return $this->setData(serialize($data)); |
|
3991 | + } |
|
3992 | + |
|
3993 | + /** |
|
3994 | + * Retrieve the data saved to the cache |
|
3995 | + * @return array Data for SimplePie::$data |
|
3996 | + */ |
|
3997 | + public function load() { |
|
3998 | + $data = $this->cache->get($this->name); |
|
3999 | + |
|
4000 | + if ($data !== false) { |
|
4001 | + return unserialize($data); |
|
4002 | + } |
|
4003 | + return false; |
|
4004 | + } |
|
4005 | + |
|
4006 | + /** |
|
4007 | + * Retrieve the last modified time for the cache |
|
4008 | + * @return int Timestamp |
|
4009 | + */ |
|
4010 | + public function mtime() { |
|
4011 | + $data = $this->cache->get($this->name . '_mtime'); |
|
4012 | + return (int) $data; |
|
4013 | + } |
|
4014 | + |
|
4015 | + /** |
|
4016 | + * Set the last modified time to the current time |
|
4017 | + * @return bool Success status |
|
4018 | + */ |
|
4019 | + public function touch() { |
|
4020 | + $data = $this->cache->get($this->name); |
|
4021 | + return $this->setData($data); |
|
4022 | + } |
|
4023 | + |
|
4024 | + /** |
|
4025 | + * Remove the cache |
|
4026 | + * @return bool Success status |
|
4027 | + */ |
|
4028 | + public function unlink() { |
|
4029 | + return $this->cache->delete($this->name, 0); |
|
4030 | + } |
|
4031 | + |
|
4032 | + /** |
|
4033 | + * Set the last modified time and data to Memcached |
|
4034 | + * @return bool Success status |
|
4035 | + */ |
|
4036 | + private function setData($data) { |
|
4037 | + |
|
4038 | + if ($data !== false) { |
|
4039 | + $this->cache->set($this->name . '_mtime', time(), (int)$this->options['extras']['timeout']); |
|
4040 | + return $this->cache->set($this->name, $data, (int)$this->options['extras']['timeout']); |
|
4041 | + } |
|
4042 | + |
|
4043 | + return false; |
|
4044 | + } |
|
4046 | 4045 | } |
4047 | 4046 | |
4048 | 4047 | /** |
@@ -4471,143 +4470,143 @@ discard block |
||
4471 | 4470 | * @uses Redis |
4472 | 4471 | */ |
4473 | 4472 | class SimplePie_Cache_Redis implements SimplePie_Cache_Base { |
4474 | - /** |
|
4475 | - * Redis instance |
|
4476 | - * |
|
4477 | - * @var \Redis |
|
4478 | - */ |
|
4479 | - protected $cache; |
|
4480 | - |
|
4481 | - /** |
|
4482 | - * Options |
|
4483 | - * |
|
4484 | - * @var array |
|
4485 | - */ |
|
4486 | - protected $options; |
|
4487 | - |
|
4488 | - /** |
|
4489 | - * Cache name |
|
4490 | - * |
|
4491 | - * @var string |
|
4492 | - */ |
|
4493 | - protected $name; |
|
4494 | - |
|
4495 | - /** |
|
4496 | - * Cache Data |
|
4497 | - * |
|
4498 | - * @var type |
|
4499 | - */ |
|
4500 | - protected $data; |
|
4501 | - |
|
4502 | - /** |
|
4503 | - * Create a new cache object |
|
4504 | - * |
|
4505 | - * @param string $location Location string (from SimplePie::$cache_location) |
|
4506 | - * @param string $name Unique ID for the cache |
|
4507 | - * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data |
|
4508 | - */ |
|
4509 | - public function __construct($location, $name, $options = null) { |
|
4510 | - //$this->cache = \flow\simple\cache\Redis::getRedisClientInstance(); |
|
4511 | - $parsed = SimplePie_Cache::parse_URL($location); |
|
4512 | - $redis = new Redis(); |
|
4513 | - $redis->connect($parsed['host'], $parsed['port']); |
|
4514 | - $this->cache = $redis; |
|
4515 | - |
|
4516 | - if (!is_null($options) && is_array($options)) { |
|
4517 | - $this->options = $options; |
|
4518 | - } else { |
|
4519 | - $this->options = array ( |
|
4520 | - 'prefix' => 'rss:simple_primary:', |
|
4521 | - 'expire' => 0, |
|
4522 | - ); |
|
4523 | - } |
|
4524 | - |
|
4525 | - $this->name = $this->options['prefix'] . $name; |
|
4526 | - } |
|
4527 | - |
|
4528 | - /** |
|
4529 | - * @param \Redis $cache |
|
4530 | - */ |
|
4531 | - public function setRedisClient(\Redis $cache) { |
|
4532 | - $this->cache = $cache; |
|
4533 | - } |
|
4534 | - |
|
4535 | - /** |
|
4536 | - * Save data to the cache |
|
4537 | - * |
|
4538 | - * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property |
|
4539 | - * @return bool Successfulness |
|
4540 | - */ |
|
4541 | - public function save($data) { |
|
4542 | - if ($data instanceof SimplePie) { |
|
4543 | - $data = $data->data; |
|
4544 | - } |
|
4545 | - $response = $this->cache->set($this->name, serialize($data)); |
|
4546 | - if ($this->options['expire']) { |
|
4547 | - $this->cache->expire($this->name, $this->options['expire']); |
|
4548 | - } |
|
4549 | - |
|
4550 | - return $response; |
|
4551 | - } |
|
4552 | - |
|
4553 | - /** |
|
4554 | - * Retrieve the data saved to the cache |
|
4555 | - * |
|
4556 | - * @return array Data for SimplePie::$data |
|
4557 | - */ |
|
4558 | - public function load() { |
|
4559 | - $data = $this->cache->get($this->name); |
|
4560 | - |
|
4561 | - if ($data !== false) { |
|
4562 | - return unserialize($data); |
|
4563 | - } |
|
4564 | - return false; |
|
4565 | - } |
|
4566 | - |
|
4567 | - /** |
|
4568 | - * Retrieve the last modified time for the cache |
|
4569 | - * |
|
4570 | - * @return int Timestamp |
|
4571 | - */ |
|
4572 | - public function mtime() { |
|
4573 | - |
|
4574 | - $data = $this->cache->get($this->name); |
|
4575 | - |
|
4576 | - if ($data !== false) { |
|
4577 | - return time(); |
|
4578 | - } |
|
4579 | - |
|
4580 | - return false; |
|
4581 | - } |
|
4582 | - |
|
4583 | - /** |
|
4584 | - * Set the last modified time to the current time |
|
4585 | - * |
|
4586 | - * @return bool Success status |
|
4587 | - */ |
|
4588 | - public function touch() { |
|
4589 | - |
|
4590 | - $data = $this->cache->get($this->name); |
|
4591 | - |
|
4592 | - if ($data !== false) { |
|
4593 | - $return = $this->cache->set($this->name, $data); |
|
4594 | - if ($this->options['expire']) { |
|
4595 | - return $this->cache->expire($this->name, $this->ttl); |
|
4596 | - } |
|
4597 | - return $return; |
|
4598 | - } |
|
4599 | - |
|
4600 | - return false; |
|
4601 | - } |
|
4602 | - |
|
4603 | - /** |
|
4604 | - * Remove the cache |
|
4605 | - * |
|
4606 | - * @return bool Success status |
|
4607 | - */ |
|
4608 | - public function unlink() { |
|
4609 | - return $this->cache->set($this->name, null); |
|
4610 | - } |
|
4473 | + /** |
|
4474 | + * Redis instance |
|
4475 | + * |
|
4476 | + * @var \Redis |
|
4477 | + */ |
|
4478 | + protected $cache; |
|
4479 | + |
|
4480 | + /** |
|
4481 | + * Options |
|
4482 | + * |
|
4483 | + * @var array |
|
4484 | + */ |
|
4485 | + protected $options; |
|
4486 | + |
|
4487 | + /** |
|
4488 | + * Cache name |
|
4489 | + * |
|
4490 | + * @var string |
|
4491 | + */ |
|
4492 | + protected $name; |
|
4493 | + |
|
4494 | + /** |
|
4495 | + * Cache Data |
|
4496 | + * |
|
4497 | + * @var type |
|
4498 | + */ |
|
4499 | + protected $data; |
|
4500 | + |
|
4501 | + /** |
|
4502 | + * Create a new cache object |
|
4503 | + * |
|
4504 | + * @param string $location Location string (from SimplePie::$cache_location) |
|
4505 | + * @param string $name Unique ID for the cache |
|
4506 | + * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data |
|
4507 | + */ |
|
4508 | + public function __construct($location, $name, $options = null) { |
|
4509 | + //$this->cache = \flow\simple\cache\Redis::getRedisClientInstance(); |
|
4510 | + $parsed = SimplePie_Cache::parse_URL($location); |
|
4511 | + $redis = new Redis(); |
|
4512 | + $redis->connect($parsed['host'], $parsed['port']); |
|
4513 | + $this->cache = $redis; |
|
4514 | + |
|
4515 | + if (!is_null($options) && is_array($options)) { |
|
4516 | + $this->options = $options; |
|
4517 | + } else { |
|
4518 | + $this->options = array ( |
|
4519 | + 'prefix' => 'rss:simple_primary:', |
|
4520 | + 'expire' => 0, |
|
4521 | + ); |
|
4522 | + } |
|
4523 | + |
|
4524 | + $this->name = $this->options['prefix'] . $name; |
|
4525 | + } |
|
4526 | + |
|
4527 | + /** |
|
4528 | + * @param \Redis $cache |
|
4529 | + */ |
|
4530 | + public function setRedisClient(\Redis $cache) { |
|
4531 | + $this->cache = $cache; |
|
4532 | + } |
|
4533 | + |
|
4534 | + /** |
|
4535 | + * Save data to the cache |
|
4536 | + * |
|
4537 | + * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property |
|
4538 | + * @return bool Successfulness |
|
4539 | + */ |
|
4540 | + public function save($data) { |
|
4541 | + if ($data instanceof SimplePie) { |
|
4542 | + $data = $data->data; |
|
4543 | + } |
|
4544 | + $response = $this->cache->set($this->name, serialize($data)); |
|
4545 | + if ($this->options['expire']) { |
|
4546 | + $this->cache->expire($this->name, $this->options['expire']); |
|
4547 | + } |
|
4548 | + |
|
4549 | + return $response; |
|
4550 | + } |
|
4551 | + |
|
4552 | + /** |
|
4553 | + * Retrieve the data saved to the cache |
|
4554 | + * |
|
4555 | + * @return array Data for SimplePie::$data |
|
4556 | + */ |
|
4557 | + public function load() { |
|
4558 | + $data = $this->cache->get($this->name); |
|
4559 | + |
|
4560 | + if ($data !== false) { |
|
4561 | + return unserialize($data); |
|
4562 | + } |
|
4563 | + return false; |
|
4564 | + } |
|
4565 | + |
|
4566 | + /** |
|
4567 | + * Retrieve the last modified time for the cache |
|
4568 | + * |
|
4569 | + * @return int Timestamp |
|
4570 | + */ |
|
4571 | + public function mtime() { |
|
4572 | + |
|
4573 | + $data = $this->cache->get($this->name); |
|
4574 | + |
|
4575 | + if ($data !== false) { |
|
4576 | + return time(); |
|
4577 | + } |
|
4578 | + |
|
4579 | + return false; |
|
4580 | + } |
|
4581 | + |
|
4582 | + /** |
|
4583 | + * Set the last modified time to the current time |
|
4584 | + * |
|
4585 | + * @return bool Success status |
|
4586 | + */ |
|
4587 | + public function touch() { |
|
4588 | + |
|
4589 | + $data = $this->cache->get($this->name); |
|
4590 | + |
|
4591 | + if ($data !== false) { |
|
4592 | + $return = $this->cache->set($this->name, $data); |
|
4593 | + if ($this->options['expire']) { |
|
4594 | + return $this->cache->expire($this->name, $this->ttl); |
|
4595 | + } |
|
4596 | + return $return; |
|
4597 | + } |
|
4598 | + |
|
4599 | + return false; |
|
4600 | + } |
|
4601 | + |
|
4602 | + /** |
|
4603 | + * Remove the cache |
|
4604 | + * |
|
4605 | + * @return bool Success status |
|
4606 | + */ |
|
4607 | + public function unlink() { |
|
4608 | + return $this->cache->set($this->name, null); |
|
4609 | + } |
|
4611 | 4610 | |
4612 | 4611 | } |
4613 | 4612 | |
@@ -8269,9 +8268,9 @@ discard block |
||
8269 | 8268 | * Clean up |
8270 | 8269 | */ |
8271 | 8270 | public function __destruct() { |
8272 | - $this->set_iri(null, true); |
|
8273 | - $this->set_path(null, true); |
|
8274 | - $this->set_authority(null, true); |
|
8271 | + $this->set_iri(null, true); |
|
8272 | + $this->set_path(null, true); |
|
8273 | + $this->set_authority(null, true); |
|
8275 | 8274 | } |
8276 | 8275 | |
8277 | 8276 | /** |
@@ -8794,9 +8793,9 @@ discard block |
||
8794 | 8793 | // Relative urls cannot have a colon in the first path segment (and the |
8795 | 8794 | // slashes themselves are not included so skip the first character). |
8796 | 8795 | if (!$this->scheme && !$isauthority && |
8797 | - strpos($this->ipath, ':') !== false && |
|
8798 | - strpos($this->ipath, '/', 1) !== false && |
|
8799 | - strpos($this->ipath, ':') < strpos($this->ipath, '/', 1)) return false; |
|
8796 | + strpos($this->ipath, ':') !== false && |
|
8797 | + strpos($this->ipath, '/', 1) !== false && |
|
8798 | + strpos($this->ipath, ':') < strpos($this->ipath, '/', 1)) return false; |
|
8800 | 8799 | |
8801 | 8800 | return true; |
8802 | 8801 | } |
@@ -9469,7 +9468,7 @@ discard block |
||
9469 | 9468 | $fn = 'md5'; |
9470 | 9469 | } |
9471 | 9470 | return call_user_func($fn, |
9472 | - $this->get_permalink().$this->get_title().$this->get_content()); |
|
9471 | + $this->get_permalink().$this->get_title().$this->get_content()); |
|
9473 | 9472 | } |
9474 | 9473 | |
9475 | 9474 | /** |
@@ -9538,47 +9537,47 @@ discard block |
||
9538 | 9537 | public function get_description($description_only = false) |
9539 | 9538 | { |
9540 | 9539 | if (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary')) && |
9541 | - ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) |
|
9540 | + ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) |
|
9542 | 9541 | { |
9543 | 9542 | return $return; |
9544 | 9543 | } |
9545 | 9544 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary')) && |
9546 | - ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) |
|
9545 | + ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) |
|
9547 | 9546 | { |
9548 | 9547 | return $return; |
9549 | 9548 | } |
9550 | 9549 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) && |
9551 | - ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($tags[0])))) |
|
9550 | + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($tags[0])))) |
|
9552 | 9551 | { |
9553 | 9552 | return $return; |
9554 | 9553 | } |
9555 | 9554 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) && |
9556 | - ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0])))) |
|
9555 | + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0])))) |
|
9557 | 9556 | { |
9558 | 9557 | return $return; |
9559 | 9558 | } |
9560 | 9559 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) && |
9561 | - ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT))) |
|
9560 | + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT))) |
|
9562 | 9561 | { |
9563 | 9562 | return $return; |
9564 | 9563 | } |
9565 | 9564 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) && |
9566 | - ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT))) |
|
9565 | + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT))) |
|
9567 | 9566 | { |
9568 | 9567 | return $return; |
9569 | 9568 | } |
9570 | 9569 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) && |
9571 | - ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0])))) |
|
9570 | + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0])))) |
|
9572 | 9571 | { |
9573 | 9572 | return $return; |
9574 | 9573 | } |
9575 | 9574 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) && |
9576 | - ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT))) |
|
9575 | + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT))) |
|
9577 | 9576 | { |
9578 | 9577 | return $return; |
9579 | 9578 | } |
9580 | 9579 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) && |
9581 | - ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML))) |
|
9580 | + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML))) |
|
9582 | 9581 | { |
9583 | 9582 | return $return; |
9584 | 9583 | } |
@@ -9610,17 +9609,17 @@ discard block |
||
9610 | 9609 | public function get_content($content_only = false) |
9611 | 9610 | { |
9612 | 9611 | if (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content')) && |
9613 | - ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) |
|
9612 | + ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) |
|
9614 | 9613 | { |
9615 | 9614 | return $return; |
9616 | 9615 | } |
9617 | 9616 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content')) && |
9618 | - ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) |
|
9617 | + ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) |
|
9619 | 9618 | { |
9620 | 9619 | return $return; |
9621 | 9620 | } |
9622 | 9621 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded')) && |
9623 | - ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0])))) |
|
9622 | + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0])))) |
|
9624 | 9623 | { |
9625 | 9624 | return $return; |
9626 | 9625 | } |
@@ -12335,8 +12334,8 @@ discard block |
||
12335 | 12334 | $sniffer = $this->registry->create('Content_Type_Sniffer', array($file)); |
12336 | 12335 | $sniffed = $sniffer->get_type(); |
12337 | 12336 | $mime_types = array('application/rss+xml', 'application/rdf+xml', |
12338 | - 'text/rdf', 'application/atom+xml', 'text/xml', |
|
12339 | - 'application/xml', 'application/x-rss+xml'); |
|
12337 | + 'text/rdf', 'application/atom+xml', 'text/xml', |
|
12338 | + 'application/xml', 'application/x-rss+xml'); |
|
12340 | 12339 | if ($check_html) |
12341 | 12340 | { |
12342 | 12341 | $mime_types[] = 'text/html'; |
@@ -12510,12 +12509,12 @@ discard block |
||
12510 | 12509 | if ($this->dom === null) |
12511 | 12510 | { |
12512 | 12511 | throw new SimplePie_Exception('DOMDocument not found, unable to use '. |
12513 | - 'locator'); |
|
12512 | + 'locator'); |
|
12514 | 12513 | } |
12515 | 12514 | if (!class_exists('DOMXpath')) |
12516 | 12515 | { |
12517 | 12516 | throw new SimplePie_Exception('DOMXpath not found, unable to use '. |
12518 | - 'get_rel_link'); |
|
12517 | + 'get_rel_link'); |
|
12519 | 12518 | } |
12520 | 12519 | |
12521 | 12520 | $xpath = new DOMXpath($this->dom); |
@@ -12525,22 +12524,22 @@ discard block |
||
12525 | 12524 | $href = trim($link->getAttribute('href')); |
12526 | 12525 | $parsed = $this->registry->call('Misc', 'parse_url', array($href)); |
12527 | 12526 | if ($parsed['scheme'] === '' || |
12528 | - preg_match('/^https?$/i', $parsed['scheme'])) |
|
12527 | + preg_match('/^https?$/i', $parsed['scheme'])) |
|
12529 | 12528 | { |
12530 | 12529 | if (method_exists($link, 'getLineNo') && |
12531 | - $this->base_location < $link->getLineNo()) |
|
12530 | + $this->base_location < $link->getLineNo()) |
|
12532 | 12531 | { |
12533 | 12532 | $href = |
12534 | 12533 | $this->registry->call('Misc', 'absolutize_url', |
12535 | - array(trim($link->getAttribute('href')), |
|
12536 | - $this->base)); |
|
12534 | + array(trim($link->getAttribute('href')), |
|
12535 | + $this->base)); |
|
12537 | 12536 | } |
12538 | 12537 | else |
12539 | 12538 | { |
12540 | 12539 | $href = |
12541 | 12540 | $this->registry->call('Misc', 'absolutize_url', |
12542 | - array(trim($link->getAttribute('href')), |
|
12543 | - $this->http_base)); |
|
12541 | + array(trim($link->getAttribute('href')), |
|
12542 | + $this->http_base)); |
|
12544 | 12543 | } |
12545 | 12544 | if ($href === false) |
12546 | 12545 | { |
@@ -16630,9 +16629,9 @@ discard block |
||
16630 | 16629 | } |
16631 | 16630 | $channel = array('channel' => array(array('child' => array('' => |
16632 | 16631 | array('link' => $link, 'image' => $image, 'title' => $feed_title, |
16633 | - 'item' => $items))))); |
|
16632 | + 'item' => $items))))); |
|
16634 | 16633 | $rss = array(array('attribs' => array('' => array('version' => '2.0')), |
16635 | - 'child' => array('' => $channel))); |
|
16634 | + 'child' => array('' => $channel))); |
|
16636 | 16635 | $this->data = array('child' => array('' => array('rss' => $rss))); |
16637 | 16636 | return true; |
16638 | 16637 | } |
@@ -254,16 +254,16 @@ discard block |
||
254 | 254 | <div class="more"> |
255 | 255 | <?php |
256 | 256 | |
257 | - if ($year != '' && $month != '') { |
|
258 | - ?> |
|
257 | + if ($year != '' && $month != '') { |
|
258 | + ?> |
|
259 | 259 | <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
260 | 260 | <?php |
261 | - } else { |
|
262 | - ?> |
|
261 | + } else { |
|
262 | + ?> |
|
263 | 263 | <a href="<?php print $globalURL; ?>/marine/statistics/type" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
264 | 264 | <?php |
265 | - } |
|
266 | - ?> |
|
265 | + } |
|
266 | + ?> |
|
267 | 267 | </div> |
268 | 268 | </div> |
269 | 269 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | ?> |
298 | 298 | <div class="more"> |
299 | 299 | <?php |
300 | - /* |
|
300 | + /* |
|
301 | 301 | if ($year != '' && $month != '') { |
302 | 302 | ?> |
303 | 303 | <a href="<?php print $globalURL; ?>/tracker/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | <?php |
309 | 309 | } |
310 | 310 | */ |
311 | - ?> |
|
311 | + ?> |
|
312 | 312 | </div> |
313 | 313 | </div> |
314 | 314 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | </form> |
8 | 8 | </div> |
9 | 9 | <?php |
10 | - if (isset($owner)) { |
|
10 | + if (isset($owner)) { |
|
11 | 11 | ?> |
12 | 12 | <div class="sub-menu sub-menu-container"> |
13 | 13 | <ul class="nav nav-pills"> |
@@ -38,5 +38,5 @@ discard block |
||
38 | 38 | </ul> |
39 | 39 | </div> |
40 | 40 | <?php |
41 | - } |
|
41 | + } |
|
42 | 42 | ?> |
43 | 43 | \ No newline at end of file |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | $id = $spotter_item['Waypoint']['@attributes']['id']; |
24 | 24 | if ($id == 0 || !is_numeric($id)) $id = $j; |
25 | 25 | $output .= '{"type": "Feature",'; |
26 | - $output .= '"id": '.$id.','; |
|
27 | - $output .= '"properties": {'; |
|
26 | + $output .= '"id": '.$id.','; |
|
27 | + $output .= '"properties": {'; |
|
28 | 28 | $output .= '"type": "'.$spotter_item['@attributes']['type'].'",'; |
29 | 29 | //$output .= '"id": "'.$spotter_item['Waypoint']['@attributes']['id'].'",'; |
30 | 30 | $output .= '"name": "'.$spotter_item['Waypoint']['@attributes']['name'].'",'; |
@@ -35,31 +35,31 @@ discard block |
||
35 | 35 | } elseif ($spotter_item['@attributes']['type'] == 'Finish') { |
36 | 36 | $output .= '"icon": "/images/tsk/tsk-finish.png"'; |
37 | 37 | } else $output .= '"icon": "/images/tsk/number_'.$id.'.png"'; |
38 | - $output .= '},'; |
|
39 | - $output .= '"geometry": {'; |
|
38 | + $output .= '},'; |
|
39 | + $output .= '"geometry": {'; |
|
40 | 40 | $output .= '"type": "Point",'; |
41 | 41 | $output .= '"coordinates": ['; |
42 | - $output .= $spotter_item['Waypoint']['Location']['@attributes']['longitude'].', '.$spotter_item['Waypoint']['Location']['@attributes']['latitude']; |
|
42 | + $output .= $spotter_item['Waypoint']['Location']['@attributes']['longitude'].', '.$spotter_item['Waypoint']['Location']['@attributes']['latitude']; |
|
43 | 43 | $output .= ']'; |
44 | - $output .= '}'; |
|
44 | + $output .= '}'; |
|
45 | 45 | $output .= '},'; |
46 | 46 | $j++; |
47 | 47 | } |
48 | 48 | // Lines |
49 | 49 | $output .= '{"type": "Feature",'; |
50 | - $output .= '"properties": {'; |
|
50 | + $output .= '"properties": {'; |
|
51 | 51 | $output .= '"type": "'.$spotter_array['@attributes']['type'].'"'; |
52 | - $output .= '},'; |
|
53 | - $output .= '"geometry": {'; |
|
52 | + $output .= '},'; |
|
53 | + $output .= '"geometry": {'; |
|
54 | 54 | $output .= '"type": "LineString",'; |
55 | 55 | $output .= '"coordinates": ['; |
56 | 56 | foreach($spotter_array['Point'] as $spotter_item) |
57 | 57 | { |
58 | - $output .= '['.$spotter_item['Waypoint']['Location']['@attributes']['longitude'].', '.$spotter_item['Waypoint']['Location']['@attributes']['latitude'].'],'; |
|
58 | + $output .= '['.$spotter_item['Waypoint']['Location']['@attributes']['longitude'].', '.$spotter_item['Waypoint']['Location']['@attributes']['latitude'].'],'; |
|
59 | 59 | } |
60 | 60 | $output = substr($output, 0, -1); |
61 | 61 | $output .= ']'; |
62 | - $output .= '}'; |
|
62 | + $output .= '}'; |
|
63 | 63 | $output .= '},'; |
64 | 64 | $output = substr($output, 0, -1); |
65 | 65 | } |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | //protected $cookies = array(); |
8 | 8 | |
9 | 9 | /** |
10 | - * Get data from form result |
|
11 | - * @param String $url form URL |
|
12 | - * @param String $type type of submit form method (get or post) |
|
13 | - * @param String|Array $data values form post method |
|
14 | - * @param Array $headers header to submit with the form |
|
15 | - * @return String the result |
|
16 | - */ |
|
10 | + * Get data from form result |
|
11 | + * @param String $url form URL |
|
12 | + * @param String $type type of submit form method (get or post) |
|
13 | + * @param String|Array $data values form post method |
|
14 | + * @param Array $headers header to submit with the form |
|
15 | + * @return String the result |
|
16 | + */ |
|
17 | 17 | public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '', $sizelimit = false, $async = false) { |
18 | 18 | global $globalProxy, $globalForceIPv4; |
19 | 19 | $ch = curl_init(); |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
169 | - * Convert a HTML table to an array |
|
170 | - * @param String $data HTML page |
|
171 | - * @return Array array of the tables in HTML page |
|
172 | - */ |
|
169 | + * Convert a HTML table to an array |
|
170 | + * @param String $data HTML page |
|
171 | + * @return Array array of the tables in HTML page |
|
172 | + */ |
|
173 | 173 | public function table2array($data) { |
174 | 174 | if (!is_string($data)) return array(); |
175 | 175 | if ($data == '') return array(); |
@@ -203,10 +203,10 @@ discard block |
||
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
206 | - * Convert <p> part of a HTML page to an array |
|
207 | - * @param String $data HTML page |
|
208 | - * @return Array array of the <p> in HTML page |
|
209 | - */ |
|
206 | + * Convert <p> part of a HTML page to an array |
|
207 | + * @param String $data HTML page |
|
208 | + * @return Array array of the <p> in HTML page |
|
209 | + */ |
|
210 | 210 | public function text2array($data) { |
211 | 211 | $html = str_get_html($data); |
212 | 212 | if ($html === false) return array(); |
@@ -221,14 +221,14 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
224 | - * Give distance between 2 coordonnates |
|
225 | - * @param Float $lat latitude of first point |
|
226 | - * @param Float $lon longitude of first point |
|
227 | - * @param Float $latc latitude of second point |
|
228 | - * @param Float $lonc longitude of second point |
|
229 | - * @param String $unit km else no unit used |
|
230 | - * @return Float Distance in $unit |
|
231 | - */ |
|
224 | + * Give distance between 2 coordonnates |
|
225 | + * @param Float $lat latitude of first point |
|
226 | + * @param Float $lon longitude of first point |
|
227 | + * @param Float $latc latitude of second point |
|
228 | + * @param Float $lonc longitude of second point |
|
229 | + * @param String $unit km else no unit used |
|
230 | + * @return Float Distance in $unit |
|
231 | + */ |
|
232 | 232 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
233 | 233 | if ($lat == $latc && $lon == $lonc) return 0; |
234 | 234 | $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
@@ -246,25 +246,25 @@ discard block |
||
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
249 | - * Give plunge between 2 altitudes and distance |
|
250 | - * @param Float $initial_altitude altitude of first point in m |
|
251 | - * @param Float $final_altitude altitude of second point in m |
|
252 | - * @param String $distance distance between two points in m |
|
253 | - * @return Float plunge |
|
254 | - */ |
|
249 | + * Give plunge between 2 altitudes and distance |
|
250 | + * @param Float $initial_altitude altitude of first point in m |
|
251 | + * @param Float $final_altitude altitude of second point in m |
|
252 | + * @param String $distance distance between two points in m |
|
253 | + * @return Float plunge |
|
254 | + */ |
|
255 | 255 | public function plunge($initial_altitude,$final_altitude,$distance) { |
256 | 256 | $plunge = rad2deg(asin(($final_altitude-$initial_altitude)/$distance)); |
257 | 257 | return $plunge; |
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
261 | - * Give azimuth between 2 coordonnates |
|
262 | - * @param Float $lat latitude of first point |
|
263 | - * @param Float $lon longitude of first point |
|
264 | - * @param Float $latc latitude of second point |
|
265 | - * @param Float $lonc longitude of second point |
|
266 | - * @return Float Azimuth |
|
267 | - */ |
|
261 | + * Give azimuth between 2 coordonnates |
|
262 | + * @param Float $lat latitude of first point |
|
263 | + * @param Float $lon longitude of first point |
|
264 | + * @param Float $latc latitude of second point |
|
265 | + * @param Float $lonc longitude of second point |
|
266 | + * @return Float Azimuth |
|
267 | + */ |
|
268 | 268 | public function azimuth($lat, $lon, $latc, $lonc) { |
269 | 269 | $dX = $latc - $lat; |
270 | 270 | $dY = $lonc - $lon; |
@@ -275,11 +275,11 @@ discard block |
||
275 | 275 | |
276 | 276 | |
277 | 277 | /** |
278 | - * Check is distance realistic |
|
279 | - * @param int $timeDifference the time between the reception of both messages |
|
280 | - * @param float $distance distance covered |
|
281 | - * @return whether distance is realistic |
|
282 | - */ |
|
278 | + * Check is distance realistic |
|
279 | + * @param int $timeDifference the time between the reception of both messages |
|
280 | + * @param float $distance distance covered |
|
281 | + * @return whether distance is realistic |
|
282 | + */ |
|
283 | 283 | public function withinThreshold ($timeDifference, $distance) { |
284 | 284 | $x = abs($timeDifference); |
285 | 285 | $d = abs($distance); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | public function isInteger($input){ |
300 | - return(ctype_digit(strval($input))); |
|
300 | + return(ctype_digit(strval($input))); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | |
@@ -328,11 +328,11 @@ discard block |
||
328 | 328 | } |
329 | 329 | |
330 | 330 | /** |
331 | - * Copy folder contents |
|
332 | - * @param string $source Source path |
|
333 | - * @param string $dest Destination path |
|
334 | - * @return bool Returns true on success, false on failure |
|
335 | - */ |
|
331 | + * Copy folder contents |
|
332 | + * @param string $source Source path |
|
333 | + * @param string $dest Destination path |
|
334 | + * @return bool Returns true on success, false on failure |
|
335 | + */ |
|
336 | 336 | public function xcopy($source, $dest) |
337 | 337 | { |
338 | 338 | $files = glob($source.'*.*'); |
@@ -344,20 +344,20 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
347 | - * Check if an url exist |
|
348 | - * @param String $url url to check |
|
349 | - * @return bool Return true on succes false on failure |
|
350 | - */ |
|
347 | + * Check if an url exist |
|
348 | + * @param String $url url to check |
|
349 | + * @return bool Return true on succes false on failure |
|
350 | + */ |
|
351 | 351 | public function urlexist($url){ |
352 | 352 | $headers=get_headers($url); |
353 | 353 | return stripos($headers[0],"200 OK")?true:false; |
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
357 | - * Convert hexa to string |
|
358 | - * @param String $hex data in hexa |
|
359 | - * @return String Return result |
|
360 | - */ |
|
357 | + * Convert hexa to string |
|
358 | + * @param String $hex data in hexa |
|
359 | + * @return String Return result |
|
360 | + */ |
|
361 | 361 | public function hex2str($hex) { |
362 | 362 | $str = ''; |
363 | 363 | $hexln = strlen($hex); |
@@ -366,10 +366,10 @@ discard block |
||
366 | 366 | } |
367 | 367 | |
368 | 368 | /** |
369 | - * Convert hexa color to rgb |
|
370 | - * @param String $hex data in hexa |
|
371 | - * @return String Return result |
|
372 | - */ |
|
369 | + * Convert hexa color to rgb |
|
370 | + * @param String $hex data in hexa |
|
371 | + * @return String Return result |
|
372 | + */ |
|
373 | 373 | public function hex2rgb($hex) { |
374 | 374 | $hex = str_replace('#','',$hex); |
375 | 375 | return sscanf($hex, "%02x%02x%02x"); |
@@ -447,9 +447,9 @@ discard block |
||
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
450 | - * Returns list of available locales |
|
451 | - * |
|
452 | - * @return array |
|
450 | + * Returns list of available locales |
|
451 | + * |
|
452 | + * @return array |
|
453 | 453 | */ |
454 | 454 | public function listLocaleDir() |
455 | 455 | { |
@@ -548,100 +548,100 @@ discard block |
||
548 | 548 | public function remove_accents($string) { |
549 | 549 | if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
550 | 550 | $chars = array( |
551 | - // Decompositions for Latin-1 Supplement |
|
552 | - chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
|
553 | - chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', |
|
554 | - chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', |
|
555 | - chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', |
|
556 | - chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', |
|
557 | - chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', |
|
558 | - chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', |
|
559 | - chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', |
|
560 | - chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', |
|
561 | - chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', |
|
562 | - chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', |
|
563 | - chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', |
|
564 | - chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', |
|
565 | - chr(195).chr(159) => 's', chr(195).chr(160) => 'a', |
|
566 | - chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', |
|
567 | - chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', |
|
568 | - chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', |
|
569 | - chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', |
|
570 | - chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', |
|
571 | - chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', |
|
572 | - chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', |
|
573 | - chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', |
|
574 | - chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', |
|
575 | - chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', |
|
576 | - chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', |
|
577 | - chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', |
|
578 | - chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', |
|
579 | - chr(195).chr(191) => 'y', |
|
580 | - // Decompositions for Latin Extended-A |
|
581 | - chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', |
|
582 | - chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', |
|
583 | - chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', |
|
584 | - chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', |
|
585 | - chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', |
|
586 | - chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', |
|
587 | - chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', |
|
588 | - chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', |
|
589 | - chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', |
|
590 | - chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', |
|
591 | - chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', |
|
592 | - chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', |
|
593 | - chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', |
|
594 | - chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', |
|
595 | - chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', |
|
596 | - chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', |
|
597 | - chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', |
|
598 | - chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', |
|
599 | - chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', |
|
600 | - chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', |
|
601 | - chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', |
|
602 | - chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', |
|
603 | - chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
|
604 | - chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
|
605 | - chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
|
606 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
607 | - chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
|
608 | - chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
|
609 | - chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
|
610 | - chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', |
|
611 | - chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', |
|
612 | - chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', |
|
613 | - chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', |
|
614 | - chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', |
|
615 | - chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', |
|
616 | - chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', |
|
617 | - chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', |
|
618 | - chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', |
|
619 | - chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
|
620 | - chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
|
621 | - chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
|
622 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
623 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
624 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
625 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
626 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
627 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
628 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
629 | - chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
|
630 | - chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
|
631 | - chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
|
632 | - chr(197).chr(166) => 'T', chr(197).chr(167) => 't', |
|
633 | - chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', |
|
634 | - chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', |
|
635 | - chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', |
|
636 | - chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', |
|
637 | - chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', |
|
638 | - chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', |
|
639 | - chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', |
|
640 | - chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', |
|
641 | - chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', |
|
642 | - chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', |
|
643 | - chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', |
|
644 | - chr(197).chr(190) => 'z', chr(197).chr(191) => 's' |
|
551 | + // Decompositions for Latin-1 Supplement |
|
552 | + chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
|
553 | + chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', |
|
554 | + chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', |
|
555 | + chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', |
|
556 | + chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', |
|
557 | + chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', |
|
558 | + chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', |
|
559 | + chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', |
|
560 | + chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', |
|
561 | + chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', |
|
562 | + chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', |
|
563 | + chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', |
|
564 | + chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', |
|
565 | + chr(195).chr(159) => 's', chr(195).chr(160) => 'a', |
|
566 | + chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', |
|
567 | + chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', |
|
568 | + chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', |
|
569 | + chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', |
|
570 | + chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', |
|
571 | + chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', |
|
572 | + chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', |
|
573 | + chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', |
|
574 | + chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', |
|
575 | + chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', |
|
576 | + chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', |
|
577 | + chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', |
|
578 | + chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', |
|
579 | + chr(195).chr(191) => 'y', |
|
580 | + // Decompositions for Latin Extended-A |
|
581 | + chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', |
|
582 | + chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', |
|
583 | + chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', |
|
584 | + chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', |
|
585 | + chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', |
|
586 | + chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', |
|
587 | + chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', |
|
588 | + chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', |
|
589 | + chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', |
|
590 | + chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', |
|
591 | + chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', |
|
592 | + chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', |
|
593 | + chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', |
|
594 | + chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', |
|
595 | + chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', |
|
596 | + chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', |
|
597 | + chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', |
|
598 | + chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', |
|
599 | + chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', |
|
600 | + chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', |
|
601 | + chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', |
|
602 | + chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', |
|
603 | + chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
|
604 | + chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
|
605 | + chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
|
606 | + chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
607 | + chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
|
608 | + chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
|
609 | + chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
|
610 | + chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', |
|
611 | + chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', |
|
612 | + chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', |
|
613 | + chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', |
|
614 | + chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', |
|
615 | + chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', |
|
616 | + chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', |
|
617 | + chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', |
|
618 | + chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', |
|
619 | + chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
|
620 | + chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
|
621 | + chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
|
622 | + chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
623 | + chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
624 | + chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
625 | + chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
626 | + chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
627 | + chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
628 | + chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
629 | + chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
|
630 | + chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
|
631 | + chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
|
632 | + chr(197).chr(166) => 'T', chr(197).chr(167) => 't', |
|
633 | + chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', |
|
634 | + chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', |
|
635 | + chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', |
|
636 | + chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', |
|
637 | + chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', |
|
638 | + chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', |
|
639 | + chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', |
|
640 | + chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', |
|
641 | + chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', |
|
642 | + chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', |
|
643 | + chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', |
|
644 | + chr(197).chr(190) => 'z', chr(197).chr(191) => 's' |
|
645 | 645 | ); |
646 | 646 | $string = strtr($string, $chars); |
647 | 647 | return $string; |
@@ -331,15 +331,15 @@ discard block |
||
331 | 331 | } |
332 | 332 | |
333 | 333 | <?php |
334 | - if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
334 | + if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
|
335 | 335 | ?> |
336 | 336 | var loc_geojson = Cesium.loadJson("<?php print $globalURL; ?>/location-geojson.php?coord="+bbox()); |
337 | 337 | <?php |
338 | - } else { |
|
338 | + } else { |
|
339 | 339 | ?> |
340 | 340 | var loc_geojson = Cesium.loadJson("<?php print $globalURL; ?>/location-geojson.php"); |
341 | 341 | <?php |
342 | - } |
|
342 | + } |
|
343 | 343 | ?> |
344 | 344 | loc_geojson.then(function(geojsondata) { |
345 | 345 | loc = new Cesium.CustomDataSource('location'); |
@@ -512,15 +512,15 @@ discard block |
||
512 | 512 | // if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') { |
513 | 513 | ?> |
514 | 514 | <?php |
515 | - if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
|
515 | + if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
|
516 | 516 | ?> |
517 | 517 | var MapTerrain = 'ellipsoid'; |
518 | 518 | <?php |
519 | - } else { |
|
519 | + } else { |
|
520 | 520 | ?> |
521 | 521 | var MapTerrain = getCookie('MapTerrain'); |
522 | 522 | <?php |
523 | - } |
|
523 | + } |
|
524 | 524 | ?> |
525 | 525 | |
526 | 526 | |
@@ -574,11 +574,11 @@ discard block |
||
574 | 574 | } |
575 | 575 | |
576 | 576 | <?php |
577 | - if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) { |
|
577 | + if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) { |
|
578 | 578 | ?> |
579 | 579 | update_tsk(); |
580 | 580 | <?php |
581 | - } |
|
581 | + } |
|
582 | 582 | ?> |
583 | 583 | |
584 | 584 | update_locationsLayer(); |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | /** |
16 | - * Gets the images based on the aircraft registration |
|
17 | - * |
|
18 | - * @return Array the images list |
|
19 | - * |
|
20 | - */ |
|
16 | + * Gets the images based on the aircraft registration |
|
17 | + * |
|
18 | + * @return Array the images list |
|
19 | + * |
|
20 | + */ |
|
21 | 21 | public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
22 | 22 | { |
23 | 23 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | - * Gets the images based on the ship name |
|
42 | - * |
|
43 | - * @return Array the images list |
|
44 | - * |
|
45 | - */ |
|
41 | + * Gets the images based on the ship name |
|
42 | + * |
|
43 | + * @return Array the images list |
|
44 | + * |
|
45 | + */ |
|
46 | 46 | public function getMarineImage($mmsi,$imo = '',$name = '') |
47 | 47 | { |
48 | 48 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
@@ -69,11 +69,11 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | - * Gets the image copyright based on the Exif data |
|
73 | - * |
|
74 | - * @return String image copyright |
|
75 | - * |
|
76 | - */ |
|
72 | + * Gets the image copyright based on the Exif data |
|
73 | + * |
|
74 | + * @return String image copyright |
|
75 | + * |
|
76 | + */ |
|
77 | 77 | public function getExifCopyright($url) { |
78 | 78 | $exif = exif_read_data($url); |
79 | 79 | $copyright = ''; |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | - * Adds the images based on the aircraft registration |
|
92 | - * |
|
93 | - * @return String either success or error |
|
94 | - * |
|
95 | - */ |
|
91 | + * Adds the images based on the aircraft registration |
|
92 | + * |
|
93 | + * @return String either success or error |
|
94 | + * |
|
95 | + */ |
|
96 | 96 | public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
97 | 97 | { |
98 | 98 | global $globalDebug,$globalAircraftImageFetch, $globalOffline; |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | - * Adds the images based on the marine name |
|
124 | - * |
|
125 | - * @return String either success or error |
|
126 | - * |
|
127 | - */ |
|
123 | + * Adds the images based on the marine name |
|
124 | + * |
|
125 | + * @return String either success or error |
|
126 | + * |
|
127 | + */ |
|
128 | 128 | public function addMarineImage($mmsi,$imo = '',$name = '') |
129 | 129 | { |
130 | 130 | global $globalDebug,$globalMarineImageFetch, $globalOffline; |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
164 | - * Gets the aircraft image |
|
165 | - * |
|
166 | - * @param String $aircraft_registration the registration of the aircraft |
|
167 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
168 | - * |
|
169 | - */ |
|
164 | + * Gets the aircraft image |
|
165 | + * |
|
166 | + * @param String $aircraft_registration the registration of the aircraft |
|
167 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
168 | + * |
|
169 | + */ |
|
170 | 170 | public function findAircraftImage($aircraft_registration, $aircraft_icao = '', $airline_icao = '') |
171 | 171 | { |
172 | 172 | global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO, $globalVA; |
@@ -210,14 +210,14 @@ discard block |
||
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
213 | - * Gets the vessel image |
|
214 | - * |
|
215 | - * @param String $mmsi the vessel mmsi |
|
216 | - * @param String $imo the vessel imo |
|
217 | - * @param String $name the vessel name |
|
218 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
219 | - * |
|
220 | - */ |
|
213 | + * Gets the vessel image |
|
214 | + * |
|
215 | + * @param String $mmsi the vessel mmsi |
|
216 | + * @param String $imo the vessel imo |
|
217 | + * @param String $name the vessel name |
|
218 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
219 | + * |
|
220 | + */ |
|
221 | 221 | public function findMarineImage($mmsi,$imo = '',$name = '') |
222 | 222 | { |
223 | 223 | global $globalMarineImageSources; |
@@ -251,13 +251,13 @@ discard block |
||
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
254 | - * Gets the aircraft image from Planespotters |
|
255 | - * |
|
256 | - * @param String $aircraft_registration the registration of the aircraft |
|
257 | - * @param String $aircraft_name type of the aircraft |
|
258 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
259 | - * |
|
260 | - */ |
|
254 | + * Gets the aircraft image from Planespotters |
|
255 | + * |
|
256 | + * @param String $aircraft_registration the registration of the aircraft |
|
257 | + * @param String $aircraft_name type of the aircraft |
|
258 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
259 | + * |
|
260 | + */ |
|
261 | 261 | public function fromPlanespotters($type,$aircraft_registration, $aircraft_name='') { |
262 | 262 | $Common = new Common(); |
263 | 263 | // If aircraft registration is only number, also check with aircraft model |
@@ -285,13 +285,13 @@ discard block |
||
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
288 | - * Gets the aircraft image from Deviantart |
|
289 | - * |
|
290 | - * @param String $registration the registration of the aircraft |
|
291 | - * @param String $name type of the aircraft |
|
292 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
293 | - * |
|
294 | - */ |
|
288 | + * Gets the aircraft image from Deviantart |
|
289 | + * |
|
290 | + * @param String $registration the registration of the aircraft |
|
291 | + * @param String $name type of the aircraft |
|
292 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
293 | + * |
|
294 | + */ |
|
295 | 295 | public function fromDeviantart($type,$registration, $name='') { |
296 | 296 | $Common = new Common(); |
297 | 297 | if ($type == 'aircraft') { |
@@ -325,13 +325,13 @@ discard block |
||
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
328 | - * Gets the aircraft image from JetPhotos |
|
329 | - * |
|
330 | - * @param String $aircraft_registration the registration of the aircraft |
|
331 | - * @param String $aircraft_name type of the aircraft |
|
332 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
333 | - * |
|
334 | - */ |
|
328 | + * Gets the aircraft image from JetPhotos |
|
329 | + * |
|
330 | + * @param String $aircraft_registration the registration of the aircraft |
|
331 | + * @param String $aircraft_name type of the aircraft |
|
332 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
333 | + * |
|
334 | + */ |
|
335 | 335 | public function fromJetPhotos($type,$aircraft_registration, $aircraft_name='') { |
336 | 336 | $Common = new Common(); |
337 | 337 | $url= 'http://jetphotos.net/showphotos.php?displaymode=2®search='.$aircraft_registration; |
@@ -367,13 +367,13 @@ discard block |
||
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
370 | - * Gets the aircraft image from PlanePictures |
|
371 | - * |
|
372 | - * @param String $aircraft_registration the registration of the aircraft |
|
373 | - * @param String $aircraft_name type of the aircraft |
|
374 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
375 | - * |
|
376 | - */ |
|
370 | + * Gets the aircraft image from PlanePictures |
|
371 | + * |
|
372 | + * @param String $aircraft_registration the registration of the aircraft |
|
373 | + * @param String $aircraft_name type of the aircraft |
|
374 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
375 | + * |
|
376 | + */ |
|
377 | 377 | public function fromPlanePictures($type,$aircraft_registration, $aircraft_name='') { |
378 | 378 | $Common = new Common(); |
379 | 379 | $url= 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
@@ -401,13 +401,13 @@ discard block |
||
401 | 401 | } |
402 | 402 | |
403 | 403 | /** |
404 | - * Gets the aircraft image from Flickr |
|
405 | - * |
|
406 | - * @param String $registration the registration of the aircraft |
|
407 | - * @param String $name type of the aircraft |
|
408 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
409 | - * |
|
410 | - */ |
|
404 | + * Gets the aircraft image from Flickr |
|
405 | + * |
|
406 | + * @param String $registration the registration of the aircraft |
|
407 | + * @param String $name type of the aircraft |
|
408 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
409 | + * |
|
410 | + */ |
|
411 | 411 | public function fromFlickr($type,$registration,$name='') { |
412 | 412 | $Common = new Common(); |
413 | 413 | if ($type == 'aircraft') { |
@@ -451,13 +451,13 @@ discard block |
||
451 | 451 | } |
452 | 452 | |
453 | 453 | /** |
454 | - * Gets the aircraft image from Bing |
|
455 | - * |
|
456 | - * @param String $aircraft_registration the registration of the aircraft |
|
457 | - * @param String $aircraft_name type of the aircraft |
|
458 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
459 | - * |
|
460 | - */ |
|
454 | + * Gets the aircraft image from Bing |
|
455 | + * |
|
456 | + * @param String $aircraft_registration the registration of the aircraft |
|
457 | + * @param String $aircraft_name type of the aircraft |
|
458 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
459 | + * |
|
460 | + */ |
|
461 | 461 | public function fromBing($type,$aircraft_registration,$aircraft_name='') { |
462 | 462 | global $globalImageBingKey; |
463 | 463 | $Common = new Common(); |
@@ -488,13 +488,13 @@ discard block |
||
488 | 488 | } |
489 | 489 | |
490 | 490 | /** |
491 | - * Gets the aircraft image from airport-data |
|
492 | - * |
|
493 | - * @param String $aircraft_registration the registration of the aircraft |
|
494 | - * @param String $aircraft_name type of the aircraft |
|
495 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
496 | - * |
|
497 | - */ |
|
491 | + * Gets the aircraft image from airport-data |
|
492 | + * |
|
493 | + * @param String $aircraft_registration the registration of the aircraft |
|
494 | + * @param String $aircraft_name type of the aircraft |
|
495 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
496 | + * |
|
497 | + */ |
|
498 | 498 | public function fromAirportData($type,$aircraft_registration,$aircraft_name='') { |
499 | 499 | $Common = new Common(); |
500 | 500 | $url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration; |
@@ -513,13 +513,13 @@ discard block |
||
513 | 513 | } |
514 | 514 | |
515 | 515 | /** |
516 | - * Gets image from WikiMedia |
|
517 | - * |
|
518 | - * @param String $registration the registration of the aircraft/mmsi |
|
519 | - * @param String $name name |
|
520 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
521 | - * |
|
522 | - */ |
|
516 | + * Gets image from WikiMedia |
|
517 | + * |
|
518 | + * @param String $registration the registration of the aircraft/mmsi |
|
519 | + * @param String $name name |
|
520 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
521 | + * |
|
522 | + */ |
|
523 | 523 | public function fromWikimedia($type,$registration,$name='') { |
524 | 524 | $Common = new Common(); |
525 | 525 | if ($type == 'aircraft') { |
@@ -574,13 +574,13 @@ discard block |
||
574 | 574 | } |
575 | 575 | |
576 | 576 | /** |
577 | - * Gets the aircraft image from custom url |
|
578 | - * |
|
579 | - * @param String $registration the registration of the aircraft |
|
580 | - * @param String $name type of the aircraft |
|
581 | - * @return Array the aircraft thumbnail, orignal url and copyright |
|
582 | - * |
|
583 | - */ |
|
577 | + * Gets the aircraft image from custom url |
|
578 | + * |
|
579 | + * @param String $registration the registration of the aircraft |
|
580 | + * @param String $name type of the aircraft |
|
581 | + * @return Array the aircraft thumbnail, orignal url and copyright |
|
582 | + * |
|
583 | + */ |
|
584 | 584 | public function fromCustomSource($type,$registration,$name='') { |
585 | 585 | global $globalAircraftImageCustomSources, $globalMarineImageCustomSources, $globalDebug; |
586 | 586 | //$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true); |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | }; |
376 | 376 | |
377 | 377 | <?php |
378 | - if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) { |
|
378 | + if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) { |
|
379 | 379 | ?> |
380 | 380 | function tskPopup (feature, layer) { |
381 | 381 | var output = ''; |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | }; |
411 | 411 | update_tsk(); |
412 | 412 | <?php |
413 | - } |
|
413 | + } |
|
414 | 414 | ?> |
415 | 415 | map.on('moveend', function() { |
416 | 416 | //if (map.getZoom() > 7) { |
@@ -426,10 +426,10 @@ discard block |
||
426 | 426 | setInterval(function(){if (noTimeout) update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
427 | 427 | |
428 | 428 | <?php |
429 | - // Add support for custom json via $globalMapJson |
|
430 | - if (isset($globalMapJson) && is_array($globalMapJson)) { |
|
429 | + // Add support for custom json via $globalMapJson |
|
430 | + if (isset($globalMapJson) && is_array($globalMapJson)) { |
|
431 | 431 | foreach ($globalMapJson as $json) { |
432 | - if (isset($json['url'])) { |
|
432 | + if (isset($json['url'])) { |
|
433 | 433 | ?> |
434 | 434 | update_genLayer('<?php print $json['url']; ?>'); |
435 | 435 | <?php |
@@ -438,9 +438,9 @@ discard block |
||
438 | 438 | setInterval(function(){if (noTimeout) update_genLayer('<?php print $json['url']; ?>')}, <?php print $json['refresh']; ?>); |
439 | 439 | <?php |
440 | 440 | } |
441 | - } |
|
441 | + } |
|
442 | + } |
|
442 | 443 | } |
443 | - } |
|
444 | 444 | |
445 | 445 | ?> |
446 | 446 | //adds the bootstrap tooltip to the map icons |