@@ -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; |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | - * Executes the SQL statements to get the spotter information |
|
| 92 | - * |
|
| 93 | - * @param String $query the SQL query |
|
| 94 | - * @param Array $params parameter of the query |
|
| 95 | - * @param String $limitQuery the limit query |
|
| 96 | - * @return Array the spotter information |
|
| 97 | - * |
|
| 98 | - */ |
|
| 91 | + * Executes the SQL statements to get the spotter information |
|
| 92 | + * |
|
| 93 | + * @param String $query the SQL query |
|
| 94 | + * @param Array $params parameter of the query |
|
| 95 | + * @param String $limitQuery the limit query |
|
| 96 | + * @return Array the spotter information |
|
| 97 | + * |
|
| 98 | + */ |
|
| 99 | 99 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
| 100 | 100 | { |
| 101 | 101 | date_default_timezone_set('UTC'); |
@@ -233,11 +233,11 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | |
| 235 | 235 | /** |
| 236 | - * Gets all the spotter information based on the latest data entry |
|
| 237 | - * |
|
| 238 | - * @return Array the spotter information |
|
| 239 | - * |
|
| 240 | - */ |
|
| 236 | + * Gets all the spotter information based on the latest data entry |
|
| 237 | + * |
|
| 238 | + * @return Array the spotter information |
|
| 239 | + * |
|
| 240 | + */ |
|
| 241 | 241 | public function getLatestMarineData($limit = '', $sort = '', $filter = array()) |
| 242 | 242 | { |
| 243 | 243 | global $global_marine_query; |
@@ -286,11 +286,11 @@ discard block |
||
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | /** |
| 289 | - * Gets all the spotter information based on the callsign |
|
| 290 | - * |
|
| 291 | - * @return Array the spotter information |
|
| 292 | - * |
|
| 293 | - */ |
|
| 289 | + * Gets all the spotter information based on the callsign |
|
| 290 | + * |
|
| 291 | + * @return Array the spotter information |
|
| 292 | + * |
|
| 293 | + */ |
|
| 294 | 294 | public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
| 295 | 295 | { |
| 296 | 296 | global $global_marine_query; |
@@ -342,11 +342,11 @@ discard block |
||
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
| 345 | - * Gets all the marine information based on the type |
|
| 346 | - * |
|
| 347 | - * @return Array the marine information |
|
| 348 | - * |
|
| 349 | - */ |
|
| 345 | + * Gets all the marine information based on the type |
|
| 346 | + * |
|
| 347 | + * @return Array the marine information |
|
| 348 | + * |
|
| 349 | + */ |
|
| 350 | 350 | public function getMarineDataByType($type = '', $limit = '', $sort = '', $filter = array()) |
| 351 | 351 | { |
| 352 | 352 | global $global_marine_query; |
@@ -452,11 +452,11 @@ discard block |
||
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | /** |
| 455 | - * Gets all the marine information based on the captain |
|
| 456 | - * |
|
| 457 | - * @return Array the marine information |
|
| 458 | - * |
|
| 459 | - */ |
|
| 455 | + * Gets all the marine information based on the captain |
|
| 456 | + * |
|
| 457 | + * @return Array the marine information |
|
| 458 | + * |
|
| 459 | + */ |
|
| 460 | 460 | public function getMarineDataByCaptain($captain = '', $limit = '', $sort = '', $filter = array()) |
| 461 | 461 | { |
| 462 | 462 | global $global_marine_query; |
@@ -495,11 +495,11 @@ discard block |
||
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | /** |
| 498 | - * Gets all the marine information based on the race |
|
| 499 | - * |
|
| 500 | - * @return Array the marine information |
|
| 501 | - * |
|
| 502 | - */ |
|
| 498 | + * Gets all the marine information based on the race |
|
| 499 | + * |
|
| 500 | + * @return Array the marine information |
|
| 501 | + * |
|
| 502 | + */ |
|
| 503 | 503 | public function getMarineDataByRace($race = '', $limit = '', $sort = '', $filter = array()) |
| 504 | 504 | { |
| 505 | 505 | global $global_marine_query,$globalDBdriver; |
@@ -542,11 +542,11 @@ discard block |
||
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | /** |
| 545 | - * Count races by captain |
|
| 546 | - * |
|
| 547 | - * @return String Duration of all races |
|
| 548 | - * |
|
| 549 | - */ |
|
| 545 | + * Count races by captain |
|
| 546 | + * |
|
| 547 | + * @return String Duration of all races |
|
| 548 | + * |
|
| 549 | + */ |
|
| 550 | 550 | public function countRacesByCaptain($captain,$filters = array()) |
| 551 | 551 | { |
| 552 | 552 | $captain = filter_var($captain,FILTER_SANITIZE_STRING); |
@@ -562,11 +562,11 @@ discard block |
||
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | /** |
| 565 | - * Count captains by race |
|
| 566 | - * |
|
| 567 | - * @return String Duration of all races |
|
| 568 | - * |
|
| 569 | - */ |
|
| 565 | + * Count captains by race |
|
| 566 | + * |
|
| 567 | + * @return String Duration of all races |
|
| 568 | + * |
|
| 569 | + */ |
|
| 570 | 570 | public function countCaptainsByRace($race,$filters = array()) |
| 571 | 571 | { |
| 572 | 572 | $race = filter_var($race,FILTER_SANITIZE_STRING); |
@@ -582,11 +582,11 @@ discard block |
||
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | /** |
| 585 | - * Gets all boat types that have been used by a captain |
|
| 586 | - * |
|
| 587 | - * @return Array the boat list |
|
| 588 | - * |
|
| 589 | - */ |
|
| 585 | + * Gets all boat types that have been used by a captain |
|
| 586 | + * |
|
| 587 | + * @return Array the boat list |
|
| 588 | + * |
|
| 589 | + */ |
|
| 590 | 590 | public function countAllBoatTypesByCaptain($captain,$filters = array(),$year = '',$month = '',$day = '') |
| 591 | 591 | { |
| 592 | 592 | global $globalDBdriver; |
@@ -631,11 +631,11 @@ discard block |
||
| 631 | 631 | } |
| 632 | 632 | |
| 633 | 633 | /** |
| 634 | - * Gets all boat types that have been used on a race |
|
| 635 | - * |
|
| 636 | - * @return Array the boat list |
|
| 637 | - * |
|
| 638 | - */ |
|
| 634 | + * Gets all boat types that have been used on a race |
|
| 635 | + * |
|
| 636 | + * @return Array the boat list |
|
| 637 | + * |
|
| 638 | + */ |
|
| 639 | 639 | public function countAllBoatTypesByRace($race,$filters = array(),$year = '',$month = '',$day = '') |
| 640 | 640 | { |
| 641 | 641 | global $globalDBdriver; |
@@ -680,11 +680,11 @@ discard block |
||
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | /** |
| 683 | - * Gets race duration by captain |
|
| 684 | - * |
|
| 685 | - * @return String Duration of all race |
|
| 686 | - * |
|
| 687 | - */ |
|
| 683 | + * Gets race duration by captain |
|
| 684 | + * |
|
| 685 | + * @return String Duration of all race |
|
| 686 | + * |
|
| 687 | + */ |
|
| 688 | 688 | public function getRaceDurationByCaptain($captain,$filters = array(),$year = '',$month = '',$day = '') |
| 689 | 689 | { |
| 690 | 690 | global $globalDBdriver; |
@@ -730,11 +730,11 @@ discard block |
||
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | /** |
| 733 | - * Gets a list of all captain names and captain ids |
|
| 734 | - * |
|
| 735 | - * @return Array list of captain names and captain ids |
|
| 736 | - * |
|
| 737 | - */ |
|
| 733 | + * Gets a list of all captain names and captain ids |
|
| 734 | + * |
|
| 735 | + * @return Array list of captain names and captain ids |
|
| 736 | + * |
|
| 737 | + */ |
|
| 738 | 738 | public function getAllCaptainNames($filters = array()) |
| 739 | 739 | { |
| 740 | 740 | $filter_query = $this->getFilter($filters,true,true); |
@@ -748,11 +748,11 @@ discard block |
||
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | /** |
| 751 | - * Gets a list of all race names and race ids |
|
| 752 | - * |
|
| 753 | - * @return Array list of race names and race ids |
|
| 754 | - * |
|
| 755 | - */ |
|
| 751 | + * Gets a list of all race names and race ids |
|
| 752 | + * |
|
| 753 | + * @return Array list of race names and race ids |
|
| 754 | + * |
|
| 755 | + */ |
|
| 756 | 756 | public function getAllRaceNames($filters = array()) |
| 757 | 757 | { |
| 758 | 758 | $filter_query = $this->getFilter($filters,true,true); |
@@ -766,12 +766,12 @@ discard block |
||
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | /** |
| 769 | - * Gets all source name |
|
| 770 | - * |
|
| 771 | - * @param String type format of source |
|
| 772 | - * @return Array list of source name |
|
| 773 | - * |
|
| 774 | - */ |
|
| 769 | + * Gets all source name |
|
| 770 | + * |
|
| 771 | + * @param String type format of source |
|
| 772 | + * @return Array list of source name |
|
| 773 | + * |
|
| 774 | + */ |
|
| 775 | 775 | public function getAllSourceName($type = '',$filters = array()) |
| 776 | 776 | { |
| 777 | 777 | $filter_query = $this->getFilter($filters,true,true); |
@@ -801,11 +801,11 @@ discard block |
||
| 801 | 801 | |
| 802 | 802 | |
| 803 | 803 | /** |
| 804 | - * Gets a list of all idents/callsigns |
|
| 805 | - * |
|
| 806 | - * @return Array list of ident/callsign names |
|
| 807 | - * |
|
| 808 | - */ |
|
| 804 | + * Gets a list of all idents/callsigns |
|
| 805 | + * |
|
| 806 | + * @return Array list of ident/callsign names |
|
| 807 | + * |
|
| 808 | + */ |
|
| 809 | 809 | public function getAllIdents($filters = array()) |
| 810 | 810 | { |
| 811 | 811 | $filter_query = $this->getFilter($filters,true,true); |
@@ -829,11 +829,11 @@ discard block |
||
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | /** |
| 832 | - * Gets all info from a mmsi |
|
| 833 | - * |
|
| 834 | - * @return Array ident |
|
| 835 | - * |
|
| 836 | - */ |
|
| 832 | + * Gets all info from a mmsi |
|
| 833 | + * |
|
| 834 | + * @return Array ident |
|
| 835 | + * |
|
| 836 | + */ |
|
| 837 | 837 | public function getIdentity($mmsi) |
| 838 | 838 | { |
| 839 | 839 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -846,9 +846,9 @@ discard block |
||
| 846 | 846 | } |
| 847 | 847 | |
| 848 | 848 | /** |
| 849 | - * Add identity |
|
| 850 | - * |
|
| 851 | - */ |
|
| 849 | + * Add identity |
|
| 850 | + * |
|
| 851 | + */ |
|
| 852 | 852 | public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
| 853 | 853 | { |
| 854 | 854 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -914,13 +914,13 @@ discard block |
||
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | /** |
| 917 | - * Update ident tracker data |
|
| 918 | - * |
|
| 919 | - * @param String $fammarine_id the ID |
|
| 920 | - * @param String $ident the marine ident |
|
| 921 | - * @return String success or false |
|
| 922 | - * |
|
| 923 | - */ |
|
| 917 | + * Update ident tracker data |
|
| 918 | + * |
|
| 919 | + * @param String $fammarine_id the ID |
|
| 920 | + * @param String $ident the marine ident |
|
| 921 | + * @return String success or false |
|
| 922 | + * |
|
| 923 | + */ |
|
| 924 | 924 | public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
| 925 | 925 | { |
| 926 | 926 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
@@ -935,13 +935,13 @@ discard block |
||
| 935 | 935 | } |
| 936 | 936 | |
| 937 | 937 | /** |
| 938 | - * Update arrival marine data |
|
| 939 | - * |
|
| 940 | - * @param String $fammarine_id the ID |
|
| 941 | - * @param String $arrival_code the marine ident |
|
| 942 | - * @return String success or false |
|
| 943 | - * |
|
| 944 | - */ |
|
| 938 | + * Update arrival marine data |
|
| 939 | + * |
|
| 940 | + * @param String $fammarine_id the ID |
|
| 941 | + * @param String $arrival_code the marine ident |
|
| 942 | + * @return String success or false |
|
| 943 | + * |
|
| 944 | + */ |
|
| 945 | 945 | public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL) |
| 946 | 946 | { |
| 947 | 947 | $query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id'; |
@@ -956,19 +956,19 @@ discard block |
||
| 956 | 956 | } |
| 957 | 957 | |
| 958 | 958 | /** |
| 959 | - * Update Status data |
|
| 960 | - * |
|
| 961 | - * @param String $fammarine_id the ID |
|
| 962 | - * @param String $status_id the marine status id |
|
| 963 | - * @param String $status the marine status |
|
| 964 | - * @return String success or false |
|
| 965 | - * |
|
| 966 | - */ |
|
| 959 | + * Update Status data |
|
| 960 | + * |
|
| 961 | + * @param String $fammarine_id the ID |
|
| 962 | + * @param String $status_id the marine status id |
|
| 963 | + * @param String $status the marine status |
|
| 964 | + * @return String success or false |
|
| 965 | + * |
|
| 966 | + */ |
|
| 967 | 967 | public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
| 968 | 968 | { |
| 969 | 969 | |
| 970 | 970 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
| 971 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
| 971 | + $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
| 972 | 972 | |
| 973 | 973 | try { |
| 974 | 974 | $sth = $this->db->prepare($query); |
@@ -981,13 +981,13 @@ discard block |
||
| 981 | 981 | |
| 982 | 982 | } |
| 983 | 983 | /** |
| 984 | - * Update latest marine data |
|
| 985 | - * |
|
| 986 | - * @param String $fammarine_id the ID |
|
| 987 | - * @param String $ident the marine ident |
|
| 988 | - * @return String success or false |
|
| 989 | - * |
|
| 990 | - */ |
|
| 984 | + * Update latest marine data |
|
| 985 | + * |
|
| 986 | + * @param String $fammarine_id the ID |
|
| 987 | + * @param String $ident the marine ident |
|
| 988 | + * @return String success or false |
|
| 989 | + * |
|
| 990 | + */ |
|
| 991 | 991 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '',$distance = NULL,$race_rank = NULL, $race_time = NULL, $status = '', $race_begin = '') |
| 992 | 992 | { |
| 993 | 993 | if ($latitude == '') $latitude = NULL; |
@@ -1013,30 +1013,30 @@ discard block |
||
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | 1015 | /** |
| 1016 | - * Adds a new marine data |
|
| 1017 | - * |
|
| 1018 | - * @param String $fammarine_id the ID |
|
| 1019 | - * @param String $ident the marine ident |
|
| 1020 | - * @param String $departure_airport_icao the departure airport |
|
| 1021 | - * @param String $arrival_airport_icao the arrival airport |
|
| 1022 | - * @param String $latitude latitude of flight |
|
| 1023 | - * @param String $longitude latitude of flight |
|
| 1024 | - * @param String $waypoints waypoints of flight |
|
| 1025 | - * @param String $heading heading of flight |
|
| 1026 | - * @param String $groundspeed speed of flight |
|
| 1027 | - * @param String $date date of flight |
|
| 1028 | - * @param String $departure_airport_time departure time of flight |
|
| 1029 | - * @param String $arrival_airport_time arrival time of flight |
|
| 1030 | - * @param String $squawk squawk code of flight |
|
| 1031 | - * @param String $route_stop route stop of flight |
|
| 1032 | - * @param String $highlight highlight or not |
|
| 1033 | - * @param String $ModeS ModesS code of flight |
|
| 1034 | - * @param String $registration registration code of flight |
|
| 1035 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 1036 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 1037 | - * @param String $verticalrate vertival rate of flight |
|
| 1038 | - * @return String success or false |
|
| 1039 | - */ |
|
| 1016 | + * Adds a new marine data |
|
| 1017 | + * |
|
| 1018 | + * @param String $fammarine_id the ID |
|
| 1019 | + * @param String $ident the marine ident |
|
| 1020 | + * @param String $departure_airport_icao the departure airport |
|
| 1021 | + * @param String $arrival_airport_icao the arrival airport |
|
| 1022 | + * @param String $latitude latitude of flight |
|
| 1023 | + * @param String $longitude latitude of flight |
|
| 1024 | + * @param String $waypoints waypoints of flight |
|
| 1025 | + * @param String $heading heading of flight |
|
| 1026 | + * @param String $groundspeed speed of flight |
|
| 1027 | + * @param String $date date of flight |
|
| 1028 | + * @param String $departure_airport_time departure time of flight |
|
| 1029 | + * @param String $arrival_airport_time arrival time of flight |
|
| 1030 | + * @param String $squawk squawk code of flight |
|
| 1031 | + * @param String $route_stop route stop of flight |
|
| 1032 | + * @param String $highlight highlight or not |
|
| 1033 | + * @param String $ModeS ModesS code of flight |
|
| 1034 | + * @param String $registration registration code of flight |
|
| 1035 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 1036 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 1037 | + * @param String $verticalrate vertival rate of flight |
|
| 1038 | + * @return String success or false |
|
| 1039 | + */ |
|
| 1040 | 1040 | 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 = '', $captain_id = '',$captain_name = '',$race_id = '', $race_name = '', $distance = '',$race_rank = '', $race_time = '') |
| 1041 | 1041 | { |
| 1042 | 1042 | global $globalURL, $globalMarineImageFetch; |
@@ -1170,11 +1170,11 @@ discard block |
||
| 1170 | 1170 | |
| 1171 | 1171 | |
| 1172 | 1172 | /** |
| 1173 | - * Gets the aircraft ident within the last hour |
|
| 1174 | - * |
|
| 1175 | - * @return String the ident |
|
| 1176 | - * |
|
| 1177 | - */ |
|
| 1173 | + * Gets the aircraft ident within the last hour |
|
| 1174 | + * |
|
| 1175 | + * @return String the ident |
|
| 1176 | + * |
|
| 1177 | + */ |
|
| 1178 | 1178 | public function getIdentFromLastHour($ident) |
| 1179 | 1179 | { |
| 1180 | 1180 | global $globalDBdriver, $globalTimezone; |
@@ -1190,11 +1190,11 @@ discard block |
||
| 1190 | 1190 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 1191 | 1191 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
| 1192 | 1192 | $query_data = array(':ident' => $ident); |
| 1193 | - } |
|
| 1193 | + } |
|
| 1194 | 1194 | |
| 1195 | 1195 | $sth = $this->db->prepare($query); |
| 1196 | 1196 | $sth->execute($query_data); |
| 1197 | - $ident_result=''; |
|
| 1197 | + $ident_result=''; |
|
| 1198 | 1198 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 1199 | 1199 | { |
| 1200 | 1200 | $ident_result = $row['ident']; |
@@ -1205,11 +1205,11 @@ discard block |
||
| 1205 | 1205 | |
| 1206 | 1206 | |
| 1207 | 1207 | /** |
| 1208 | - * Gets the aircraft data from the last 20 seconds |
|
| 1209 | - * |
|
| 1210 | - * @return Array the marine data |
|
| 1211 | - * |
|
| 1212 | - */ |
|
| 1208 | + * Gets the aircraft data from the last 20 seconds |
|
| 1209 | + * |
|
| 1210 | + * @return Array the marine data |
|
| 1211 | + * |
|
| 1212 | + */ |
|
| 1213 | 1213 | public function getRealTimeData($q = '') |
| 1214 | 1214 | { |
| 1215 | 1215 | global $globalDBdriver; |
@@ -1247,11 +1247,11 @@ discard block |
||
| 1247 | 1247 | |
| 1248 | 1248 | |
| 1249 | 1249 | /** |
| 1250 | - * Gets all number of flight over countries |
|
| 1251 | - * |
|
| 1252 | - * @return Array the airline country list |
|
| 1253 | - * |
|
| 1254 | - */ |
|
| 1250 | + * Gets all number of flight over countries |
|
| 1251 | + * |
|
| 1252 | + * @return Array the airline country list |
|
| 1253 | + * |
|
| 1254 | + */ |
|
| 1255 | 1255 | |
| 1256 | 1256 | public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 1257 | 1257 | { |
@@ -1324,11 +1324,11 @@ discard block |
||
| 1324 | 1324 | |
| 1325 | 1325 | |
| 1326 | 1326 | /** |
| 1327 | - * Gets all callsigns that have flown over |
|
| 1328 | - * |
|
| 1329 | - * @return Array the callsign list |
|
| 1330 | - * |
|
| 1331 | - */ |
|
| 1327 | + * Gets all callsigns that have flown over |
|
| 1328 | + * |
|
| 1329 | + * @return Array the callsign list |
|
| 1330 | + * |
|
| 1331 | + */ |
|
| 1332 | 1332 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 1333 | 1333 | { |
| 1334 | 1334 | global $globalDBdriver; |
@@ -1395,11 +1395,11 @@ discard block |
||
| 1395 | 1395 | |
| 1396 | 1396 | |
| 1397 | 1397 | /** |
| 1398 | - * Counts all dates |
|
| 1399 | - * |
|
| 1400 | - * @return Array the date list |
|
| 1401 | - * |
|
| 1402 | - */ |
|
| 1398 | + * Counts all dates |
|
| 1399 | + * |
|
| 1400 | + * @return Array the date list |
|
| 1401 | + * |
|
| 1402 | + */ |
|
| 1403 | 1403 | public function countAllDates($filters = array()) |
| 1404 | 1404 | { |
| 1405 | 1405 | global $globalTimezone, $globalDBdriver; |
@@ -1445,11 +1445,11 @@ discard block |
||
| 1445 | 1445 | |
| 1446 | 1446 | |
| 1447 | 1447 | /** |
| 1448 | - * Counts all dates during the last 7 days |
|
| 1449 | - * |
|
| 1450 | - * @return Array the date list |
|
| 1451 | - * |
|
| 1452 | - */ |
|
| 1448 | + * Counts all dates during the last 7 days |
|
| 1449 | + * |
|
| 1450 | + * @return Array the date list |
|
| 1451 | + * |
|
| 1452 | + */ |
|
| 1453 | 1453 | public function countAllDatesLast7Days($filters = array()) |
| 1454 | 1454 | { |
| 1455 | 1455 | global $globalTimezone, $globalDBdriver; |
@@ -1471,7 +1471,7 @@ discard block |
||
| 1471 | 1471 | $query .= " GROUP BY date_name |
| 1472 | 1472 | ORDER BY date_name ASC"; |
| 1473 | 1473 | $query_data = array(':offset' => $offset); |
| 1474 | - } |
|
| 1474 | + } |
|
| 1475 | 1475 | |
| 1476 | 1476 | $sth = $this->db->prepare($query); |
| 1477 | 1477 | $sth->execute($query_data); |
@@ -1491,11 +1491,11 @@ discard block |
||
| 1491 | 1491 | } |
| 1492 | 1492 | |
| 1493 | 1493 | /** |
| 1494 | - * Counts all dates during the last month |
|
| 1495 | - * |
|
| 1496 | - * @return Array the date list |
|
| 1497 | - * |
|
| 1498 | - */ |
|
| 1494 | + * Counts all dates during the last month |
|
| 1495 | + * |
|
| 1496 | + * @return Array the date list |
|
| 1497 | + * |
|
| 1498 | + */ |
|
| 1499 | 1499 | public function countAllDatesLastMonth($filters = array()) |
| 1500 | 1500 | { |
| 1501 | 1501 | global $globalTimezone, $globalDBdriver; |
@@ -1517,7 +1517,7 @@ discard block |
||
| 1517 | 1517 | $query .= " GROUP BY date_name |
| 1518 | 1518 | ORDER BY date_name ASC"; |
| 1519 | 1519 | $query_data = array(':offset' => $offset); |
| 1520 | - } |
|
| 1520 | + } |
|
| 1521 | 1521 | |
| 1522 | 1522 | $sth = $this->db->prepare($query); |
| 1523 | 1523 | $sth->execute($query_data); |
@@ -1539,11 +1539,11 @@ discard block |
||
| 1539 | 1539 | |
| 1540 | 1540 | |
| 1541 | 1541 | /** |
| 1542 | - * Counts all month |
|
| 1543 | - * |
|
| 1544 | - * @return Array the month list |
|
| 1545 | - * |
|
| 1546 | - */ |
|
| 1542 | + * Counts all month |
|
| 1543 | + * |
|
| 1544 | + * @return Array the month list |
|
| 1545 | + * |
|
| 1546 | + */ |
|
| 1547 | 1547 | public function countAllMonths($filters = array()) |
| 1548 | 1548 | { |
| 1549 | 1549 | global $globalTimezone, $globalDBdriver; |
@@ -1588,11 +1588,11 @@ discard block |
||
| 1588 | 1588 | |
| 1589 | 1589 | |
| 1590 | 1590 | /** |
| 1591 | - * Counts all dates during the last year |
|
| 1592 | - * |
|
| 1593 | - * @return Array the date list |
|
| 1594 | - * |
|
| 1595 | - */ |
|
| 1591 | + * Counts all dates during the last year |
|
| 1592 | + * |
|
| 1593 | + * @return Array the date list |
|
| 1594 | + * |
|
| 1595 | + */ |
|
| 1596 | 1596 | public function countAllMonthsLastYear($filters) |
| 1597 | 1597 | { |
| 1598 | 1598 | global $globalTimezone, $globalDBdriver; |
@@ -1614,7 +1614,7 @@ discard block |
||
| 1614 | 1614 | $query .= " GROUP BY year_name, month_name |
| 1615 | 1615 | ORDER BY year_name, month_name ASC"; |
| 1616 | 1616 | $query_data = array(':offset' => $offset); |
| 1617 | - } |
|
| 1617 | + } |
|
| 1618 | 1618 | |
| 1619 | 1619 | $sth = $this->db->prepare($query); |
| 1620 | 1620 | $sth->execute($query_data); |
@@ -1637,11 +1637,11 @@ discard block |
||
| 1637 | 1637 | |
| 1638 | 1638 | |
| 1639 | 1639 | /** |
| 1640 | - * Counts all hours |
|
| 1641 | - * |
|
| 1642 | - * @return Array the hour list |
|
| 1643 | - * |
|
| 1644 | - */ |
|
| 1640 | + * Counts all hours |
|
| 1641 | + * |
|
| 1642 | + * @return Array the hour list |
|
| 1643 | + * |
|
| 1644 | + */ |
|
| 1645 | 1645 | public function countAllHours($orderby,$filters = array()) |
| 1646 | 1646 | { |
| 1647 | 1647 | global $globalTimezone, $globalDBdriver; |
@@ -1704,11 +1704,11 @@ discard block |
||
| 1704 | 1704 | |
| 1705 | 1705 | |
| 1706 | 1706 | /** |
| 1707 | - * Counts all hours by date |
|
| 1708 | - * |
|
| 1709 | - * @return Array the hour list |
|
| 1710 | - * |
|
| 1711 | - */ |
|
| 1707 | + * Counts all hours by date |
|
| 1708 | + * |
|
| 1709 | + * @return Array the hour list |
|
| 1710 | + * |
|
| 1711 | + */ |
|
| 1712 | 1712 | public function countAllHoursByDate($date, $filters = array()) |
| 1713 | 1713 | { |
| 1714 | 1714 | global $globalTimezone, $globalDBdriver; |
@@ -1752,11 +1752,11 @@ discard block |
||
| 1752 | 1752 | |
| 1753 | 1753 | |
| 1754 | 1754 | /** |
| 1755 | - * Counts all hours by a ident/callsign |
|
| 1756 | - * |
|
| 1757 | - * @return Array the hour list |
|
| 1758 | - * |
|
| 1759 | - */ |
|
| 1755 | + * Counts all hours by a ident/callsign |
|
| 1756 | + * |
|
| 1757 | + * @return Array the hour list |
|
| 1758 | + * |
|
| 1759 | + */ |
|
| 1760 | 1760 | public function countAllHoursByIdent($ident, $filters = array()) |
| 1761 | 1761 | { |
| 1762 | 1762 | global $globalTimezone, $globalDBdriver; |
@@ -1801,11 +1801,11 @@ discard block |
||
| 1801 | 1801 | |
| 1802 | 1802 | |
| 1803 | 1803 | /** |
| 1804 | - * Counts all vessels |
|
| 1805 | - * |
|
| 1806 | - * @return Integer the number of vessels |
|
| 1807 | - * |
|
| 1808 | - */ |
|
| 1804 | + * Counts all vessels |
|
| 1805 | + * |
|
| 1806 | + * @return Integer the number of vessels |
|
| 1807 | + * |
|
| 1808 | + */ |
|
| 1809 | 1809 | public function countOverallMarine($filters = array(),$year = '',$month = '') |
| 1810 | 1810 | { |
| 1811 | 1811 | global $globalDBdriver; |
@@ -1840,11 +1840,11 @@ discard block |
||
| 1840 | 1840 | } |
| 1841 | 1841 | |
| 1842 | 1842 | /** |
| 1843 | - * Counts all vessel type |
|
| 1844 | - * |
|
| 1845 | - * @return Integer the number of vessels |
|
| 1846 | - * |
|
| 1847 | - */ |
|
| 1843 | + * Counts all vessel type |
|
| 1844 | + * |
|
| 1845 | + * @return Integer the number of vessels |
|
| 1846 | + * |
|
| 1847 | + */ |
|
| 1848 | 1848 | public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
| 1849 | 1849 | { |
| 1850 | 1850 | global $globalDBdriver; |
@@ -1879,11 +1879,11 @@ discard block |
||
| 1879 | 1879 | |
| 1880 | 1880 | |
| 1881 | 1881 | /** |
| 1882 | - * Counts all hours of today |
|
| 1883 | - * |
|
| 1884 | - * @return Array the hour list |
|
| 1885 | - * |
|
| 1886 | - */ |
|
| 1882 | + * Counts all hours of today |
|
| 1883 | + * |
|
| 1884 | + * @return Array the hour list |
|
| 1885 | + * |
|
| 1886 | + */ |
|
| 1887 | 1887 | public function countAllHoursFromToday($filters = array()) |
| 1888 | 1888 | { |
| 1889 | 1889 | global $globalTimezone, $globalDBdriver; |
@@ -1923,12 +1923,12 @@ discard block |
||
| 1923 | 1923 | } |
| 1924 | 1924 | |
| 1925 | 1925 | |
| 1926 | - /** |
|
| 1927 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1928 | - * |
|
| 1929 | - * @return Integer the Barrie Spotter ID |
|
| 1926 | + /** |
|
| 1927 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1928 | + * |
|
| 1929 | + * @return Integer the Barrie Spotter ID |
|
| 1930 | 1930 | q * |
| 1931 | - */ |
|
| 1931 | + */ |
|
| 1932 | 1932 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
| 1933 | 1933 | { |
| 1934 | 1934 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -1949,13 +1949,13 @@ discard block |
||
| 1949 | 1949 | |
| 1950 | 1950 | |
| 1951 | 1951 | /** |
| 1952 | - * Parses a date string |
|
| 1953 | - * |
|
| 1954 | - * @param String $dateString the date string |
|
| 1955 | - * @param String $timezone the timezone of a user |
|
| 1956 | - * @return Array the time information |
|
| 1957 | - * |
|
| 1958 | - */ |
|
| 1952 | + * Parses a date string |
|
| 1953 | + * |
|
| 1954 | + * @param String $dateString the date string |
|
| 1955 | + * @param String $timezone the timezone of a user |
|
| 1956 | + * @return Array the time information |
|
| 1957 | + * |
|
| 1958 | + */ |
|
| 1959 | 1959 | public function parseDateString($dateString, $timezone = '') |
| 1960 | 1960 | { |
| 1961 | 1961 | $time_array = array(); |
@@ -1988,12 +1988,12 @@ discard block |
||
| 1988 | 1988 | } |
| 1989 | 1989 | |
| 1990 | 1990 | /** |
| 1991 | - * Parses the direction degrees to working |
|
| 1992 | - * |
|
| 1993 | - * @param Float $direction the direction in degrees |
|
| 1994 | - * @return Array the direction information |
|
| 1995 | - * |
|
| 1996 | - */ |
|
| 1991 | + * Parses the direction degrees to working |
|
| 1992 | + * |
|
| 1993 | + * @param Float $direction the direction in degrees |
|
| 1994 | + * @return Array the direction information |
|
| 1995 | + * |
|
| 1996 | + */ |
|
| 1997 | 1997 | public function parseDirection($direction = 0) |
| 1998 | 1998 | { |
| 1999 | 1999 | if ($direction == '') $direction = 0; |
@@ -2072,12 +2072,12 @@ discard block |
||
| 2072 | 2072 | |
| 2073 | 2073 | |
| 2074 | 2074 | /** |
| 2075 | - * Gets Country from latitude/longitude |
|
| 2076 | - * |
|
| 2077 | - * @param Float $latitude latitute of the flight |
|
| 2078 | - * @param Float $longitude longitute of the flight |
|
| 2079 | - * @return String the countrie |
|
| 2080 | - */ |
|
| 2075 | + * Gets Country from latitude/longitude |
|
| 2076 | + * |
|
| 2077 | + * @param Float $latitude latitute of the flight |
|
| 2078 | + * @param Float $longitude longitute of the flight |
|
| 2079 | + * @return String the countrie |
|
| 2080 | + */ |
|
| 2081 | 2081 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 2082 | 2082 | { |
| 2083 | 2083 | global $globalDBdriver, $globalDebug; |
@@ -2114,11 +2114,11 @@ discard block |
||
| 2114 | 2114 | } |
| 2115 | 2115 | |
| 2116 | 2116 | /** |
| 2117 | - * Gets Country from iso2 |
|
| 2118 | - * |
|
| 2119 | - * @param String $iso2 ISO2 country code |
|
| 2120 | - * @return String the countrie |
|
| 2121 | - */ |
|
| 2117 | + * Gets Country from iso2 |
|
| 2118 | + * |
|
| 2119 | + * @param String $iso2 ISO2 country code |
|
| 2120 | + * @return String the countrie |
|
| 2121 | + */ |
|
| 2122 | 2122 | public function getCountryFromISO2($iso2) |
| 2123 | 2123 | { |
| 2124 | 2124 | global $globalDBdriver, $globalDebug; |
@@ -2147,12 +2147,12 @@ discard block |
||
| 2147 | 2147 | |
| 2148 | 2148 | |
| 2149 | 2149 | /** |
| 2150 | - * Gets the short url from bit.ly |
|
| 2151 | - * |
|
| 2152 | - * @param String $url the full url |
|
| 2153 | - * @return String the bit.ly url |
|
| 2154 | - * |
|
| 2155 | - */ |
|
| 2150 | + * Gets the short url from bit.ly |
|
| 2151 | + * |
|
| 2152 | + * @param String $url the full url |
|
| 2153 | + * @return String the bit.ly url |
|
| 2154 | + * |
|
| 2155 | + */ |
|
| 2156 | 2156 | public function getBitlyURL($url) |
| 2157 | 2157 | { |
| 2158 | 2158 | global $globalBitlyAccessToken; |
@@ -2179,11 +2179,11 @@ discard block |
||
| 2179 | 2179 | |
| 2180 | 2180 | |
| 2181 | 2181 | /** |
| 2182 | - * Gets all vessels types that have flown over |
|
| 2183 | - * |
|
| 2184 | - * @return Array the vessel type list |
|
| 2185 | - * |
|
| 2186 | - */ |
|
| 2182 | + * Gets all vessels types that have flown over |
|
| 2183 | + * |
|
| 2184 | + * @return Array the vessel type list |
|
| 2185 | + * |
|
| 2186 | + */ |
|
| 2187 | 2187 | public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 2188 | 2188 | { |
| 2189 | 2189 | global $globalDBdriver; |
@@ -2249,11 +2249,11 @@ discard block |
||
| 2249 | 2249 | } |
| 2250 | 2250 | |
| 2251 | 2251 | /** |
| 2252 | - * Gets all the tracker information |
|
| 2253 | - * |
|
| 2254 | - * @return Array the tracker information |
|
| 2255 | - * |
|
| 2256 | - */ |
|
| 2252 | + * Gets all the tracker information |
|
| 2253 | + * |
|
| 2254 | + * @return Array the tracker information |
|
| 2255 | + * |
|
| 2256 | + */ |
|
| 2257 | 2257 | public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
| 2258 | 2258 | { |
| 2259 | 2259 | global $globalTimezone, $globalDBdriver; |
@@ -2382,11 +2382,11 @@ discard block |
||
| 2382 | 2382 | } |
| 2383 | 2383 | |
| 2384 | 2384 | /** |
| 2385 | - * Check marine by id |
|
| 2386 | - * |
|
| 2387 | - * @return String the ident |
|
| 2388 | - * |
|
| 2389 | - */ |
|
| 2385 | + * Check marine by id |
|
| 2386 | + * |
|
| 2387 | + * @return String the ident |
|
| 2388 | + * |
|
| 2389 | + */ |
|
| 2390 | 2390 | public function checkId($id) |
| 2391 | 2391 | { |
| 2392 | 2392 | global $globalDBdriver, $globalTimezone; |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | require_once(dirname(__FILE__).'/class.Image.php'); |
| 3 | 3 | $global_marine_query = "SELECT marine_output.* FROM marine_output"; |
| 4 | 4 | |
| 5 | -class Marine{ |
|
| 5 | +class Marine { |
|
| 6 | 6 | public $db; |
| 7 | 7 | |
| 8 | 8 | public function __construct($dbc = null) { |
@@ -17,33 +17,33 @@ discard block |
||
| 17 | 17 | * @return Array the SQL part |
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 22 | 22 | $filters = array(); |
| 23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
| 26 | 26 | } else { |
| 27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | if (isset($filter[0]['source'])) { |
| 31 | - $filters = array_merge($filters,$filter); |
|
| 31 | + $filters = array_merge($filters, $filter); |
|
| 32 | 32 | } |
| 33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 34 | 34 | $filter_query_join = ''; |
| 35 | 35 | $filter_query_where = ''; |
| 36 | - foreach($filters as $flt) { |
|
| 36 | + foreach ($filters as $flt) { |
|
| 37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 38 | 38 | if (isset($flt['source'])) { |
| 39 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
| 39 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
| 40 | 40 | } else { |
| 41 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
| 41 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 47 | 47 | } |
| 48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 82 | 82 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 83 | 83 | if ($filter_query_where != '') { |
| 84 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 84 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 85 | 85 | } |
| 86 | 86 | $filter_query = $filter_query_join.$filter_query_where; |
| 87 | 87 | return $filter_query; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @return Array the spotter information |
| 97 | 97 | * |
| 98 | 98 | */ |
| 99 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
| 99 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
| 100 | 100 | { |
| 101 | 101 | date_default_timezone_set('UTC'); |
| 102 | 102 | if (!is_string($query)) |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | $sth = $this->db->prepare($query.$limitQuery); |
| 117 | 117 | $sth->execute($params); |
| 118 | 118 | } catch (PDOException $e) { |
| 119 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
| 119 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
| 120 | 120 | exit(); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | $num_rows = 0; |
| 124 | 124 | $spotter_array = array(); |
| 125 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 125 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 126 | 126 | { |
| 127 | 127 | $num_rows++; |
| 128 | 128 | $temp_array = array(); |
@@ -164,10 +164,10 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
| 166 | 166 | |
| 167 | - if(isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
|
| 167 | + if (isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
|
| 168 | 168 | { |
| 169 | 169 | $Image = new Image($this->db); |
| 170 | - if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
| 170 | + if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'], '', $temp_array['ident']); |
|
| 171 | 171 | else $image_array = $Image->getMarineImage($temp_array['mmsi']); |
| 172 | 172 | unset($Image); |
| 173 | 173 | if (count($image_array) > 0) { |
@@ -203,17 +203,17 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
| 205 | 205 | } else { |
| 206 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
| 206 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
| 207 | 207 | } |
| 208 | 208 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
| 209 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
| 210 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
| 209 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
| 210 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
| 211 | 211 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
| 212 | 212 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
| 213 | 213 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
| 214 | 214 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
| 215 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
| 216 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
| 215 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
| 216 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
| 217 | 217 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
| 218 | 218 | } |
| 219 | 219 | } |
@@ -246,8 +246,8 @@ discard block |
||
| 246 | 246 | if ($limit != "") |
| 247 | 247 | { |
| 248 | 248 | $limit_array = explode(",", $limit); |
| 249 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 250 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 249 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 250 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 251 | 251 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 252 | 252 | { |
| 253 | 253 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -261,8 +261,8 @@ discard block |
||
| 261 | 261 | } else { |
| 262 | 262 | $orderby_query = " ORDER BY marine_output.date DESC"; |
| 263 | 263 | } |
| 264 | - $query = $global_marine_query.$filter_query." ".$orderby_query; |
|
| 265 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
| 264 | + $query = $global_marine_query.$filter_query." ".$orderby_query; |
|
| 265 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
| 266 | 266 | return $spotter_array; |
| 267 | 267 | } |
| 268 | 268 | |
@@ -280,8 +280,8 @@ discard block |
||
| 280 | 280 | if ($id == '') return array(); |
| 281 | 281 | $additional_query = "marine_output.fammarine_id = :id"; |
| 282 | 282 | $query_values = array(':id' => $id); |
| 283 | - $query = $global_marine_query." WHERE ".$additional_query." "; |
|
| 284 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
| 283 | + $query = $global_marine_query." WHERE ".$additional_query." "; |
|
| 284 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
| 285 | 285 | return $spotter_array; |
| 286 | 286 | } |
| 287 | 287 | |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | $query_values = array(); |
| 301 | 301 | $limit_query = ''; |
| 302 | 302 | $additional_query = ''; |
| 303 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 303 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 304 | 304 | if ($ident != "") |
| 305 | 305 | { |
| 306 | 306 | if (!is_string($ident)) |
@@ -316,8 +316,8 @@ discard block |
||
| 316 | 316 | { |
| 317 | 317 | $limit_array = explode(",", $limit); |
| 318 | 318 | |
| 319 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 320 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 319 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 320 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 321 | 321 | |
| 322 | 322 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 323 | 323 | { |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | $query_values = array(); |
| 357 | 357 | $limit_query = ''; |
| 358 | 358 | $additional_query = ''; |
| 359 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 359 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 360 | 360 | if (!is_string($type)) |
| 361 | 361 | { |
| 362 | 362 | return false; |
@@ -369,8 +369,8 @@ discard block |
||
| 369 | 369 | { |
| 370 | 370 | $limit_array = explode(",", $limit); |
| 371 | 371 | |
| 372 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 373 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 372 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 373 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 374 | 374 | |
| 375 | 375 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 376 | 376 | { |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | return $spotter_array; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - public function getMarineDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
| 397 | + public function getMarineDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
| 398 | 398 | { |
| 399 | 399 | global $global_marine_query, $globalTimezone, $globalDBdriver; |
| 400 | 400 | |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | $limit_query = ''; |
| 403 | 403 | $additional_query = ''; |
| 404 | 404 | |
| 405 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 405 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 406 | 406 | |
| 407 | 407 | if ($date != "") |
| 408 | 408 | { |
@@ -428,8 +428,8 @@ discard block |
||
| 428 | 428 | { |
| 429 | 429 | $limit_array = explode(",", $limit); |
| 430 | 430 | |
| 431 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 432 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 431 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 432 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 433 | 433 | |
| 434 | 434 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 435 | 435 | { |
@@ -464,8 +464,8 @@ discard block |
||
| 464 | 464 | $query_values = array(); |
| 465 | 465 | $limit_query = ''; |
| 466 | 466 | $additional_query = ''; |
| 467 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 468 | - $captain = filter_var($captain,FILTER_SANITIZE_STRING); |
|
| 467 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 468 | + $captain = filter_var($captain, FILTER_SANITIZE_STRING); |
|
| 469 | 469 | if ($captain != "") |
| 470 | 470 | { |
| 471 | 471 | $additional_query = " AND (marine_output.captain_name = :captain OR marine_output.captain_id = :captain)"; |
@@ -474,8 +474,8 @@ discard block |
||
| 474 | 474 | if ($limit != "") |
| 475 | 475 | { |
| 476 | 476 | $limit_array = explode(",", $limit); |
| 477 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 478 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 477 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 478 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 479 | 479 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 480 | 480 | { |
| 481 | 481 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -502,13 +502,13 @@ discard block |
||
| 502 | 502 | */ |
| 503 | 503 | public function getMarineDataByRace($race = '', $limit = '', $sort = '', $filter = array()) |
| 504 | 504 | { |
| 505 | - global $global_marine_query,$globalDBdriver; |
|
| 505 | + global $global_marine_query, $globalDBdriver; |
|
| 506 | 506 | date_default_timezone_set('UTC'); |
| 507 | 507 | $query_values = array(); |
| 508 | 508 | $limit_query = ''; |
| 509 | 509 | $additional_query = ''; |
| 510 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 511 | - $race = filter_var($race,FILTER_SANITIZE_STRING); |
|
| 510 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 511 | + $race = filter_var($race, FILTER_SANITIZE_STRING); |
|
| 512 | 512 | if ($race != "") |
| 513 | 513 | { |
| 514 | 514 | $additional_query = " AND (marine_output.race_name = :race OR marine_output.race_id = :race)"; |
@@ -517,8 +517,8 @@ discard block |
||
| 517 | 517 | if ($limit != "") |
| 518 | 518 | { |
| 519 | 519 | $limit_array = explode(",", $limit); |
| 520 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 521 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 520 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 521 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 522 | 522 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 523 | 523 | { |
| 524 | 524 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -547,14 +547,14 @@ discard block |
||
| 547 | 547 | * @return String Duration of all races |
| 548 | 548 | * |
| 549 | 549 | */ |
| 550 | - public function countRacesByCaptain($captain,$filters = array()) |
|
| 550 | + public function countRacesByCaptain($captain, $filters = array()) |
|
| 551 | 551 | { |
| 552 | - $captain = filter_var($captain,FILTER_SANITIZE_STRING); |
|
| 553 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 554 | - $query = "SELECT COUNT(*) AS nb |
|
| 552 | + $captain = filter_var($captain, FILTER_SANITIZE_STRING); |
|
| 553 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 554 | + $query = "SELECT COUNT(*) AS nb |
|
| 555 | 555 | FROM marine_output".$filter_query." (marine_output.captain_name = :captain OR marine_output.captain_id = :captain)"; |
| 556 | 556 | $query_values = array(); |
| 557 | - $query_values = array_merge($query_values,array(':captain' => $captain)); |
|
| 557 | + $query_values = array_merge($query_values, array(':captain' => $captain)); |
|
| 558 | 558 | $sth = $this->db->prepare($query); |
| 559 | 559 | $sth->execute($query_values); |
| 560 | 560 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -567,14 +567,14 @@ discard block |
||
| 567 | 567 | * @return String Duration of all races |
| 568 | 568 | * |
| 569 | 569 | */ |
| 570 | - public function countCaptainsByRace($race,$filters = array()) |
|
| 570 | + public function countCaptainsByRace($race, $filters = array()) |
|
| 571 | 571 | { |
| 572 | - $race = filter_var($race,FILTER_SANITIZE_STRING); |
|
| 573 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 574 | - $query = "SELECT COUNT(*) AS nb |
|
| 572 | + $race = filter_var($race, FILTER_SANITIZE_STRING); |
|
| 573 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 574 | + $query = "SELECT COUNT(*) AS nb |
|
| 575 | 575 | FROM marine_output".$filter_query." (marine_output.race_name = :race OR marine_output.race_id = :race)"; |
| 576 | 576 | $query_values = array(); |
| 577 | - $query_values = array_merge($query_values,array(':race' => $race)); |
|
| 577 | + $query_values = array_merge($query_values, array(':race' => $race)); |
|
| 578 | 578 | $sth = $this->db->prepare($query); |
| 579 | 579 | $sth->execute($query_values); |
| 580 | 580 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -587,44 +587,44 @@ discard block |
||
| 587 | 587 | * @return Array the boat list |
| 588 | 588 | * |
| 589 | 589 | */ |
| 590 | - public function countAllBoatTypesByCaptain($captain,$filters = array(),$year = '',$month = '',$day = '') |
|
| 590 | + public function countAllBoatTypesByCaptain($captain, $filters = array(), $year = '', $month = '', $day = '') |
|
| 591 | 591 | { |
| 592 | 592 | global $globalDBdriver; |
| 593 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 594 | - $captain = filter_var($captain,FILTER_SANITIZE_STRING); |
|
| 595 | - $query = "SELECT DISTINCT marine_output.type, COUNT(marine_output.type) AS type_count |
|
| 593 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 594 | + $captain = filter_var($captain, FILTER_SANITIZE_STRING); |
|
| 595 | + $query = "SELECT DISTINCT marine_output.type, COUNT(marine_output.type) AS type_count |
|
| 596 | 596 | FROM marine_output".$filter_query." (marine_output.captain_id = :captain OR marine_output.captain_name = :captain)"; |
| 597 | 597 | $query_values = array(); |
| 598 | 598 | if ($year != '') { |
| 599 | 599 | if ($globalDBdriver == 'mysql') { |
| 600 | 600 | $query .= " AND YEAR(marine_output.date) = :year"; |
| 601 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 601 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 602 | 602 | } else { |
| 603 | 603 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
| 604 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 604 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 605 | 605 | } |
| 606 | 606 | } |
| 607 | 607 | if ($month != '') { |
| 608 | 608 | if ($globalDBdriver == 'mysql') { |
| 609 | 609 | $query .= " AND MONTH(marine_output.date) = :month"; |
| 610 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 610 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 611 | 611 | } else { |
| 612 | 612 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
| 613 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 613 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 614 | 614 | } |
| 615 | 615 | } |
| 616 | 616 | if ($day != '') { |
| 617 | 617 | if ($globalDBdriver == 'mysql') { |
| 618 | 618 | $query .= " AND DAY(marine_output.date) = :day"; |
| 619 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 619 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 620 | 620 | } else { |
| 621 | 621 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
| 622 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 622 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 623 | 623 | } |
| 624 | 624 | } |
| 625 | 625 | $query .= " GROUP BY marine_output.type |
| 626 | 626 | ORDER BY type_count DESC"; |
| 627 | - $query_values = array_merge($query_values,array(':captain' => $captain)); |
|
| 627 | + $query_values = array_merge($query_values, array(':captain' => $captain)); |
|
| 628 | 628 | $sth = $this->db->prepare($query); |
| 629 | 629 | $sth->execute($query_values); |
| 630 | 630 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -636,44 +636,44 @@ discard block |
||
| 636 | 636 | * @return Array the boat list |
| 637 | 637 | * |
| 638 | 638 | */ |
| 639 | - public function countAllBoatTypesByRace($race,$filters = array(),$year = '',$month = '',$day = '') |
|
| 639 | + public function countAllBoatTypesByRace($race, $filters = array(), $year = '', $month = '', $day = '') |
|
| 640 | 640 | { |
| 641 | 641 | global $globalDBdriver; |
| 642 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 643 | - $race = filter_var($race,FILTER_SANITIZE_STRING); |
|
| 644 | - $query = "SELECT DISTINCT marine_output.type, COUNT(marine_output.type) AS type_count |
|
| 642 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 643 | + $race = filter_var($race, FILTER_SANITIZE_STRING); |
|
| 644 | + $query = "SELECT DISTINCT marine_output.type, COUNT(marine_output.type) AS type_count |
|
| 645 | 645 | FROM marine_output".$filter_query." (marine_output.race_id = :race OR marine_output.race_name = :race)"; |
| 646 | 646 | $query_values = array(); |
| 647 | 647 | if ($year != '') { |
| 648 | 648 | if ($globalDBdriver == 'mysql') { |
| 649 | 649 | $query .= " AND YEAR(marine_output.date) = :year"; |
| 650 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 650 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 651 | 651 | } else { |
| 652 | 652 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
| 653 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 653 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 654 | 654 | } |
| 655 | 655 | } |
| 656 | 656 | if ($month != '') { |
| 657 | 657 | if ($globalDBdriver == 'mysql') { |
| 658 | 658 | $query .= " AND MONTH(marine_output.date) = :month"; |
| 659 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 659 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 660 | 660 | } else { |
| 661 | 661 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
| 662 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 662 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 663 | 663 | } |
| 664 | 664 | } |
| 665 | 665 | if ($day != '') { |
| 666 | 666 | if ($globalDBdriver == 'mysql') { |
| 667 | 667 | $query .= " AND DAY(marine_output.date) = :day"; |
| 668 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 668 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 669 | 669 | } else { |
| 670 | 670 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
| 671 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 671 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 672 | 672 | } |
| 673 | 673 | } |
| 674 | 674 | $query .= " GROUP BY marine_output.type |
| 675 | 675 | ORDER BY type_count DESC"; |
| 676 | - $query_values = array_merge($query_values,array(':race' => $race)); |
|
| 676 | + $query_values = array_merge($query_values, array(':race' => $race)); |
|
| 677 | 677 | $sth = $this->db->prepare($query); |
| 678 | 678 | $sth->execute($query_values); |
| 679 | 679 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -685,47 +685,47 @@ discard block |
||
| 685 | 685 | * @return String Duration of all race |
| 686 | 686 | * |
| 687 | 687 | */ |
| 688 | - public function getRaceDurationByCaptain($captain,$filters = array(),$year = '',$month = '',$day = '') |
|
| 688 | + public function getRaceDurationByCaptain($captain, $filters = array(), $year = '', $month = '', $day = '') |
|
| 689 | 689 | { |
| 690 | 690 | global $globalDBdriver; |
| 691 | - $captain = filter_var($captain,FILTER_SANITIZE_STRING); |
|
| 692 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 693 | - $query = "SELECT SUM(last_seen - date) AS duration |
|
| 691 | + $captain = filter_var($captain, FILTER_SANITIZE_STRING); |
|
| 692 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 693 | + $query = "SELECT SUM(last_seen - date) AS duration |
|
| 694 | 694 | FROM marine_output".$filter_query." (marine_output.captain_name = :captain OR marine_output.captain_id = :captain) |
| 695 | 695 | AND last_seen > date"; |
| 696 | 696 | $query_values = array(); |
| 697 | 697 | if ($year != '') { |
| 698 | 698 | if ($globalDBdriver == 'mysql') { |
| 699 | 699 | $query .= " AND YEAR(marine_output.date) = :year"; |
| 700 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 700 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 701 | 701 | } else { |
| 702 | 702 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
| 703 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 703 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 704 | 704 | } |
| 705 | 705 | } |
| 706 | 706 | if ($month != '') { |
| 707 | 707 | if ($globalDBdriver == 'mysql') { |
| 708 | 708 | $query .= " AND MONTH(marine_output.date) = :month"; |
| 709 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 709 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 710 | 710 | } else { |
| 711 | 711 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
| 712 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 712 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 713 | 713 | } |
| 714 | 714 | } |
| 715 | 715 | if ($day != '') { |
| 716 | 716 | if ($globalDBdriver == 'mysql') { |
| 717 | 717 | $query .= " AND DAY(marine_output.date) = :day"; |
| 718 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 718 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 719 | 719 | } else { |
| 720 | 720 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
| 721 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 721 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 722 | 722 | } |
| 723 | 723 | } |
| 724 | - $query_values = array_merge($query_values,array(':captain' => $captain)); |
|
| 724 | + $query_values = array_merge($query_values, array(':captain' => $captain)); |
|
| 725 | 725 | $sth = $this->db->prepare($query); |
| 726 | 726 | $sth->execute($query_values); |
| 727 | 727 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 728 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 728 | + if (is_int($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']); |
|
| 729 | 729 | else return $result[0]['duration']; |
| 730 | 730 | } |
| 731 | 731 | |
@@ -737,8 +737,8 @@ discard block |
||
| 737 | 737 | */ |
| 738 | 738 | public function getAllCaptainNames($filters = array()) |
| 739 | 739 | { |
| 740 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 741 | - $query = "SELECT DISTINCT marine_output.captain_name, marine_output.captain_id |
|
| 740 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 741 | + $query = "SELECT DISTINCT marine_output.captain_name, marine_output.captain_id |
|
| 742 | 742 | FROM marine_output".$filter_query." marine_output.captain_name <> '' |
| 743 | 743 | ORDER BY marine_output.captain_name ASC"; |
| 744 | 744 | |
@@ -755,8 +755,8 @@ discard block |
||
| 755 | 755 | */ |
| 756 | 756 | public function getAllRaceNames($filters = array()) |
| 757 | 757 | { |
| 758 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 759 | - $query = "SELECT DISTINCT marine_output.race_name, marine_output.race_id |
|
| 758 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 759 | + $query = "SELECT DISTINCT marine_output.race_name, marine_output.race_id |
|
| 760 | 760 | FROM marine_output".$filter_query." marine_output.race_name <> '' |
| 761 | 761 | ORDER BY marine_output.race_name ASC"; |
| 762 | 762 | |
@@ -772,11 +772,11 @@ discard block |
||
| 772 | 772 | * @return Array list of source name |
| 773 | 773 | * |
| 774 | 774 | */ |
| 775 | - public function getAllSourceName($type = '',$filters = array()) |
|
| 775 | + public function getAllSourceName($type = '', $filters = array()) |
|
| 776 | 776 | { |
| 777 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 777 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 778 | 778 | $query_values = array(); |
| 779 | - $query = "SELECT DISTINCT marine_output.source_name |
|
| 779 | + $query = "SELECT DISTINCT marine_output.source_name |
|
| 780 | 780 | FROM marine_output".$filter_query." marine_output.source_name <> ''"; |
| 781 | 781 | if ($type != '') { |
| 782 | 782 | $query_values = array(':type' => $type); |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | $source_array = array(); |
| 792 | 792 | $temp_array = array(); |
| 793 | 793 | |
| 794 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 794 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 795 | 795 | { |
| 796 | 796 | $temp_array['source_name'] = $row['source_name']; |
| 797 | 797 | $source_array[] = $temp_array; |
@@ -808,8 +808,8 @@ discard block |
||
| 808 | 808 | */ |
| 809 | 809 | public function getAllIdents($filters = array()) |
| 810 | 810 | { |
| 811 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 812 | - $query = "SELECT DISTINCT marine_output.ident |
|
| 811 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 812 | + $query = "SELECT DISTINCT marine_output.ident |
|
| 813 | 813 | FROM marine_output".$filter_query." marine_output.ident <> '' |
| 814 | 814 | ORDER BY marine_output.date ASC LIMIT 700 OFFSET 0"; |
| 815 | 815 | |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | $ident_array = array(); |
| 820 | 820 | $temp_array = array(); |
| 821 | 821 | |
| 822 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 822 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 823 | 823 | { |
| 824 | 824 | $temp_array['ident'] = $row['ident']; |
| 825 | 825 | $ident_array[] = $temp_array; |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | */ |
| 837 | 837 | public function getIdentity($mmsi) |
| 838 | 838 | { |
| 839 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
| 839 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
| 840 | 840 | $query = "SELECT * FROM marine_identity WHERE mmsi = :mmsi LIMIT 1"; |
| 841 | 841 | $sth = $this->db->prepare($query); |
| 842 | 842 | $sth->execute(array(':mmsi' => $mmsi)); |
@@ -849,23 +849,23 @@ discard block |
||
| 849 | 849 | * Add identity |
| 850 | 850 | * |
| 851 | 851 | */ |
| 852 | - public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
|
| 852 | + public function addIdentity($mmsi, $imo, $ident, $callsign, $type) |
|
| 853 | 853 | { |
| 854 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
| 854 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
| 855 | 855 | if ($mmsi != '') { |
| 856 | - $imo = filter_var($imo,FILTER_SANITIZE_NUMBER_INT); |
|
| 857 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 858 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 859 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
| 856 | + $imo = filter_var($imo, FILTER_SANITIZE_NUMBER_INT); |
|
| 857 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 858 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 859 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
| 860 | 860 | $identinfo = $this->getIdentity($mmsi); |
| 861 | 861 | if (empty($identinfo)) { |
| 862 | - $query = "INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:type)"; |
|
| 862 | + $query = "INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:type)"; |
|
| 863 | 863 | $sth = $this->db->prepare($query); |
| 864 | - $sth->execute(array(':mmsi' => $mmsi,':imo' => $imo,':call_sign' => $callsign,':ship_name' => $ident,':type' => $type)); |
|
| 864 | + $sth->execute(array(':mmsi' => $mmsi, ':imo' => $imo, ':call_sign' => $callsign, ':ship_name' => $ident, ':type' => $type)); |
|
| 865 | 865 | } elseif ($ident != '' && $identinfo['ship_name'] != $ident) { |
| 866 | - $query = "UPDATE marine_identity SET ship_name = :ship_name,type = :type WHERE mmsi = :mmsi"; |
|
| 866 | + $query = "UPDATE marine_identity SET ship_name = :ship_name,type = :type WHERE mmsi = :mmsi"; |
|
| 867 | 867 | $sth = $this->db->prepare($query); |
| 868 | - $sth->execute(array(':mmsi' => $mmsi,':ship_name' => $ident,':type' => $type)); |
|
| 868 | + $sth->execute(array(':mmsi' => $mmsi, ':ship_name' => $ident, ':type' => $type)); |
|
| 869 | 869 | } |
| 870 | 870 | } |
| 871 | 871 | } |
@@ -886,12 +886,12 @@ discard block |
||
| 886 | 886 | } else $offset = '+00:00'; |
| 887 | 887 | |
| 888 | 888 | if ($globalDBdriver == 'mysql') { |
| 889 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
| 889 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
| 890 | 890 | FROM marine_output |
| 891 | 891 | WHERE marine_output.date <> '' |
| 892 | 892 | ORDER BY marine_output.date ASC LIMIT 0,100"; |
| 893 | 893 | } else { |
| 894 | - $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 894 | + $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 895 | 895 | FROM marine_output |
| 896 | 896 | WHERE marine_output.date <> '' |
| 897 | 897 | ORDER BY marine_output.date ASC LIMIT 0,100"; |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | $date_array = array(); |
| 904 | 904 | $temp_array = array(); |
| 905 | 905 | |
| 906 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 906 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 907 | 907 | { |
| 908 | 908 | $temp_array['date'] = $row['date']; |
| 909 | 909 | |
@@ -921,10 +921,10 @@ discard block |
||
| 921 | 921 | * @return String success or false |
| 922 | 922 | * |
| 923 | 923 | */ |
| 924 | - public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
|
| 924 | + public function updateIdentMarineData($fammarine_id = '', $ident = '', $fromsource = NULL) |
|
| 925 | 925 | { |
| 926 | 926 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
| 927 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident); |
|
| 927 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident); |
|
| 928 | 928 | try { |
| 929 | 929 | $sth = $this->db->prepare($query); |
| 930 | 930 | $sth->execute($query_values); |
@@ -942,10 +942,10 @@ discard block |
||
| 942 | 942 | * @return String success or false |
| 943 | 943 | * |
| 944 | 944 | */ |
| 945 | - public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL) |
|
| 945 | + public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '', $fromsource = NULL) |
|
| 946 | 946 | { |
| 947 | 947 | $query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id'; |
| 948 | - $query_values = array(':fammarine_id' => $fammarine_id,':arrival_code' => $arrival_code); |
|
| 948 | + $query_values = array(':fammarine_id' => $fammarine_id, ':arrival_code' => $arrival_code); |
|
| 949 | 949 | try { |
| 950 | 950 | $sth = $this->db->prepare($query); |
| 951 | 951 | $sth->execute($query_values); |
@@ -964,11 +964,11 @@ discard block |
||
| 964 | 964 | * @return String success or false |
| 965 | 965 | * |
| 966 | 966 | */ |
| 967 | - public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
|
| 967 | + public function updateStatusMarineData($fammarine_id = '', $status_id = '', $status = '') |
|
| 968 | 968 | { |
| 969 | 969 | |
| 970 | 970 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
| 971 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
| 971 | + $query_values = array(':fammarine_id' => $fammarine_id, ':status' => $status, ':status_id' => $status_id); |
|
| 972 | 972 | |
| 973 | 973 | try { |
| 974 | 974 | $sth = $this->db->prepare($query); |
@@ -988,17 +988,17 @@ discard block |
||
| 988 | 988 | * @return String success or false |
| 989 | 989 | * |
| 990 | 990 | */ |
| 991 | - public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '',$distance = NULL,$race_rank = NULL, $race_time = NULL, $status = '', $race_begin = '') |
|
| 991 | + public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '', $distance = NULL, $race_rank = NULL, $race_time = NULL, $status = '', $race_begin = '') |
|
| 992 | 992 | { |
| 993 | 993 | if ($latitude == '') $latitude = NULL; |
| 994 | 994 | if ($longitude == '') $longitude = NULL; |
| 995 | 995 | $groundspeed = round($groundspeed); |
| 996 | 996 | if ($race_begin != '') { |
| 997 | 997 | $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, distance = :distance, race_rank = :race_rank, race_time = :race_time, status = :status, date = :race_begin WHERE fammarine_id = :fammarine_id'; |
| 998 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident,':distance' => $distance,':race_rank' => $race_rank,':race_time' => $race_time,':status' => $status,':race_begin' => $race_begin); |
|
| 998 | + $query_values = array(':fammarine_id' => $fammarine_id, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident, ':distance' => $distance, ':race_rank' => $race_rank, ':race_time' => $race_time, ':status' => $status, ':race_begin' => $race_begin); |
|
| 999 | 999 | } else { |
| 1000 | 1000 | $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, distance = :distance, race_rank = :race_rank, race_time = :race_time, status = :status WHERE fammarine_id = :fammarine_id'; |
| 1001 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident,':distance' => $distance,':race_rank' => $race_rank,':race_time' => $race_time,':status' => $status); |
|
| 1001 | + $query_values = array(':fammarine_id' => $fammarine_id, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident, ':distance' => $distance, ':race_rank' => $race_rank, ':race_time' => $race_time, ':status' => $status); |
|
| 1002 | 1002 | } |
| 1003 | 1003 | try { |
| 1004 | 1004 | $sth = $this->db->prepare($query); |
@@ -1037,7 +1037,7 @@ discard block |
||
| 1037 | 1037 | * @param String $verticalrate vertival rate of flight |
| 1038 | 1038 | * @return String success or false |
| 1039 | 1039 | */ |
| 1040 | - 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 = '', $captain_id = '',$captain_name = '',$race_id = '', $race_name = '', $distance = '',$race_rank = '', $race_time = '') |
|
| 1040 | + 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 = '', $captain_id = '', $captain_name = '', $race_id = '', $race_name = '', $distance = '', $race_rank = '', $race_time = '') |
|
| 1041 | 1041 | { |
| 1042 | 1042 | global $globalURL, $globalMarineImageFetch; |
| 1043 | 1043 | |
@@ -1109,34 +1109,34 @@ discard block |
||
| 1109 | 1109 | $date = date("Y-m-d H:i:s", time()); |
| 1110 | 1110 | } |
| 1111 | 1111 | |
| 1112 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
| 1113 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 1114 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1115 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1116 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 1117 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1118 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 1119 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
| 1120 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
| 1121 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
| 1122 | - $type_id = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT); |
|
| 1123 | - $status_id = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT); |
|
| 1124 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
| 1125 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 1126 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
| 1127 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
| 1128 | - $captain_id = filter_var($captain_id,FILTER_SANITIZE_STRING); |
|
| 1129 | - $captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING); |
|
| 1130 | - $race_id = filter_var($race_id,FILTER_SANITIZE_STRING); |
|
| 1131 | - $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
|
| 1132 | - $race_rank = filter_var($race_rank,FILTER_SANITIZE_NUMBER_INT); |
|
| 1133 | - $race_time = filter_var($race_time,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1134 | - $distance = filter_var($distance,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1112 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
| 1113 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 1114 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1115 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1116 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 1117 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1118 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 1119 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
| 1120 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
| 1121 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
| 1122 | + $type_id = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT); |
|
| 1123 | + $status_id = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT); |
|
| 1124 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
| 1125 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 1126 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
| 1127 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
| 1128 | + $captain_id = filter_var($captain_id, FILTER_SANITIZE_STRING); |
|
| 1129 | + $captain_name = filter_var($captain_name, FILTER_SANITIZE_STRING); |
|
| 1130 | + $race_id = filter_var($race_id, FILTER_SANITIZE_STRING); |
|
| 1131 | + $race_name = filter_var($race_name, FILTER_SANITIZE_STRING); |
|
| 1132 | + $race_rank = filter_var($race_rank, FILTER_SANITIZE_NUMBER_INT); |
|
| 1133 | + $race_time = filter_var($race_time, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1134 | + $distance = filter_var($distance, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1135 | 1135 | if (isset($globalMarineImageFetch) && $globalMarineImageFetch === TRUE) { |
| 1136 | 1136 | $Image = new Image($this->db); |
| 1137 | - $image_array = $Image->getMarineImage($mmsi,$imo,$ident); |
|
| 1137 | + $image_array = $Image->getMarineImage($mmsi, $imo, $ident); |
|
| 1138 | 1138 | if (!isset($image_array[0]['mmsi'])) { |
| 1139 | - $Image->addMarineImage($mmsi,$imo,$ident); |
|
| 1139 | + $Image->addMarineImage($mmsi, $imo, $ident); |
|
| 1140 | 1140 | } |
| 1141 | 1141 | unset($Image); |
| 1142 | 1142 | } |
@@ -1152,10 +1152,10 @@ discard block |
||
| 1152 | 1152 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
| 1153 | 1153 | //if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
| 1154 | 1154 | if ($arrival_date == '') $arrival_date = NULL; |
| 1155 | - $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name, distance, race_rank,race_time) |
|
| 1155 | + $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name, distance, race_rank,race_time) |
|
| 1156 | 1156 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:type_id,:status,:status_id,:imo,:arrival_port_name,:arrival_port_date,:captain_id,:captain_name,:race_id,:race_name, :distance, :race_rank,:race_time)"; |
| 1157 | 1157 | |
| 1158 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':mmsi' => $mmsi,':type' => $type,':type_id' => $type_id,':status' => $status,':status_id' => $status_id,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date,':captain_id' => $captain_id,':captain_name' => $captain_name,':race_id' => $race_id,':race_name' => $race_name,':distance' => $distance,':race_rank' => $race_rank,':race_time' => $race_time); |
|
| 1158 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':mmsi' => $mmsi, ':type' => $type, ':type_id' => $type_id, ':status' => $status, ':status_id' => $status_id, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date, ':captain_id' => $captain_id, ':captain_name' => $captain_name, ':race_id' => $race_id, ':race_name' => $race_name, ':distance' => $distance, ':race_rank' => $race_rank, ':race_time' => $race_time); |
|
| 1159 | 1159 | try { |
| 1160 | 1160 | $sth = $this->db->prepare($query); |
| 1161 | 1161 | $sth->execute($query_values); |
@@ -1179,13 +1179,13 @@ discard block |
||
| 1179 | 1179 | { |
| 1180 | 1180 | global $globalDBdriver, $globalTimezone; |
| 1181 | 1181 | if ($globalDBdriver == 'mysql') { |
| 1182 | - $query = "SELECT marine_output.ident FROM marine_output |
|
| 1182 | + $query = "SELECT marine_output.ident FROM marine_output |
|
| 1183 | 1183 | WHERE marine_output.ident = :ident |
| 1184 | 1184 | AND marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 1185 | 1185 | AND marine_output.date < UTC_TIMESTAMP()"; |
| 1186 | 1186 | $query_data = array(':ident' => $ident); |
| 1187 | 1187 | } else { |
| 1188 | - $query = "SELECT marine_output.ident FROM marine_output |
|
| 1188 | + $query = "SELECT marine_output.ident FROM marine_output |
|
| 1189 | 1189 | WHERE marine_output.ident = :ident |
| 1190 | 1190 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 1191 | 1191 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -1194,8 +1194,8 @@ discard block |
||
| 1194 | 1194 | |
| 1195 | 1195 | $sth = $this->db->prepare($query); |
| 1196 | 1196 | $sth->execute($query_data); |
| 1197 | - $ident_result=''; |
|
| 1198 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1197 | + $ident_result = ''; |
|
| 1198 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1199 | 1199 | { |
| 1200 | 1200 | $ident_result = $row['ident']; |
| 1201 | 1201 | } |
@@ -1221,8 +1221,8 @@ discard block |
||
| 1221 | 1221 | return false; |
| 1222 | 1222 | } else { |
| 1223 | 1223 | $q_array = explode(" ", $q); |
| 1224 | - foreach ($q_array as $q_item){ |
|
| 1225 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 1224 | + foreach ($q_array as $q_item) { |
|
| 1225 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 1226 | 1226 | $additional_query .= " AND ("; |
| 1227 | 1227 | $additional_query .= "(marine_output.ident like '%".$q_item."%')"; |
| 1228 | 1228 | $additional_query .= ")"; |
@@ -1230,11 +1230,11 @@ discard block |
||
| 1230 | 1230 | } |
| 1231 | 1231 | } |
| 1232 | 1232 | if ($globalDBdriver == 'mysql') { |
| 1233 | - $query = "SELECT marine_output.* FROM marine_output |
|
| 1233 | + $query = "SELECT marine_output.* FROM marine_output |
|
| 1234 | 1234 | WHERE marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 1235 | 1235 | AND marine_output.date < UTC_TIMESTAMP()"; |
| 1236 | 1236 | } else { |
| 1237 | - $query = "SELECT marine_output.* FROM marine_output |
|
| 1237 | + $query = "SELECT marine_output.* FROM marine_output |
|
| 1238 | 1238 | WHERE marine_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 1239 | 1239 | AND marine_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 1240 | 1240 | } |
@@ -1253,16 +1253,16 @@ discard block |
||
| 1253 | 1253 | * |
| 1254 | 1254 | */ |
| 1255 | 1255 | |
| 1256 | - public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 1256 | + public function countAllMarineOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 1257 | 1257 | { |
| 1258 | 1258 | global $globalDBdriver, $globalArchive; |
| 1259 | 1259 | //$filter_query = $this->getFilter($filters,true,true); |
| 1260 | - $Connection= new Connection($this->db); |
|
| 1260 | + $Connection = new Connection($this->db); |
|
| 1261 | 1261 | if (!$Connection->tableExists('countries')) return array(); |
| 1262 | 1262 | require_once('class.SpotterLive.php'); |
| 1263 | 1263 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
| 1264 | 1264 | $MarineLive = new MarineLive($this->db); |
| 1265 | - $filter_query = $MarineLive->getFilter($filters,true,true); |
|
| 1265 | + $filter_query = $MarineLive->getFilter($filters, true, true); |
|
| 1266 | 1266 | $filter_query .= " over_country IS NOT NULL AND over_country <> ''"; |
| 1267 | 1267 | if ($olderthanmonths > 0) { |
| 1268 | 1268 | if ($globalDBdriver == 'mysql') { |
@@ -1282,7 +1282,7 @@ discard block |
||
| 1282 | 1282 | } else { |
| 1283 | 1283 | require_once(dirname(__FILE__)."/class.MarineArchive.php"); |
| 1284 | 1284 | $MarineArchive = new MarineArchive($this->db); |
| 1285 | - $filter_query = $MarineArchive->getFilter($filters,true,true); |
|
| 1285 | + $filter_query = $MarineArchive->getFilter($filters, true, true); |
|
| 1286 | 1286 | $filter_query .= " over_country <> ''"; |
| 1287 | 1287 | if ($olderthanmonths > 0) { |
| 1288 | 1288 | if ($globalDBdriver == 'mysql') { |
@@ -1310,7 +1310,7 @@ discard block |
||
| 1310 | 1310 | $flight_array = array(); |
| 1311 | 1311 | $temp_array = array(); |
| 1312 | 1312 | |
| 1313 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1313 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1314 | 1314 | { |
| 1315 | 1315 | $temp_array['marine_count'] = $row['nb']; |
| 1316 | 1316 | $temp_array['marine_country'] = $row['name']; |
@@ -1329,11 +1329,11 @@ discard block |
||
| 1329 | 1329 | * @return Array the callsign list |
| 1330 | 1330 | * |
| 1331 | 1331 | */ |
| 1332 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
| 1332 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 1333 | 1333 | { |
| 1334 | 1334 | global $globalDBdriver; |
| 1335 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1336 | - $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
| 1335 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1336 | + $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
| 1337 | 1337 | FROM marine_output".$filter_query." marine_output.ident <> ''"; |
| 1338 | 1338 | if ($olderthanmonths > 0) { |
| 1339 | 1339 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -1347,28 +1347,28 @@ discard block |
||
| 1347 | 1347 | if ($year != '') { |
| 1348 | 1348 | if ($globalDBdriver == 'mysql') { |
| 1349 | 1349 | $query .= " AND YEAR(marine_output.date) = :year"; |
| 1350 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1350 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1351 | 1351 | } else { |
| 1352 | 1352 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
| 1353 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1353 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1354 | 1354 | } |
| 1355 | 1355 | } |
| 1356 | 1356 | if ($month != '') { |
| 1357 | 1357 | if ($globalDBdriver == 'mysql') { |
| 1358 | 1358 | $query .= " AND MONTH(marine_output.date) = :month"; |
| 1359 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1359 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1360 | 1360 | } else { |
| 1361 | 1361 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
| 1362 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1362 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1363 | 1363 | } |
| 1364 | 1364 | } |
| 1365 | 1365 | if ($day != '') { |
| 1366 | 1366 | if ($globalDBdriver == 'mysql') { |
| 1367 | 1367 | $query .= " AND DAY(marine_output.date) = :day"; |
| 1368 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 1368 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 1369 | 1369 | } else { |
| 1370 | 1370 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
| 1371 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 1371 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 1372 | 1372 | } |
| 1373 | 1373 | } |
| 1374 | 1374 | $query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC"; |
@@ -1380,7 +1380,7 @@ discard block |
||
| 1380 | 1380 | $callsign_array = array(); |
| 1381 | 1381 | $temp_array = array(); |
| 1382 | 1382 | |
| 1383 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1383 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1384 | 1384 | { |
| 1385 | 1385 | $temp_array['callsign_icao'] = $row['ident']; |
| 1386 | 1386 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -1432,7 +1432,7 @@ discard block |
||
| 1432 | 1432 | $date_array = array(); |
| 1433 | 1433 | $temp_array = array(); |
| 1434 | 1434 | |
| 1435 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1435 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1436 | 1436 | { |
| 1437 | 1437 | $temp_array['date_name'] = $row['date_name']; |
| 1438 | 1438 | $temp_array['date_count'] = $row['date_count']; |
@@ -1458,7 +1458,7 @@ discard block |
||
| 1458 | 1458 | $datetime = new DateTime(); |
| 1459 | 1459 | $offset = $datetime->format('P'); |
| 1460 | 1460 | } else $offset = '+00:00'; |
| 1461 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1461 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1462 | 1462 | if ($globalDBdriver == 'mysql') { |
| 1463 | 1463 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 1464 | 1464 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -1479,7 +1479,7 @@ discard block |
||
| 1479 | 1479 | $date_array = array(); |
| 1480 | 1480 | $temp_array = array(); |
| 1481 | 1481 | |
| 1482 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1482 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1483 | 1483 | { |
| 1484 | 1484 | $temp_array['date_name'] = $row['date_name']; |
| 1485 | 1485 | $temp_array['date_count'] = $row['date_count']; |
@@ -1504,7 +1504,7 @@ discard block |
||
| 1504 | 1504 | $datetime = new DateTime(); |
| 1505 | 1505 | $offset = $datetime->format('P'); |
| 1506 | 1506 | } else $offset = '+00:00'; |
| 1507 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1507 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1508 | 1508 | if ($globalDBdriver == 'mysql') { |
| 1509 | 1509 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 1510 | 1510 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -1525,7 +1525,7 @@ discard block |
||
| 1525 | 1525 | $date_array = array(); |
| 1526 | 1526 | $temp_array = array(); |
| 1527 | 1527 | |
| 1528 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1528 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1529 | 1529 | { |
| 1530 | 1530 | $temp_array['date_name'] = $row['date_name']; |
| 1531 | 1531 | $temp_array['date_count'] = $row['date_count']; |
@@ -1572,7 +1572,7 @@ discard block |
||
| 1572 | 1572 | $date_array = array(); |
| 1573 | 1573 | $temp_array = array(); |
| 1574 | 1574 | |
| 1575 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1575 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1576 | 1576 | { |
| 1577 | 1577 | $temp_array['month_name'] = $row['month_name']; |
| 1578 | 1578 | $temp_array['year_name'] = $row['year_name']; |
@@ -1601,7 +1601,7 @@ discard block |
||
| 1601 | 1601 | $datetime = new DateTime(); |
| 1602 | 1602 | $offset = $datetime->format('P'); |
| 1603 | 1603 | } else $offset = '+00:00'; |
| 1604 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1604 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1605 | 1605 | if ($globalDBdriver == 'mysql') { |
| 1606 | 1606 | $query = "SELECT MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
| 1607 | 1607 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -1622,7 +1622,7 @@ discard block |
||
| 1622 | 1622 | $date_array = array(); |
| 1623 | 1623 | $temp_array = array(); |
| 1624 | 1624 | |
| 1625 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1625 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1626 | 1626 | { |
| 1627 | 1627 | $temp_array['year_name'] = $row['year_name']; |
| 1628 | 1628 | $temp_array['month_name'] = $row['month_name']; |
@@ -1642,7 +1642,7 @@ discard block |
||
| 1642 | 1642 | * @return Array the hour list |
| 1643 | 1643 | * |
| 1644 | 1644 | */ |
| 1645 | - public function countAllHours($orderby,$filters = array()) |
|
| 1645 | + public function countAllHours($orderby, $filters = array()) |
|
| 1646 | 1646 | { |
| 1647 | 1647 | global $globalTimezone, $globalDBdriver; |
| 1648 | 1648 | if ($globalTimezone != '') { |
@@ -1690,7 +1690,7 @@ discard block |
||
| 1690 | 1690 | $hour_array = array(); |
| 1691 | 1691 | $temp_array = array(); |
| 1692 | 1692 | |
| 1693 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1693 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1694 | 1694 | { |
| 1695 | 1695 | $temp_array['hour_name'] = $row['hour_name']; |
| 1696 | 1696 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1712,8 +1712,8 @@ discard block |
||
| 1712 | 1712 | public function countAllHoursByDate($date, $filters = array()) |
| 1713 | 1713 | { |
| 1714 | 1714 | global $globalTimezone, $globalDBdriver; |
| 1715 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1716 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 1715 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1716 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 1717 | 1717 | if ($globalTimezone != '') { |
| 1718 | 1718 | date_default_timezone_set($globalTimezone); |
| 1719 | 1719 | $datetime = new DateTime($date); |
@@ -1721,12 +1721,12 @@ discard block |
||
| 1721 | 1721 | } else $offset = '+00:00'; |
| 1722 | 1722 | |
| 1723 | 1723 | if ($globalDBdriver == 'mysql') { |
| 1724 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1724 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1725 | 1725 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = :date |
| 1726 | 1726 | GROUP BY hour_name |
| 1727 | 1727 | ORDER BY hour_name ASC"; |
| 1728 | 1728 | } else { |
| 1729 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1729 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1730 | 1730 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
| 1731 | 1731 | GROUP BY hour_name |
| 1732 | 1732 | ORDER BY hour_name ASC"; |
@@ -1738,7 +1738,7 @@ discard block |
||
| 1738 | 1738 | $hour_array = array(); |
| 1739 | 1739 | $temp_array = array(); |
| 1740 | 1740 | |
| 1741 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1741 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1742 | 1742 | { |
| 1743 | 1743 | $temp_array['hour_name'] = $row['hour_name']; |
| 1744 | 1744 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1760,8 +1760,8 @@ discard block |
||
| 1760 | 1760 | public function countAllHoursByIdent($ident, $filters = array()) |
| 1761 | 1761 | { |
| 1762 | 1762 | global $globalTimezone, $globalDBdriver; |
| 1763 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1764 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 1763 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1764 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 1765 | 1765 | if ($globalTimezone != '') { |
| 1766 | 1766 | date_default_timezone_set($globalTimezone); |
| 1767 | 1767 | $datetime = new DateTime(); |
@@ -1769,12 +1769,12 @@ discard block |
||
| 1769 | 1769 | } else $offset = '+00:00'; |
| 1770 | 1770 | |
| 1771 | 1771 | if ($globalDBdriver == 'mysql') { |
| 1772 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1772 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1773 | 1773 | FROM marine_output".$filter_query." marine_output.ident = :ident |
| 1774 | 1774 | GROUP BY hour_name |
| 1775 | 1775 | ORDER BY hour_name ASC"; |
| 1776 | 1776 | } else { |
| 1777 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1777 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1778 | 1778 | FROM marine_output".$filter_query." marine_output.ident = :ident |
| 1779 | 1779 | GROUP BY hour_name |
| 1780 | 1780 | ORDER BY hour_name ASC"; |
@@ -1782,12 +1782,12 @@ discard block |
||
| 1782 | 1782 | |
| 1783 | 1783 | |
| 1784 | 1784 | $sth = $this->db->prepare($query); |
| 1785 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
| 1785 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
| 1786 | 1786 | |
| 1787 | 1787 | $hour_array = array(); |
| 1788 | 1788 | $temp_array = array(); |
| 1789 | 1789 | |
| 1790 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1790 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1791 | 1791 | { |
| 1792 | 1792 | $temp_array['hour_name'] = $row['hour_name']; |
| 1793 | 1793 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1806,33 +1806,33 @@ discard block |
||
| 1806 | 1806 | * @return Integer the number of vessels |
| 1807 | 1807 | * |
| 1808 | 1808 | */ |
| 1809 | - public function countOverallMarine($filters = array(),$year = '',$month = '') |
|
| 1809 | + public function countOverallMarine($filters = array(), $year = '', $month = '') |
|
| 1810 | 1810 | { |
| 1811 | 1811 | global $globalDBdriver; |
| 1812 | 1812 | //$queryi = "SELECT COUNT(marine_output.marine_id) AS flight_count FROM marine_output"; |
| 1813 | - $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
| 1813 | + $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
| 1814 | 1814 | $query_values = array(); |
| 1815 | 1815 | $query = ''; |
| 1816 | 1816 | if ($year != '') { |
| 1817 | 1817 | if ($globalDBdriver == 'mysql') { |
| 1818 | 1818 | $query .= " AND YEAR(marine_output.date) = :year"; |
| 1819 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1819 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1820 | 1820 | } else { |
| 1821 | 1821 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
| 1822 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1822 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1823 | 1823 | } |
| 1824 | 1824 | } |
| 1825 | 1825 | if ($month != '') { |
| 1826 | 1826 | if ($globalDBdriver == 'mysql') { |
| 1827 | 1827 | $query .= " AND MONTH(marine_output.date) = :month"; |
| 1828 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1828 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1829 | 1829 | } else { |
| 1830 | 1830 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
| 1831 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1831 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1832 | 1832 | } |
| 1833 | 1833 | } |
| 1834 | 1834 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
| 1835 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1835 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
| 1836 | 1836 | |
| 1837 | 1837 | $sth = $this->db->prepare($queryi); |
| 1838 | 1838 | $sth->execute($query_values); |
@@ -1845,32 +1845,32 @@ discard block |
||
| 1845 | 1845 | * @return Integer the number of vessels |
| 1846 | 1846 | * |
| 1847 | 1847 | */ |
| 1848 | - public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
|
| 1848 | + public function countOverallMarineTypes($filters = array(), $year = '', $month = '') |
|
| 1849 | 1849 | { |
| 1850 | 1850 | global $globalDBdriver; |
| 1851 | - $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
| 1851 | + $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
| 1852 | 1852 | $query_values = array(); |
| 1853 | 1853 | $query = ''; |
| 1854 | 1854 | if ($year != '') { |
| 1855 | 1855 | if ($globalDBdriver == 'mysql') { |
| 1856 | 1856 | $query .= " AND YEAR(marine_output.date) = :year"; |
| 1857 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1857 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1858 | 1858 | } else { |
| 1859 | 1859 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
| 1860 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1860 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1861 | 1861 | } |
| 1862 | 1862 | } |
| 1863 | 1863 | if ($month != '') { |
| 1864 | 1864 | if ($globalDBdriver == 'mysql') { |
| 1865 | 1865 | $query .= " AND MONTH(marine_output.date) = :month"; |
| 1866 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1866 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1867 | 1867 | } else { |
| 1868 | 1868 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
| 1869 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1869 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1870 | 1870 | } |
| 1871 | 1871 | } |
| 1872 | 1872 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
| 1873 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1873 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
| 1874 | 1874 | |
| 1875 | 1875 | $sth = $this->db->prepare($queryi); |
| 1876 | 1876 | $sth->execute($query_values); |
@@ -1887,7 +1887,7 @@ discard block |
||
| 1887 | 1887 | public function countAllHoursFromToday($filters = array()) |
| 1888 | 1888 | { |
| 1889 | 1889 | global $globalTimezone, $globalDBdriver; |
| 1890 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1890 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1891 | 1891 | if ($globalTimezone != '') { |
| 1892 | 1892 | date_default_timezone_set($globalTimezone); |
| 1893 | 1893 | $datetime = new DateTime(); |
@@ -1895,12 +1895,12 @@ discard block |
||
| 1895 | 1895 | } else $offset = '+00:00'; |
| 1896 | 1896 | |
| 1897 | 1897 | if ($globalDBdriver == 'mysql') { |
| 1898 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1898 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1899 | 1899 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = CURDATE() |
| 1900 | 1900 | GROUP BY hour_name |
| 1901 | 1901 | ORDER BY hour_name ASC"; |
| 1902 | 1902 | } else { |
| 1903 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1903 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1904 | 1904 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
| 1905 | 1905 | GROUP BY hour_name |
| 1906 | 1906 | ORDER BY hour_name ASC"; |
@@ -1912,7 +1912,7 @@ discard block |
||
| 1912 | 1912 | $hour_array = array(); |
| 1913 | 1913 | $temp_array = array(); |
| 1914 | 1914 | |
| 1915 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1915 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1916 | 1916 | { |
| 1917 | 1917 | $temp_array['hour_name'] = $row['hour_name']; |
| 1918 | 1918 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1931,9 +1931,9 @@ discard block |
||
| 1931 | 1931 | */ |
| 1932 | 1932 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
| 1933 | 1933 | { |
| 1934 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
| 1934 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
| 1935 | 1935 | |
| 1936 | - $query = "SELECT marine_output.marine_id |
|
| 1936 | + $query = "SELECT marine_output.marine_id |
|
| 1937 | 1937 | FROM marine_output |
| 1938 | 1938 | WHERE marine_output.fammarine_id = '".$fammarine_id."'"; |
| 1939 | 1939 | |
@@ -1941,7 +1941,7 @@ discard block |
||
| 1941 | 1941 | $sth = $this->db->prepare($query); |
| 1942 | 1942 | $sth->execute(); |
| 1943 | 1943 | |
| 1944 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1944 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1945 | 1945 | { |
| 1946 | 1946 | return $row['marine_id']; |
| 1947 | 1947 | } |
@@ -1966,23 +1966,23 @@ discard block |
||
| 1966 | 1966 | } |
| 1967 | 1967 | |
| 1968 | 1968 | $current_date = date("Y-m-d H:i:s"); |
| 1969 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
| 1969 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
| 1970 | 1970 | |
| 1971 | 1971 | $diff = abs(strtotime($current_date) - strtotime($date)); |
| 1972 | 1972 | |
| 1973 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
| 1973 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
| 1974 | 1974 | $years = $time_array['years']; |
| 1975 | 1975 | |
| 1976 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
| 1976 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
| 1977 | 1977 | $months = $time_array['months']; |
| 1978 | 1978 | |
| 1979 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
| 1979 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
| 1980 | 1980 | $days = $time_array['days']; |
| 1981 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
| 1981 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
| 1982 | 1982 | $hours = $time_array['hours']; |
| 1983 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
| 1983 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
| 1984 | 1984 | $minutes = $time_array['minutes']; |
| 1985 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 1985 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 1986 | 1986 | |
| 1987 | 1987 | return $time_array; |
| 1988 | 1988 | } |
@@ -2005,63 +2005,63 @@ discard block |
||
| 2005 | 2005 | $temp_array['direction_degree'] = $direction; |
| 2006 | 2006 | $temp_array['direction_shortname'] = "N"; |
| 2007 | 2007 | $temp_array['direction_fullname'] = "North"; |
| 2008 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
| 2008 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
| 2009 | 2009 | $temp_array['direction_degree'] = $direction; |
| 2010 | 2010 | $temp_array['direction_shortname'] = "NNE"; |
| 2011 | 2011 | $temp_array['direction_fullname'] = "North-Northeast"; |
| 2012 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
| 2012 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
| 2013 | 2013 | $temp_array['direction_degree'] = $direction; |
| 2014 | 2014 | $temp_array['direction_shortname'] = "NE"; |
| 2015 | 2015 | $temp_array['direction_fullname'] = "Northeast"; |
| 2016 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
| 2016 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
| 2017 | 2017 | $temp_array['direction_degree'] = $direction; |
| 2018 | 2018 | $temp_array['direction_shortname'] = "ENE"; |
| 2019 | 2019 | $temp_array['direction_fullname'] = "East-Northeast"; |
| 2020 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
| 2020 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
| 2021 | 2021 | $temp_array['direction_degree'] = $direction; |
| 2022 | 2022 | $temp_array['direction_shortname'] = "E"; |
| 2023 | 2023 | $temp_array['direction_fullname'] = "East"; |
| 2024 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
| 2024 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
| 2025 | 2025 | $temp_array['direction_degree'] = $direction; |
| 2026 | 2026 | $temp_array['direction_shortname'] = "ESE"; |
| 2027 | 2027 | $temp_array['direction_fullname'] = "East-Southeast"; |
| 2028 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
| 2028 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
| 2029 | 2029 | $temp_array['direction_degree'] = $direction; |
| 2030 | 2030 | $temp_array['direction_shortname'] = "SE"; |
| 2031 | 2031 | $temp_array['direction_fullname'] = "Southeast"; |
| 2032 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
| 2032 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
| 2033 | 2033 | $temp_array['direction_degree'] = $direction; |
| 2034 | 2034 | $temp_array['direction_shortname'] = "SSE"; |
| 2035 | 2035 | $temp_array['direction_fullname'] = "South-Southeast"; |
| 2036 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
| 2036 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
| 2037 | 2037 | $temp_array['direction_degree'] = $direction; |
| 2038 | 2038 | $temp_array['direction_shortname'] = "S"; |
| 2039 | 2039 | $temp_array['direction_fullname'] = "South"; |
| 2040 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
| 2040 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
| 2041 | 2041 | $temp_array['direction_degree'] = $direction; |
| 2042 | 2042 | $temp_array['direction_shortname'] = "SSW"; |
| 2043 | 2043 | $temp_array['direction_fullname'] = "South-Southwest"; |
| 2044 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
| 2044 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
| 2045 | 2045 | $temp_array['direction_degree'] = $direction; |
| 2046 | 2046 | $temp_array['direction_shortname'] = "SW"; |
| 2047 | 2047 | $temp_array['direction_fullname'] = "Southwest"; |
| 2048 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
| 2048 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
| 2049 | 2049 | $temp_array['direction_degree'] = $direction; |
| 2050 | 2050 | $temp_array['direction_shortname'] = "WSW"; |
| 2051 | 2051 | $temp_array['direction_fullname'] = "West-Southwest"; |
| 2052 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
| 2052 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
| 2053 | 2053 | $temp_array['direction_degree'] = $direction; |
| 2054 | 2054 | $temp_array['direction_shortname'] = "W"; |
| 2055 | 2055 | $temp_array['direction_fullname'] = "West"; |
| 2056 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
| 2056 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
| 2057 | 2057 | $temp_array['direction_degree'] = $direction; |
| 2058 | 2058 | $temp_array['direction_shortname'] = "WNW"; |
| 2059 | 2059 | $temp_array['direction_fullname'] = "West-Northwest"; |
| 2060 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
| 2060 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
| 2061 | 2061 | $temp_array['direction_degree'] = $direction; |
| 2062 | 2062 | $temp_array['direction_shortname'] = "NW"; |
| 2063 | 2063 | $temp_array['direction_fullname'] = "Northwest"; |
| 2064 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
| 2064 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
| 2065 | 2065 | $temp_array['direction_degree'] = $direction; |
| 2066 | 2066 | $temp_array['direction_shortname'] = "NNW"; |
| 2067 | 2067 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -2078,11 +2078,11 @@ discard block |
||
| 2078 | 2078 | * @param Float $longitude longitute of the flight |
| 2079 | 2079 | * @return String the countrie |
| 2080 | 2080 | */ |
| 2081 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
| 2081 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
| 2082 | 2082 | { |
| 2083 | 2083 | global $globalDBdriver, $globalDebug; |
| 2084 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2085 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2084 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2085 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2086 | 2086 | |
| 2087 | 2087 | $Connection = new Connection($this->db); |
| 2088 | 2088 | if (!$Connection->tableExists('countries')) return ''; |
@@ -2122,7 +2122,7 @@ discard block |
||
| 2122 | 2122 | public function getCountryFromISO2($iso2) |
| 2123 | 2123 | { |
| 2124 | 2124 | global $globalDBdriver, $globalDebug; |
| 2125 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
| 2125 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
| 2126 | 2126 | |
| 2127 | 2127 | $Connection = new Connection($this->db); |
| 2128 | 2128 | if (!$Connection->tableExists('countries')) return ''; |
@@ -2170,7 +2170,7 @@ discard block |
||
| 2170 | 2170 | |
| 2171 | 2171 | $bitly_data = json_decode($bitly_data); |
| 2172 | 2172 | $bitly_url = ''; |
| 2173 | - if ($bitly_data->status_txt = "OK"){ |
|
| 2173 | + if ($bitly_data->status_txt = "OK") { |
|
| 2174 | 2174 | $bitly_url = $bitly_data->data->url; |
| 2175 | 2175 | } |
| 2176 | 2176 | |
@@ -2184,11 +2184,11 @@ discard block |
||
| 2184 | 2184 | * @return Array the vessel type list |
| 2185 | 2185 | * |
| 2186 | 2186 | */ |
| 2187 | - public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
| 2187 | + public function countAllMarineTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 2188 | 2188 | { |
| 2189 | 2189 | global $globalDBdriver; |
| 2190 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2191 | - $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count, marine_output.type_id AS marine_type_id |
|
| 2190 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2191 | + $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count, marine_output.type_id AS marine_type_id |
|
| 2192 | 2192 | FROM marine_output ".$filter_query." marine_output.type <> '' AND marine_output.type_id IS NOT NULL"; |
| 2193 | 2193 | if ($olderthanmonths > 0) { |
| 2194 | 2194 | if ($globalDBdriver == 'mysql') { |
@@ -2208,28 +2208,28 @@ discard block |
||
| 2208 | 2208 | if ($year != '') { |
| 2209 | 2209 | if ($globalDBdriver == 'mysql') { |
| 2210 | 2210 | $query .= " AND YEAR(marine_output.date) = :year"; |
| 2211 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 2211 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 2212 | 2212 | } else { |
| 2213 | 2213 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
| 2214 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 2214 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 2215 | 2215 | } |
| 2216 | 2216 | } |
| 2217 | 2217 | if ($month != '') { |
| 2218 | 2218 | if ($globalDBdriver == 'mysql') { |
| 2219 | 2219 | $query .= " AND MONTH(marine_output.date) = :month"; |
| 2220 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 2220 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 2221 | 2221 | } else { |
| 2222 | 2222 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
| 2223 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 2223 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 2224 | 2224 | } |
| 2225 | 2225 | } |
| 2226 | 2226 | if ($day != '') { |
| 2227 | 2227 | if ($globalDBdriver == 'mysql') { |
| 2228 | 2228 | $query .= " AND DAY(marine_output.date) = :day"; |
| 2229 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 2229 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 2230 | 2230 | } else { |
| 2231 | 2231 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
| 2232 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 2232 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 2233 | 2233 | } |
| 2234 | 2234 | } |
| 2235 | 2235 | $query .= " GROUP BY marine_output.type, marine_output.type_id ORDER BY marine_type_count DESC"; |
@@ -2238,7 +2238,7 @@ discard block |
||
| 2238 | 2238 | $sth->execute($query_values); |
| 2239 | 2239 | $marine_array = array(); |
| 2240 | 2240 | $temp_array = array(); |
| 2241 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2241 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2242 | 2242 | { |
| 2243 | 2243 | $temp_array['marine_type'] = $row['marine_type']; |
| 2244 | 2244 | $temp_array['marine_type_id'] = $row['marine_type_id']; |
@@ -2254,13 +2254,13 @@ discard block |
||
| 2254 | 2254 | * @return Array the tracker information |
| 2255 | 2255 | * |
| 2256 | 2256 | */ |
| 2257 | - public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
|
| 2257 | + public function searchMarineData($q = '', $callsign = '', $mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
| 2258 | 2258 | { |
| 2259 | 2259 | global $globalTimezone, $globalDBdriver; |
| 2260 | 2260 | date_default_timezone_set('UTC'); |
| 2261 | 2261 | $query_values = array(); |
| 2262 | 2262 | $additional_query = ''; |
| 2263 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2263 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2264 | 2264 | if ($q != "") |
| 2265 | 2265 | { |
| 2266 | 2266 | if (!is_string($q)) |
@@ -2268,8 +2268,8 @@ discard block |
||
| 2268 | 2268 | return false; |
| 2269 | 2269 | } else { |
| 2270 | 2270 | $q_array = explode(" ", $q); |
| 2271 | - foreach ($q_array as $q_item){ |
|
| 2272 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 2271 | + foreach ($q_array as $q_item) { |
|
| 2272 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 2273 | 2273 | $additional_query .= " AND ("; |
| 2274 | 2274 | if (is_int($q_item)) $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
| 2275 | 2275 | if (is_int($q_item)) $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
@@ -2281,42 +2281,42 @@ discard block |
||
| 2281 | 2281 | } |
| 2282 | 2282 | if ($callsign != "") |
| 2283 | 2283 | { |
| 2284 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 2284 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 2285 | 2285 | if (!is_string($callsign)) |
| 2286 | 2286 | { |
| 2287 | 2287 | return false; |
| 2288 | 2288 | } else { |
| 2289 | 2289 | $additional_query .= " AND marine_output.ident = :callsign"; |
| 2290 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
| 2290 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
| 2291 | 2291 | } |
| 2292 | 2292 | } |
| 2293 | 2293 | if ($mmsi != "") |
| 2294 | 2294 | { |
| 2295 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
| 2295 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
| 2296 | 2296 | if (!is_numeric($mmsi)) |
| 2297 | 2297 | { |
| 2298 | 2298 | return false; |
| 2299 | 2299 | } else { |
| 2300 | 2300 | $additional_query .= " AND marine_output.mmsi = :mmsi"; |
| 2301 | - $query_values = array_merge($query_values,array(':mmsi' => $mmsi)); |
|
| 2301 | + $query_values = array_merge($query_values, array(':mmsi' => $mmsi)); |
|
| 2302 | 2302 | } |
| 2303 | 2303 | } |
| 2304 | 2304 | if ($imo != "") |
| 2305 | 2305 | { |
| 2306 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
| 2306 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
| 2307 | 2307 | if (!is_numeric($imo)) |
| 2308 | 2308 | { |
| 2309 | 2309 | return false; |
| 2310 | 2310 | } else { |
| 2311 | 2311 | $additional_query .= " AND marine_output.imo = :imo"; |
| 2312 | - $query_values = array_merge($query_values,array(':imo' => $imo)); |
|
| 2312 | + $query_values = array_merge($query_values, array(':imo' => $imo)); |
|
| 2313 | 2313 | } |
| 2314 | 2314 | } |
| 2315 | 2315 | if ($date_posted != "") |
| 2316 | 2316 | { |
| 2317 | 2317 | $date_array = explode(",", $date_posted); |
| 2318 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
| 2319 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
| 2318 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
| 2319 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
| 2320 | 2320 | if ($globalTimezone != '') { |
| 2321 | 2321 | date_default_timezone_set($globalTimezone); |
| 2322 | 2322 | $datetime = new DateTime(); |
@@ -2343,8 +2343,8 @@ discard block |
||
| 2343 | 2343 | if ($limit != "") |
| 2344 | 2344 | { |
| 2345 | 2345 | $limit_array = explode(",", $limit); |
| 2346 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 2347 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 2346 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 2347 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 2348 | 2348 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 2349 | 2349 | { |
| 2350 | 2350 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
@@ -2362,22 +2362,22 @@ discard block |
||
| 2362 | 2362 | } |
| 2363 | 2363 | } |
| 2364 | 2364 | if ($origLat != "" && $origLon != "" && $dist != "") { |
| 2365 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
| 2365 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
| 2366 | 2366 | if ($globalDBdriver == 'mysql') { |
| 2367 | - $query="SELECT marine_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2))) as distance |
|
| 2367 | + $query = "SELECT marine_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2))) as distance |
|
| 2368 | 2368 | FROM marine_archive,marine_output".$filter_query." marine_output.fammarine_id = marine_archive.fammarine_id AND marine_output.ident <> '' ".$additional_query."AND marine_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and marine_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 2369 | 2369 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query; |
| 2370 | 2370 | } else { |
| 2371 | - $query="SELECT marine_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 2371 | + $query = "SELECT marine_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 2372 | 2372 | FROM marine_archive,marine_output".$filter_query." marine_output.fammarine_id = marine_archive.fammarine_id AND marine_output.ident <> '' ".$additional_query."AND CAST(marine_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(marine_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 2373 | 2373 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query; |
| 2374 | 2374 | } |
| 2375 | 2375 | } else { |
| 2376 | - $query = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' |
|
| 2376 | + $query = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' |
|
| 2377 | 2377 | ".$additional_query." |
| 2378 | 2378 | ".$orderby_query; |
| 2379 | 2379 | } |
| 2380 | - $marine_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
| 2380 | + $marine_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
| 2381 | 2381 | return $marine_array; |
| 2382 | 2382 | } |
| 2383 | 2383 | |
@@ -2390,12 +2390,12 @@ discard block |
||
| 2390 | 2390 | public function checkId($id) |
| 2391 | 2391 | { |
| 2392 | 2392 | global $globalDBdriver, $globalTimezone; |
| 2393 | - $query = 'SELECT marine_output.ident, marine_output.fammarine_id FROM marine_output WHERE marine_output.fammarine_id = :id'; |
|
| 2393 | + $query = 'SELECT marine_output.ident, marine_output.fammarine_id FROM marine_output WHERE marine_output.fammarine_id = :id'; |
|
| 2394 | 2394 | $query_data = array(':id' => $id); |
| 2395 | 2395 | $sth = $this->db->prepare($query); |
| 2396 | 2396 | $sth->execute($query_data); |
| 2397 | - $ident_result=''; |
|
| 2398 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2397 | + $ident_result = ''; |
|
| 2398 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2399 | 2399 | { |
| 2400 | 2400 | $ident_result = $row['fammarine_id']; |
| 2401 | 2401 | } |
@@ -2404,7 +2404,7 @@ discard block |
||
| 2404 | 2404 | |
| 2405 | 2405 | public function getOrderBy() |
| 2406 | 2406 | { |
| 2407 | - $orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY marine_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY marine_output.type DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure port - ASC", "sql" => "ORDER BY marine_output.departure_port_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
| 2407 | + $orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY marine_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY marine_output.type DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure port - ASC", "sql" => "ORDER BY marine_output.departure_port_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
| 2408 | 2408 | |
| 2409 | 2409 | return $orderby; |
| 2410 | 2410 | |