@@ -14,10 +14,10 @@ discard block |
||
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | - * Get SQL query part for filter used |
|
| 18 | - * @param Array $filter the filter |
|
| 19 | - * @return Array the SQL part |
|
| 20 | - */ |
|
| 17 | + * Get SQL query part for filter used |
|
| 18 | + * @param Array $filter the filter |
|
| 19 | + * @return Array the SQL part |
|
| 20 | + */ |
|
| 21 | 21 | |
| 22 | 22 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 23 | 23 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -84,14 +84,14 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | - * Executes the SQL statements to get the tracker information |
|
| 88 | - * |
|
| 89 | - * @param String $query the SQL query |
|
| 90 | - * @param Array $params parameter of the query |
|
| 91 | - * @param String $limitQuery the limit query |
|
| 92 | - * @return Array the tracker information |
|
| 93 | - * |
|
| 94 | - */ |
|
| 87 | + * Executes the SQL statements to get the tracker information |
|
| 88 | + * |
|
| 89 | + * @param String $query the SQL query |
|
| 90 | + * @param Array $params parameter of the query |
|
| 91 | + * @param String $limitQuery the limit query |
|
| 92 | + * @return Array the tracker information |
|
| 93 | + * |
|
| 94 | + */ |
|
| 95 | 95 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
| 96 | 96 | { |
| 97 | 97 | date_default_timezone_set('UTC'); |
@@ -204,11 +204,11 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | |
| 206 | 206 | /** |
| 207 | - * Gets all the tracker information based on the latest data entry |
|
| 208 | - * |
|
| 209 | - * @return Array the tracker information |
|
| 210 | - * |
|
| 211 | - */ |
|
| 207 | + * Gets all the tracker information based on the latest data entry |
|
| 208 | + * |
|
| 209 | + * @return Array the tracker information |
|
| 210 | + * |
|
| 211 | + */ |
|
| 212 | 212 | public function getLatestTrackerData($limit = '', $sort = '', $filter = array()) |
| 213 | 213 | { |
| 214 | 214 | global $global_tracker_query; |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
| 269 | - * Gets all the tracker information based on the callsign |
|
| 270 | - * |
|
| 271 | - * @return Array the tracker information |
|
| 272 | - * |
|
| 273 | - */ |
|
| 269 | + * Gets all the tracker information based on the callsign |
|
| 270 | + * |
|
| 271 | + * @return Array the tracker information |
|
| 272 | + * |
|
| 273 | + */ |
|
| 274 | 274 | public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
| 275 | 275 | { |
| 276 | 276 | global $global_tracker_query; |
@@ -381,12 +381,12 @@ discard block |
||
| 381 | 381 | |
| 382 | 382 | |
| 383 | 383 | /** |
| 384 | - * Gets all source name |
|
| 385 | - * |
|
| 386 | - * @param String type format of source |
|
| 387 | - * @return Array list of source name |
|
| 388 | - * |
|
| 389 | - */ |
|
| 384 | + * Gets all source name |
|
| 385 | + * |
|
| 386 | + * @param String type format of source |
|
| 387 | + * @return Array list of source name |
|
| 388 | + * |
|
| 389 | + */ |
|
| 390 | 390 | public function getAllSourceName($type = '',$filters = array()) |
| 391 | 391 | { |
| 392 | 392 | $filter_query = $this->getFilter($filters,true,true); |
@@ -416,11 +416,11 @@ discard block |
||
| 416 | 416 | |
| 417 | 417 | |
| 418 | 418 | /** |
| 419 | - * Gets a list of all idents/callsigns |
|
| 420 | - * |
|
| 421 | - * @return Array list of ident/callsign names |
|
| 422 | - * |
|
| 423 | - */ |
|
| 419 | + * Gets a list of all idents/callsigns |
|
| 420 | + * |
|
| 421 | + * @return Array list of ident/callsign names |
|
| 422 | + * |
|
| 423 | + */ |
|
| 424 | 424 | public function getAllIdents($filters = array()) |
| 425 | 425 | { |
| 426 | 426 | $filter_query = $this->getFilter($filters,true,true); |
@@ -488,18 +488,18 @@ discard block |
||
| 488 | 488 | |
| 489 | 489 | |
| 490 | 490 | /** |
| 491 | - * Update ident tracker data |
|
| 492 | - * |
|
| 493 | - * @param String $flightaware_id the ID from flightaware |
|
| 494 | - * @param String $ident the flight ident |
|
| 495 | - * @return String success or false |
|
| 496 | - * |
|
| 497 | - */ |
|
| 491 | + * Update ident tracker data |
|
| 492 | + * |
|
| 493 | + * @param String $flightaware_id the ID from flightaware |
|
| 494 | + * @param String $ident the flight ident |
|
| 495 | + * @return String success or false |
|
| 496 | + * |
|
| 497 | + */ |
|
| 498 | 498 | public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL) |
| 499 | 499 | { |
| 500 | 500 | |
| 501 | 501 | $query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid'; |
| 502 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident); |
|
| 502 | + $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident); |
|
| 503 | 503 | |
| 504 | 504 | try { |
| 505 | 505 | $sth = $this->db->prepare($query); |
@@ -512,18 +512,18 @@ discard block |
||
| 512 | 512 | |
| 513 | 513 | } |
| 514 | 514 | /** |
| 515 | - * Update latest tracker data |
|
| 516 | - * |
|
| 517 | - * @param String $flightaware_id the ID from flightaware |
|
| 518 | - * @param String $ident the flight ident |
|
| 519 | - * @param String $arrival_airport_icao the arrival airport |
|
| 520 | - * @return String success or false |
|
| 521 | - * |
|
| 522 | - */ |
|
| 515 | + * Update latest tracker data |
|
| 516 | + * |
|
| 517 | + * @param String $flightaware_id the ID from flightaware |
|
| 518 | + * @param String $ident the flight ident |
|
| 519 | + * @param String $arrival_airport_icao the arrival airport |
|
| 520 | + * @return String success or false |
|
| 521 | + * |
|
| 522 | + */ |
|
| 523 | 523 | public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '') |
| 524 | 524 | { |
| 525 | 525 | $query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid'; |
| 526 | - $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 526 | + $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 527 | 527 | |
| 528 | 528 | try { |
| 529 | 529 | $sth = $this->db->prepare($query); |
@@ -537,32 +537,32 @@ discard block |
||
| 537 | 537 | } |
| 538 | 538 | |
| 539 | 539 | /** |
| 540 | - * Adds a new tracker data |
|
| 541 | - * |
|
| 542 | - * @param String $flightaware_id the ID from flightaware |
|
| 543 | - * @param String $ident the flight ident |
|
| 544 | - * @param String $aircraft_icao the aircraft type |
|
| 545 | - * @param String $departure_airport_icao the departure airport |
|
| 546 | - * @param String $arrival_airport_icao the arrival airport |
|
| 547 | - * @param String $latitude latitude of flight |
|
| 548 | - * @param String $longitude latitude of flight |
|
| 549 | - * @param String $waypoints waypoints of flight |
|
| 550 | - * @param String $altitude altitude of flight |
|
| 551 | - * @param String $heading heading of flight |
|
| 552 | - * @param String $groundspeed speed of flight |
|
| 553 | - * @param String $date date of flight |
|
| 554 | - * @param String $departure_airport_time departure time of flight |
|
| 555 | - * @param String $arrival_airport_time arrival time of flight |
|
| 556 | - * @param String $squawk squawk code of flight |
|
| 557 | - * @param String $route_stop route stop of flight |
|
| 558 | - * @param String $highlight highlight or not |
|
| 559 | - * @param String $ModeS ModesS code of flight |
|
| 560 | - * @param String $registration registration code of flight |
|
| 561 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 562 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 563 | - * @param String $verticalrate vertival rate of flight |
|
| 564 | - * @return String success or false |
|
| 565 | - */ |
|
| 540 | + * Adds a new tracker data |
|
| 541 | + * |
|
| 542 | + * @param String $flightaware_id the ID from flightaware |
|
| 543 | + * @param String $ident the flight ident |
|
| 544 | + * @param String $aircraft_icao the aircraft type |
|
| 545 | + * @param String $departure_airport_icao the departure airport |
|
| 546 | + * @param String $arrival_airport_icao the arrival airport |
|
| 547 | + * @param String $latitude latitude of flight |
|
| 548 | + * @param String $longitude latitude of flight |
|
| 549 | + * @param String $waypoints waypoints of flight |
|
| 550 | + * @param String $altitude altitude of flight |
|
| 551 | + * @param String $heading heading of flight |
|
| 552 | + * @param String $groundspeed speed of flight |
|
| 553 | + * @param String $date date of flight |
|
| 554 | + * @param String $departure_airport_time departure time of flight |
|
| 555 | + * @param String $arrival_airport_time arrival time of flight |
|
| 556 | + * @param String $squawk squawk code of flight |
|
| 557 | + * @param String $route_stop route stop of flight |
|
| 558 | + * @param String $highlight highlight or not |
|
| 559 | + * @param String $ModeS ModesS code of flight |
|
| 560 | + * @param String $registration registration code of flight |
|
| 561 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 562 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 563 | + * @param String $verticalrate vertival rate of flight |
|
| 564 | + * @return String success or false |
|
| 565 | + */ |
|
| 566 | 566 | public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '') |
| 567 | 567 | { |
| 568 | 568 | global $globalURL; |
@@ -647,16 +647,16 @@ discard block |
||
| 647 | 647 | $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
| 648 | 648 | $type = filter_var($type,FILTER_SANITIZE_STRING); |
| 649 | 649 | |
| 650 | - if ($latitude == '' && $longitude == '') { |
|
| 651 | - $latitude = 0; |
|
| 652 | - $longitude = 0; |
|
| 653 | - } |
|
| 654 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 655 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 656 | - $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
| 650 | + if ($latitude == '' && $longitude == '') { |
|
| 651 | + $latitude = 0; |
|
| 652 | + $longitude = 0; |
|
| 653 | + } |
|
| 654 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 655 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 656 | + $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
| 657 | 657 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
| 658 | 658 | |
| 659 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type); |
|
| 659 | + $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type); |
|
| 660 | 660 | |
| 661 | 661 | try { |
| 662 | 662 | |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | $sth->execute($query_values); |
| 665 | 665 | $this->db = null; |
| 666 | 666 | } catch (PDOException $e) { |
| 667 | - return "error : ".$e->getMessage(); |
|
| 667 | + return "error : ".$e->getMessage(); |
|
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | return "success"; |
@@ -673,11 +673,11 @@ discard block |
||
| 673 | 673 | |
| 674 | 674 | |
| 675 | 675 | /** |
| 676 | - * Gets the aircraft ident within the last hour |
|
| 677 | - * |
|
| 678 | - * @return String the ident |
|
| 679 | - * |
|
| 680 | - */ |
|
| 676 | + * Gets the aircraft ident within the last hour |
|
| 677 | + * |
|
| 678 | + * @return String the ident |
|
| 679 | + * |
|
| 680 | + */ |
|
| 681 | 681 | public function getIdentFromLastHour($ident) |
| 682 | 682 | { |
| 683 | 683 | global $globalDBdriver, $globalTimezone; |
@@ -693,11 +693,11 @@ discard block |
||
| 693 | 693 | AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 694 | 694 | AND tracker_output.date < now() AT TIME ZONE 'UTC'"; |
| 695 | 695 | $query_data = array(':ident' => $ident); |
| 696 | - } |
|
| 696 | + } |
|
| 697 | 697 | |
| 698 | 698 | $sth = $this->db->prepare($query); |
| 699 | 699 | $sth->execute($query_data); |
| 700 | - $ident_result=''; |
|
| 700 | + $ident_result=''; |
|
| 701 | 701 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 702 | 702 | { |
| 703 | 703 | $ident_result = $row['ident']; |
@@ -708,11 +708,11 @@ discard block |
||
| 708 | 708 | |
| 709 | 709 | |
| 710 | 710 | /** |
| 711 | - * Gets the aircraft data from the last 20 seconds |
|
| 712 | - * |
|
| 713 | - * @return Array the tracker data |
|
| 714 | - * |
|
| 715 | - */ |
|
| 711 | + * Gets the aircraft data from the last 20 seconds |
|
| 712 | + * |
|
| 713 | + * @return Array the tracker data |
|
| 714 | + * |
|
| 715 | + */ |
|
| 716 | 716 | public function getRealTimeData($q = '') |
| 717 | 717 | { |
| 718 | 718 | global $globalDBdriver; |
@@ -746,11 +746,11 @@ discard block |
||
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | /** |
| 749 | - * Gets all number of flight over countries |
|
| 750 | - * |
|
| 751 | - * @return Array the airline country list |
|
| 752 | - * |
|
| 753 | - */ |
|
| 749 | + * Gets all number of flight over countries |
|
| 750 | + * |
|
| 751 | + * @return Array the airline country list |
|
| 752 | + * |
|
| 753 | + */ |
|
| 754 | 754 | public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 755 | 755 | { |
| 756 | 756 | global $globalDBdriver, $globalArchive; |
@@ -820,11 +820,11 @@ discard block |
||
| 820 | 820 | } |
| 821 | 821 | |
| 822 | 822 | /** |
| 823 | - * Gets all callsigns that have flown over |
|
| 824 | - * |
|
| 825 | - * @return Array the callsign list |
|
| 826 | - * |
|
| 827 | - */ |
|
| 823 | + * Gets all callsigns that have flown over |
|
| 824 | + * |
|
| 825 | + * @return Array the callsign list |
|
| 826 | + * |
|
| 827 | + */ |
|
| 828 | 828 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 829 | 829 | { |
| 830 | 830 | global $globalDBdriver; |
@@ -891,11 +891,11 @@ discard block |
||
| 891 | 891 | |
| 892 | 892 | |
| 893 | 893 | /** |
| 894 | - * Counts all dates |
|
| 895 | - * |
|
| 896 | - * @return Array the date list |
|
| 897 | - * |
|
| 898 | - */ |
|
| 894 | + * Counts all dates |
|
| 895 | + * |
|
| 896 | + * @return Array the date list |
|
| 897 | + * |
|
| 898 | + */ |
|
| 899 | 899 | public function countAllDates($filters = array()) |
| 900 | 900 | { |
| 901 | 901 | global $globalTimezone, $globalDBdriver; |
@@ -941,11 +941,11 @@ discard block |
||
| 941 | 941 | |
| 942 | 942 | |
| 943 | 943 | /** |
| 944 | - * Counts all dates during the last 7 days |
|
| 945 | - * |
|
| 946 | - * @return Array the date list |
|
| 947 | - * |
|
| 948 | - */ |
|
| 944 | + * Counts all dates during the last 7 days |
|
| 945 | + * |
|
| 946 | + * @return Array the date list |
|
| 947 | + * |
|
| 948 | + */ |
|
| 949 | 949 | public function countAllDatesLast7Days($filters = array()) |
| 950 | 950 | { |
| 951 | 951 | global $globalTimezone, $globalDBdriver; |
@@ -967,7 +967,7 @@ discard block |
||
| 967 | 967 | $query .= " GROUP BY date_name |
| 968 | 968 | ORDER BY date_name ASC"; |
| 969 | 969 | $query_data = array(':offset' => $offset); |
| 970 | - } |
|
| 970 | + } |
|
| 971 | 971 | |
| 972 | 972 | $sth = $this->db->prepare($query); |
| 973 | 973 | $sth->execute($query_data); |
@@ -987,11 +987,11 @@ discard block |
||
| 987 | 987 | } |
| 988 | 988 | |
| 989 | 989 | /** |
| 990 | - * Counts all dates during the last month |
|
| 991 | - * |
|
| 992 | - * @return Array the date list |
|
| 993 | - * |
|
| 994 | - */ |
|
| 990 | + * Counts all dates during the last month |
|
| 991 | + * |
|
| 992 | + * @return Array the date list |
|
| 993 | + * |
|
| 994 | + */ |
|
| 995 | 995 | public function countAllDatesLastMonth($filters = array()) |
| 996 | 996 | { |
| 997 | 997 | global $globalTimezone, $globalDBdriver; |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | $query .= " GROUP BY date_name |
| 1014 | 1014 | ORDER BY date_name ASC"; |
| 1015 | 1015 | $query_data = array(':offset' => $offset); |
| 1016 | - } |
|
| 1016 | + } |
|
| 1017 | 1017 | |
| 1018 | 1018 | $sth = $this->db->prepare($query); |
| 1019 | 1019 | $sth->execute($query_data); |
@@ -1035,11 +1035,11 @@ discard block |
||
| 1035 | 1035 | |
| 1036 | 1036 | |
| 1037 | 1037 | /** |
| 1038 | - * Counts all month |
|
| 1039 | - * |
|
| 1040 | - * @return Array the month list |
|
| 1041 | - * |
|
| 1042 | - */ |
|
| 1038 | + * Counts all month |
|
| 1039 | + * |
|
| 1040 | + * @return Array the month list |
|
| 1041 | + * |
|
| 1042 | + */ |
|
| 1043 | 1043 | public function countAllMonths($filters = array()) |
| 1044 | 1044 | { |
| 1045 | 1045 | global $globalTimezone, $globalDBdriver; |
@@ -1084,11 +1084,11 @@ discard block |
||
| 1084 | 1084 | |
| 1085 | 1085 | |
| 1086 | 1086 | /** |
| 1087 | - * Counts all dates during the last year |
|
| 1088 | - * |
|
| 1089 | - * @return Array the date list |
|
| 1090 | - * |
|
| 1091 | - */ |
|
| 1087 | + * Counts all dates during the last year |
|
| 1088 | + * |
|
| 1089 | + * @return Array the date list |
|
| 1090 | + * |
|
| 1091 | + */ |
|
| 1092 | 1092 | public function countAllMonthsLastYear($filters) |
| 1093 | 1093 | { |
| 1094 | 1094 | global $globalTimezone, $globalDBdriver; |
@@ -1110,7 +1110,7 @@ discard block |
||
| 1110 | 1110 | $query .= " GROUP BY year_name, month_name |
| 1111 | 1111 | ORDER BY year_name, month_name ASC"; |
| 1112 | 1112 | $query_data = array(':offset' => $offset); |
| 1113 | - } |
|
| 1113 | + } |
|
| 1114 | 1114 | |
| 1115 | 1115 | $sth = $this->db->prepare($query); |
| 1116 | 1116 | $sth->execute($query_data); |
@@ -1133,11 +1133,11 @@ discard block |
||
| 1133 | 1133 | |
| 1134 | 1134 | |
| 1135 | 1135 | /** |
| 1136 | - * Counts all hours |
|
| 1137 | - * |
|
| 1138 | - * @return Array the hour list |
|
| 1139 | - * |
|
| 1140 | - */ |
|
| 1136 | + * Counts all hours |
|
| 1137 | + * |
|
| 1138 | + * @return Array the hour list |
|
| 1139 | + * |
|
| 1140 | + */ |
|
| 1141 | 1141 | public function countAllHours($orderby,$filters = array()) |
| 1142 | 1142 | { |
| 1143 | 1143 | global $globalTimezone, $globalDBdriver; |
@@ -1200,11 +1200,11 @@ discard block |
||
| 1200 | 1200 | |
| 1201 | 1201 | |
| 1202 | 1202 | /** |
| 1203 | - * Counts all hours by date |
|
| 1204 | - * |
|
| 1205 | - * @return Array the hour list |
|
| 1206 | - * |
|
| 1207 | - */ |
|
| 1203 | + * Counts all hours by date |
|
| 1204 | + * |
|
| 1205 | + * @return Array the hour list |
|
| 1206 | + * |
|
| 1207 | + */ |
|
| 1208 | 1208 | public function countAllHoursByDate($date, $filters = array()) |
| 1209 | 1209 | { |
| 1210 | 1210 | global $globalTimezone, $globalDBdriver; |
@@ -1248,11 +1248,11 @@ discard block |
||
| 1248 | 1248 | |
| 1249 | 1249 | |
| 1250 | 1250 | /** |
| 1251 | - * Counts all hours by a ident/callsign |
|
| 1252 | - * |
|
| 1253 | - * @return Array the hour list |
|
| 1254 | - * |
|
| 1255 | - */ |
|
| 1251 | + * Counts all hours by a ident/callsign |
|
| 1252 | + * |
|
| 1253 | + * @return Array the hour list |
|
| 1254 | + * |
|
| 1255 | + */ |
|
| 1256 | 1256 | public function countAllHoursByIdent($ident, $filters = array()) |
| 1257 | 1257 | { |
| 1258 | 1258 | global $globalTimezone, $globalDBdriver; |
@@ -1297,11 +1297,11 @@ discard block |
||
| 1297 | 1297 | |
| 1298 | 1298 | |
| 1299 | 1299 | /** |
| 1300 | - * Counts all trackers that have flown over |
|
| 1301 | - * |
|
| 1302 | - * @return Integer the number of trackers |
|
| 1303 | - * |
|
| 1304 | - */ |
|
| 1300 | + * Counts all trackers that have flown over |
|
| 1301 | + * |
|
| 1302 | + * @return Integer the number of trackers |
|
| 1303 | + * |
|
| 1304 | + */ |
|
| 1305 | 1305 | public function countOverallTracker($filters = array(),$year = '',$month = '') |
| 1306 | 1306 | { |
| 1307 | 1307 | global $globalDBdriver; |
@@ -1336,11 +1336,11 @@ discard block |
||
| 1336 | 1336 | } |
| 1337 | 1337 | |
| 1338 | 1338 | /** |
| 1339 | - * Counts all trackers type that have flown over |
|
| 1340 | - * |
|
| 1341 | - * @return Integer the number of flights |
|
| 1342 | - * |
|
| 1343 | - */ |
|
| 1339 | + * Counts all trackers type that have flown over |
|
| 1340 | + * |
|
| 1341 | + * @return Integer the number of flights |
|
| 1342 | + * |
|
| 1343 | + */ |
|
| 1344 | 1344 | public function countOverallTrackerTypes($filters = array(),$year = '',$month = '') |
| 1345 | 1345 | { |
| 1346 | 1346 | global $globalDBdriver; |
@@ -1375,11 +1375,11 @@ discard block |
||
| 1375 | 1375 | |
| 1376 | 1376 | |
| 1377 | 1377 | /** |
| 1378 | - * Counts all hours of today |
|
| 1379 | - * |
|
| 1380 | - * @return Array the hour list |
|
| 1381 | - * |
|
| 1382 | - */ |
|
| 1378 | + * Counts all hours of today |
|
| 1379 | + * |
|
| 1380 | + * @return Array the hour list |
|
| 1381 | + * |
|
| 1382 | + */ |
|
| 1383 | 1383 | public function countAllHoursFromToday($filters = array()) |
| 1384 | 1384 | { |
| 1385 | 1385 | global $globalTimezone, $globalDBdriver; |
@@ -1419,12 +1419,12 @@ discard block |
||
| 1419 | 1419 | } |
| 1420 | 1420 | |
| 1421 | 1421 | |
| 1422 | - /** |
|
| 1423 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1424 | - * |
|
| 1425 | - * @return Integer the Barrie Spotter ID |
|
| 1422 | + /** |
|
| 1423 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1424 | + * |
|
| 1425 | + * @return Integer the Barrie Spotter ID |
|
| 1426 | 1426 | q * |
| 1427 | - */ |
|
| 1427 | + */ |
|
| 1428 | 1428 | public function getTrackerIDBasedOnFamTrackID($famtrackid) |
| 1429 | 1429 | { |
| 1430 | 1430 | $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
@@ -1445,13 +1445,13 @@ discard block |
||
| 1445 | 1445 | |
| 1446 | 1446 | |
| 1447 | 1447 | /** |
| 1448 | - * Parses a date string |
|
| 1449 | - * |
|
| 1450 | - * @param String $dateString the date string |
|
| 1451 | - * @param String $timezone the timezone of a user |
|
| 1452 | - * @return Array the time information |
|
| 1453 | - * |
|
| 1454 | - */ |
|
| 1448 | + * Parses a date string |
|
| 1449 | + * |
|
| 1450 | + * @param String $dateString the date string |
|
| 1451 | + * @param String $timezone the timezone of a user |
|
| 1452 | + * @return Array the time information |
|
| 1453 | + * |
|
| 1454 | + */ |
|
| 1455 | 1455 | public function parseDateString($dateString, $timezone = '') |
| 1456 | 1456 | { |
| 1457 | 1457 | $time_array = array(); |
@@ -1484,12 +1484,12 @@ discard block |
||
| 1484 | 1484 | } |
| 1485 | 1485 | |
| 1486 | 1486 | /** |
| 1487 | - * Parses the direction degrees to working |
|
| 1488 | - * |
|
| 1489 | - * @param Float $direction the direction in degrees |
|
| 1490 | - * @return Array the direction information |
|
| 1491 | - * |
|
| 1492 | - */ |
|
| 1487 | + * Parses the direction degrees to working |
|
| 1488 | + * |
|
| 1489 | + * @param Float $direction the direction in degrees |
|
| 1490 | + * @return Array the direction information |
|
| 1491 | + * |
|
| 1492 | + */ |
|
| 1493 | 1493 | public function parseDirection($direction = 0) |
| 1494 | 1494 | { |
| 1495 | 1495 | if ($direction == '') $direction = 0; |
@@ -1568,12 +1568,12 @@ discard block |
||
| 1568 | 1568 | |
| 1569 | 1569 | |
| 1570 | 1570 | /** |
| 1571 | - * Gets Country from latitude/longitude |
|
| 1572 | - * |
|
| 1573 | - * @param Float $latitude latitute of the flight |
|
| 1574 | - * @param Float $longitude longitute of the flight |
|
| 1575 | - * @return String the countrie |
|
| 1576 | - */ |
|
| 1571 | + * Gets Country from latitude/longitude |
|
| 1572 | + * |
|
| 1573 | + * @param Float $latitude latitute of the flight |
|
| 1574 | + * @param Float $longitude longitute of the flight |
|
| 1575 | + * @return String the countrie |
|
| 1576 | + */ |
|
| 1577 | 1577 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 1578 | 1578 | { |
| 1579 | 1579 | global $globalDBdriver, $globalDebug; |
@@ -1610,11 +1610,11 @@ discard block |
||
| 1610 | 1610 | } |
| 1611 | 1611 | |
| 1612 | 1612 | /** |
| 1613 | - * Gets Country from iso2 |
|
| 1614 | - * |
|
| 1615 | - * @param String $iso2 ISO2 country code |
|
| 1616 | - * @return String the countrie |
|
| 1617 | - */ |
|
| 1613 | + * Gets Country from iso2 |
|
| 1614 | + * |
|
| 1615 | + * @param String $iso2 ISO2 country code |
|
| 1616 | + * @return String the countrie |
|
| 1617 | + */ |
|
| 1618 | 1618 | public function getCountryFromISO2($iso2) |
| 1619 | 1619 | { |
| 1620 | 1620 | global $globalDBdriver, $globalDebug; |
@@ -1642,11 +1642,11 @@ discard block |
||
| 1642 | 1642 | } |
| 1643 | 1643 | |
| 1644 | 1644 | /** |
| 1645 | - * Gets all vessels types that have flown over |
|
| 1646 | - * |
|
| 1647 | - * @return Array the vessel type list |
|
| 1648 | - * |
|
| 1649 | - */ |
|
| 1645 | + * Gets all vessels types that have flown over |
|
| 1646 | + * |
|
| 1647 | + * @return Array the vessel type list |
|
| 1648 | + * |
|
| 1649 | + */ |
|
| 1650 | 1650 | public function countAllTrackerTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 1651 | 1651 | { |
| 1652 | 1652 | global $globalDBdriver; |
@@ -1711,11 +1711,11 @@ discard block |
||
| 1711 | 1711 | } |
| 1712 | 1712 | |
| 1713 | 1713 | /** |
| 1714 | - * Gets all the tracker information |
|
| 1715 | - * |
|
| 1716 | - * @return Array the tracker information |
|
| 1717 | - * |
|
| 1718 | - */ |
|
| 1714 | + * Gets all the tracker information |
|
| 1715 | + * |
|
| 1716 | + * @return Array the tracker information |
|
| 1717 | + * |
|
| 1718 | + */ |
|
| 1719 | 1719 | public function searchTrackerData($q = '', $callsign = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
| 1720 | 1720 | { |
| 1721 | 1721 | global $globalTimezone, $globalDBdriver; |
@@ -1820,12 +1820,12 @@ discard block |
||
| 1820 | 1820 | } |
| 1821 | 1821 | |
| 1822 | 1822 | /** |
| 1823 | - * Gets the short url from bit.ly |
|
| 1824 | - * |
|
| 1825 | - * @param String $url the full url |
|
| 1826 | - * @return String the bit.ly url |
|
| 1827 | - * |
|
| 1828 | - */ |
|
| 1823 | + * Gets the short url from bit.ly |
|
| 1824 | + * |
|
| 1825 | + * @param String $url the full url |
|
| 1826 | + * @return String the bit.ly url |
|
| 1827 | + * |
|
| 1828 | + */ |
|
| 1829 | 1829 | public function getBitlyURL($url) |
| 1830 | 1830 | { |
| 1831 | 1831 | global $globalBitlyAccessToken; |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | public function __construct($dbc = null) { |
| 11 | 11 | $Connection = new Connection($dbc); |
| 12 | 12 | $this->db = $Connection->db(); |
| 13 | - if ($this->db === null) die('Error: No DB connection. (Tracker)'); |
|
| 13 | + if ($this->db === null) { |
|
| 14 | + die('Error: No DB connection. (Tracker)'); |
|
| 15 | + } |
|
| 14 | 16 | } |
| 15 | 17 | |
| 16 | 18 | /** |
@@ -32,7 +34,9 @@ discard block |
||
| 32 | 34 | if (isset($filter[0]['source'])) { |
| 33 | 35 | $filters = array_merge($filters,$filter); |
| 34 | 36 | } |
| 35 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 37 | + if (is_array($globalFilter)) { |
|
| 38 | + $filter = array_merge($filter,$globalFilter); |
|
| 39 | + } |
|
| 36 | 40 | $filter_query_join = ''; |
| 37 | 41 | $filter_query_where = ''; |
| 38 | 42 | foreach($filters as $flt) { |
@@ -74,8 +78,11 @@ discard block |
||
| 74 | 78 | $filter_query_where .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; |
| 75 | 79 | } |
| 76 | 80 | } |
| 77 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 78 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 81 | + if ($filter_query_where == '' && $where) { |
|
| 82 | + $filter_query_where = ' WHERE'; |
|
| 83 | + } elseif ($filter_query_where != '' && $and) { |
|
| 84 | + $filter_query_where .= ' AND'; |
|
| 85 | + } |
|
| 79 | 86 | if ($filter_query_where != '') { |
| 80 | 87 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 81 | 88 | } |
@@ -129,26 +136,43 @@ discard block |
||
| 129 | 136 | $temp_array['tracker_id'] = $row['tracker_archive_id']; |
| 130 | 137 | } elseif (isset($row['tracker_archive_output_id'])) { |
| 131 | 138 | $temp_array['tracker_id'] = $row['tracker_archive_output_id']; |
| 132 | - */} |
|
| 133 | - elseif (isset($row['trackerid'])) { |
|
| 139 | + */} elseif (isset($row['trackerid'])) { |
|
| 134 | 140 | $temp_array['trackerid'] = $row['trackerid']; |
| 135 | 141 | } else { |
| 136 | 142 | $temp_array['trackerid'] = ''; |
| 137 | 143 | } |
| 138 | - if (isset($row['famtrackid'])) $temp_array['famtrackid'] = $row['famtrackid']; |
|
| 139 | - if (isset($row['type'])) $temp_array['type'] = $row['type']; |
|
| 140 | - if (isset($row['comment'])) $temp_array['comment'] = $row['comment']; |
|
| 144 | + if (isset($row['famtrackid'])) { |
|
| 145 | + $temp_array['famtrackid'] = $row['famtrackid']; |
|
| 146 | + } |
|
| 147 | + if (isset($row['type'])) { |
|
| 148 | + $temp_array['type'] = $row['type']; |
|
| 149 | + } |
|
| 150 | + if (isset($row['comment'])) { |
|
| 151 | + $temp_array['comment'] = $row['comment']; |
|
| 152 | + } |
|
| 141 | 153 | $temp_array['ident'] = $row['ident']; |
| 142 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 143 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 144 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 145 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
| 154 | + if (isset($row['latitude'])) { |
|
| 155 | + $temp_array['latitude'] = $row['latitude']; |
|
| 156 | + } |
|
| 157 | + if (isset($row['longitude'])) { |
|
| 158 | + $temp_array['longitude'] = $row['longitude']; |
|
| 159 | + } |
|
| 160 | + if (isset($row['format_source'])) { |
|
| 161 | + $temp_array['format_source'] = $row['format_source']; |
|
| 162 | + } |
|
| 163 | + if (isset($row['altitude'])) { |
|
| 164 | + $temp_array['altitude'] = $row['altitude']; |
|
| 165 | + } |
|
| 146 | 166 | if (isset($row['heading'])) { |
| 147 | 167 | $temp_array['heading'] = $row['heading']; |
| 148 | 168 | $heading_direction = $this->parseDirection($row['heading']); |
| 149 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 169 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 170 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 171 | + } |
|
| 172 | + } |
|
| 173 | + if (isset($row['ground_speed'])) { |
|
| 174 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 150 | 175 | } |
| 151 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 152 | 176 | |
| 153 | 177 | if (isset($row['date'])) { |
| 154 | 178 | $dateArray = $this->parseDateString($row['date']); |
@@ -191,13 +215,21 @@ discard block |
||
| 191 | 215 | } |
| 192 | 216 | |
| 193 | 217 | $fromsource = NULL; |
| 194 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 195 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 196 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 218 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 219 | + $temp_array['source_name'] = $row['source_name']; |
|
| 220 | + } |
|
| 221 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 222 | + $temp_array['over_country'] = $row['over_country']; |
|
| 223 | + } |
|
| 224 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 225 | + $temp_array['distance'] = $row['distance']; |
|
| 226 | + } |
|
| 197 | 227 | $temp_array['query_number_rows'] = $num_rows; |
| 198 | 228 | $tracker_array[] = $temp_array; |
| 199 | 229 | } |
| 200 | - if ($num_rows == 0) return array(); |
|
| 230 | + if ($num_rows == 0) { |
|
| 231 | + return array(); |
|
| 232 | + } |
|
| 201 | 233 | $tracker_array[0]['query_number_rows'] = $num_rows; |
| 202 | 234 | return $tracker_array; |
| 203 | 235 | } |
@@ -228,8 +260,12 @@ discard block |
||
| 228 | 260 | { |
| 229 | 261 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 230 | 262 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 231 | - } else $limit_query = ""; |
|
| 232 | - } else $limit_query = ""; |
|
| 263 | + } else { |
|
| 264 | + $limit_query = ""; |
|
| 265 | + } |
|
| 266 | + } else { |
|
| 267 | + $limit_query = ""; |
|
| 268 | + } |
|
| 233 | 269 | |
| 234 | 270 | if ($sort != "") |
| 235 | 271 | { |
@@ -257,7 +293,9 @@ discard block |
||
| 257 | 293 | global $global_tracker_query; |
| 258 | 294 | |
| 259 | 295 | date_default_timezone_set('UTC'); |
| 260 | - if ($id == '') return array(); |
|
| 296 | + if ($id == '') { |
|
| 297 | + return array(); |
|
| 298 | + } |
|
| 261 | 299 | $additional_query = "tracker_output.famtrackid = :id"; |
| 262 | 300 | $query_values = array(':id' => $id); |
| 263 | 301 | $query = $global_tracker_query." WHERE ".$additional_query." "; |
@@ -400,8 +438,11 @@ discard block |
||
| 400 | 438 | $query .= " ORDER BY tracker_output.source_name ASC"; |
| 401 | 439 | |
| 402 | 440 | $sth = $this->db->prepare($query); |
| 403 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 404 | - else $sth->execute(); |
|
| 441 | + if (!empty($query_values)) { |
|
| 442 | + $sth->execute($query_values); |
|
| 443 | + } else { |
|
| 444 | + $sth->execute(); |
|
| 445 | + } |
|
| 405 | 446 | |
| 406 | 447 | $source_array = array(); |
| 407 | 448 | $temp_array = array(); |
@@ -456,7 +497,9 @@ discard block |
||
| 456 | 497 | date_default_timezone_set($globalTimezone); |
| 457 | 498 | $datetime = new DateTime(); |
| 458 | 499 | $offset = $datetime->format('P'); |
| 459 | - } else $offset = '+00:00'; |
|
| 500 | + } else { |
|
| 501 | + $offset = '+00:00'; |
|
| 502 | + } |
|
| 460 | 503 | |
| 461 | 504 | if ($globalDBdriver == 'mysql') { |
| 462 | 505 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
@@ -612,7 +655,9 @@ discard block |
||
| 612 | 655 | { |
| 613 | 656 | return false; |
| 614 | 657 | } |
| 615 | - } else $altitude = 0; |
|
| 658 | + } else { |
|
| 659 | + $altitude = 0; |
|
| 660 | + } |
|
| 616 | 661 | |
| 617 | 662 | if ($heading != "") |
| 618 | 663 | { |
@@ -651,8 +696,12 @@ discard block |
||
| 651 | 696 | $latitude = 0; |
| 652 | 697 | $longitude = 0; |
| 653 | 698 | } |
| 654 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 655 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 699 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 700 | + $heading = 0; |
|
| 701 | + } |
|
| 702 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 703 | + $groundspeed = 0; |
|
| 704 | + } |
|
| 656 | 705 | $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
| 657 | 706 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
| 658 | 707 | |
@@ -756,7 +805,9 @@ discard block |
||
| 756 | 805 | global $globalDBdriver, $globalArchive; |
| 757 | 806 | //$filter_query = $this->getFilter($filters,true,true); |
| 758 | 807 | $Connection= new Connection($this->db); |
| 759 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 808 | + if (!$Connection->tableExists('countries')) { |
|
| 809 | + return array(); |
|
| 810 | + } |
|
| 760 | 811 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
| 761 | 812 | require_once('class.TrackerLive.php'); |
| 762 | 813 | $TrackerLive = new TrackerLive($this->db); |
@@ -799,7 +850,9 @@ discard block |
||
| 799 | 850 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT famtrackid,over_country FROM tracker_archive".$filter_query.") l ON c.iso2 = l.over_country "; |
| 800 | 851 | } |
| 801 | 852 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
| 802 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 853 | + if ($limit) { |
|
| 854 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 855 | + } |
|
| 803 | 856 | |
| 804 | 857 | |
| 805 | 858 | $sth = $this->db->prepare($query); |
@@ -832,12 +885,18 @@ discard block |
||
| 832 | 885 | $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
| 833 | 886 | FROM tracker_output".$filter_query." tracker_output.ident <> ''"; |
| 834 | 887 | if ($olderthanmonths > 0) { |
| 835 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 836 | - else $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 888 | + if ($globalDBdriver == 'mysql') { |
|
| 889 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 890 | + } else { |
|
| 891 | + $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 892 | + } |
|
| 837 | 893 | } |
| 838 | 894 | if ($sincedate != '') { |
| 839 | - if ($globalDBdriver == 'mysql') $query .= " AND tracker_output.date > '".$sincedate."'"; |
|
| 840 | - else $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 895 | + if ($globalDBdriver == 'mysql') { |
|
| 896 | + $query .= " AND tracker_output.date > '".$sincedate."'"; |
|
| 897 | + } else { |
|
| 898 | + $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 899 | + } |
|
| 841 | 900 | } |
| 842 | 901 | $query_values = array(); |
| 843 | 902 | if ($year != '') { |
@@ -868,7 +927,9 @@ discard block |
||
| 868 | 927 | } |
| 869 | 928 | } |
| 870 | 929 | $query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC"; |
| 871 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 930 | + if ($limit) { |
|
| 931 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 932 | + } |
|
| 872 | 933 | |
| 873 | 934 | $sth = $this->db->prepare($query); |
| 874 | 935 | $sth->execute($query_values); |
@@ -903,7 +964,9 @@ discard block |
||
| 903 | 964 | date_default_timezone_set($globalTimezone); |
| 904 | 965 | $datetime = new DateTime(); |
| 905 | 966 | $offset = $datetime->format('P'); |
| 906 | - } else $offset = '+00:00'; |
|
| 967 | + } else { |
|
| 968 | + $offset = '+00:00'; |
|
| 969 | + } |
|
| 907 | 970 | |
| 908 | 971 | if ($globalDBdriver == 'mysql') { |
| 909 | 972 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -953,7 +1016,9 @@ discard block |
||
| 953 | 1016 | date_default_timezone_set($globalTimezone); |
| 954 | 1017 | $datetime = new DateTime(); |
| 955 | 1018 | $offset = $datetime->format('P'); |
| 956 | - } else $offset = '+00:00'; |
|
| 1019 | + } else { |
|
| 1020 | + $offset = '+00:00'; |
|
| 1021 | + } |
|
| 957 | 1022 | $filter_query = $this->getFilter($filters,true,true); |
| 958 | 1023 | if ($globalDBdriver == 'mysql') { |
| 959 | 1024 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -999,7 +1064,9 @@ discard block |
||
| 999 | 1064 | date_default_timezone_set($globalTimezone); |
| 1000 | 1065 | $datetime = new DateTime(); |
| 1001 | 1066 | $offset = $datetime->format('P'); |
| 1002 | - } else $offset = '+00:00'; |
|
| 1067 | + } else { |
|
| 1068 | + $offset = '+00:00'; |
|
| 1069 | + } |
|
| 1003 | 1070 | $filter_query = $this->getFilter($filters,true,true); |
| 1004 | 1071 | if ($globalDBdriver == 'mysql') { |
| 1005 | 1072 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1047,7 +1114,9 @@ discard block |
||
| 1047 | 1114 | date_default_timezone_set($globalTimezone); |
| 1048 | 1115 | $datetime = new DateTime(); |
| 1049 | 1116 | $offset = $datetime->format('P'); |
| 1050 | - } else $offset = '+00:00'; |
|
| 1117 | + } else { |
|
| 1118 | + $offset = '+00:00'; |
|
| 1119 | + } |
|
| 1051 | 1120 | |
| 1052 | 1121 | if ($globalDBdriver == 'mysql') { |
| 1053 | 1122 | $query = "SELECT YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -1096,7 +1165,9 @@ discard block |
||
| 1096 | 1165 | date_default_timezone_set($globalTimezone); |
| 1097 | 1166 | $datetime = new DateTime(); |
| 1098 | 1167 | $offset = $datetime->format('P'); |
| 1099 | - } else $offset = '+00:00'; |
|
| 1168 | + } else { |
|
| 1169 | + $offset = '+00:00'; |
|
| 1170 | + } |
|
| 1100 | 1171 | $filter_query = $this->getFilter($filters,true,true); |
| 1101 | 1172 | if ($globalDBdriver == 'mysql') { |
| 1102 | 1173 | $query = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -1145,7 +1216,9 @@ discard block |
||
| 1145 | 1216 | date_default_timezone_set($globalTimezone); |
| 1146 | 1217 | $datetime = new DateTime(); |
| 1147 | 1218 | $offset = $datetime->format('P'); |
| 1148 | - } else $offset = '+00:00'; |
|
| 1219 | + } else { |
|
| 1220 | + $offset = '+00:00'; |
|
| 1221 | + } |
|
| 1149 | 1222 | |
| 1150 | 1223 | $orderby_sql = ''; |
| 1151 | 1224 | if ($orderby == "hour") |
@@ -1214,7 +1287,9 @@ discard block |
||
| 1214 | 1287 | date_default_timezone_set($globalTimezone); |
| 1215 | 1288 | $datetime = new DateTime($date); |
| 1216 | 1289 | $offset = $datetime->format('P'); |
| 1217 | - } else $offset = '+00:00'; |
|
| 1290 | + } else { |
|
| 1291 | + $offset = '+00:00'; |
|
| 1292 | + } |
|
| 1218 | 1293 | |
| 1219 | 1294 | if ($globalDBdriver == 'mysql') { |
| 1220 | 1295 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1262,7 +1337,9 @@ discard block |
||
| 1262 | 1337 | date_default_timezone_set($globalTimezone); |
| 1263 | 1338 | $datetime = new DateTime(); |
| 1264 | 1339 | $offset = $datetime->format('P'); |
| 1265 | - } else $offset = '+00:00'; |
|
| 1340 | + } else { |
|
| 1341 | + $offset = '+00:00'; |
|
| 1342 | + } |
|
| 1266 | 1343 | |
| 1267 | 1344 | if ($globalDBdriver == 'mysql') { |
| 1268 | 1345 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1327,8 +1404,11 @@ discard block |
||
| 1327 | 1404 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 1328 | 1405 | } |
| 1329 | 1406 | } |
| 1330 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 1331 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1407 | + if (empty($query_values)) { |
|
| 1408 | + $queryi .= $this->getFilter($filters); |
|
| 1409 | + } else { |
|
| 1410 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1411 | + } |
|
| 1332 | 1412 | |
| 1333 | 1413 | $sth = $this->db->prepare($queryi); |
| 1334 | 1414 | $sth->execute($query_values); |
@@ -1365,8 +1445,11 @@ discard block |
||
| 1365 | 1445 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 1366 | 1446 | } |
| 1367 | 1447 | } |
| 1368 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 1369 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1448 | + if (empty($query_values)) { |
|
| 1449 | + $queryi .= $this->getFilter($filters); |
|
| 1450 | + } else { |
|
| 1451 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1452 | + } |
|
| 1370 | 1453 | |
| 1371 | 1454 | $sth = $this->db->prepare($queryi); |
| 1372 | 1455 | $sth->execute($query_values); |
@@ -1388,7 +1471,9 @@ discard block |
||
| 1388 | 1471 | date_default_timezone_set($globalTimezone); |
| 1389 | 1472 | $datetime = new DateTime(); |
| 1390 | 1473 | $offset = $datetime->format('P'); |
| 1391 | - } else $offset = '+00:00'; |
|
| 1474 | + } else { |
|
| 1475 | + $offset = '+00:00'; |
|
| 1476 | + } |
|
| 1392 | 1477 | |
| 1393 | 1478 | if ($globalDBdriver == 'mysql') { |
| 1394 | 1479 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1492,7 +1577,9 @@ discard block |
||
| 1492 | 1577 | */ |
| 1493 | 1578 | public function parseDirection($direction = 0) |
| 1494 | 1579 | { |
| 1495 | - if ($direction == '') $direction = 0; |
|
| 1580 | + if ($direction == '') { |
|
| 1581 | + $direction = 0; |
|
| 1582 | + } |
|
| 1496 | 1583 | $direction_array = array(); |
| 1497 | 1584 | $temp_array = array(); |
| 1498 | 1585 | |
@@ -1581,7 +1668,9 @@ discard block |
||
| 1581 | 1668 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1582 | 1669 | |
| 1583 | 1670 | $Connection = new Connection($this->db); |
| 1584 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 1671 | + if (!$Connection->tableExists('countries')) { |
|
| 1672 | + return ''; |
|
| 1673 | + } |
|
| 1585 | 1674 | |
| 1586 | 1675 | try { |
| 1587 | 1676 | /* |
@@ -1601,9 +1690,13 @@ discard block |
||
| 1601 | 1690 | $sth->closeCursor(); |
| 1602 | 1691 | if (count($row) > 0) { |
| 1603 | 1692 | return $row; |
| 1604 | - } else return ''; |
|
| 1693 | + } else { |
|
| 1694 | + return ''; |
|
| 1695 | + } |
|
| 1605 | 1696 | } catch (PDOException $e) { |
| 1606 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 1697 | + if (isset($globalDebug) && $globalDebug) { |
|
| 1698 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 1699 | + } |
|
| 1607 | 1700 | return ''; |
| 1608 | 1701 | } |
| 1609 | 1702 | |
@@ -1621,7 +1714,9 @@ discard block |
||
| 1621 | 1714 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
| 1622 | 1715 | |
| 1623 | 1716 | $Connection = new Connection($this->db); |
| 1624 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 1717 | + if (!$Connection->tableExists('countries')) { |
|
| 1718 | + return ''; |
|
| 1719 | + } |
|
| 1625 | 1720 | |
| 1626 | 1721 | try { |
| 1627 | 1722 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -1633,9 +1728,13 @@ discard block |
||
| 1633 | 1728 | $sth->closeCursor(); |
| 1634 | 1729 | if (count($row) > 0) { |
| 1635 | 1730 | return $row; |
| 1636 | - } else return ''; |
|
| 1731 | + } else { |
|
| 1732 | + return ''; |
|
| 1733 | + } |
|
| 1637 | 1734 | } catch (PDOException $e) { |
| 1638 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 1735 | + if (isset($globalDebug) && $globalDebug) { |
|
| 1736 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 1737 | + } |
|
| 1639 | 1738 | return ''; |
| 1640 | 1739 | } |
| 1641 | 1740 | |
@@ -1696,7 +1795,9 @@ discard block |
||
| 1696 | 1795 | } |
| 1697 | 1796 | } |
| 1698 | 1797 | $query .= " GROUP BY tracker_output.type ORDER BY tracker_type_count DESC"; |
| 1699 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 1798 | + if ($limit) { |
|
| 1799 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 1800 | + } |
|
| 1700 | 1801 | $sth = $this->db->prepare($query); |
| 1701 | 1802 | $sth->execute($query_values); |
| 1702 | 1803 | $tracker_array = array(); |
@@ -1733,7 +1834,9 @@ discard block |
||
| 1733 | 1834 | foreach ($q_array as $q_item){ |
| 1734 | 1835 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
| 1735 | 1836 | $additional_query .= " AND ("; |
| 1736 | - if (is_int($q_item)) $additional_query .= "(tracker_output.tracker_id = '".$q_item."') OR "; |
|
| 1837 | + if (is_int($q_item)) { |
|
| 1838 | + $additional_query .= "(tracker_output.tracker_id = '".$q_item."') OR "; |
|
| 1839 | + } |
|
| 1737 | 1840 | $additional_query .= "(tracker_output.ident like '%".$q_item."%') OR "; |
| 1738 | 1841 | $additional_query .= ")"; |
| 1739 | 1842 | } |
@@ -1759,7 +1862,9 @@ discard block |
||
| 1759 | 1862 | date_default_timezone_set($globalTimezone); |
| 1760 | 1863 | $datetime = new DateTime(); |
| 1761 | 1864 | $offset = $datetime->format('P'); |
| 1762 | - } else $offset = '+00:00'; |
|
| 1865 | + } else { |
|
| 1866 | + $offset = '+00:00'; |
|
| 1867 | + } |
|
| 1763 | 1868 | if ($date_array[1] != "") |
| 1764 | 1869 | { |
| 1765 | 1870 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
@@ -1786,8 +1891,12 @@ discard block |
||
| 1786 | 1891 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1787 | 1892 | { |
| 1788 | 1893 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 1789 | - } else $limit_query = ""; |
|
| 1790 | - } else $limit_query = ""; |
|
| 1894 | + } else { |
|
| 1895 | + $limit_query = ""; |
|
| 1896 | + } |
|
| 1897 | + } else { |
|
| 1898 | + $limit_query = ""; |
|
| 1899 | + } |
|
| 1791 | 1900 | if ($sort != "") |
| 1792 | 1901 | { |
| 1793 | 1902 | $search_orderby_array = $this->getOrderBy(); |
@@ -1830,7 +1939,9 @@ discard block |
||
| 1830 | 1939 | { |
| 1831 | 1940 | global $globalBitlyAccessToken; |
| 1832 | 1941 | |
| 1833 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 1942 | + if ($globalBitlyAccessToken == '') { |
|
| 1943 | + return $url; |
|
| 1944 | + } |
|
| 1834 | 1945 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 1835 | 1946 | $ch = curl_init(); |
| 1836 | 1947 | curl_setopt($ch, CURLOPT_HEADER, 0); |
@@ -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'); |
@@ -230,11 +230,11 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | - * Gets all the spotter information based on the latest data entry |
|
| 234 | - * |
|
| 235 | - * @return Array the spotter information |
|
| 236 | - * |
|
| 237 | - */ |
|
| 233 | + * Gets all the spotter information based on the latest data entry |
|
| 234 | + * |
|
| 235 | + * @return Array the spotter information |
|
| 236 | + * |
|
| 237 | + */ |
|
| 238 | 238 | public function getLatestMarineData($limit = '', $sort = '', $filter = array()) |
| 239 | 239 | { |
| 240 | 240 | global $global_marine_query; |
@@ -283,11 +283,11 @@ discard block |
||
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | /** |
| 286 | - * Gets all the spotter information based on the callsign |
|
| 287 | - * |
|
| 288 | - * @return Array the spotter information |
|
| 289 | - * |
|
| 290 | - */ |
|
| 286 | + * Gets all the spotter information based on the callsign |
|
| 287 | + * |
|
| 288 | + * @return Array the spotter information |
|
| 289 | + * |
|
| 290 | + */ |
|
| 291 | 291 | public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
| 292 | 292 | { |
| 293 | 293 | global $global_marine_query; |
@@ -339,11 +339,11 @@ discard block |
||
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | /** |
| 342 | - * Gets all the marine information based on the type |
|
| 343 | - * |
|
| 344 | - * @return Array the marine information |
|
| 345 | - * |
|
| 346 | - */ |
|
| 342 | + * Gets all the marine information based on the type |
|
| 343 | + * |
|
| 344 | + * @return Array the marine information |
|
| 345 | + * |
|
| 346 | + */ |
|
| 347 | 347 | public function getMarineDataByType($type = '', $limit = '', $sort = '', $filter = array()) |
| 348 | 348 | { |
| 349 | 349 | global $global_marine_query; |
@@ -449,11 +449,11 @@ discard block |
||
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | /** |
| 452 | - * Gets all the marine information based on the captain |
|
| 453 | - * |
|
| 454 | - * @return Array the marine information |
|
| 455 | - * |
|
| 456 | - */ |
|
| 452 | + * Gets all the marine information based on the captain |
|
| 453 | + * |
|
| 454 | + * @return Array the marine information |
|
| 455 | + * |
|
| 456 | + */ |
|
| 457 | 457 | public function getMarineDataByCaptain($captain = '', $limit = '', $sort = '', $filter = array()) |
| 458 | 458 | { |
| 459 | 459 | global $global_marine_query; |
@@ -491,12 +491,12 @@ discard block |
||
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | /** |
| 494 | - * Gets all source name |
|
| 495 | - * |
|
| 496 | - * @param String type format of source |
|
| 497 | - * @return Array list of source name |
|
| 498 | - * |
|
| 499 | - */ |
|
| 494 | + * Gets all source name |
|
| 495 | + * |
|
| 496 | + * @param String type format of source |
|
| 497 | + * @return Array list of source name |
|
| 498 | + * |
|
| 499 | + */ |
|
| 500 | 500 | public function getAllSourceName($type = '',$filters = array()) |
| 501 | 501 | { |
| 502 | 502 | $filter_query = $this->getFilter($filters,true,true); |
@@ -526,11 +526,11 @@ discard block |
||
| 526 | 526 | |
| 527 | 527 | |
| 528 | 528 | /** |
| 529 | - * Gets a list of all idents/callsigns |
|
| 530 | - * |
|
| 531 | - * @return Array list of ident/callsign names |
|
| 532 | - * |
|
| 533 | - */ |
|
| 529 | + * Gets a list of all idents/callsigns |
|
| 530 | + * |
|
| 531 | + * @return Array list of ident/callsign names |
|
| 532 | + * |
|
| 533 | + */ |
|
| 534 | 534 | public function getAllIdents($filters = array()) |
| 535 | 535 | { |
| 536 | 536 | $filter_query = $this->getFilter($filters,true,true); |
@@ -554,11 +554,11 @@ discard block |
||
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | /** |
| 557 | - * Gets all info from a mmsi |
|
| 558 | - * |
|
| 559 | - * @return Array ident |
|
| 560 | - * |
|
| 561 | - */ |
|
| 557 | + * Gets all info from a mmsi |
|
| 558 | + * |
|
| 559 | + * @return Array ident |
|
| 560 | + * |
|
| 561 | + */ |
|
| 562 | 562 | public function getIdentity($mmsi) |
| 563 | 563 | { |
| 564 | 564 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -571,9 +571,9 @@ discard block |
||
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | /** |
| 574 | - * Add identity |
|
| 575 | - * |
|
| 576 | - */ |
|
| 574 | + * Add identity |
|
| 575 | + * |
|
| 576 | + */ |
|
| 577 | 577 | public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
| 578 | 578 | { |
| 579 | 579 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -639,13 +639,13 @@ discard block |
||
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | /** |
| 642 | - * Update ident tracker data |
|
| 643 | - * |
|
| 644 | - * @param String $fammarine_id the ID |
|
| 645 | - * @param String $ident the marine ident |
|
| 646 | - * @return String success or false |
|
| 647 | - * |
|
| 648 | - */ |
|
| 642 | + * Update ident tracker data |
|
| 643 | + * |
|
| 644 | + * @param String $fammarine_id the ID |
|
| 645 | + * @param String $ident the marine ident |
|
| 646 | + * @return String success or false |
|
| 647 | + * |
|
| 648 | + */ |
|
| 649 | 649 | public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
| 650 | 650 | { |
| 651 | 651 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
@@ -660,13 +660,13 @@ discard block |
||
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | /** |
| 663 | - * Update arrival marine data |
|
| 664 | - * |
|
| 665 | - * @param String $fammarine_id the ID |
|
| 666 | - * @param String $arrival_code the marine ident |
|
| 667 | - * @return String success or false |
|
| 668 | - * |
|
| 669 | - */ |
|
| 663 | + * Update arrival marine data |
|
| 664 | + * |
|
| 665 | + * @param String $fammarine_id the ID |
|
| 666 | + * @param String $arrival_code the marine ident |
|
| 667 | + * @return String success or false |
|
| 668 | + * |
|
| 669 | + */ |
|
| 670 | 670 | public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL) |
| 671 | 671 | { |
| 672 | 672 | $query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id'; |
@@ -681,19 +681,19 @@ discard block |
||
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | /** |
| 684 | - * Update Status data |
|
| 685 | - * |
|
| 686 | - * @param String $fammarine_id the ID |
|
| 687 | - * @param String $status_id the marine status id |
|
| 688 | - * @param String $status the marine status |
|
| 689 | - * @return String success or false |
|
| 690 | - * |
|
| 691 | - */ |
|
| 684 | + * Update Status data |
|
| 685 | + * |
|
| 686 | + * @param String $fammarine_id the ID |
|
| 687 | + * @param String $status_id the marine status id |
|
| 688 | + * @param String $status the marine status |
|
| 689 | + * @return String success or false |
|
| 690 | + * |
|
| 691 | + */ |
|
| 692 | 692 | public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
| 693 | 693 | { |
| 694 | 694 | |
| 695 | 695 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
| 696 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
| 696 | + $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
| 697 | 697 | |
| 698 | 698 | try { |
| 699 | 699 | $sth = $this->db->prepare($query); |
@@ -706,17 +706,17 @@ discard block |
||
| 706 | 706 | |
| 707 | 707 | } |
| 708 | 708 | /** |
| 709 | - * Update latest marine data |
|
| 710 | - * |
|
| 711 | - * @param String $fammarine_id the ID |
|
| 712 | - * @param String $ident the marine ident |
|
| 713 | - * @return String success or false |
|
| 714 | - * |
|
| 715 | - */ |
|
| 709 | + * Update latest marine data |
|
| 710 | + * |
|
| 711 | + * @param String $fammarine_id the ID |
|
| 712 | + * @param String $ident the marine ident |
|
| 713 | + * @return String success or false |
|
| 714 | + * |
|
| 715 | + */ |
|
| 716 | 716 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
| 717 | 717 | { |
| 718 | 718 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id'; |
| 719 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 719 | + $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 720 | 720 | |
| 721 | 721 | try { |
| 722 | 722 | $sth = $this->db->prepare($query); |
@@ -730,30 +730,30 @@ discard block |
||
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | /** |
| 733 | - * Adds a new spotter data |
|
| 734 | - * |
|
| 735 | - * @param String $fammarine_id the ID |
|
| 736 | - * @param String $ident the marine ident |
|
| 737 | - * @param String $departure_airport_icao the departure airport |
|
| 738 | - * @param String $arrival_airport_icao the arrival airport |
|
| 739 | - * @param String $latitude latitude of flight |
|
| 740 | - * @param String $longitude latitude of flight |
|
| 741 | - * @param String $waypoints waypoints of flight |
|
| 742 | - * @param String $heading heading of flight |
|
| 743 | - * @param String $groundspeed speed of flight |
|
| 744 | - * @param String $date date of flight |
|
| 745 | - * @param String $departure_airport_time departure time of flight |
|
| 746 | - * @param String $arrival_airport_time arrival time of flight |
|
| 747 | - * @param String $squawk squawk code of flight |
|
| 748 | - * @param String $route_stop route stop of flight |
|
| 749 | - * @param String $highlight highlight or not |
|
| 750 | - * @param String $ModeS ModesS code of flight |
|
| 751 | - * @param String $registration registration code of flight |
|
| 752 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 753 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 754 | - * @param String $verticalrate vertival rate of flight |
|
| 755 | - * @return String success or false |
|
| 756 | - */ |
|
| 733 | + * Adds a new spotter data |
|
| 734 | + * |
|
| 735 | + * @param String $fammarine_id the ID |
|
| 736 | + * @param String $ident the marine ident |
|
| 737 | + * @param String $departure_airport_icao the departure airport |
|
| 738 | + * @param String $arrival_airport_icao the arrival airport |
|
| 739 | + * @param String $latitude latitude of flight |
|
| 740 | + * @param String $longitude latitude of flight |
|
| 741 | + * @param String $waypoints waypoints of flight |
|
| 742 | + * @param String $heading heading of flight |
|
| 743 | + * @param String $groundspeed speed of flight |
|
| 744 | + * @param String $date date of flight |
|
| 745 | + * @param String $departure_airport_time departure time of flight |
|
| 746 | + * @param String $arrival_airport_time arrival time of flight |
|
| 747 | + * @param String $squawk squawk code of flight |
|
| 748 | + * @param String $route_stop route stop of flight |
|
| 749 | + * @param String $highlight highlight or not |
|
| 750 | + * @param String $ModeS ModesS code of flight |
|
| 751 | + * @param String $registration registration code of flight |
|
| 752 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 753 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 754 | + * @param String $verticalrate vertival rate of flight |
|
| 755 | + * @return String success or false |
|
| 756 | + */ |
|
| 757 | 757 | 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 = '') |
| 758 | 758 | { |
| 759 | 759 | global $globalURL, $globalMarineImageFetch; |
@@ -881,11 +881,11 @@ discard block |
||
| 881 | 881 | |
| 882 | 882 | |
| 883 | 883 | /** |
| 884 | - * Gets the aircraft ident within the last hour |
|
| 885 | - * |
|
| 886 | - * @return String the ident |
|
| 887 | - * |
|
| 888 | - */ |
|
| 884 | + * Gets the aircraft ident within the last hour |
|
| 885 | + * |
|
| 886 | + * @return String the ident |
|
| 887 | + * |
|
| 888 | + */ |
|
| 889 | 889 | public function getIdentFromLastHour($ident) |
| 890 | 890 | { |
| 891 | 891 | global $globalDBdriver, $globalTimezone; |
@@ -901,11 +901,11 @@ discard block |
||
| 901 | 901 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 902 | 902 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
| 903 | 903 | $query_data = array(':ident' => $ident); |
| 904 | - } |
|
| 904 | + } |
|
| 905 | 905 | |
| 906 | 906 | $sth = $this->db->prepare($query); |
| 907 | 907 | $sth->execute($query_data); |
| 908 | - $ident_result=''; |
|
| 908 | + $ident_result=''; |
|
| 909 | 909 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 910 | 910 | { |
| 911 | 911 | $ident_result = $row['ident']; |
@@ -916,11 +916,11 @@ discard block |
||
| 916 | 916 | |
| 917 | 917 | |
| 918 | 918 | /** |
| 919 | - * Gets the aircraft data from the last 20 seconds |
|
| 920 | - * |
|
| 921 | - * @return Array the spotter data |
|
| 922 | - * |
|
| 923 | - */ |
|
| 919 | + * Gets the aircraft data from the last 20 seconds |
|
| 920 | + * |
|
| 921 | + * @return Array the spotter data |
|
| 922 | + * |
|
| 923 | + */ |
|
| 924 | 924 | public function getRealTimeData($q = '') |
| 925 | 925 | { |
| 926 | 926 | global $globalDBdriver; |
@@ -958,11 +958,11 @@ discard block |
||
| 958 | 958 | |
| 959 | 959 | |
| 960 | 960 | /** |
| 961 | - * Gets all number of flight over countries |
|
| 962 | - * |
|
| 963 | - * @return Array the airline country list |
|
| 964 | - * |
|
| 965 | - */ |
|
| 961 | + * Gets all number of flight over countries |
|
| 962 | + * |
|
| 963 | + * @return Array the airline country list |
|
| 964 | + * |
|
| 965 | + */ |
|
| 966 | 966 | |
| 967 | 967 | public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 968 | 968 | { |
@@ -1035,11 +1035,11 @@ discard block |
||
| 1035 | 1035 | |
| 1036 | 1036 | |
| 1037 | 1037 | /** |
| 1038 | - * Gets all callsigns that have flown over |
|
| 1039 | - * |
|
| 1040 | - * @return Array the callsign list |
|
| 1041 | - * |
|
| 1042 | - */ |
|
| 1038 | + * Gets all callsigns that have flown over |
|
| 1039 | + * |
|
| 1040 | + * @return Array the callsign list |
|
| 1041 | + * |
|
| 1042 | + */ |
|
| 1043 | 1043 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 1044 | 1044 | { |
| 1045 | 1045 | global $globalDBdriver; |
@@ -1106,11 +1106,11 @@ discard block |
||
| 1106 | 1106 | |
| 1107 | 1107 | |
| 1108 | 1108 | /** |
| 1109 | - * Counts all dates |
|
| 1110 | - * |
|
| 1111 | - * @return Array the date list |
|
| 1112 | - * |
|
| 1113 | - */ |
|
| 1109 | + * Counts all dates |
|
| 1110 | + * |
|
| 1111 | + * @return Array the date list |
|
| 1112 | + * |
|
| 1113 | + */ |
|
| 1114 | 1114 | public function countAllDates($filters = array()) |
| 1115 | 1115 | { |
| 1116 | 1116 | global $globalTimezone, $globalDBdriver; |
@@ -1156,11 +1156,11 @@ discard block |
||
| 1156 | 1156 | |
| 1157 | 1157 | |
| 1158 | 1158 | /** |
| 1159 | - * Counts all dates during the last 7 days |
|
| 1160 | - * |
|
| 1161 | - * @return Array the date list |
|
| 1162 | - * |
|
| 1163 | - */ |
|
| 1159 | + * Counts all dates during the last 7 days |
|
| 1160 | + * |
|
| 1161 | + * @return Array the date list |
|
| 1162 | + * |
|
| 1163 | + */ |
|
| 1164 | 1164 | public function countAllDatesLast7Days($filters = array()) |
| 1165 | 1165 | { |
| 1166 | 1166 | global $globalTimezone, $globalDBdriver; |
@@ -1182,7 +1182,7 @@ discard block |
||
| 1182 | 1182 | $query .= " GROUP BY date_name |
| 1183 | 1183 | ORDER BY date_name ASC"; |
| 1184 | 1184 | $query_data = array(':offset' => $offset); |
| 1185 | - } |
|
| 1185 | + } |
|
| 1186 | 1186 | |
| 1187 | 1187 | $sth = $this->db->prepare($query); |
| 1188 | 1188 | $sth->execute($query_data); |
@@ -1202,11 +1202,11 @@ discard block |
||
| 1202 | 1202 | } |
| 1203 | 1203 | |
| 1204 | 1204 | /** |
| 1205 | - * Counts all dates during the last month |
|
| 1206 | - * |
|
| 1207 | - * @return Array the date list |
|
| 1208 | - * |
|
| 1209 | - */ |
|
| 1205 | + * Counts all dates during the last month |
|
| 1206 | + * |
|
| 1207 | + * @return Array the date list |
|
| 1208 | + * |
|
| 1209 | + */ |
|
| 1210 | 1210 | public function countAllDatesLastMonth($filters = array()) |
| 1211 | 1211 | { |
| 1212 | 1212 | global $globalTimezone, $globalDBdriver; |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | $query .= " GROUP BY date_name |
| 1229 | 1229 | ORDER BY date_name ASC"; |
| 1230 | 1230 | $query_data = array(':offset' => $offset); |
| 1231 | - } |
|
| 1231 | + } |
|
| 1232 | 1232 | |
| 1233 | 1233 | $sth = $this->db->prepare($query); |
| 1234 | 1234 | $sth->execute($query_data); |
@@ -1250,11 +1250,11 @@ discard block |
||
| 1250 | 1250 | |
| 1251 | 1251 | |
| 1252 | 1252 | /** |
| 1253 | - * Counts all month |
|
| 1254 | - * |
|
| 1255 | - * @return Array the month list |
|
| 1256 | - * |
|
| 1257 | - */ |
|
| 1253 | + * Counts all month |
|
| 1254 | + * |
|
| 1255 | + * @return Array the month list |
|
| 1256 | + * |
|
| 1257 | + */ |
|
| 1258 | 1258 | public function countAllMonths($filters = array()) |
| 1259 | 1259 | { |
| 1260 | 1260 | global $globalTimezone, $globalDBdriver; |
@@ -1299,11 +1299,11 @@ discard block |
||
| 1299 | 1299 | |
| 1300 | 1300 | |
| 1301 | 1301 | /** |
| 1302 | - * Counts all dates during the last year |
|
| 1303 | - * |
|
| 1304 | - * @return Array the date list |
|
| 1305 | - * |
|
| 1306 | - */ |
|
| 1302 | + * Counts all dates during the last year |
|
| 1303 | + * |
|
| 1304 | + * @return Array the date list |
|
| 1305 | + * |
|
| 1306 | + */ |
|
| 1307 | 1307 | public function countAllMonthsLastYear($filters) |
| 1308 | 1308 | { |
| 1309 | 1309 | global $globalTimezone, $globalDBdriver; |
@@ -1325,7 +1325,7 @@ discard block |
||
| 1325 | 1325 | $query .= " GROUP BY year_name, month_name |
| 1326 | 1326 | ORDER BY year_name, month_name ASC"; |
| 1327 | 1327 | $query_data = array(':offset' => $offset); |
| 1328 | - } |
|
| 1328 | + } |
|
| 1329 | 1329 | |
| 1330 | 1330 | $sth = $this->db->prepare($query); |
| 1331 | 1331 | $sth->execute($query_data); |
@@ -1348,11 +1348,11 @@ discard block |
||
| 1348 | 1348 | |
| 1349 | 1349 | |
| 1350 | 1350 | /** |
| 1351 | - * Counts all hours |
|
| 1352 | - * |
|
| 1353 | - * @return Array the hour list |
|
| 1354 | - * |
|
| 1355 | - */ |
|
| 1351 | + * Counts all hours |
|
| 1352 | + * |
|
| 1353 | + * @return Array the hour list |
|
| 1354 | + * |
|
| 1355 | + */ |
|
| 1356 | 1356 | public function countAllHours($orderby,$filters = array()) |
| 1357 | 1357 | { |
| 1358 | 1358 | global $globalTimezone, $globalDBdriver; |
@@ -1415,11 +1415,11 @@ discard block |
||
| 1415 | 1415 | |
| 1416 | 1416 | |
| 1417 | 1417 | /** |
| 1418 | - * Counts all hours by date |
|
| 1419 | - * |
|
| 1420 | - * @return Array the hour list |
|
| 1421 | - * |
|
| 1422 | - */ |
|
| 1418 | + * Counts all hours by date |
|
| 1419 | + * |
|
| 1420 | + * @return Array the hour list |
|
| 1421 | + * |
|
| 1422 | + */ |
|
| 1423 | 1423 | public function countAllHoursByDate($date, $filters = array()) |
| 1424 | 1424 | { |
| 1425 | 1425 | global $globalTimezone, $globalDBdriver; |
@@ -1463,11 +1463,11 @@ discard block |
||
| 1463 | 1463 | |
| 1464 | 1464 | |
| 1465 | 1465 | /** |
| 1466 | - * Counts all hours by a ident/callsign |
|
| 1467 | - * |
|
| 1468 | - * @return Array the hour list |
|
| 1469 | - * |
|
| 1470 | - */ |
|
| 1466 | + * Counts all hours by a ident/callsign |
|
| 1467 | + * |
|
| 1468 | + * @return Array the hour list |
|
| 1469 | + * |
|
| 1470 | + */ |
|
| 1471 | 1471 | public function countAllHoursByIdent($ident, $filters = array()) |
| 1472 | 1472 | { |
| 1473 | 1473 | global $globalTimezone, $globalDBdriver; |
@@ -1512,11 +1512,11 @@ discard block |
||
| 1512 | 1512 | |
| 1513 | 1513 | |
| 1514 | 1514 | /** |
| 1515 | - * Counts all vessels |
|
| 1516 | - * |
|
| 1517 | - * @return Integer the number of vessels |
|
| 1518 | - * |
|
| 1519 | - */ |
|
| 1515 | + * Counts all vessels |
|
| 1516 | + * |
|
| 1517 | + * @return Integer the number of vessels |
|
| 1518 | + * |
|
| 1519 | + */ |
|
| 1520 | 1520 | public function countOverallMarine($filters = array(),$year = '',$month = '') |
| 1521 | 1521 | { |
| 1522 | 1522 | global $globalDBdriver; |
@@ -1551,11 +1551,11 @@ discard block |
||
| 1551 | 1551 | } |
| 1552 | 1552 | |
| 1553 | 1553 | /** |
| 1554 | - * Counts all vessel type |
|
| 1555 | - * |
|
| 1556 | - * @return Integer the number of vessels |
|
| 1557 | - * |
|
| 1558 | - */ |
|
| 1554 | + * Counts all vessel type |
|
| 1555 | + * |
|
| 1556 | + * @return Integer the number of vessels |
|
| 1557 | + * |
|
| 1558 | + */ |
|
| 1559 | 1559 | public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
| 1560 | 1560 | { |
| 1561 | 1561 | global $globalDBdriver; |
@@ -1590,11 +1590,11 @@ discard block |
||
| 1590 | 1590 | |
| 1591 | 1591 | |
| 1592 | 1592 | /** |
| 1593 | - * Counts all hours of today |
|
| 1594 | - * |
|
| 1595 | - * @return Array the hour list |
|
| 1596 | - * |
|
| 1597 | - */ |
|
| 1593 | + * Counts all hours of today |
|
| 1594 | + * |
|
| 1595 | + * @return Array the hour list |
|
| 1596 | + * |
|
| 1597 | + */ |
|
| 1598 | 1598 | public function countAllHoursFromToday($filters = array()) |
| 1599 | 1599 | { |
| 1600 | 1600 | global $globalTimezone, $globalDBdriver; |
@@ -1634,12 +1634,12 @@ discard block |
||
| 1634 | 1634 | } |
| 1635 | 1635 | |
| 1636 | 1636 | |
| 1637 | - /** |
|
| 1638 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1639 | - * |
|
| 1640 | - * @return Integer the Barrie Spotter ID |
|
| 1637 | + /** |
|
| 1638 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1639 | + * |
|
| 1640 | + * @return Integer the Barrie Spotter ID |
|
| 1641 | 1641 | q * |
| 1642 | - */ |
|
| 1642 | + */ |
|
| 1643 | 1643 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
| 1644 | 1644 | { |
| 1645 | 1645 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -1660,13 +1660,13 @@ discard block |
||
| 1660 | 1660 | |
| 1661 | 1661 | |
| 1662 | 1662 | /** |
| 1663 | - * Parses a date string |
|
| 1664 | - * |
|
| 1665 | - * @param String $dateString the date string |
|
| 1666 | - * @param String $timezone the timezone of a user |
|
| 1667 | - * @return Array the time information |
|
| 1668 | - * |
|
| 1669 | - */ |
|
| 1663 | + * Parses a date string |
|
| 1664 | + * |
|
| 1665 | + * @param String $dateString the date string |
|
| 1666 | + * @param String $timezone the timezone of a user |
|
| 1667 | + * @return Array the time information |
|
| 1668 | + * |
|
| 1669 | + */ |
|
| 1670 | 1670 | public function parseDateString($dateString, $timezone = '') |
| 1671 | 1671 | { |
| 1672 | 1672 | $time_array = array(); |
@@ -1699,12 +1699,12 @@ discard block |
||
| 1699 | 1699 | } |
| 1700 | 1700 | |
| 1701 | 1701 | /** |
| 1702 | - * Parses the direction degrees to working |
|
| 1703 | - * |
|
| 1704 | - * @param Float $direction the direction in degrees |
|
| 1705 | - * @return Array the direction information |
|
| 1706 | - * |
|
| 1707 | - */ |
|
| 1702 | + * Parses the direction degrees to working |
|
| 1703 | + * |
|
| 1704 | + * @param Float $direction the direction in degrees |
|
| 1705 | + * @return Array the direction information |
|
| 1706 | + * |
|
| 1707 | + */ |
|
| 1708 | 1708 | public function parseDirection($direction = 0) |
| 1709 | 1709 | { |
| 1710 | 1710 | if ($direction == '') $direction = 0; |
@@ -1783,12 +1783,12 @@ discard block |
||
| 1783 | 1783 | |
| 1784 | 1784 | |
| 1785 | 1785 | /** |
| 1786 | - * Gets Country from latitude/longitude |
|
| 1787 | - * |
|
| 1788 | - * @param Float $latitude latitute of the flight |
|
| 1789 | - * @param Float $longitude longitute of the flight |
|
| 1790 | - * @return String the countrie |
|
| 1791 | - */ |
|
| 1786 | + * Gets Country from latitude/longitude |
|
| 1787 | + * |
|
| 1788 | + * @param Float $latitude latitute of the flight |
|
| 1789 | + * @param Float $longitude longitute of the flight |
|
| 1790 | + * @return String the countrie |
|
| 1791 | + */ |
|
| 1792 | 1792 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 1793 | 1793 | { |
| 1794 | 1794 | global $globalDBdriver, $globalDebug; |
@@ -1825,11 +1825,11 @@ discard block |
||
| 1825 | 1825 | } |
| 1826 | 1826 | |
| 1827 | 1827 | /** |
| 1828 | - * Gets Country from iso2 |
|
| 1829 | - * |
|
| 1830 | - * @param String $iso2 ISO2 country code |
|
| 1831 | - * @return String the countrie |
|
| 1832 | - */ |
|
| 1828 | + * Gets Country from iso2 |
|
| 1829 | + * |
|
| 1830 | + * @param String $iso2 ISO2 country code |
|
| 1831 | + * @return String the countrie |
|
| 1832 | + */ |
|
| 1833 | 1833 | public function getCountryFromISO2($iso2) |
| 1834 | 1834 | { |
| 1835 | 1835 | global $globalDBdriver, $globalDebug; |
@@ -1858,12 +1858,12 @@ discard block |
||
| 1858 | 1858 | |
| 1859 | 1859 | |
| 1860 | 1860 | /** |
| 1861 | - * Gets the short url from bit.ly |
|
| 1862 | - * |
|
| 1863 | - * @param String $url the full url |
|
| 1864 | - * @return String the bit.ly url |
|
| 1865 | - * |
|
| 1866 | - */ |
|
| 1861 | + * Gets the short url from bit.ly |
|
| 1862 | + * |
|
| 1863 | + * @param String $url the full url |
|
| 1864 | + * @return String the bit.ly url |
|
| 1865 | + * |
|
| 1866 | + */ |
|
| 1867 | 1867 | public function getBitlyURL($url) |
| 1868 | 1868 | { |
| 1869 | 1869 | global $globalBitlyAccessToken; |
@@ -1890,11 +1890,11 @@ discard block |
||
| 1890 | 1890 | |
| 1891 | 1891 | |
| 1892 | 1892 | /** |
| 1893 | - * Gets all vessels types that have flown over |
|
| 1894 | - * |
|
| 1895 | - * @return Array the vessel type list |
|
| 1896 | - * |
|
| 1897 | - */ |
|
| 1893 | + * Gets all vessels types that have flown over |
|
| 1894 | + * |
|
| 1895 | + * @return Array the vessel type list |
|
| 1896 | + * |
|
| 1897 | + */ |
|
| 1898 | 1898 | public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 1899 | 1899 | { |
| 1900 | 1900 | global $globalDBdriver; |
@@ -1960,11 +1960,11 @@ discard block |
||
| 1960 | 1960 | } |
| 1961 | 1961 | |
| 1962 | 1962 | /** |
| 1963 | - * Gets all the tracker information |
|
| 1964 | - * |
|
| 1965 | - * @return Array the tracker information |
|
| 1966 | - * |
|
| 1967 | - */ |
|
| 1963 | + * Gets all the tracker information |
|
| 1964 | + * |
|
| 1965 | + * @return Array the tracker information |
|
| 1966 | + * |
|
| 1967 | + */ |
|
| 1968 | 1968 | public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
| 1969 | 1969 | { |
| 1970 | 1970 | global $globalTimezone, $globalDBdriver; |
@@ -8,7 +8,9 @@ discard block |
||
| 8 | 8 | public function __construct($dbc = null) { |
| 9 | 9 | $Connection = new Connection($dbc); |
| 10 | 10 | $this->db = $Connection->db(); |
| 11 | - if ($this->db === null) die('Error: No DB connection. (Marine)'); |
|
| 11 | + if ($this->db === null) { |
|
| 12 | + die('Error: No DB connection. (Marine)'); |
|
| 13 | + } |
|
| 12 | 14 | } |
| 13 | 15 | |
| 14 | 16 | /** |
@@ -30,7 +32,9 @@ discard block |
||
| 30 | 32 | if (isset($filter[0]['source'])) { |
| 31 | 33 | $filters = array_merge($filters,$filter); |
| 32 | 34 | } |
| 33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 35 | + if (is_array($globalFilter)) { |
|
| 36 | + $filter = array_merge($filter,$globalFilter); |
|
| 37 | + } |
|
| 34 | 38 | $filter_query_join = ''; |
| 35 | 39 | $filter_query_where = ''; |
| 36 | 40 | foreach($filters as $flt) { |
@@ -78,8 +82,11 @@ discard block |
||
| 78 | 82 | $filter_query_where .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'"; |
| 79 | 83 | } |
| 80 | 84 | } |
| 81 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 82 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 85 | + if ($filter_query_where == '' && $where) { |
|
| 86 | + $filter_query_where = ' WHERE'; |
|
| 87 | + } elseif ($filter_query_where != '' && $and) { |
|
| 88 | + $filter_query_where .= ' AND'; |
|
| 89 | + } |
|
| 83 | 90 | if ($filter_query_where != '') { |
| 84 | 91 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 85 | 92 | } |
@@ -133,39 +140,75 @@ discard block |
||
| 133 | 140 | $temp_array['spotter_id'] = $row['spotter_archive_id']; |
| 134 | 141 | } elseif (isset($row['spotter_archive_output_id'])) { |
| 135 | 142 | $temp_array['spotter_id'] = $row['spotter_archive_output_id']; |
| 136 | - */} |
|
| 137 | - elseif (isset($row['marineid'])) { |
|
| 143 | + */} elseif (isset($row['marineid'])) { |
|
| 138 | 144 | $temp_array['marine_id'] = $row['marineid']; |
| 139 | 145 | } else { |
| 140 | 146 | $temp_array['marine_id'] = ''; |
| 141 | 147 | } |
| 142 | - if (isset($row['fammarine_id'])) $temp_array['fammarine_id'] = $row['fammarine_id']; |
|
| 143 | - if (isset($row['mmsi'])) $temp_array['mmsi'] = $row['mmsi']; |
|
| 144 | - if (isset($row['type'])) $temp_array['type'] = $row['type']; |
|
| 145 | - if (isset($row['type_id'])) $temp_array['type_id'] = $row['type_id']; |
|
| 146 | - if (isset($row['status'])) $temp_array['status'] = $row['status']; |
|
| 147 | - if (isset($row['status_id'])) $temp_array['status_id'] = $row['status_id']; |
|
| 148 | - if (isset($row['captain_id'])) $temp_array['captain_id'] = $row['captain_id']; |
|
| 149 | - if (isset($row['captain_name'])) $temp_array['captain_name'] = $row['captain_name']; |
|
| 150 | - if (isset($row['race_id'])) $temp_array['race_id'] = $row['race_id']; |
|
| 151 | - if (isset($row['race_name'])) $temp_array['race_name'] = $row['race_name']; |
|
| 152 | - if (isset($row['ident'])) $temp_array['ident'] = $row['ident']; |
|
| 153 | - if (isset($row['arrival_port_name'])) $temp_array['arrival_port_name'] = $row['arrival_port_name']; |
|
| 154 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 155 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 156 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 148 | + if (isset($row['fammarine_id'])) { |
|
| 149 | + $temp_array['fammarine_id'] = $row['fammarine_id']; |
|
| 150 | + } |
|
| 151 | + if (isset($row['mmsi'])) { |
|
| 152 | + $temp_array['mmsi'] = $row['mmsi']; |
|
| 153 | + } |
|
| 154 | + if (isset($row['type'])) { |
|
| 155 | + $temp_array['type'] = $row['type']; |
|
| 156 | + } |
|
| 157 | + if (isset($row['type_id'])) { |
|
| 158 | + $temp_array['type_id'] = $row['type_id']; |
|
| 159 | + } |
|
| 160 | + if (isset($row['status'])) { |
|
| 161 | + $temp_array['status'] = $row['status']; |
|
| 162 | + } |
|
| 163 | + if (isset($row['status_id'])) { |
|
| 164 | + $temp_array['status_id'] = $row['status_id']; |
|
| 165 | + } |
|
| 166 | + if (isset($row['captain_id'])) { |
|
| 167 | + $temp_array['captain_id'] = $row['captain_id']; |
|
| 168 | + } |
|
| 169 | + if (isset($row['captain_name'])) { |
|
| 170 | + $temp_array['captain_name'] = $row['captain_name']; |
|
| 171 | + } |
|
| 172 | + if (isset($row['race_id'])) { |
|
| 173 | + $temp_array['race_id'] = $row['race_id']; |
|
| 174 | + } |
|
| 175 | + if (isset($row['race_name'])) { |
|
| 176 | + $temp_array['race_name'] = $row['race_name']; |
|
| 177 | + } |
|
| 178 | + if (isset($row['ident'])) { |
|
| 179 | + $temp_array['ident'] = $row['ident']; |
|
| 180 | + } |
|
| 181 | + if (isset($row['arrival_port_name'])) { |
|
| 182 | + $temp_array['arrival_port_name'] = $row['arrival_port_name']; |
|
| 183 | + } |
|
| 184 | + if (isset($row['latitude'])) { |
|
| 185 | + $temp_array['latitude'] = $row['latitude']; |
|
| 186 | + } |
|
| 187 | + if (isset($row['longitude'])) { |
|
| 188 | + $temp_array['longitude'] = $row['longitude']; |
|
| 189 | + } |
|
| 190 | + if (isset($row['format_source'])) { |
|
| 191 | + $temp_array['format_source'] = $row['format_source']; |
|
| 192 | + } |
|
| 157 | 193 | if (isset($row['heading'])) { |
| 158 | 194 | $temp_array['heading'] = $row['heading']; |
| 159 | 195 | $heading_direction = $this->parseDirection($row['heading']); |
| 160 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 196 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 197 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 198 | + } |
|
| 199 | + } |
|
| 200 | + if (isset($row['ground_speed'])) { |
|
| 201 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 161 | 202 | } |
| 162 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 163 | 203 | |
| 164 | 204 | if(isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
| 165 | 205 | { |
| 166 | 206 | $Image = new Image($this->db); |
| 167 | - if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
| 168 | - else $image_array = $Image->getMarineImage($temp_array['mmsi']); |
|
| 207 | + if (isset($temp_array['ident']) && $temp_array['ident'] != '') { |
|
| 208 | + $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
| 209 | + } else { |
|
| 210 | + $image_array = $Image->getMarineImage($temp_array['mmsi']); |
|
| 211 | + } |
|
| 169 | 212 | unset($Image); |
| 170 | 213 | if (count($image_array) > 0) { |
| 171 | 214 | $temp_array['image'] = $image_array[0]['image']; |
@@ -217,13 +260,21 @@ discard block |
||
| 217 | 260 | } |
| 218 | 261 | |
| 219 | 262 | $fromsource = NULL; |
| 220 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 221 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 222 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 263 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 264 | + $temp_array['source_name'] = $row['source_name']; |
|
| 265 | + } |
|
| 266 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 267 | + $temp_array['over_country'] = $row['over_country']; |
|
| 268 | + } |
|
| 269 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 270 | + $temp_array['distance'] = $row['distance']; |
|
| 271 | + } |
|
| 223 | 272 | $temp_array['query_number_rows'] = $num_rows; |
| 224 | 273 | $spotter_array[] = $temp_array; |
| 225 | 274 | } |
| 226 | - if ($num_rows == 0) return array(); |
|
| 275 | + if ($num_rows == 0) { |
|
| 276 | + return array(); |
|
| 277 | + } |
|
| 227 | 278 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 228 | 279 | return $spotter_array; |
| 229 | 280 | } |
@@ -249,8 +300,12 @@ discard block |
||
| 249 | 300 | { |
| 250 | 301 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 251 | 302 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 252 | - } else $limit_query = ""; |
|
| 253 | - } else $limit_query = ""; |
|
| 303 | + } else { |
|
| 304 | + $limit_query = ""; |
|
| 305 | + } |
|
| 306 | + } else { |
|
| 307 | + $limit_query = ""; |
|
| 308 | + } |
|
| 254 | 309 | if ($sort != "") |
| 255 | 310 | { |
| 256 | 311 | $search_orderby_array = $this->getOrderBy(); |
@@ -274,7 +329,9 @@ discard block |
||
| 274 | 329 | global $global_marine_query; |
| 275 | 330 | |
| 276 | 331 | date_default_timezone_set('UTC'); |
| 277 | - if ($id == '') return array(); |
|
| 332 | + if ($id == '') { |
|
| 333 | + return array(); |
|
| 334 | + } |
|
| 278 | 335 | $additional_query = "marine_output.fammarine_id = :id"; |
| 279 | 336 | $query_values = array(':id' => $id); |
| 280 | 337 | $query = $global_marine_query." WHERE ".$additional_query." "; |
@@ -510,8 +567,11 @@ discard block |
||
| 510 | 567 | $query .= " ORDER BY marine_output.source_name ASC"; |
| 511 | 568 | |
| 512 | 569 | $sth = $this->db->prepare($query); |
| 513 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 514 | - else $sth->execute(); |
|
| 570 | + if (!empty($query_values)) { |
|
| 571 | + $sth->execute($query_values); |
|
| 572 | + } else { |
|
| 573 | + $sth->execute(); |
|
| 574 | + } |
|
| 515 | 575 | |
| 516 | 576 | $source_array = array(); |
| 517 | 577 | $temp_array = array(); |
@@ -566,8 +626,11 @@ discard block |
||
| 566 | 626 | $sth = $this->db->prepare($query); |
| 567 | 627 | $sth->execute(array(':mmsi' => $mmsi)); |
| 568 | 628 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 569 | - if (isset($result[0])) return $result[0]; |
|
| 570 | - else return array(); |
|
| 629 | + if (isset($result[0])) { |
|
| 630 | + return $result[0]; |
|
| 631 | + } else { |
|
| 632 | + return array(); |
|
| 633 | + } |
|
| 571 | 634 | } |
| 572 | 635 | |
| 573 | 636 | /** |
@@ -608,7 +671,9 @@ discard block |
||
| 608 | 671 | date_default_timezone_set($globalTimezone); |
| 609 | 672 | $datetime = new DateTime(); |
| 610 | 673 | $offset = $datetime->format('P'); |
| 611 | - } else $offset = '+00:00'; |
|
| 674 | + } else { |
|
| 675 | + $offset = '+00:00'; |
|
| 676 | + } |
|
| 612 | 677 | |
| 613 | 678 | if ($globalDBdriver == 'mysql') { |
| 614 | 679 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
@@ -858,11 +923,19 @@ discard block |
||
| 858 | 923 | $latitude = 0; |
| 859 | 924 | $longitude = 0; |
| 860 | 925 | } |
| 861 | - if ($type_id == '') $type_id = NULL; |
|
| 862 | - if ($status_id == '') $status_id = NULL; |
|
| 863 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 926 | + if ($type_id == '') { |
|
| 927 | + $type_id = NULL; |
|
| 928 | + } |
|
| 929 | + if ($status_id == '') { |
|
| 930 | + $status_id = NULL; |
|
| 931 | + } |
|
| 932 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 933 | + $heading = 0; |
|
| 934 | + } |
|
| 864 | 935 | //if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
| 865 | - if ($arrival_date == '') $arrival_date = NULL; |
|
| 936 | + if ($arrival_date == '') { |
|
| 937 | + $arrival_date = NULL; |
|
| 938 | + } |
|
| 866 | 939 | $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) |
| 867 | 940 | 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)"; |
| 868 | 941 | |
@@ -969,7 +1042,9 @@ discard block |
||
| 969 | 1042 | global $globalDBdriver, $globalArchive; |
| 970 | 1043 | //$filter_query = $this->getFilter($filters,true,true); |
| 971 | 1044 | $Connection= new Connection($this->db); |
| 972 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 1045 | + if (!$Connection->tableExists('countries')) { |
|
| 1046 | + return array(); |
|
| 1047 | + } |
|
| 973 | 1048 | require_once('class.SpotterLive.php'); |
| 974 | 1049 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
| 975 | 1050 | $MarineLive = new MarineLive($this->db); |
@@ -1013,7 +1088,9 @@ discard block |
||
| 1013 | 1088 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT fammarine_id,over_country FROM marine_archive".$filter_query.") l ON c.iso2 = l.over_country "; |
| 1014 | 1089 | } |
| 1015 | 1090 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
| 1016 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 1091 | + if ($limit) { |
|
| 1092 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 1093 | + } |
|
| 1017 | 1094 | |
| 1018 | 1095 | $sth = $this->db->prepare($query); |
| 1019 | 1096 | $sth->execute(); |
@@ -1047,12 +1124,18 @@ discard block |
||
| 1047 | 1124 | $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
| 1048 | 1125 | FROM marine_output".$filter_query." marine_output.ident <> ''"; |
| 1049 | 1126 | if ($olderthanmonths > 0) { |
| 1050 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 1051 | - else $query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 1127 | + if ($globalDBdriver == 'mysql') { |
|
| 1128 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 1129 | + } else { |
|
| 1130 | + $query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 1131 | + } |
|
| 1052 | 1132 | } |
| 1053 | 1133 | if ($sincedate != '') { |
| 1054 | - if ($globalDBdriver == 'mysql') $query .= " AND marine_output.date > '".$sincedate."'"; |
|
| 1055 | - else $query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 1134 | + if ($globalDBdriver == 'mysql') { |
|
| 1135 | + $query .= " AND marine_output.date > '".$sincedate."'"; |
|
| 1136 | + } else { |
|
| 1137 | + $query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 1138 | + } |
|
| 1056 | 1139 | } |
| 1057 | 1140 | $query_values = array(); |
| 1058 | 1141 | if ($year != '') { |
@@ -1083,7 +1166,9 @@ discard block |
||
| 1083 | 1166 | } |
| 1084 | 1167 | } |
| 1085 | 1168 | $query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC"; |
| 1086 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 1169 | + if ($limit) { |
|
| 1170 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 1171 | + } |
|
| 1087 | 1172 | |
| 1088 | 1173 | $sth = $this->db->prepare($query); |
| 1089 | 1174 | $sth->execute($query_values); |
@@ -1118,7 +1203,9 @@ discard block |
||
| 1118 | 1203 | date_default_timezone_set($globalTimezone); |
| 1119 | 1204 | $datetime = new DateTime(); |
| 1120 | 1205 | $offset = $datetime->format('P'); |
| 1121 | - } else $offset = '+00:00'; |
|
| 1206 | + } else { |
|
| 1207 | + $offset = '+00:00'; |
|
| 1208 | + } |
|
| 1122 | 1209 | |
| 1123 | 1210 | if ($globalDBdriver == 'mysql') { |
| 1124 | 1211 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1168,7 +1255,9 @@ discard block |
||
| 1168 | 1255 | date_default_timezone_set($globalTimezone); |
| 1169 | 1256 | $datetime = new DateTime(); |
| 1170 | 1257 | $offset = $datetime->format('P'); |
| 1171 | - } else $offset = '+00:00'; |
|
| 1258 | + } else { |
|
| 1259 | + $offset = '+00:00'; |
|
| 1260 | + } |
|
| 1172 | 1261 | $filter_query = $this->getFilter($filters,true,true); |
| 1173 | 1262 | if ($globalDBdriver == 'mysql') { |
| 1174 | 1263 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1214,7 +1303,9 @@ discard block |
||
| 1214 | 1303 | date_default_timezone_set($globalTimezone); |
| 1215 | 1304 | $datetime = new DateTime(); |
| 1216 | 1305 | $offset = $datetime->format('P'); |
| 1217 | - } else $offset = '+00:00'; |
|
| 1306 | + } else { |
|
| 1307 | + $offset = '+00:00'; |
|
| 1308 | + } |
|
| 1218 | 1309 | $filter_query = $this->getFilter($filters,true,true); |
| 1219 | 1310 | if ($globalDBdriver == 'mysql') { |
| 1220 | 1311 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1262,7 +1353,9 @@ discard block |
||
| 1262 | 1353 | date_default_timezone_set($globalTimezone); |
| 1263 | 1354 | $datetime = new DateTime(); |
| 1264 | 1355 | $offset = $datetime->format('P'); |
| 1265 | - } else $offset = '+00:00'; |
|
| 1356 | + } else { |
|
| 1357 | + $offset = '+00:00'; |
|
| 1358 | + } |
|
| 1266 | 1359 | |
| 1267 | 1360 | if ($globalDBdriver == 'mysql') { |
| 1268 | 1361 | $query = "SELECT YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -1311,7 +1404,9 @@ discard block |
||
| 1311 | 1404 | date_default_timezone_set($globalTimezone); |
| 1312 | 1405 | $datetime = new DateTime(); |
| 1313 | 1406 | $offset = $datetime->format('P'); |
| 1314 | - } else $offset = '+00:00'; |
|
| 1407 | + } else { |
|
| 1408 | + $offset = '+00:00'; |
|
| 1409 | + } |
|
| 1315 | 1410 | $filter_query = $this->getFilter($filters,true,true); |
| 1316 | 1411 | if ($globalDBdriver == 'mysql') { |
| 1317 | 1412 | $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 |
@@ -1360,7 +1455,9 @@ discard block |
||
| 1360 | 1455 | date_default_timezone_set($globalTimezone); |
| 1361 | 1456 | $datetime = new DateTime(); |
| 1362 | 1457 | $offset = $datetime->format('P'); |
| 1363 | - } else $offset = '+00:00'; |
|
| 1458 | + } else { |
|
| 1459 | + $offset = '+00:00'; |
|
| 1460 | + } |
|
| 1364 | 1461 | |
| 1365 | 1462 | $orderby_sql = ''; |
| 1366 | 1463 | if ($orderby == "hour") |
@@ -1429,7 +1526,9 @@ discard block |
||
| 1429 | 1526 | date_default_timezone_set($globalTimezone); |
| 1430 | 1527 | $datetime = new DateTime($date); |
| 1431 | 1528 | $offset = $datetime->format('P'); |
| 1432 | - } else $offset = '+00:00'; |
|
| 1529 | + } else { |
|
| 1530 | + $offset = '+00:00'; |
|
| 1531 | + } |
|
| 1433 | 1532 | |
| 1434 | 1533 | if ($globalDBdriver == 'mysql') { |
| 1435 | 1534 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1477,7 +1576,9 @@ discard block |
||
| 1477 | 1576 | date_default_timezone_set($globalTimezone); |
| 1478 | 1577 | $datetime = new DateTime(); |
| 1479 | 1578 | $offset = $datetime->format('P'); |
| 1480 | - } else $offset = '+00:00'; |
|
| 1579 | + } else { |
|
| 1580 | + $offset = '+00:00'; |
|
| 1581 | + } |
|
| 1481 | 1582 | |
| 1482 | 1583 | if ($globalDBdriver == 'mysql') { |
| 1483 | 1584 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1542,8 +1643,11 @@ discard block |
||
| 1542 | 1643 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 1543 | 1644 | } |
| 1544 | 1645 | } |
| 1545 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 1546 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1646 | + if (empty($query_values)) { |
|
| 1647 | + $queryi .= $this->getFilter($filters); |
|
| 1648 | + } else { |
|
| 1649 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1650 | + } |
|
| 1547 | 1651 | |
| 1548 | 1652 | $sth = $this->db->prepare($queryi); |
| 1549 | 1653 | $sth->execute($query_values); |
@@ -1580,8 +1684,11 @@ discard block |
||
| 1580 | 1684 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 1581 | 1685 | } |
| 1582 | 1686 | } |
| 1583 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 1584 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1687 | + if (empty($query_values)) { |
|
| 1688 | + $queryi .= $this->getFilter($filters); |
|
| 1689 | + } else { |
|
| 1690 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1691 | + } |
|
| 1585 | 1692 | |
| 1586 | 1693 | $sth = $this->db->prepare($queryi); |
| 1587 | 1694 | $sth->execute($query_values); |
@@ -1603,7 +1710,9 @@ discard block |
||
| 1603 | 1710 | date_default_timezone_set($globalTimezone); |
| 1604 | 1711 | $datetime = new DateTime(); |
| 1605 | 1712 | $offset = $datetime->format('P'); |
| 1606 | - } else $offset = '+00:00'; |
|
| 1713 | + } else { |
|
| 1714 | + $offset = '+00:00'; |
|
| 1715 | + } |
|
| 1607 | 1716 | |
| 1608 | 1717 | if ($globalDBdriver == 'mysql') { |
| 1609 | 1718 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1707,7 +1816,9 @@ discard block |
||
| 1707 | 1816 | */ |
| 1708 | 1817 | public function parseDirection($direction = 0) |
| 1709 | 1818 | { |
| 1710 | - if ($direction == '') $direction = 0; |
|
| 1819 | + if ($direction == '') { |
|
| 1820 | + $direction = 0; |
|
| 1821 | + } |
|
| 1711 | 1822 | $direction_array = array(); |
| 1712 | 1823 | $temp_array = array(); |
| 1713 | 1824 | |
@@ -1796,7 +1907,9 @@ discard block |
||
| 1796 | 1907 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1797 | 1908 | |
| 1798 | 1909 | $Connection = new Connection($this->db); |
| 1799 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 1910 | + if (!$Connection->tableExists('countries')) { |
|
| 1911 | + return ''; |
|
| 1912 | + } |
|
| 1800 | 1913 | |
| 1801 | 1914 | try { |
| 1802 | 1915 | /* |
@@ -1816,9 +1929,13 @@ discard block |
||
| 1816 | 1929 | $sth->closeCursor(); |
| 1817 | 1930 | if (count($row) > 0) { |
| 1818 | 1931 | return $row; |
| 1819 | - } else return ''; |
|
| 1932 | + } else { |
|
| 1933 | + return ''; |
|
| 1934 | + } |
|
| 1820 | 1935 | } catch (PDOException $e) { |
| 1821 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 1936 | + if (isset($globalDebug) && $globalDebug) { |
|
| 1937 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 1938 | + } |
|
| 1822 | 1939 | return ''; |
| 1823 | 1940 | } |
| 1824 | 1941 | |
@@ -1836,7 +1953,9 @@ discard block |
||
| 1836 | 1953 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
| 1837 | 1954 | |
| 1838 | 1955 | $Connection = new Connection($this->db); |
| 1839 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 1956 | + if (!$Connection->tableExists('countries')) { |
|
| 1957 | + return ''; |
|
| 1958 | + } |
|
| 1840 | 1959 | |
| 1841 | 1960 | try { |
| 1842 | 1961 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -1848,9 +1967,13 @@ discard block |
||
| 1848 | 1967 | $sth->closeCursor(); |
| 1849 | 1968 | if (count($row) > 0) { |
| 1850 | 1969 | return $row; |
| 1851 | - } else return ''; |
|
| 1970 | + } else { |
|
| 1971 | + return ''; |
|
| 1972 | + } |
|
| 1852 | 1973 | } catch (PDOException $e) { |
| 1853 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 1974 | + if (isset($globalDebug) && $globalDebug) { |
|
| 1975 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 1976 | + } |
|
| 1854 | 1977 | return ''; |
| 1855 | 1978 | } |
| 1856 | 1979 | |
@@ -1868,7 +1991,9 @@ discard block |
||
| 1868 | 1991 | { |
| 1869 | 1992 | global $globalBitlyAccessToken; |
| 1870 | 1993 | |
| 1871 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 1994 | + if ($globalBitlyAccessToken == '') { |
|
| 1995 | + return $url; |
|
| 1996 | + } |
|
| 1872 | 1997 | |
| 1873 | 1998 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 1874 | 1999 | |
@@ -1944,7 +2069,9 @@ discard block |
||
| 1944 | 2069 | } |
| 1945 | 2070 | } |
| 1946 | 2071 | $query .= " GROUP BY marine_output.type, marine_output.type_id ORDER BY marine_type_count DESC"; |
| 1947 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 2072 | + if ($limit) { |
|
| 2073 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 2074 | + } |
|
| 1948 | 2075 | $sth = $this->db->prepare($query); |
| 1949 | 2076 | $sth->execute($query_values); |
| 1950 | 2077 | $marine_array = array(); |
@@ -1982,9 +2109,15 @@ discard block |
||
| 1982 | 2109 | foreach ($q_array as $q_item){ |
| 1983 | 2110 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
| 1984 | 2111 | $additional_query .= " AND ("; |
| 1985 | - if (is_int($q_item)) $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
|
| 1986 | - if (is_int($q_item)) $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
|
| 1987 | - if (is_int($q_item)) $additional_query .= "(marine_output.imo = '".$q_item."') OR "; |
|
| 2112 | + if (is_int($q_item)) { |
|
| 2113 | + $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
|
| 2114 | + } |
|
| 2115 | + if (is_int($q_item)) { |
|
| 2116 | + $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
|
| 2117 | + } |
|
| 2118 | + if (is_int($q_item)) { |
|
| 2119 | + $additional_query .= "(marine_output.imo = '".$q_item."') OR "; |
|
| 2120 | + } |
|
| 1988 | 2121 | $additional_query .= "(marine_output.ident like '%".$q_item."%') OR "; |
| 1989 | 2122 | $additional_query .= ")"; |
| 1990 | 2123 | } |
@@ -2032,7 +2165,9 @@ discard block |
||
| 2032 | 2165 | date_default_timezone_set($globalTimezone); |
| 2033 | 2166 | $datetime = new DateTime(); |
| 2034 | 2167 | $offset = $datetime->format('P'); |
| 2035 | - } else $offset = '+00:00'; |
|
| 2168 | + } else { |
|
| 2169 | + $offset = '+00:00'; |
|
| 2170 | + } |
|
| 2036 | 2171 | if ($date_array[1] != "") |
| 2037 | 2172 | { |
| 2038 | 2173 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
@@ -2059,8 +2194,12 @@ discard block |
||
| 2059 | 2194 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 2060 | 2195 | { |
| 2061 | 2196 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 2062 | - } else $limit_query = ""; |
|
| 2063 | - } else $limit_query = ""; |
|
| 2197 | + } else { |
|
| 2198 | + $limit_query = ""; |
|
| 2199 | + } |
|
| 2200 | + } else { |
|
| 2201 | + $limit_query = ""; |
|
| 2202 | + } |
|
| 2064 | 2203 | if ($sort != "") |
| 2065 | 2204 | { |
| 2066 | 2205 | $search_orderby_array = $this->getOrderBy(); |