@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
15 | - * Get SQL query part for filter used |
|
16 | - * @param Array $filter the filter |
|
17 | - * @return Array the SQL part |
|
18 | - */ |
|
15 | + * Get SQL query part for filter used |
|
16 | + * @param Array $filter the filter |
|
17 | + * @return Array the SQL part |
|
18 | + */ |
|
19 | 19 | |
20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
85 | - * Executes the SQL statements to get the spotter information |
|
86 | - * |
|
87 | - * @param String $query the SQL query |
|
88 | - * @param Array $params parameter of the query |
|
89 | - * @param String $limitQuery the limit query |
|
90 | - * @return Array the spotter information |
|
91 | - * |
|
92 | - */ |
|
85 | + * Executes the SQL statements to get the spotter information |
|
86 | + * |
|
87 | + * @param String $query the SQL query |
|
88 | + * @param Array $params parameter of the query |
|
89 | + * @param String $limitQuery the limit query |
|
90 | + * @return Array the spotter information |
|
91 | + * |
|
92 | + */ |
|
93 | 93 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
94 | 94 | { |
95 | 95 | date_default_timezone_set('UTC'); |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | |
221 | 221 | |
222 | 222 | /** |
223 | - * Gets all the spotter information based on the latest data entry |
|
224 | - * |
|
225 | - * @return Array the spotter information |
|
226 | - * |
|
227 | - */ |
|
223 | + * Gets all the spotter information based on the latest data entry |
|
224 | + * |
|
225 | + * @return Array the spotter information |
|
226 | + * |
|
227 | + */ |
|
228 | 228 | public function getLatestMarineData($limit = '', $sort = '', $filter = array()) |
229 | 229 | { |
230 | 230 | global $global_query; |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | } |
274 | 274 | |
275 | 275 | /** |
276 | - * Gets all the spotter information based on the callsign |
|
277 | - * |
|
278 | - * @return Array the spotter information |
|
279 | - * |
|
280 | - */ |
|
276 | + * Gets all the spotter information based on the callsign |
|
277 | + * |
|
278 | + * @return Array the spotter information |
|
279 | + * |
|
280 | + */ |
|
281 | 281 | public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
282 | 282 | { |
283 | 283 | global $global_query; |
@@ -329,11 +329,11 @@ discard block |
||
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
332 | - * Gets all the marine information based on the type |
|
333 | - * |
|
334 | - * @return Array the marine information |
|
335 | - * |
|
336 | - */ |
|
332 | + * Gets all the marine information based on the type |
|
333 | + * |
|
334 | + * @return Array the marine information |
|
335 | + * |
|
336 | + */ |
|
337 | 337 | public function getMarineDataByType($type = '', $limit = '', $sort = '', $filter = array()) |
338 | 338 | { |
339 | 339 | global $global_query; |
@@ -441,12 +441,12 @@ discard block |
||
441 | 441 | |
442 | 442 | |
443 | 443 | /** |
444 | - * Gets all source name |
|
445 | - * |
|
446 | - * @param String type format of source |
|
447 | - * @return Array list of source name |
|
448 | - * |
|
449 | - */ |
|
444 | + * Gets all source name |
|
445 | + * |
|
446 | + * @param String type format of source |
|
447 | + * @return Array list of source name |
|
448 | + * |
|
449 | + */ |
|
450 | 450 | public function getAllSourceName($type = '',$filters = array()) |
451 | 451 | { |
452 | 452 | $filter_query = $this->getFilter($filters,true,true); |
@@ -476,11 +476,11 @@ discard block |
||
476 | 476 | |
477 | 477 | |
478 | 478 | /** |
479 | - * Gets a list of all idents/callsigns |
|
480 | - * |
|
481 | - * @return Array list of ident/callsign names |
|
482 | - * |
|
483 | - */ |
|
479 | + * Gets a list of all idents/callsigns |
|
480 | + * |
|
481 | + * @return Array list of ident/callsign names |
|
482 | + * |
|
483 | + */ |
|
484 | 484 | public function getAllIdents($filters = array()) |
485 | 485 | { |
486 | 486 | $filter_query = $this->getFilter($filters,true,true); |
@@ -504,11 +504,11 @@ discard block |
||
504 | 504 | } |
505 | 505 | |
506 | 506 | /** |
507 | - * Gets all info from a mmsi |
|
508 | - * |
|
509 | - * @return Array ident |
|
510 | - * |
|
511 | - */ |
|
507 | + * Gets all info from a mmsi |
|
508 | + * |
|
509 | + * @return Array ident |
|
510 | + * |
|
511 | + */ |
|
512 | 512 | public function getIdentity($mmsi) |
513 | 513 | { |
514 | 514 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -521,9 +521,9 @@ discard block |
||
521 | 521 | } |
522 | 522 | |
523 | 523 | /** |
524 | - * Add identity |
|
525 | - * |
|
526 | - */ |
|
524 | + * Add identity |
|
525 | + * |
|
526 | + */ |
|
527 | 527 | public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
528 | 528 | { |
529 | 529 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -589,13 +589,13 @@ discard block |
||
589 | 589 | } |
590 | 590 | |
591 | 591 | /** |
592 | - * Update ident tracker data |
|
593 | - * |
|
594 | - * @param String $fammarine_id the ID |
|
595 | - * @param String $ident the marine ident |
|
596 | - * @return String success or false |
|
597 | - * |
|
598 | - */ |
|
592 | + * Update ident tracker data |
|
593 | + * |
|
594 | + * @param String $fammarine_id the ID |
|
595 | + * @param String $ident the marine ident |
|
596 | + * @return String success or false |
|
597 | + * |
|
598 | + */ |
|
599 | 599 | public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
600 | 600 | { |
601 | 601 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
@@ -610,13 +610,13 @@ discard block |
||
610 | 610 | } |
611 | 611 | |
612 | 612 | /** |
613 | - * Update arrival marine data |
|
614 | - * |
|
615 | - * @param String $fammarine_id the ID |
|
616 | - * @param String $arrival_code the marine ident |
|
617 | - * @return String success or false |
|
618 | - * |
|
619 | - */ |
|
613 | + * Update arrival marine data |
|
614 | + * |
|
615 | + * @param String $fammarine_id the ID |
|
616 | + * @param String $arrival_code the marine ident |
|
617 | + * @return String success or false |
|
618 | + * |
|
619 | + */ |
|
620 | 620 | public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL) |
621 | 621 | { |
622 | 622 | $query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id'; |
@@ -631,19 +631,19 @@ discard block |
||
631 | 631 | } |
632 | 632 | |
633 | 633 | /** |
634 | - * Update Status data |
|
635 | - * |
|
636 | - * @param String $fammarine_id the ID |
|
637 | - * @param String $status_id the marine status id |
|
638 | - * @param String $status the marine status |
|
639 | - * @return String success or false |
|
640 | - * |
|
641 | - */ |
|
634 | + * Update Status data |
|
635 | + * |
|
636 | + * @param String $fammarine_id the ID |
|
637 | + * @param String $status_id the marine status id |
|
638 | + * @param String $status the marine status |
|
639 | + * @return String success or false |
|
640 | + * |
|
641 | + */ |
|
642 | 642 | public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
643 | 643 | { |
644 | 644 | |
645 | 645 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
646 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
646 | + $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
647 | 647 | |
648 | 648 | try { |
649 | 649 | $sth = $this->db->prepare($query); |
@@ -656,17 +656,17 @@ discard block |
||
656 | 656 | |
657 | 657 | } |
658 | 658 | /** |
659 | - * Update latest marine data |
|
660 | - * |
|
661 | - * @param String $fammarine_id the ID |
|
662 | - * @param String $ident the marine ident |
|
663 | - * @return String success or false |
|
664 | - * |
|
665 | - */ |
|
659 | + * Update latest marine data |
|
660 | + * |
|
661 | + * @param String $fammarine_id the ID |
|
662 | + * @param String $ident the marine ident |
|
663 | + * @return String success or false |
|
664 | + * |
|
665 | + */ |
|
666 | 666 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
667 | 667 | { |
668 | 668 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id'; |
669 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
669 | + $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
670 | 670 | |
671 | 671 | try { |
672 | 672 | $sth = $this->db->prepare($query); |
@@ -680,30 +680,30 @@ discard block |
||
680 | 680 | } |
681 | 681 | |
682 | 682 | /** |
683 | - * Adds a new spotter data |
|
684 | - * |
|
685 | - * @param String $fammarine_id the ID |
|
686 | - * @param String $ident the marine ident |
|
687 | - * @param String $departure_airport_icao the departure airport |
|
688 | - * @param String $arrival_airport_icao the arrival airport |
|
689 | - * @param String $latitude latitude of flight |
|
690 | - * @param String $longitude latitude of flight |
|
691 | - * @param String $waypoints waypoints of flight |
|
692 | - * @param String $heading heading of flight |
|
693 | - * @param String $groundspeed speed of flight |
|
694 | - * @param String $date date of flight |
|
695 | - * @param String $departure_airport_time departure time of flight |
|
696 | - * @param String $arrival_airport_time arrival time of flight |
|
697 | - * @param String $squawk squawk code of flight |
|
698 | - * @param String $route_stop route stop of flight |
|
699 | - * @param String $highlight highlight or not |
|
700 | - * @param String $ModeS ModesS code of flight |
|
701 | - * @param String $registration registration code of flight |
|
702 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
703 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
704 | - * @param String $verticalrate vertival rate of flight |
|
705 | - * @return String success or false |
|
706 | - */ |
|
683 | + * Adds a new spotter data |
|
684 | + * |
|
685 | + * @param String $fammarine_id the ID |
|
686 | + * @param String $ident the marine ident |
|
687 | + * @param String $departure_airport_icao the departure airport |
|
688 | + * @param String $arrival_airport_icao the arrival airport |
|
689 | + * @param String $latitude latitude of flight |
|
690 | + * @param String $longitude latitude of flight |
|
691 | + * @param String $waypoints waypoints of flight |
|
692 | + * @param String $heading heading of flight |
|
693 | + * @param String $groundspeed speed of flight |
|
694 | + * @param String $date date of flight |
|
695 | + * @param String $departure_airport_time departure time of flight |
|
696 | + * @param String $arrival_airport_time arrival time of flight |
|
697 | + * @param String $squawk squawk code of flight |
|
698 | + * @param String $route_stop route stop of flight |
|
699 | + * @param String $highlight highlight or not |
|
700 | + * @param String $ModeS ModesS code of flight |
|
701 | + * @param String $registration registration code of flight |
|
702 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
703 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
704 | + * @param String $verticalrate vertival rate of flight |
|
705 | + * @return String success or false |
|
706 | + */ |
|
707 | 707 | public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '') |
708 | 708 | { |
709 | 709 | global $globalURL, $globalMarineImageFetch; |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | $sth->execute($query_values); |
819 | 819 | $this->db = null; |
820 | 820 | } catch (PDOException $e) { |
821 | - return "error : ".$e->getMessage(); |
|
821 | + return "error : ".$e->getMessage(); |
|
822 | 822 | } |
823 | 823 | |
824 | 824 | return "success"; |
@@ -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; |
@@ -847,11 +847,11 @@ discard block |
||
847 | 847 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
848 | 848 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
849 | 849 | $query_data = array(':ident' => $ident); |
850 | - } |
|
850 | + } |
|
851 | 851 | |
852 | 852 | $sth = $this->db->prepare($query); |
853 | 853 | $sth->execute($query_data); |
854 | - $ident_result=''; |
|
854 | + $ident_result=''; |
|
855 | 855 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
856 | 856 | { |
857 | 857 | $ident_result = $row['ident']; |
@@ -862,11 +862,11 @@ discard block |
||
862 | 862 | |
863 | 863 | |
864 | 864 | /** |
865 | - * Gets the aircraft data from the last 20 seconds |
|
866 | - * |
|
867 | - * @return Array the spotter data |
|
868 | - * |
|
869 | - */ |
|
865 | + * Gets the aircraft data from the last 20 seconds |
|
866 | + * |
|
867 | + * @return Array the spotter data |
|
868 | + * |
|
869 | + */ |
|
870 | 870 | public function getRealTimeData($q = '') |
871 | 871 | { |
872 | 872 | global $globalDBdriver; |
@@ -904,11 +904,11 @@ discard block |
||
904 | 904 | |
905 | 905 | |
906 | 906 | /** |
907 | - * Gets all number of flight over countries |
|
908 | - * |
|
909 | - * @return Array the airline country list |
|
910 | - * |
|
911 | - */ |
|
907 | + * Gets all number of flight over countries |
|
908 | + * |
|
909 | + * @return Array the airline country list |
|
910 | + * |
|
911 | + */ |
|
912 | 912 | |
913 | 913 | public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
914 | 914 | { |
@@ -981,11 +981,11 @@ discard block |
||
981 | 981 | |
982 | 982 | |
983 | 983 | /** |
984 | - * Gets all callsigns that have flown over |
|
985 | - * |
|
986 | - * @return Array the callsign list |
|
987 | - * |
|
988 | - */ |
|
984 | + * Gets all callsigns that have flown over |
|
985 | + * |
|
986 | + * @return Array the callsign list |
|
987 | + * |
|
988 | + */ |
|
989 | 989 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
990 | 990 | { |
991 | 991 | global $globalDBdriver; |
@@ -1052,11 +1052,11 @@ discard block |
||
1052 | 1052 | |
1053 | 1053 | |
1054 | 1054 | /** |
1055 | - * Counts all dates |
|
1056 | - * |
|
1057 | - * @return Array the date list |
|
1058 | - * |
|
1059 | - */ |
|
1055 | + * Counts all dates |
|
1056 | + * |
|
1057 | + * @return Array the date list |
|
1058 | + * |
|
1059 | + */ |
|
1060 | 1060 | public function countAllDates($filters = array()) |
1061 | 1061 | { |
1062 | 1062 | global $globalTimezone, $globalDBdriver; |
@@ -1102,11 +1102,11 @@ discard block |
||
1102 | 1102 | |
1103 | 1103 | |
1104 | 1104 | /** |
1105 | - * Counts all dates during the last 7 days |
|
1106 | - * |
|
1107 | - * @return Array the date list |
|
1108 | - * |
|
1109 | - */ |
|
1105 | + * Counts all dates during the last 7 days |
|
1106 | + * |
|
1107 | + * @return Array the date list |
|
1108 | + * |
|
1109 | + */ |
|
1110 | 1110 | public function countAllDatesLast7Days($filters = array()) |
1111 | 1111 | { |
1112 | 1112 | global $globalTimezone, $globalDBdriver; |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | $query .= " GROUP BY date_name |
1129 | 1129 | ORDER BY date_name ASC"; |
1130 | 1130 | $query_data = array(':offset' => $offset); |
1131 | - } |
|
1131 | + } |
|
1132 | 1132 | |
1133 | 1133 | $sth = $this->db->prepare($query); |
1134 | 1134 | $sth->execute($query_data); |
@@ -1148,11 +1148,11 @@ discard block |
||
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | /** |
1151 | - * Counts all dates during the last month |
|
1152 | - * |
|
1153 | - * @return Array the date list |
|
1154 | - * |
|
1155 | - */ |
|
1151 | + * Counts all dates during the last month |
|
1152 | + * |
|
1153 | + * @return Array the date list |
|
1154 | + * |
|
1155 | + */ |
|
1156 | 1156 | public function countAllDatesLastMonth($filters = array()) |
1157 | 1157 | { |
1158 | 1158 | global $globalTimezone, $globalDBdriver; |
@@ -1174,7 +1174,7 @@ discard block |
||
1174 | 1174 | $query .= " GROUP BY date_name |
1175 | 1175 | ORDER BY date_name ASC"; |
1176 | 1176 | $query_data = array(':offset' => $offset); |
1177 | - } |
|
1177 | + } |
|
1178 | 1178 | |
1179 | 1179 | $sth = $this->db->prepare($query); |
1180 | 1180 | $sth->execute($query_data); |
@@ -1196,11 +1196,11 @@ discard block |
||
1196 | 1196 | |
1197 | 1197 | |
1198 | 1198 | /** |
1199 | - * Counts all month |
|
1200 | - * |
|
1201 | - * @return Array the month list |
|
1202 | - * |
|
1203 | - */ |
|
1199 | + * Counts all month |
|
1200 | + * |
|
1201 | + * @return Array the month list |
|
1202 | + * |
|
1203 | + */ |
|
1204 | 1204 | public function countAllMonths($filters = array()) |
1205 | 1205 | { |
1206 | 1206 | global $globalTimezone, $globalDBdriver; |
@@ -1245,11 +1245,11 @@ discard block |
||
1245 | 1245 | |
1246 | 1246 | |
1247 | 1247 | /** |
1248 | - * Counts all dates during the last year |
|
1249 | - * |
|
1250 | - * @return Array the date list |
|
1251 | - * |
|
1252 | - */ |
|
1248 | + * Counts all dates during the last year |
|
1249 | + * |
|
1250 | + * @return Array the date list |
|
1251 | + * |
|
1252 | + */ |
|
1253 | 1253 | public function countAllMonthsLastYear($filters) |
1254 | 1254 | { |
1255 | 1255 | global $globalTimezone, $globalDBdriver; |
@@ -1271,7 +1271,7 @@ discard block |
||
1271 | 1271 | $query .= " GROUP BY year_name, month_name |
1272 | 1272 | ORDER BY year_name, month_name ASC"; |
1273 | 1273 | $query_data = array(':offset' => $offset); |
1274 | - } |
|
1274 | + } |
|
1275 | 1275 | |
1276 | 1276 | $sth = $this->db->prepare($query); |
1277 | 1277 | $sth->execute($query_data); |
@@ -1294,11 +1294,11 @@ discard block |
||
1294 | 1294 | |
1295 | 1295 | |
1296 | 1296 | /** |
1297 | - * Counts all hours |
|
1298 | - * |
|
1299 | - * @return Array the hour list |
|
1300 | - * |
|
1301 | - */ |
|
1297 | + * Counts all hours |
|
1298 | + * |
|
1299 | + * @return Array the hour list |
|
1300 | + * |
|
1301 | + */ |
|
1302 | 1302 | public function countAllHours($orderby,$filters = array()) |
1303 | 1303 | { |
1304 | 1304 | global $globalTimezone, $globalDBdriver; |
@@ -1361,11 +1361,11 @@ discard block |
||
1361 | 1361 | |
1362 | 1362 | |
1363 | 1363 | /** |
1364 | - * Counts all hours by date |
|
1365 | - * |
|
1366 | - * @return Array the hour list |
|
1367 | - * |
|
1368 | - */ |
|
1364 | + * Counts all hours by date |
|
1365 | + * |
|
1366 | + * @return Array the hour list |
|
1367 | + * |
|
1368 | + */ |
|
1369 | 1369 | public function countAllHoursByDate($date, $filters = array()) |
1370 | 1370 | { |
1371 | 1371 | global $globalTimezone, $globalDBdriver; |
@@ -1409,11 +1409,11 @@ discard block |
||
1409 | 1409 | |
1410 | 1410 | |
1411 | 1411 | /** |
1412 | - * Counts all hours by a ident/callsign |
|
1413 | - * |
|
1414 | - * @return Array the hour list |
|
1415 | - * |
|
1416 | - */ |
|
1412 | + * Counts all hours by a ident/callsign |
|
1413 | + * |
|
1414 | + * @return Array the hour list |
|
1415 | + * |
|
1416 | + */ |
|
1417 | 1417 | public function countAllHoursByIdent($ident, $filters = array()) |
1418 | 1418 | { |
1419 | 1419 | global $globalTimezone, $globalDBdriver; |
@@ -1458,11 +1458,11 @@ discard block |
||
1458 | 1458 | |
1459 | 1459 | |
1460 | 1460 | /** |
1461 | - * Counts all vessels |
|
1462 | - * |
|
1463 | - * @return Integer the number of vessels |
|
1464 | - * |
|
1465 | - */ |
|
1461 | + * Counts all vessels |
|
1462 | + * |
|
1463 | + * @return Integer the number of vessels |
|
1464 | + * |
|
1465 | + */ |
|
1466 | 1466 | public function countOverallMarine($filters = array(),$year = '',$month = '') |
1467 | 1467 | { |
1468 | 1468 | global $globalDBdriver; |
@@ -1497,11 +1497,11 @@ discard block |
||
1497 | 1497 | } |
1498 | 1498 | |
1499 | 1499 | /** |
1500 | - * Counts all vessel type |
|
1501 | - * |
|
1502 | - * @return Integer the number of vessels |
|
1503 | - * |
|
1504 | - */ |
|
1500 | + * Counts all vessel type |
|
1501 | + * |
|
1502 | + * @return Integer the number of vessels |
|
1503 | + * |
|
1504 | + */ |
|
1505 | 1505 | public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
1506 | 1506 | { |
1507 | 1507 | global $globalDBdriver; |
@@ -1536,11 +1536,11 @@ discard block |
||
1536 | 1536 | |
1537 | 1537 | |
1538 | 1538 | /** |
1539 | - * Counts all hours of today |
|
1540 | - * |
|
1541 | - * @return Array the hour list |
|
1542 | - * |
|
1543 | - */ |
|
1539 | + * Counts all hours of today |
|
1540 | + * |
|
1541 | + * @return Array the hour list |
|
1542 | + * |
|
1543 | + */ |
|
1544 | 1544 | public function countAllHoursFromToday($filters = array()) |
1545 | 1545 | { |
1546 | 1546 | global $globalTimezone, $globalDBdriver; |
@@ -1580,12 +1580,12 @@ discard block |
||
1580 | 1580 | } |
1581 | 1581 | |
1582 | 1582 | |
1583 | - /** |
|
1584 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
1585 | - * |
|
1586 | - * @return Integer the Barrie Spotter ID |
|
1583 | + /** |
|
1584 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
1585 | + * |
|
1586 | + * @return Integer the Barrie Spotter ID |
|
1587 | 1587 | q * |
1588 | - */ |
|
1588 | + */ |
|
1589 | 1589 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
1590 | 1590 | { |
1591 | 1591 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -1606,13 +1606,13 @@ discard block |
||
1606 | 1606 | |
1607 | 1607 | |
1608 | 1608 | /** |
1609 | - * Parses a date string |
|
1610 | - * |
|
1611 | - * @param String $dateString the date string |
|
1612 | - * @param String $timezone the timezone of a user |
|
1613 | - * @return Array the time information |
|
1614 | - * |
|
1615 | - */ |
|
1609 | + * Parses a date string |
|
1610 | + * |
|
1611 | + * @param String $dateString the date string |
|
1612 | + * @param String $timezone the timezone of a user |
|
1613 | + * @return Array the time information |
|
1614 | + * |
|
1615 | + */ |
|
1616 | 1616 | public function parseDateString($dateString, $timezone = '') |
1617 | 1617 | { |
1618 | 1618 | $time_array = array(); |
@@ -1645,12 +1645,12 @@ discard block |
||
1645 | 1645 | } |
1646 | 1646 | |
1647 | 1647 | /** |
1648 | - * Parses the direction degrees to working |
|
1649 | - * |
|
1650 | - * @param Float $direction the direction in degrees |
|
1651 | - * @return Array the direction information |
|
1652 | - * |
|
1653 | - */ |
|
1648 | + * Parses the direction degrees to working |
|
1649 | + * |
|
1650 | + * @param Float $direction the direction in degrees |
|
1651 | + * @return Array the direction information |
|
1652 | + * |
|
1653 | + */ |
|
1654 | 1654 | public function parseDirection($direction = 0) |
1655 | 1655 | { |
1656 | 1656 | if ($direction == '') $direction = 0; |
@@ -1729,12 +1729,12 @@ discard block |
||
1729 | 1729 | |
1730 | 1730 | |
1731 | 1731 | /** |
1732 | - * Gets Country from latitude/longitude |
|
1733 | - * |
|
1734 | - * @param Float $latitude latitute of the flight |
|
1735 | - * @param Float $longitude longitute of the flight |
|
1736 | - * @return String the countrie |
|
1737 | - */ |
|
1732 | + * Gets Country from latitude/longitude |
|
1733 | + * |
|
1734 | + * @param Float $latitude latitute of the flight |
|
1735 | + * @param Float $longitude longitute of the flight |
|
1736 | + * @return String the countrie |
|
1737 | + */ |
|
1738 | 1738 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
1739 | 1739 | { |
1740 | 1740 | global $globalDBdriver, $globalDebug; |
@@ -1771,11 +1771,11 @@ discard block |
||
1771 | 1771 | } |
1772 | 1772 | |
1773 | 1773 | /** |
1774 | - * Gets Country from iso2 |
|
1775 | - * |
|
1776 | - * @param String $iso2 ISO2 country code |
|
1777 | - * @return String the countrie |
|
1778 | - */ |
|
1774 | + * Gets Country from iso2 |
|
1775 | + * |
|
1776 | + * @param String $iso2 ISO2 country code |
|
1777 | + * @return String the countrie |
|
1778 | + */ |
|
1779 | 1779 | public function getCountryFromISO2($iso2) |
1780 | 1780 | { |
1781 | 1781 | global $globalDBdriver, $globalDebug; |
@@ -1804,12 +1804,12 @@ discard block |
||
1804 | 1804 | |
1805 | 1805 | |
1806 | 1806 | /** |
1807 | - * Gets the short url from bit.ly |
|
1808 | - * |
|
1809 | - * @param String $url the full url |
|
1810 | - * @return String the bit.ly url |
|
1811 | - * |
|
1812 | - */ |
|
1807 | + * Gets the short url from bit.ly |
|
1808 | + * |
|
1809 | + * @param String $url the full url |
|
1810 | + * @return String the bit.ly url |
|
1811 | + * |
|
1812 | + */ |
|
1813 | 1813 | public function getBitlyURL($url) |
1814 | 1814 | { |
1815 | 1815 | global $globalBitlyAccessToken; |
@@ -1836,11 +1836,11 @@ discard block |
||
1836 | 1836 | |
1837 | 1837 | |
1838 | 1838 | /** |
1839 | - * Gets all vessels types that have flown over |
|
1840 | - * |
|
1841 | - * @return Array the vessel type list |
|
1842 | - * |
|
1843 | - */ |
|
1839 | + * Gets all vessels types that have flown over |
|
1840 | + * |
|
1841 | + * @return Array the vessel type list |
|
1842 | + * |
|
1843 | + */ |
|
1844 | 1844 | public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
1845 | 1845 | { |
1846 | 1846 | global $globalDBdriver; |
@@ -1906,11 +1906,11 @@ discard block |
||
1906 | 1906 | } |
1907 | 1907 | |
1908 | 1908 | /** |
1909 | - * Gets all the tracker information |
|
1910 | - * |
|
1911 | - * @return Array the tracker information |
|
1912 | - * |
|
1913 | - */ |
|
1909 | + * Gets all the tracker information |
|
1910 | + * |
|
1911 | + * @return Array the tracker information |
|
1912 | + * |
|
1913 | + */ |
|
1914 | 1914 | public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
1915 | 1915 | { |
1916 | 1916 | global $globalTimezone, $globalDBdriver; |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | print '<div class="select-item">'; |
43 | 43 | print '<form action="'.$globalURL.'/aircraft" method="get">'; |
44 | 44 | print '<select name="aircraft_type" class="selectpicker" data-live-search="true">'; |
45 | - print '<option></option>'; |
|
46 | - $Stats = new Stats(); |
|
45 | + print '<option></option>'; |
|
46 | + $Stats = new Stats(); |
|
47 | 47 | $aircraft_types = $Stats->getAllAircraftTypes(); |
48 | 48 | if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
49 | 49 | foreach($aircraft_types as $aircrafttype) |
@@ -54,20 +54,20 @@ discard block |
||
54 | 54 | } else { |
55 | 55 | print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_manufacturer'].' '.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
56 | 56 | } |
57 | - } |
|
58 | - print '</select>'; |
|
59 | - print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
|
57 | + } |
|
58 | + print '</select>'; |
|
59 | + print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
|
60 | 60 | print '</form>'; |
61 | 61 | print '</div>'; |
62 | 62 | |
63 | 63 | if ($aircraft_type != "NA") |
64 | 64 | { |
65 | - print '<div class="info column">'; |
|
66 | - print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>'; |
|
67 | - print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>'; |
|
68 | - print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; |
|
69 | - if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>'; |
|
70 | - print '</div>'; |
|
65 | + print '<div class="info column">'; |
|
66 | + print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>'; |
|
67 | + print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>'; |
|
68 | + print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; |
|
69 | + if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>'; |
|
70 | + print '</div>'; |
|
71 | 71 | } else { |
72 | 72 | print '<div class="alert alert-warning">'._("This special aircraft profile shows all flights in where the aircraft type is unknown.").'</div>'; |
73 | 73 | } |
@@ -9,25 +9,25 @@ discard block |
||
9 | 9 | require_once(dirname(__FILE__).'/class.Stats.php'); |
10 | 10 | require_once(dirname(__FILE__).'/class.Source.php'); |
11 | 11 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
12 | - require_once(dirname(__FILE__).'/class.APRS.php'); |
|
12 | + require_once(dirname(__FILE__).'/class.APRS.php'); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | class MarineImport { |
16 | - private $all_tracked = array(); |
|
17 | - private $last_delete_hourly = 0; |
|
18 | - private $last_delete = 0; |
|
19 | - private $stats = array(); |
|
20 | - private $tmd = 0; |
|
21 | - private $source_location = array(); |
|
22 | - public $db = null; |
|
23 | - public $nb = 0; |
|
16 | + private $all_tracked = array(); |
|
17 | + private $last_delete_hourly = 0; |
|
18 | + private $last_delete = 0; |
|
19 | + private $stats = array(); |
|
20 | + private $tmd = 0; |
|
21 | + private $source_location = array(); |
|
22 | + public $db = null; |
|
23 | + public $nb = 0; |
|
24 | 24 | |
25 | - public function __construct($dbc = null) { |
|
25 | + public function __construct($dbc = null) { |
|
26 | 26 | global $globalBeta, $globalServerAPRS, $APRSMarine, $globalNoDB; |
27 | 27 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
28 | - $Connection = new Connection($dbc); |
|
29 | - $this->db = $Connection->db(); |
|
30 | - date_default_timezone_set('UTC'); |
|
28 | + $Connection = new Connection($dbc); |
|
29 | + $this->db = $Connection->db(); |
|
30 | + date_default_timezone_set('UTC'); |
|
31 | 31 | } |
32 | 32 | // Get previous source stats |
33 | 33 | /* |
@@ -46,57 +46,57 @@ discard block |
||
46 | 46 | } |
47 | 47 | */ |
48 | 48 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
49 | - $APRSMarine = new APRSMarine(); |
|
50 | - //$APRSSpotter->connect(); |
|
49 | + $APRSMarine = new APRSMarine(); |
|
50 | + //$APRSSpotter->connect(); |
|
51 | + } |
|
51 | 52 | } |
52 | - } |
|
53 | 53 | |
54 | - public function checkAll() { |
|
54 | + public function checkAll() { |
|
55 | 55 | global $globalDebug, $globalNoDB; |
56 | 56 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
57 | - if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
58 | - foreach ($this->all_tracked as $key => $flight) { |
|
57 | + if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
58 | + foreach ($this->all_tracked as $key => $flight) { |
|
59 | 59 | if (isset($this->all_tracked[$key]['id'])) { |
60 | - //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
|
61 | - $Marine = new Marine($this->db); |
|
62 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
60 | + //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
|
61 | + $Marine = new Marine($this->db); |
|
62 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
63 | + } |
|
63 | 64 | } |
64 | - } |
|
65 | 65 | } |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | - public function del() { |
|
68 | + public function del() { |
|
69 | 69 | global $globalDebug, $globalNoDB, $globalNoImport; |
70 | 70 | // Delete old infos |
71 | 71 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
72 | 72 | foreach ($this->all_tracked as $key => $flight) { |
73 | - if (isset($flight['lastupdate'])) { |
|
74 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
75 | - if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
76 | - if (isset($this->all_tracked[$key]['id'])) { |
|
77 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
78 | - /* |
|
73 | + if (isset($flight['lastupdate'])) { |
|
74 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
75 | + if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
76 | + if (isset($this->all_tracked[$key]['id'])) { |
|
77 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
78 | + /* |
|
79 | 79 | $MarineLive = new MarineLive(); |
80 | 80 | $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']); |
81 | 81 | $MarineLive->db = null; |
82 | 82 | */ |
83 | - //$real_arrival = $this->arrival($key); |
|
84 | - $Marine = new Marine($this->db); |
|
85 | - if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
83 | + //$real_arrival = $this->arrival($key); |
|
84 | + $Marine = new Marine($this->db); |
|
85 | + if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
86 | 86 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
87 | 87 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
88 | - } |
|
89 | - // Put in archive |
|
88 | + } |
|
89 | + // Put in archive |
|
90 | 90 | // $Marine->db = null; |
91 | 91 | } |
92 | - } |
|
93 | - unset($this->all_tracked[$key]); |
|
94 | - } |
|
95 | - } |
|
96 | - } |
|
97 | - } |
|
92 | + } |
|
93 | + unset($this->all_tracked[$key]); |
|
94 | + } |
|
95 | + } |
|
96 | + } |
|
97 | + } |
|
98 | 98 | |
99 | - public function add($line) { |
|
99 | + public function add($line) { |
|
100 | 100 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine; |
101 | 101 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
102 | 102 | date_default_timezone_set('UTC'); |
@@ -105,104 +105,104 @@ discard block |
||
105 | 105 | |
106 | 106 | // SBS format is CSV format |
107 | 107 | if(is_array($line) && isset($line['mmsi'])) { |
108 | - //print_r($line); |
|
109 | - if (isset($line['mmsi'])) { |
|
108 | + //print_r($line); |
|
109 | + if (isset($line['mmsi'])) { |
|
110 | 110 | |
111 | 111 | |
112 | 112 | // Increment message number |
113 | 113 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
114 | - $current_date = date('Y-m-d'); |
|
115 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
116 | - else $source = ''; |
|
117 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
118 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
119 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
120 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
121 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
114 | + $current_date = date('Y-m-d'); |
|
115 | + if (isset($line['source_name'])) $source = $line['source_name']; |
|
116 | + else $source = ''; |
|
117 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
118 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
119 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
120 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
121 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | |
125 | 125 | $Common = new Common(); |
126 | 126 | $AIS = new AIS(); |
127 | - if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
128 | - else $id = trim($line['id']); |
|
127 | + if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
128 | + else $id = trim($line['id']); |
|
129 | 129 | |
130 | 130 | if (!isset($this->all_tracked[$id])) { |
131 | - $this->all_tracked[$id] = array(); |
|
132 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
133 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '')); |
|
134 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
135 | - if (!isset($line['id'])) { |
|
131 | + $this->all_tracked[$id] = array(); |
|
132 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
133 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '')); |
|
134 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
135 | + if (!isset($line['id'])) { |
|
136 | 136 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
137 | 137 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
138 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
139 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
138 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
139 | + if ($globalAllTracked !== FALSE) $dataFound = true; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
143 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
144 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
143 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
144 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
145 | 145 | $Marine = new Marine($this->db); |
146 | 146 | $identity = $Marine->getIdentity($line['mmsi']); |
147 | 147 | if (!empty($identity)) { |
148 | - $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
149 | - $this->all_tracked[$id]['type'] = $identity['type']; |
|
150 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type']))); |
|
148 | + $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
149 | + $this->all_tracked[$id]['type'] = $identity['type']; |
|
150 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type']))); |
|
151 | 151 | } |
152 | 152 | //print_r($identity); |
153 | 153 | unset($Marine); |
154 | 154 | //$dataFound = true; |
155 | - } |
|
155 | + } |
|
156 | 156 | } |
157 | 157 | if (isset($line['type_id'])) { |
158 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
159 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
158 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
159 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
160 | 160 | } |
161 | 161 | if (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] == '') { |
162 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
163 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type']))); |
|
162 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
163 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type']))); |
|
164 | 164 | } |
165 | 165 | if (isset($line['status']) && $line['status'] != '') { |
166 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
166 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
167 | 167 | } |
168 | 168 | if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) { |
169 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
170 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
169 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
170 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
171 | 171 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
172 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
172 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
173 | 173 | $Marine = new Marine($this->db); |
174 | 174 | $Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']); |
175 | 175 | unset($Marine); |
176 | - } |
|
176 | + } |
|
177 | + } |
|
177 | 178 | } |
178 | - } |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
182 | 182 | if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') { |
183 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
183 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
184 | 184 | } |
185 | 185 | if (isset($line['imo']) && $line['imo'] != '') { |
186 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
186 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
187 | 187 | } |
188 | 188 | if (isset($line['callsign']) && $line['callsign'] != '') { |
189 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
189 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
190 | 190 | } |
191 | 191 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
192 | - if (!isset($this->all_tracked[$id]['arrival_code'])) { |
|
192 | + if (!isset($this->all_tracked[$id]['arrival_code'])) { |
|
193 | 193 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
194 | 194 | if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
195 | 195 | if ($this->all_tracked[$id]['addedMarine'] != 0) { |
196 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
196 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
197 | 197 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
198 | - $Marine = new Marine($this->db); |
|
199 | - $fromsource = NULL; |
|
200 | - $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource); |
|
201 | - $Marine->db = null; |
|
198 | + $Marine = new Marine($this->db); |
|
199 | + $fromsource = NULL; |
|
200 | + $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource); |
|
201 | + $Marine->db = null; |
|
202 | + } |
|
202 | 203 | } |
203 | - } |
|
204 | 204 | } |
205 | - } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) { |
|
205 | + } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) { |
|
206 | 206 | $this->all_tracked[$id]['arrival_code'] = $line['arrival_code']; |
207 | 207 | if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
208 | 208 | if (!isset($line['id'])) { |
@@ -210,26 +210,26 @@ discard block |
||
210 | 210 | $this->all_tracked[$id]['forcenew'] = 1; |
211 | 211 | $this->all_tracked[$id]['addedMarine'] = 0; |
212 | 212 | } |
213 | - } |
|
213 | + } |
|
214 | 214 | } |
215 | 215 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
216 | - if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
216 | + if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
220 | 220 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
221 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
221 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
222 | 222 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
223 | - $timeelapsed = microtime(true); |
|
224 | - $Marine = new Marine($this->db); |
|
225 | - $Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']); |
|
226 | - $Marine->db = null; |
|
223 | + $timeelapsed = microtime(true); |
|
224 | + $Marine = new Marine($this->db); |
|
225 | + $Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']); |
|
226 | + $Marine->db = null; |
|
227 | + } |
|
227 | 228 | } |
228 | - } |
|
229 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
230 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
229 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
230 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
231 | 231 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
232 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
232 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
233 | 233 | $timeelapsed = microtime(true); |
234 | 234 | $Marine = new Marine($this->db); |
235 | 235 | $fromsource = NULL; |
@@ -237,20 +237,20 @@ discard block |
||
237 | 237 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
238 | 238 | $Marine->db = null; |
239 | 239 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
240 | - } |
|
240 | + } |
|
241 | + } |
|
241 | 242 | } |
242 | - } |
|
243 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
243 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) { |
247 | - if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
247 | + if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
248 | 248 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
249 | - } else { |
|
249 | + } else { |
|
250 | 250 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
251 | 251 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
252 | 252 | return ''; |
253 | - } |
|
253 | + } |
|
254 | 254 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) { |
255 | 255 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
256 | 256 | return ''; |
@@ -267,24 +267,24 @@ discard block |
||
267 | 267 | |
268 | 268 | |
269 | 269 | if (isset($line['speed'])) { |
270 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
271 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
270 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
271 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
272 | 272 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
273 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
274 | - if ($distance > 1000 && $distance < 10000) { |
|
273 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
274 | + if ($distance > 1000 && $distance < 10000) { |
|
275 | 275 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
276 | 276 | $speed = $speed*3.6; |
277 | 277 | if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
278 | 278 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
279 | - } |
|
279 | + } |
|
280 | 280 | } |
281 | 281 | |
282 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
283 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
284 | - else unset($timediff); |
|
285 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
282 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
283 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
284 | + else unset($timediff); |
|
285 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
286 | 286 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
287 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
287 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
288 | 288 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
289 | 289 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
290 | 290 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -292,195 +292,195 @@ discard block |
||
292 | 292 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
293 | 293 | $timeelapsed = microtime(true); |
294 | 294 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
295 | - $Marine = new Marine($this->db); |
|
296 | - $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
297 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
298 | - $Marine->db = null; |
|
299 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
295 | + $Marine = new Marine($this->db); |
|
296 | + $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
297 | + if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
298 | + $Marine->db = null; |
|
299 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
300 | 300 | } |
301 | 301 | $this->tmd = 0; |
302 | 302 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
303 | - } |
|
303 | + } |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
307 | 307 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
308 | 308 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
309 | - $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
310 | - $dataFound = true; |
|
311 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
309 | + $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
310 | + $dataFound = true; |
|
311 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
312 | 312 | } |
313 | 313 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
314 | 314 | } |
315 | 315 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
316 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
316 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
317 | 317 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
318 | 318 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
319 | - $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
320 | - $dataFound = true; |
|
321 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
319 | + $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
320 | + $dataFound = true; |
|
321 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
322 | 322 | } |
323 | 323 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
324 | 324 | } |
325 | 325 | |
326 | - } else if ($globalDebug && $timediff > 20) { |
|
326 | + } else if ($globalDebug && $timediff > 20) { |
|
327 | 327 | $this->tmd = $this->tmd + 1; |
328 | 328 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
329 | 329 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
330 | 330 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
331 | 331 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
332 | - } |
|
332 | + } |
|
333 | 333 | } |
334 | 334 | if (isset($line['last_update']) && $line['last_update'] != '') { |
335 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
336 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
335 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
336 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
337 | 337 | } |
338 | 338 | if (isset($line['format_source']) && $line['format_source'] != '') { |
339 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
339 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
340 | 340 | } |
341 | 341 | if (isset($line['source_name']) && $line['source_name'] != '') { |
342 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
342 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
343 | 343 | } |
344 | 344 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
345 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
345 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | if (isset($line['heading']) && $line['heading'] != '') { |
349 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
350 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
351 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
352 | - //$dataFound = true; |
|
349 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
350 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
351 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
352 | + //$dataFound = true; |
|
353 | 353 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
354 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
355 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
356 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
357 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
354 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
355 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
356 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
357 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
358 | 358 | } |
359 | 359 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
360 | 360 | |
361 | 361 | |
362 | 362 | |
363 | 363 | if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) { |
364 | - $this->all_tracked[$id]['lastupdate'] = time(); |
|
365 | - if ($this->all_tracked[$id]['addedMarine'] == 0) { |
|
366 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
367 | - if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
364 | + $this->all_tracked[$id]['lastupdate'] = time(); |
|
365 | + if ($this->all_tracked[$id]['addedMarine'] == 0) { |
|
366 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
367 | + if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
368 | 368 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
369 | - if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
370 | - $timeelapsed = microtime(true); |
|
371 | - $MarineLive = new MarineLive($this->db); |
|
372 | - if (isset($line['id'])) { |
|
369 | + if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
370 | + $timeelapsed = microtime(true); |
|
371 | + $MarineLive = new MarineLive($this->db); |
|
372 | + if (isset($line['id'])) { |
|
373 | 373 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
374 | 374 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
375 | - } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
375 | + } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
376 | 376 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
377 | 377 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
378 | - } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
378 | + } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
379 | 379 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
380 | 380 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
381 | - } else $recent_ident = ''; |
|
382 | - $MarineLive->db=null; |
|
383 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
384 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
381 | + } else $recent_ident = ''; |
|
382 | + $MarineLive->db=null; |
|
383 | + if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
384 | + elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
385 | 385 | } else $recent_ident = ''; |
386 | - } else { |
|
386 | + } else { |
|
387 | 387 | $recent_ident = ''; |
388 | 388 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
389 | - } |
|
390 | - //if there was no vessel with the same callsign within the last hour and go post it into the archive |
|
391 | - if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
392 | - { |
|
389 | + } |
|
390 | + //if there was no vessel with the same callsign within the last hour and go post it into the archive |
|
391 | + if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
392 | + { |
|
393 | 393 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
394 | 394 | //adds the spotter data for the archive |
395 | - $highlight = ''; |
|
396 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
397 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
395 | + $highlight = ''; |
|
396 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
397 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
398 | 398 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
399 | - $timeelapsed = microtime(true); |
|
400 | - $Marine = new Marine($this->db); |
|
401 | - $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
402 | - $Marine->db = null; |
|
403 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
404 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
399 | + $timeelapsed = microtime(true); |
|
400 | + $Marine = new Marine($this->db); |
|
401 | + $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
402 | + $Marine->db = null; |
|
403 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
404 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
405 | + } |
|
405 | 406 | } |
406 | - } |
|
407 | - if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
407 | + if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
408 | 408 | // Add source stat in DB |
409 | 409 | $Stats = new Stats($this->db); |
410 | 410 | if (!empty($this->stats)) { |
411 | - if ($globalDebug) echo 'Add source stats : '; |
|
412 | - foreach($this->stats as $date => $data) { |
|
411 | + if ($globalDebug) echo 'Add source stats : '; |
|
412 | + foreach($this->stats as $date => $data) { |
|
413 | 413 | foreach($data as $source => $sourced) { |
414 | - //print_r($sourced); |
|
415 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
416 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
417 | - if (isset($sourced['msg'])) { |
|
418 | - if (time() - $sourced['msg']['date'] > 10) { |
|
419 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
420 | - echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
421 | - unset($this->stats[$date][$source]['msg']); |
|
422 | - } |
|
423 | - } |
|
424 | - } |
|
425 | - if ($date != date('Y-m-d')) { |
|
426 | - unset($this->stats[$date]); |
|
427 | - } |
|
428 | - } |
|
429 | - if ($globalDebug) echo 'Done'."\n"; |
|
414 | + //print_r($sourced); |
|
415 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
416 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
417 | + if (isset($sourced['msg'])) { |
|
418 | + if (time() - $sourced['msg']['date'] > 10) { |
|
419 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
420 | + echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
421 | + unset($this->stats[$date][$source]['msg']); |
|
422 | + } |
|
423 | + } |
|
424 | + } |
|
425 | + if ($date != date('Y-m-d')) { |
|
426 | + unset($this->stats[$date]); |
|
427 | + } |
|
428 | + } |
|
429 | + if ($globalDebug) echo 'Done'."\n"; |
|
430 | 430 | } |
431 | 431 | $Stats->db = null; |
432 | - } |
|
432 | + } |
|
433 | 433 | |
434 | - $this->del(); |
|
434 | + $this->del(); |
|
435 | 435 | //$ignoreImport = false; |
436 | 436 | $this->all_tracked[$id]['addedMarine'] = 1; |
437 | 437 | //print_r($this->all_tracked[$id]); |
438 | 438 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
439 | - if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
440 | - //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
441 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
439 | + if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
440 | + //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
441 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
442 | 442 | $MarineLive = new MarineLive($this->db); |
443 | 443 | $MarineLive->deleteLiveMarineData(); |
444 | 444 | $MarineLive->db=null; |
445 | 445 | if ($globalDebug) echo " Done\n"; |
446 | - } |
|
447 | - $this->last_delete = time(); |
|
446 | + } |
|
447 | + $this->last_delete = time(); |
|
448 | 448 | } |
449 | - } elseif ($recent_ident != '') { |
|
449 | + } elseif ($recent_ident != '') { |
|
450 | 450 | $this->all_tracked[$id]['id'] = $recent_ident; |
451 | 451 | $this->all_tracked[$id]['addedMarine'] = 1; |
452 | 452 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
453 | - if (isset($globalDaemon) && !$globalDaemon) { |
|
453 | + if (isset($globalDaemon) && !$globalDaemon) { |
|
454 | 454 | $Marine = new Marine($this->db); |
455 | 455 | $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']); |
456 | 456 | $Marine->db = null; |
457 | - } |
|
457 | + } |
|
458 | 458 | } |
459 | 459 | |
460 | - } |
|
460 | + } |
|
461 | 461 | } |
462 | - } |
|
463 | - //adds the spotter LIVE data |
|
464 | - if ($globalDebug) { |
|
462 | + } |
|
463 | + //adds the spotter LIVE data |
|
464 | + if ($globalDebug) { |
|
465 | 465 | echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n"; |
466 | - } |
|
467 | - $ignoreImport = false; |
|
466 | + } |
|
467 | + $ignoreImport = false; |
|
468 | 468 | |
469 | - if (!$ignoreImport) { |
|
469 | + if (!$ignoreImport) { |
|
470 | 470 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
471 | 471 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
472 | 472 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
473 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
473 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
474 | 474 | $timeelapsed = microtime(true); |
475 | 475 | $MarineLive = new MarineLive($this->db); |
476 | 476 | $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
477 | 477 | $MarineLive->db = null; |
478 | 478 | if ($globalDebug) echo $result."\n"; |
479 | 479 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
480 | - } |
|
480 | + } |
|
481 | 481 | } |
482 | 482 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
483 | - $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
483 | + $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
484 | 484 | } |
485 | 485 | $this->all_tracked[$id]['putinarchive'] = false; |
486 | 486 | |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | if ($stats_heading == 16) $stats_heading = 0; |
513 | 513 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
514 | 514 | for ($i=0;$i<=15;$i++) { |
515 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
515 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
516 | 516 | } |
517 | 517 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
518 | 518 | } else { |
@@ -525,11 +525,11 @@ discard block |
||
525 | 525 | //var_dump($this->stats); |
526 | 526 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
527 | 527 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
528 | - end($this->stats[$current_date][$source]['hist']); |
|
529 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
528 | + end($this->stats[$current_date][$source]['hist']); |
|
529 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
530 | 530 | } else $mini = 0; |
531 | 531 | for ($i=$mini;$i<=$distance;$i+=10) { |
532 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
532 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
533 | 533 | } |
534 | 534 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
535 | 535 | } else { |
@@ -545,24 +545,24 @@ discard block |
||
545 | 545 | |
546 | 546 | |
547 | 547 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
548 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
548 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
549 | 549 | if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
550 | 550 | $MarineLive = new MarineLive($this->db); |
551 | 551 | $MarineLive->deleteLiveMarineDataNotUpdated(); |
552 | 552 | $MarineLive->db = null; |
553 | 553 | //MarineLive->deleteLiveMarineData(); |
554 | 554 | if ($globalDebug) echo " Done\n"; |
555 | - } |
|
556 | - $this->last_delete_hourly = time(); |
|
555 | + } |
|
556 | + $this->last_delete_hourly = time(); |
|
557 | 557 | } |
558 | 558 | |
559 | - } |
|
560 | - //$ignoreImport = false; |
|
559 | + } |
|
560 | + //$ignoreImport = false; |
|
561 | 561 | } |
562 | 562 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
563 | 563 | if ($send) return $this->all_tracked[$id]; |
564 | - } |
|
564 | + } |
|
565 | + } |
|
565 | 566 | } |
566 | - } |
|
567 | 567 | } |
568 | 568 | ?> |
@@ -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 | } |
@@ -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); |
@@ -14,35 +14,35 @@ discard block |
||
14 | 14 | public $db; |
15 | 15 | |
16 | 16 | protected $texts = Array( |
17 | - 'MI' => 'Shallow', |
|
18 | - 'PR' => 'Partial', |
|
19 | - 'BC' => 'Low drifting', |
|
20 | - 'BL' => 'Blowing', |
|
21 | - 'SH' => 'Showers', |
|
22 | - 'TS' => 'Thunderstorm', |
|
23 | - 'FZ' => 'Freezing', |
|
24 | - 'DZ' => 'Drizzle', |
|
25 | - 'RA' => 'Rain', |
|
26 | - 'SN' => 'Snow', |
|
27 | - 'SG' => 'Snow Grains', |
|
28 | - 'IC' => 'Ice crystals', |
|
29 | - 'PL' => 'Ice pellets', |
|
30 | - 'GR' => 'Hail', |
|
31 | - 'GS' => 'Small hail', |
|
32 | - 'UP' => 'Unknown', |
|
33 | - 'BR' => 'Mist', |
|
34 | - 'FG' => 'Fog', |
|
35 | - 'FU' => 'Smoke', |
|
36 | - 'VA' => 'Volcanic ash', |
|
37 | - 'DU' => 'Widespread dust', |
|
38 | - 'SA' => 'Sand', |
|
39 | - 'HZ' => 'Haze', |
|
40 | - 'PY' => 'Spray', |
|
41 | - 'PO' => 'Well developed dust / sand whirls', |
|
42 | - 'SQ' => 'Squalls', |
|
43 | - 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
44 | - 'SS' => 'Sandstorm', |
|
45 | - 'DS' => 'Duststorm' |
|
17 | + 'MI' => 'Shallow', |
|
18 | + 'PR' => 'Partial', |
|
19 | + 'BC' => 'Low drifting', |
|
20 | + 'BL' => 'Blowing', |
|
21 | + 'SH' => 'Showers', |
|
22 | + 'TS' => 'Thunderstorm', |
|
23 | + 'FZ' => 'Freezing', |
|
24 | + 'DZ' => 'Drizzle', |
|
25 | + 'RA' => 'Rain', |
|
26 | + 'SN' => 'Snow', |
|
27 | + 'SG' => 'Snow Grains', |
|
28 | + 'IC' => 'Ice crystals', |
|
29 | + 'PL' => 'Ice pellets', |
|
30 | + 'GR' => 'Hail', |
|
31 | + 'GS' => 'Small hail', |
|
32 | + 'UP' => 'Unknown', |
|
33 | + 'BR' => 'Mist', |
|
34 | + 'FG' => 'Fog', |
|
35 | + 'FU' => 'Smoke', |
|
36 | + 'VA' => 'Volcanic ash', |
|
37 | + 'DU' => 'Widespread dust', |
|
38 | + 'SA' => 'Sand', |
|
39 | + 'HZ' => 'Haze', |
|
40 | + 'PY' => 'Spray', |
|
41 | + 'PO' => 'Well developed dust / sand whirls', |
|
42 | + 'SQ' => 'Squalls', |
|
43 | + 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
44 | + 'SS' => 'Sandstorm', |
|
45 | + 'DS' => 'Duststorm' |
|
46 | 46 | ); |
47 | 47 | |
48 | 48 | /* |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $result['QNH_format'] = $matches[1] == 'Q' ? 'hPa' : 'inHg'; |
178 | 178 | */ |
179 | 179 | } |
180 | - /* |
|
180 | + /* |
|
181 | 181 | // Wind Direction |
182 | 182 | if (preg_match('#^([0-9]{3})V([0-9]{3})$#', $piece, $matches)) { |
183 | 183 | $result['wind_direction'] = $matches[1]; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $result['speed_variable'] = $matches[1]; |
189 | 189 | } |
190 | 190 | */ |
191 | - // Visibility |
|
191 | + // Visibility |
|
192 | 192 | if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
193 | 193 | if (isset($matches[3]) && strlen($matches[3]) > 0) { |
194 | 194 | $result['visibility'] = (float)$matches[3] * 1609.34; |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
247 | 247 | if (isset($matches[3])) { |
248 | 248 | $range = Array( |
249 | - 'from' => (float)$matches[2], |
|
250 | - 'to' => (float)$matches[4], |
|
251 | - 'unit' => $matches[5] ? 'FT' : 'M' |
|
249 | + 'from' => (float)$matches[2], |
|
250 | + 'to' => (float)$matches[4], |
|
251 | + 'unit' => $matches[5] ? 'FT' : 'M' |
|
252 | 252 | ); |
253 | 253 | } |
254 | 254 | $result['RVR'] = $matches[1]; |