@@ -5,11 +5,11 @@ |
||
5 | 5 | |
6 | 6 | if ($_POST['aircraft_manufacturer'] != "") |
7 | 7 | { |
8 | - $aircraft_manufacturer = filter_input(INPUT_POST,'aircraft_manufacturer',FILTER_SANITIZE_STRING); |
|
8 | + $aircraft_manufacturer = filter_input(INPUT_POST, 'aircraft_manufacturer', FILTER_SANITIZE_STRING); |
|
9 | 9 | header('Location: '.$globalURL.'/manufacturer/'.$aircraft_manufacturer); |
10 | 10 | } elseif ($_GET['aircraft_manufacturer'] != "") |
11 | 11 | { |
12 | - $aircraft_manufacturer = filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING); |
|
12 | + $aircraft_manufacturer = filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING); |
|
13 | 13 | header('Location: '.$globalURL.'/manufacturer/'.$aircraft_manufacturer); |
14 | 14 | } else { |
15 | 15 | if ($globalURL == '') { |
@@ -5,7 +5,7 @@ |
||
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | if ($_GET['flightaware_id'] != "") |
7 | 7 | { |
8 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
8 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
9 | 9 | $spotter_id = $Spotter->getSpotterIDBasedOnFlightAwareID($flightaware_id); |
10 | 10 | if ($spotter_id != "") |
11 | 11 | { |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | if (isset($_POST['country']) && $_POST['country'] != "") |
6 | 6 | { |
7 | - $country = filter_input(INPUT_POST,'country',FILTER_SANITIZE_STRING); |
|
7 | + $country = filter_input(INPUT_POST, 'country', FILTER_SANITIZE_STRING); |
|
8 | 8 | header('Location: '.$globalURL.'/country/'.$country); |
9 | 9 | } else { |
10 | 10 | if ($globalURL == '') { |
@@ -5,13 +5,13 @@ discard block |
||
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | require_once('require/class.SpotterArchive.php'); |
7 | 7 | |
8 | -if (!isset($_GET['pilot'])){ |
|
8 | +if (!isset($_GET['pilot'])) { |
|
9 | 9 | header('Location: '.$globalURL.'/'); |
10 | 10 | } else { |
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | $SpotterArchive = new SpotterArchive(); |
13 | 13 | //calculuation for the pagination |
14 | - if(!isset($_GET['limit'])) |
|
14 | + if (!isset($_GET['limit'])) |
|
15 | 15 | { |
16 | 16 | $limit_start = 0; |
17 | 17 | $limit_end = 25; |
@@ -32,29 +32,29 @@ discard block |
||
32 | 32 | |
33 | 33 | $page_url = $globalURL.'/pilot/'.$_GET['pilot']; |
34 | 34 | |
35 | - $pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING); |
|
36 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
37 | - $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
38 | - $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
35 | + $pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING); |
|
36 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
37 | + $year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
38 | + $month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
39 | 39 | $filter = array(); |
40 | - if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
41 | - if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
40 | + if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
41 | + if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
42 | 42 | if ($sort != '') |
43 | 43 | { |
44 | - $spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter); |
|
44 | + $spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort, $filter); |
|
45 | 45 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
46 | - $spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter); |
|
46 | + $spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort, $filter); |
|
47 | 47 | } |
48 | 48 | } else { |
49 | - $spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference,'',$filter); |
|
49 | + $spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, '', $filter); |
|
50 | 50 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
51 | - $spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference,'',$filter); |
|
51 | + $spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, '', $filter); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | |
55 | 55 | if (!empty($spotter_array)) |
56 | 56 | { |
57 | - $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']); |
|
57 | + $title = sprintf(_("Detailed View for %s"), $spotter_array[0]['pilot_name']); |
|
58 | 58 | $ident = $spotter_array[0]['ident']; |
59 | 59 | if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
60 | 60 | if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
@@ -115,23 +115,23 @@ discard block |
||
115 | 115 | $Stats = new Stats(); |
116 | 116 | $flights = $Stats->getStatsPilot($pilot); |
117 | 117 | } else $flights = 0; |
118 | - if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter); |
|
118 | + if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot, $filter); |
|
119 | 119 | print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>'; |
120 | - $aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter)); |
|
120 | + $aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot, $filter)); |
|
121 | 121 | print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>'; |
122 | - $aircraft_registration = count($Spotter->countAllAircraftRegistrationByPilot($pilot,$filter)); |
|
122 | + $aircraft_registration = count($Spotter->countAllAircraftRegistrationByPilot($pilot, $filter)); |
|
123 | 123 | print '<div><span class="label">'._("Aircrafts").'</span>'.$aircraft_registration.'</div>'; |
124 | - $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByPilot($pilot,$filter)); |
|
124 | + $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByPilot($pilot, $filter)); |
|
125 | 125 | print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>'; |
126 | - $airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter)); |
|
126 | + $airlines = count($Spotter->countAllAirlinesByPilot($pilot, $filter)); |
|
127 | 127 | print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>'; |
128 | - $duration = $Spotter->getFlightDurationByPilot($pilot,$filter); |
|
128 | + $duration = $Spotter->getFlightDurationByPilot($pilot, $filter); |
|
129 | 129 | if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
130 | 130 | print '</div>'; |
131 | 131 | |
132 | 132 | include('pilot-sub-menu.php'); |
133 | 133 | print '<div class="table column">'; |
134 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>'; |
|
134 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>'; |
|
135 | 135 | |
136 | 136 | include('table-output.php'); |
137 | 137 | print '<div class="pagination">'; |
@@ -37,8 +37,12 @@ discard block |
||
37 | 37 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
38 | 38 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
39 | 39 | $filter = array(); |
40 | - if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
41 | - if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
40 | + if ($year != '') { |
|
41 | + $filter = array_merge($filter,array('year' => $year)); |
|
42 | + } |
|
43 | + if ($month != '') { |
|
44 | + $filter = array_merge($filter,array('month' => $month)); |
|
45 | + } |
|
42 | 46 | if ($sort != '') |
43 | 47 | { |
44 | 48 | $spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter); |
@@ -56,8 +60,12 @@ discard block |
||
56 | 60 | { |
57 | 61 | $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']); |
58 | 62 | $ident = $spotter_array[0]['ident']; |
59 | - if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
|
60 | - if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
|
63 | + if (isset($spotter_array[0]['latitude'])) { |
|
64 | + $latitude = $spotter_array[0]['latitude']; |
|
65 | + } |
|
66 | + if (isset($spotter_array[0]['longitude'])) { |
|
67 | + $longitude = $spotter_array[0]['longitude']; |
|
68 | + } |
|
61 | 69 | require_once('header.php'); |
62 | 70 | /* |
63 | 71 | if (isset($globalArchive) && $globalArchive) { |
@@ -110,12 +118,18 @@ discard block |
||
110 | 118 | */ |
111 | 119 | print '<div class="info column">'; |
112 | 120 | print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>'; |
113 | - if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>'; |
|
121 | + if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') { |
|
122 | + print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>'; |
|
123 | + } |
|
114 | 124 | if ($year == '' && $month == '') { |
115 | 125 | $Stats = new Stats(); |
116 | 126 | $flights = $Stats->getStatsPilot($pilot); |
117 | - } else $flights = 0; |
|
118 | - if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter); |
|
127 | + } else { |
|
128 | + $flights = 0; |
|
129 | + } |
|
130 | + if ($flights == 0) { |
|
131 | + $flights = $Spotter->countFlightsByPilot($pilot,$filter); |
|
132 | + } |
|
119 | 133 | print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>'; |
120 | 134 | $aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter)); |
121 | 135 | print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>'; |
@@ -126,7 +140,9 @@ discard block |
||
126 | 140 | $airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter)); |
127 | 141 | print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>'; |
128 | 142 | $duration = $Spotter->getFlightDurationByPilot($pilot,$filter); |
129 | - if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
|
143 | + if ($duration != '0') { |
|
144 | + print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
|
145 | + } |
|
130 | 146 | print '</div>'; |
131 | 147 | |
132 | 148 | include('pilot-sub-menu.php'); |
@@ -5,8 +5,8 @@ |
||
5 | 5 | |
6 | 6 | if (isset($_POST['departure_airport']) && $_POST['departure_airport'] != '') |
7 | 7 | { |
8 | - $departure_airport = filter_input(INPUT_POST,'departure_airport',FILTER_SANITIZE_STRING); |
|
9 | - $arrival_airport = filter_input(INPUT_POST,'arrival_airport',FILTER_SANITIZE_STRING); |
|
8 | + $departure_airport = filter_input(INPUT_POST, 'departure_airport', FILTER_SANITIZE_STRING); |
|
9 | + $arrival_airport = filter_input(INPUT_POST, 'arrival_airport', FILTER_SANITIZE_STRING); |
|
10 | 10 | header('Location: '.$globalURL.'/route/'.$departure_airport.'/'.$arrival_airport); |
11 | 11 | } else { |
12 | 12 | if ($globalURL == '') { |
@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | |
6 | -if (!isset($_GET['country'])){ |
|
6 | +if (!isset($_GET['country'])) { |
|
7 | 7 | header('Location: '.$globalURL.''); |
8 | 8 | } else { |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | //calculuation for the pagination |
11 | - if(!isset($_GET['limit'])) |
|
11 | + if (!isset($_GET['limit'])) |
|
12 | 12 | { |
13 | 13 | $limit_start = 0; |
14 | 14 | $limit_end = 25; |
15 | 15 | $absolute_difference = 25; |
16 | - } else { |
|
16 | + } else { |
|
17 | 17 | $limit_explode = explode(",", $_GET['limit']); |
18 | 18 | if (isset($limit_explode[1])) { |
19 | 19 | $limit_start = $limit_explode[0]; |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | $limit_previous_1 = $limit_start - $absolute_difference; |
33 | 33 | $limit_previous_2 = $limit_end - $absolute_difference; |
34 | 34 | |
35 | - $country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING)))); |
|
35 | + $country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING)))); |
|
36 | 36 | |
37 | 37 | $page_url = $globalURL.'/country/'.$_GET['country']; |
38 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
38 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
39 | 39 | if ($country == 'Na') { |
40 | 40 | $spotter_array = array(); |
41 | 41 | } else { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | if (!empty($spotter_array)) |
50 | 50 | { |
51 | - $title = sprintf(_("Detailed View for Airports & Airlines from %s"),$country); |
|
51 | + $title = sprintf(_("Detailed View for Airports & Airlines from %s"), $country); |
|
52 | 52 | |
53 | 53 | require_once('header.php'); |
54 | 54 | print '<div class="select-item">'; |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | print '<select name="country" class="selectpicker" data-live-search="true">'; |
57 | 57 | print '<option></option>'; |
58 | 58 | $all_countries = $Spotter->getAllCountries(); |
59 | - foreach($all_countries as $all_country) |
|
59 | + foreach ($all_countries as $all_country) |
|
60 | 60 | { |
61 | - if($country == $all_country['country']) |
|
61 | + if ($country == $all_country['country']) |
|
62 | 62 | { |
63 | 63 | print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>'; |
64 | 64 | } else { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | if ($_GET['country'] != "NA") |
74 | 74 | { |
75 | 75 | print '<div class="info column">'; |
76 | - print '<h1>'.sprintf(_("Airports & Airlines from %s"),$country).'</h1>'; |
|
76 | + print '<h1>'.sprintf(_("Airports & Airlines from %s"), $country).'</h1>'; |
|
77 | 77 | print '</div>'; |
78 | 78 | } else { |
79 | 79 | print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>'; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | include('country-sub-menu.php'); |
83 | 83 | print '<div class="table column">'; |
84 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights of airports (both departure & arrival) OR airlines from <strong>%s</strong>."),$country).'</p>'; |
|
84 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights of airports (both departure & arrival) OR airlines from <strong>%s</strong>."), $country).'</p>'; |
|
85 | 85 | |
86 | 86 | include('table-output.php'); |
87 | 87 | print '<div class="pagination">'; |
@@ -13,7 +13,7 @@ |
||
13 | 13 | $limit_start = 0; |
14 | 14 | $limit_end = 25; |
15 | 15 | $absolute_difference = 25; |
16 | - } else { |
|
16 | + } else { |
|
17 | 17 | $limit_explode = explode(",", $_GET['limit']); |
18 | 18 | if (isset($limit_explode[1])) { |
19 | 19 | $limit_start = $limit_explode[0]; |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | if (isset($_GET['start_date'])) { |
7 | 7 | //for the date manipulation into the query |
8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
9 | 9 | $start_date = $_GET['start_date'].":00"; |
10 | 10 | $end_date = $_GET['end_date'].":00"; |
11 | 11 | $sql_date = $start_date.",".$end_date; |
12 | - } else if($_GET['start_date'] != ""){ |
|
12 | + } else if ($_GET['start_date'] != "") { |
|
13 | 13 | $start_date = $_GET['start_date'].":00"; |
14 | 14 | $sql_date = $start_date; |
15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
15 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
17 | 17 | $sql_date = $end_date; |
18 | 18 | } else $sql_date = ''; |
@@ -20,38 +20,38 @@ discard block |
||
20 | 20 | |
21 | 21 | if (isset($_GET['highest_altitude'])) { |
22 | 22 | //for altitude manipulation |
23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
24 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
25 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
24 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
25 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
27 | - } else if($_GET['highest_altitude'] != ""){ |
|
28 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
27 | + } else if ($_GET['highest_altitude'] != "") { |
|
28 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
29 | 29 | $sql_altitude = $end_altitude; |
30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
31 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
31 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
32 | 32 | $sql_altitude = $start_altitude; |
33 | 33 | } else $sql_altitude = ''; |
34 | 34 | } else $sql_altitude = ''; |
35 | 35 | |
36 | 36 | //calculuation for the pagination |
37 | -if(!isset($_GET['limit'])) |
|
37 | +if (!isset($_GET['limit'])) |
|
38 | 38 | { |
39 | 39 | if (!isset($_GET['number_results'])) { |
40 | 40 | $limit_start = 0; |
41 | 41 | $limit_end = 25; |
42 | 42 | $absolute_difference = 25; |
43 | 43 | } else { |
44 | - if ($_GET['number_results'] > 1000){ |
|
44 | + if ($_GET['number_results'] > 1000) { |
|
45 | 45 | $_GET['number_results'] = 1000; |
46 | 46 | } |
47 | 47 | $limit_start = 0; |
48 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
49 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
48 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
49 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
50 | 50 | } |
51 | -} else { |
|
51 | +} else { |
|
52 | 52 | $limit_explode = explode(",", $_GET['limit']); |
53 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
54 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
53 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
54 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -68,23 +68,23 @@ discard block |
||
68 | 68 | |
69 | 69 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
70 | 70 | else $sort = ''; |
71 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
72 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
73 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
74 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
75 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
76 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
77 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
78 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
79 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
80 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
81 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
82 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
83 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
84 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
85 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
86 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
87 | -$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
71 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
72 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
73 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
74 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
75 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
76 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
77 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
78 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
79 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
80 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
81 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
82 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
83 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
84 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
85 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
86 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
87 | +$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
88 | 88 | |
89 | 89 | $output = '<?xml version="1.0" encoding="UTF-8"?>'; |
90 | 90 | $output .= '<kml xmlns="http://www.opengis.net/kml/2.2">'; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $output .= '</Style>'; |
113 | 113 | |
114 | 114 | if (!empty($spotter_array)) { |
115 | - foreach($spotter_array as $spotter_item) { |
|
115 | + foreach ($spotter_array as $spotter_item) { |
|
116 | 116 | $altitude = $spotter_item['altitude'].'00'; |
117 | 117 | if ($spotter_item['waypoints'] != '') { |
118 | 118 | //waypoint plotting |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $waypoint_pieces = explode(' ', $spotter_item['waypoints']); |
124 | 124 | $waypoint_pieces = array_chunk($waypoint_pieces, 2); |
125 | 125 | foreach ($waypoint_pieces as $waypoint_coordinate) { |
126 | - if (isset($waypoint_coordinate[1])) $output .= $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' '; |
|
126 | + if (isset($waypoint_coordinate[1])) $output .= $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' '; |
|
127 | 127 | } |
128 | 128 | $output .= '</coordinates>'; |
129 | 129 | $output .= '<altitudeMode>absolute</altitudeMode>'; |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $output .= ' ]]></description>'; |
168 | 168 | $output .= '<styleUrl>#departureAirport</styleUrl>'; |
169 | 169 | $output .= '<Point>'; |
170 | - $output .= '<coordinates>'.$spotter_item['departure_airport_longitude'].', '.$spotter_item['departure_airport_latitude'].', '.$spotter_item['departure_airport_altitude'].'</coordinates>'; |
|
170 | + $output .= '<coordinates>'.$spotter_item['departure_airport_longitude'].', '.$spotter_item['departure_airport_latitude'].', '.$spotter_item['departure_airport_altitude'].'</coordinates>'; |
|
171 | 171 | $output .= '<altitudeMode>absolute</altitudeMode>'; |
172 | 172 | $output .= '</Point>'; |
173 | 173 | $output .= '</Placemark>'; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $output .= ' ]]></description>'; |
209 | 209 | $output .= '<styleUrl>#arrivalAirport</styleUrl>'; |
210 | 210 | $output .= '<Point>'; |
211 | - $output .= '<coordinates>'.$spotter_item['arrival_airport_longitude'].', '.$spotter_item['arrival_airport_latitude'].', '.$spotter_item['arrival_airport_altitude'].'</coordinates>'; |
|
211 | + $output .= '<coordinates>'.$spotter_item['arrival_airport_longitude'].', '.$spotter_item['arrival_airport_latitude'].', '.$spotter_item['arrival_airport_altitude'].'</coordinates>'; |
|
212 | 212 | $output .= '<altitudeMode>absolute</altitudeMode>'; |
213 | 213 | $output .= '</Point>'; |
214 | 214 | $output .= '</Placemark>'; |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $output .= ' ]]></description>'; |
253 | 253 | $output .= '<styleUrl>#aircraft_'.$spotter_item['spotter_id'].'</styleUrl>'; |
254 | 254 | $output .= '<Point>'; |
255 | - $output .= '<coordinates>'.$spotter_item['longitude'].', '.$spotter_item['latitude'].', '.$altitude.'</coordinates>'; |
|
255 | + $output .= '<coordinates>'.$spotter_item['longitude'].', '.$spotter_item['latitude'].', '.$altitude.'</coordinates>'; |
|
256 | 256 | $output .= '<altitudeMode>absolute</altitudeMode>'; |
257 | 257 | $output .= '</Point>'; |
258 | 258 | $output .= '</Placemark>'; |
@@ -15,8 +15,12 @@ discard block |
||
15 | 15 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
17 | 17 | $sql_date = $end_date; |
18 | - } else $sql_date = ''; |
|
19 | -} else $sql_date = ''; |
|
18 | + } else { |
|
19 | + $sql_date = ''; |
|
20 | + } |
|
21 | + } else { |
|
22 | + $sql_date = ''; |
|
23 | +} |
|
20 | 24 | |
21 | 25 | if (isset($_GET['highest_altitude'])) { |
22 | 26 | //for altitude manipulation |
@@ -30,8 +34,12 @@ discard block |
||
30 | 34 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
31 | 35 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
32 | 36 | $sql_altitude = $start_altitude; |
33 | - } else $sql_altitude = ''; |
|
34 | -} else $sql_altitude = ''; |
|
37 | + } else { |
|
38 | + $sql_altitude = ''; |
|
39 | + } |
|
40 | + } else { |
|
41 | + $sql_altitude = ''; |
|
42 | +} |
|
35 | 43 | |
36 | 44 | //calculuation for the pagination |
37 | 45 | if(!isset($_GET['limit'])) |
@@ -48,7 +56,7 @@ discard block |
||
48 | 56 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
49 | 57 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
50 | 58 | } |
51 | -} else { |
|
59 | +} else { |
|
52 | 60 | $limit_explode = explode(",", $_GET['limit']); |
53 | 61 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
54 | 62 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -66,8 +74,11 @@ discard block |
||
66 | 74 | |
67 | 75 | header('Content-Type: text/xml'); |
68 | 76 | |
69 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
70 | -else $sort = ''; |
|
77 | +if (isset($_GET['sort'])) { |
|
78 | + $sort = $_GET['sort']; |
|
79 | +} else { |
|
80 | + $sort = ''; |
|
81 | +} |
|
71 | 82 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
72 | 83 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
73 | 84 | $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
@@ -123,7 +134,9 @@ discard block |
||
123 | 134 | $waypoint_pieces = explode(' ', $spotter_item['waypoints']); |
124 | 135 | $waypoint_pieces = array_chunk($waypoint_pieces, 2); |
125 | 136 | foreach ($waypoint_pieces as $waypoint_coordinate) { |
126 | - if (isset($waypoint_coordinate[1])) $output .= $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' '; |
|
137 | + if (isset($waypoint_coordinate[1])) { |
|
138 | + $output .= $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' '; |
|
139 | + } |
|
127 | 140 | } |
128 | 141 | $output .= '</coordinates>'; |
129 | 142 | $output .= '<altitudeMode>absolute</altitudeMode>'; |
@@ -8,8 +8,12 @@ discard block |
||
8 | 8 | } |
9 | 9 | $tracker = false; |
10 | 10 | $marine = false; |
11 | -if (isset($_GET['tracker'])) $tracker = true; |
|
12 | -if (isset($_GET['marine'])) $marine = true; |
|
11 | +if (isset($_GET['tracker'])) { |
|
12 | + $tracker = true; |
|
13 | +} |
|
14 | +if (isset($_GET['marine'])) { |
|
15 | + $marine = true; |
|
16 | +} |
|
13 | 17 | if ($tracker) { |
14 | 18 | require_once('require/class.Tracker.php'); |
15 | 19 | require_once('require/class.TrackerLive.php'); |
@@ -66,24 +70,49 @@ discard block |
||
66 | 70 | } |
67 | 71 | header('Content-Type: text/javascript'); |
68 | 72 | |
69 | -if (!isset($globalJsonCompress)) $compress = true; |
|
70 | -else $compress = $globalJsonCompress; |
|
73 | +if (!isset($globalJsonCompress)) { |
|
74 | + $compress = true; |
|
75 | +} else { |
|
76 | + $compress = $globalJsonCompress; |
|
77 | +} |
|
71 | 78 | |
72 | 79 | $from_archive = false; |
73 | 80 | $min = false; |
74 | 81 | $allhistory = false; |
75 | 82 | $filter['source'] = array(); |
76 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
77 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
78 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
79 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
80 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
81 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
82 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
83 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
84 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
85 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
86 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
83 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
84 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
85 | +} |
|
86 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
87 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
88 | +} |
|
89 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
90 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
91 | +} |
|
92 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
93 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
94 | +} |
|
95 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
96 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
97 | +} |
|
98 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
99 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
100 | +} |
|
101 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
102 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
103 | +} |
|
104 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
105 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
106 | +} |
|
107 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
108 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
109 | +} |
|
110 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
111 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
112 | +} |
|
113 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
114 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
115 | +} |
|
87 | 116 | /* |
88 | 117 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
89 | 118 | $min = true; |
@@ -180,8 +209,12 @@ discard block |
||
180 | 209 | } else { |
181 | 210 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
182 | 211 | } |
183 | - if ($flightcnt == '') $flightcnt = 0; |
|
184 | -} else $flightcnt = 0; |
|
212 | + if ($flightcnt == '') { |
|
213 | + $flightcnt = 0; |
|
214 | + } |
|
215 | + } else { |
|
216 | + $flightcnt = 0; |
|
217 | +} |
|
185 | 218 | |
186 | 219 | $sqltime = round(microtime(true)-$begintime,2); |
187 | 220 | $minitime = time(); |
@@ -217,7 +250,9 @@ discard block |
||
217 | 250 | $prev_flightaware_id = ''; |
218 | 251 | $speed = 1; |
219 | 252 | $gltf2 = false; |
220 | -if (isset($archivespeed)) $speed = $archivespeed; |
|
253 | +if (isset($archivespeed)) { |
|
254 | + $speed = $archivespeed; |
|
255 | +} |
|
221 | 256 | $output = '['; |
222 | 257 | if ($tracker) { |
223 | 258 | $output .= '{"id" : "document", "name" : "tracker","version" : "1.0"'; |
@@ -253,9 +288,13 @@ discard block |
||
253 | 288 | $image = "images/placeholder_thumb.png"; |
254 | 289 | } |
255 | 290 | |
256 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
257 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
258 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
291 | + if (isset($spotter_item['flightaware_id'])) { |
|
292 | + $id = $spotter_item['flightaware_id']; |
|
293 | + } elseif (isset($spotter_item['famtrackid'])) { |
|
294 | + $id = $spotter_item['famtrackid']; |
|
295 | + } elseif (isset($spotter_item['fammarine_id'])) { |
|
296 | + $id = $spotter_item['fammarine_id']; |
|
297 | + } |
|
259 | 298 | if ($prev_flightaware_id != $id) { |
260 | 299 | if ($prev_flightaware_id != '') { |
261 | 300 | /* |
@@ -303,7 +342,9 @@ discard block |
||
303 | 342 | } |
304 | 343 | } |
305 | 344 | } |
306 | - if ($ident != '') $output.= '"ident": "'.$ident.'",'; |
|
345 | + if ($ident != '') { |
|
346 | + $output.= '"ident": "'.$ident.'",'; |
|
347 | + } |
|
307 | 348 | } |
308 | 349 | $output.= '"gltf2": %gltf2%,'; |
309 | 350 | $output.= '"type": "flight"'; |
@@ -335,7 +376,9 @@ discard block |
||
335 | 376 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
336 | 377 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
337 | 378 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
338 | - } else $aircraft_shadow = ''; |
|
379 | + } else { |
|
380 | + $aircraft_shadow = ''; |
|
381 | + } |
|
339 | 382 | $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
340 | 383 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
341 | 384 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
@@ -343,7 +386,9 @@ discard block |
||
343 | 386 | } |
344 | 387 | $output .= '},'; |
345 | 388 | } |
346 | - } else $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},'; |
|
389 | + } else { |
|
390 | + $output .= ' "billboard" : {"image" : "data:image/png;base64,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","scale" : 0.5},'; |
|
391 | + } |
|
347 | 392 | } elseif ($one3dmodel) { |
348 | 393 | if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') { |
349 | 394 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : 1.0,"minimumPixelSize": 20'; |
@@ -383,7 +428,9 @@ discard block |
||
383 | 428 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
384 | 429 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
385 | 430 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
386 | - } else $aircraft_shadow = ''; |
|
431 | + } else { |
|
432 | + $aircraft_shadow = ''; |
|
433 | + } |
|
387 | 434 | if ($aircraft_shadow != '') { |
388 | 435 | if (isset($modelsdb[$aircraft_shadow])) { |
389 | 436 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20'; |
@@ -520,7 +567,9 @@ discard block |
||
520 | 567 | } |
521 | 568 | $output .= '},'; |
522 | 569 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
523 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
570 | + if ($spotter_item['aircraft_icao'] != '') { |
|
571 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
572 | + } |
|
524 | 573 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
525 | 574 | } |
526 | 575 | } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
@@ -542,7 +591,9 @@ discard block |
||
542 | 591 | } |
543 | 592 | $output .= '},'; |
544 | 593 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
545 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
594 | + if ($spotter_item['aircraft_icao'] != '') { |
|
595 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
596 | + } |
|
546 | 597 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
547 | 598 | } |
548 | 599 | } else { |
@@ -555,7 +606,9 @@ discard block |
||
555 | 606 | } |
556 | 607 | $output .= '},'; |
557 | 608 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
558 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
609 | + if ($spotter_item['aircraft_icao'] != '') { |
|
610 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
611 | + } |
|
559 | 612 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
560 | 613 | } |
561 | 614 | } elseif ($tracker && isset($spotter_item['type'])) { |
@@ -659,8 +712,11 @@ discard block |
||
659 | 712 | $output .= '},'; |
660 | 713 | } |
661 | 714 | } |
662 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
663 | - else $output = str_replace('%onground%','false',$output); |
|
715 | + if (isset($onground) && $onground) { |
|
716 | + $output = str_replace('%onground%','true',$output); |
|
717 | + } else { |
|
718 | + $output = str_replace('%onground%','false',$output); |
|
719 | + } |
|
664 | 720 | |
665 | 721 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
666 | 722 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -673,8 +729,12 @@ discard block |
||
673 | 729 | // $output .= '"interpolationDegree" : 5,'; |
674 | 730 | // $output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; |
675 | 731 | $output .= '"cartographicDegrees": ['; |
676 | - if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
|
677 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
732 | + if ($minitime > strtotime($spotter_item['date'])) { |
|
733 | + $minitime = strtotime($spotter_item['date']); |
|
734 | + } |
|
735 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
736 | + $maxitime = strtotime($spotter_item['date']); |
|
737 | + } |
|
678 | 738 | $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
679 | 739 | $output .= $spotter_item['longitude'].', '; |
680 | 740 | $output .= $spotter_item['latitude']; |
@@ -697,7 +757,9 @@ discard block |
||
697 | 757 | $output .= ', '.round($spotter_item['altitude']*30.48); |
698 | 758 | $prevalt = round($spotter_item['altitude']*30.48); |
699 | 759 | } |
700 | - } else $output .= ', 0'; |
|
760 | + } else { |
|
761 | + $output .= ', 0'; |
|
762 | + } |
|
701 | 763 | //$orientation = '"orientation" : { '; |
702 | 764 | //$orientation .= '"unitQuaternion": ['; |
703 | 765 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
@@ -705,13 +767,18 @@ discard block |
||
705 | 767 | } else { |
706 | 768 | $nblatlong = $nblatlong+1; |
707 | 769 | $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
708 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
770 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
771 | + $maxitime = strtotime($spotter_item['date']); |
|
772 | + } |
|
709 | 773 | if ($spotter_item['ground_speed'] == 0) { |
710 | 774 | $output .= $prevlong.', '; |
711 | 775 | $output .= $prevlat; |
712 | 776 | //if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt; |
713 | - if (!$marine) $output .= ', '.$prevalt; |
|
714 | - else $output .= ', 0'; |
|
777 | + if (!$marine) { |
|
778 | + $output .= ', '.$prevalt; |
|
779 | + } else { |
|
780 | + $output .= ', 0'; |
|
781 | + } |
|
715 | 782 | } else { |
716 | 783 | $output .= $spotter_item['longitude'].', '; |
717 | 784 | $output .= $spotter_item['latitude']; |
@@ -724,14 +791,17 @@ discard block |
||
724 | 791 | $output .= ', 0'; |
725 | 792 | } |
726 | 793 | } else { |
727 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
|
728 | - elseif ($tracker) { |
|
794 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
795 | + $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
|
796 | + } elseif ($tracker) { |
|
729 | 797 | $output .= ', '.round($spotter_item['altitude']*0.3048); |
730 | 798 | } else { |
731 | 799 | $output .= ', '.round($spotter_item['altitude']*30.48); |
732 | 800 | } |
733 | 801 | } |
734 | - } else $output .= ', 0'; |
|
802 | + } else { |
|
803 | + $output .= ', 0'; |
|
804 | + } |
|
735 | 805 | } |
736 | 806 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
737 | 807 | //$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
@@ -750,11 +820,17 @@ discard block |
||
750 | 820 | } else { |
751 | 821 | $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
752 | 822 | } |
823 | + } else { |
|
824 | + $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
753 | 825 | } |
754 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
755 | -} else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
826 | + } else { |
|
827 | + $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
828 | +} |
|
756 | 829 | $output = str_replace('%maxitime%',date("c",$maxitime),$output); |
757 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
758 | -else $output = str_replace('%gltf2%','false',$output); |
|
830 | +if ($gltf2) { |
|
831 | + $output = str_replace('%gltf2%','true',$output); |
|
832 | +} else { |
|
833 | + $output = str_replace('%gltf2%','false',$output); |
|
834 | +} |
|
759 | 835 | print $output; |
760 | 836 | ?> |
@@ -39,30 +39,30 @@ discard block |
||
39 | 39 | |
40 | 40 | |
41 | 41 | function quaternionrotate($heading, $attitude = 0, $bank = 0) { |
42 | - // Assuming the angles are in radians. |
|
43 | - $c1 = cos($heading/2); |
|
44 | - $s1 = sin($heading/2); |
|
45 | - $c2 = cos($attitude/2); |
|
46 | - $s2 = sin($attitude/2); |
|
47 | - $c3 = cos($bank/2); |
|
48 | - $s3 = sin($bank/2); |
|
49 | - $c1c2 = $c1*$c2; |
|
50 | - $s1s2 = $s1*$s2; |
|
51 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
52 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
53 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
54 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
55 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
42 | + // Assuming the angles are in radians. |
|
43 | + $c1 = cos($heading/2); |
|
44 | + $s1 = sin($heading/2); |
|
45 | + $c2 = cos($attitude/2); |
|
46 | + $s2 = sin($attitude/2); |
|
47 | + $c3 = cos($bank/2); |
|
48 | + $s3 = sin($bank/2); |
|
49 | + $c1c2 = $c1*$c2; |
|
50 | + $s1s2 = $s1*$s2; |
|
51 | + $w =$c1c2*$c3 - $s1s2*$s3; |
|
52 | + $x =$c1c2*$s3 + $s1s2*$c3; |
|
53 | + $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
54 | + $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
55 | + return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
56 | 56 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
57 | 57 | |
58 | 58 | } |
59 | 59 | |
60 | 60 | |
61 | 61 | if (isset($_GET['download'])) { |
62 | - if ($_GET['download'] == "true") |
|
63 | - { |
|
62 | + if ($_GET['download'] == "true") |
|
63 | + { |
|
64 | 64 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
65 | - } |
|
65 | + } |
|
66 | 66 | } |
67 | 67 | header('Content-Type: text/javascript'); |
68 | 68 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
156 | 156 | $coord = explode(',',$_GET['coord']); |
157 | 157 | if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
158 | - && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
158 | + && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
159 | 159 | $coord = array(); |
160 | 160 | } |
161 | 161 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
166 | 166 | $coord = explode(',',$_GET['coord']); |
167 | 167 | if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
168 | - && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
168 | + && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
169 | 169 | $coord = array(); |
170 | 170 | } |
171 | 171 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
176 | 176 | $coord = explode(',',$_GET['coord']); |
177 | 177 | if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
178 | - && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
178 | + && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
179 | 179 | $coord = array(); |
180 | 180 | } |
181 | 181 | } |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | $image = "images/placeholder_thumb.png"; |
266 | 266 | } |
267 | 267 | |
268 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
269 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
270 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
271 | - if ($prev_flightaware_id != $id) { |
|
268 | + if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
269 | + elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
270 | + elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
271 | + if ($prev_flightaware_id != $id) { |
|
272 | 272 | if ($prev_flightaware_id != '') { |
273 | 273 | /* |
274 | 274 | if ($nblatlong == 1) { |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
349 | 349 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
350 | 350 | } else $aircraft_shadow = ''; |
351 | - $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
|
351 | + $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
|
352 | 352 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
353 | 353 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
354 | 354 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
380 | 380 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
381 | 381 | } |
382 | - $output .= '},'; |
|
382 | + $output .= '},'; |
|
383 | 383 | } elseif (isset($modelsdb[$aircraft_icao]) && $aircraft_icao != '') { |
384 | 384 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_icao].'","scale" : 1.0,"minimumPixelSize": 20'; |
385 | 385 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
388 | 388 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
389 | 389 | } |
390 | - $output .= '},'; |
|
390 | + $output .= '},'; |
|
391 | 391 | } elseif ($aircraft_icao != '') { |
392 | 392 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao); |
393 | 393 | if (isset($aircraft_info[0]['engine_type'])) { |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | $s3 = sin($bank/2); |
49 | 49 | $c1c2 = $c1*$c2; |
50 | 50 | $s1s2 = $s1*$s2; |
51 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
52 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
53 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
54 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
55 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
51 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
52 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
53 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
54 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
55 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
56 | 56 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
57 | 57 | |
58 | 58 | } |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | $min = false; |
74 | 74 | $allhistory = false; |
75 | 75 | $filter['source'] = array(); |
76 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
77 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
78 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
79 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
80 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
81 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
82 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
83 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
84 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
85 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
86 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
76 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
77 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
78 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
79 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
80 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
81 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
82 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
83 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
84 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
85 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
86 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
87 | 87 | /* |
88 | 88 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
89 | 89 | $min = true; |
@@ -130,12 +130,12 @@ discard block |
||
130 | 130 | $from_archive = true; |
131 | 131 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
132 | 132 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
133 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
134 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
135 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
136 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
137 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
138 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
133 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
134 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
135 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
136 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
137 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
138 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
139 | 139 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
140 | 140 | $from_archive = true; |
141 | 141 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
@@ -145,46 +145,46 @@ discard block |
||
145 | 145 | $begindate = $_COOKIE['archive_begin']; |
146 | 146 | $enddate = $_COOKIE['archive_end']; |
147 | 147 | |
148 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
149 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
150 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
148 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
149 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
150 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
151 | 151 | // echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
152 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
152 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
153 | 153 | } elseif ($tracker) { |
154 | 154 | $coord = array(); |
155 | 155 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
156 | - $coord = explode(',',$_GET['coord']); |
|
157 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
156 | + $coord = explode(',', $_GET['coord']); |
|
157 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
158 | 158 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
159 | 159 | $coord = array(); |
160 | 160 | } |
161 | 161 | } |
162 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true); |
|
162 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true); |
|
163 | 163 | } elseif ($marine) { |
164 | 164 | $coord = array(); |
165 | 165 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
166 | - $coord = explode(',',$_GET['coord']); |
|
167 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
166 | + $coord = explode(',', $_GET['coord']); |
|
167 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
168 | 168 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
169 | 169 | $coord = array(); |
170 | 170 | } |
171 | 171 | } |
172 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true); |
|
172 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true); |
|
173 | 173 | } else { |
174 | 174 | $coord = array(); |
175 | 175 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
176 | - $coord = explode(',',$_GET['coord']); |
|
177 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
176 | + $coord = explode(',', $_GET['coord']); |
|
177 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
178 | 178 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
179 | 179 | $coord = array(); |
180 | 180 | } |
181 | 181 | } |
182 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
|
182 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true); |
|
183 | 183 | } |
184 | 184 | //print_r($spotter_array); |
185 | 185 | if (!empty($spotter_array) && isset($coord)) { |
186 | 186 | if (isset($_GET['archive'])) { |
187 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
187 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
188 | 188 | } elseif ($tracker) { |
189 | 189 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
190 | 190 | } elseif ($marine) { |
@@ -195,15 +195,15 @@ discard block |
||
195 | 195 | if ($flightcnt == '') $flightcnt = 0; |
196 | 196 | } else $flightcnt = 0; |
197 | 197 | |
198 | -$sqltime = round(microtime(true)-$begintime,2); |
|
198 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
199 | 199 | $minitime = time(); |
200 | 200 | $maxitime = 0; |
201 | -$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
|
201 | +$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT); |
|
202 | 202 | $modelsdb = array(); |
203 | 203 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
204 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
205 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
206 | - if (isset($row[1]) ){ |
|
204 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
205 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
206 | + if (isset($row[1])) { |
|
207 | 207 | $model = $row[0]; |
208 | 208 | $modelsdb[$model] = $row[1]; |
209 | 209 | } |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | } |
214 | 214 | $modelsdb2 = array(); |
215 | 215 | if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) { |
216 | - if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) { |
|
217 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
218 | - if (isset($row[1]) ){ |
|
216 | + if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) { |
|
217 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
218 | + if (isset($row[1])) { |
|
219 | 219 | $model = $row[0]; |
220 | 220 | $modelsdb2[$model] = $row[1]; |
221 | 221 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | if (!empty($spotter_array) && is_array($spotter_array)) |
254 | 254 | { |
255 | 255 | $nblatlong = 0; |
256 | - foreach($spotter_array as $spotter_item) |
|
256 | + foreach ($spotter_array as $spotter_item) |
|
257 | 257 | { |
258 | 258 | $j++; |
259 | 259 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | $output .= '"lastupdate": "'.$lastupdate.'",'; |
296 | 296 | $output .= '"format": "'.$spotter_item['format_source'].'",'; |
297 | 297 | if ($tracker) { |
298 | - $output.= '"type": "tracker"'; |
|
298 | + $output .= '"type": "tracker"'; |
|
299 | 299 | } elseif ($marine) { |
300 | - $output.= '"type": "marine"'; |
|
300 | + $output .= '"type": "marine"'; |
|
301 | 301 | } else { |
302 | 302 | if (isset($globalMap3DLiveries) && $globalMap3DLiveries) { |
303 | 303 | $aircraft_icao = $spotter_item['aircraft_icao']; |
@@ -311,14 +311,14 @@ discard block |
||
311 | 311 | if (isset($airline_icao)) { |
312 | 312 | $imagefile = $aircraft_icao.'-'.$airline_icao.'.png'; |
313 | 313 | if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) { |
314 | - $output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
314 | + $output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
315 | 315 | } |
316 | 316 | } |
317 | 317 | } |
318 | - if ($ident != '') $output.= '"ident": "'.$ident.'",'; |
|
318 | + if ($ident != '') $output .= '"ident": "'.$ident.'",'; |
|
319 | 319 | } |
320 | - $output.= '"gltf2": %gltf2%,'; |
|
321 | - $output.= '"type": "flight"'; |
|
320 | + $output .= '"gltf2": %gltf2%,'; |
|
321 | + $output .= '"type": "flight"'; |
|
322 | 322 | } |
323 | 323 | $output .= '},'; |
324 | 324 | |
@@ -671,8 +671,8 @@ discard block |
||
671 | 671 | $output .= '},'; |
672 | 672 | } |
673 | 673 | } |
674 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
675 | - else $output = str_replace('%onground%','false',$output); |
|
674 | + if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output); |
|
675 | + else $output = str_replace('%onground%', 'false', $output); |
|
676 | 676 | |
677 | 677 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
678 | 678 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | $output .= '"cartographicDegrees": ['; |
688 | 688 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
689 | 689 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
690 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
690 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
691 | 691 | $output .= $spotter_item['longitude'].', '; |
692 | 692 | $output .= $spotter_item['latitude']; |
693 | 693 | $prevlong = $spotter_item['longitude']; |
@@ -715,8 +715,8 @@ discard block |
||
715 | 715 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
716 | 716 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
717 | 717 | } else { |
718 | - $nblatlong = $nblatlong+1; |
|
719 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
718 | + $nblatlong = $nblatlong + 1; |
|
719 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
720 | 720 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
721 | 721 | if ($spotter_item['ground_speed'] == 0) { |
722 | 722 | $output .= $prevlong.', '; |
@@ -756,17 +756,17 @@ discard block |
||
756 | 756 | } |
757 | 757 | $output .= ']'; |
758 | 758 | if (isset($globalArchive) && $globalArchive === TRUE) { |
759 | - if ((time()-$globalLiveInterval) > $minitime) { |
|
760 | - if (time()-$globalLiveInterval > $maxitime) { |
|
761 | - $output = str_replace('%minitime%',date("c",$maxitime),$output); |
|
759 | + if ((time() - $globalLiveInterval) > $minitime) { |
|
760 | + if (time() - $globalLiveInterval > $maxitime) { |
|
761 | + $output = str_replace('%minitime%', date("c", $maxitime), $output); |
|
762 | 762 | } else { |
763 | - $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
763 | + $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
764 | 764 | } |
765 | 765 | } |
766 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
767 | -} else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
768 | -$output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
769 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
770 | -else $output = str_replace('%gltf2%','false',$output); |
|
766 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
767 | +} else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
768 | +$output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
769 | +if ($gltf2) $output = str_replace('%gltf2%', 'true', $output); |
|
770 | +else $output = str_replace('%gltf2%', 'false', $output); |
|
771 | 771 | print $output; |
772 | 772 | ?> |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * Get SQL query part for filter used |
16 | 16 | * @param Array $filter the filter |
17 | - * @return Array the SQL part |
|
17 | + * @return string the SQL part |
|
18 | 18 | */ |
19 | 19 | |
20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
@@ -467,6 +467,11 @@ discard block |
||
467 | 467 | /** |
468 | 468 | * Add identity |
469 | 469 | * |
470 | + * @param string $mmsi |
|
471 | + * @param string $imo |
|
472 | + * @param string $ident |
|
473 | + * @param string $callsign |
|
474 | + * @param string $type |
|
470 | 475 | */ |
471 | 476 | public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
472 | 477 | { |
@@ -600,25 +605,6 @@ discard block |
||
600 | 605 | * |
601 | 606 | * @param String $fammarine_id the ID |
602 | 607 | * @param String $ident the marine ident |
603 | - * @param String $departure_airport_icao the departure airport |
|
604 | - * @param String $arrival_airport_icao the arrival airport |
|
605 | - * @param String $latitude latitude of flight |
|
606 | - * @param String $longitude latitude of flight |
|
607 | - * @param String $waypoints waypoints of flight |
|
608 | - * @param String $heading heading of flight |
|
609 | - * @param String $groundspeed speed of flight |
|
610 | - * @param String $date date of flight |
|
611 | - * @param String $departure_airport_time departure time of flight |
|
612 | - * @param String $arrival_airport_time arrival time of flight |
|
613 | - * @param String $squawk squawk code of flight |
|
614 | - * @param String $route_stop route stop of flight |
|
615 | - * @param String $highlight highlight or not |
|
616 | - * @param String $ModeS ModesS code of flight |
|
617 | - * @param String $registration registration code of flight |
|
618 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
619 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
620 | - * @param String $verticalrate vertival rate of flight |
|
621 | - * @return String success or false |
|
622 | 608 | */ |
623 | 609 | 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 = '') |
624 | 610 | { |
@@ -1211,6 +1197,7 @@ discard block |
||
1211 | 1197 | /** |
1212 | 1198 | * Counts all hours |
1213 | 1199 | * |
1200 | + * @param string $orderby |
|
1214 | 1201 | * @return Array the hour list |
1215 | 1202 | * |
1216 | 1203 | */ |
@@ -1562,7 +1549,7 @@ discard block |
||
1562 | 1549 | /** |
1563 | 1550 | * Parses the direction degrees to working |
1564 | 1551 | * |
1565 | - * @param Float $direction the direction in degrees |
|
1552 | + * @param integer $direction the direction in degrees |
|
1566 | 1553 | * @return Array the direction information |
1567 | 1554 | * |
1568 | 1555 | */ |
@@ -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) { |
@@ -72,8 +76,11 @@ discard block |
||
72 | 76 | $filter_query_where .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'"; |
73 | 77 | } |
74 | 78 | } |
75 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
76 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
79 | + if ($filter_query_where == '' && $where) { |
|
80 | + $filter_query_where = ' WHERE'; |
|
81 | + } elseif ($filter_query_where != '' && $and) { |
|
82 | + $filter_query_where .= ' AND'; |
|
83 | + } |
|
77 | 84 | if ($filter_query_where != '') { |
78 | 85 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
79 | 86 | } |
@@ -127,32 +134,54 @@ discard block |
||
127 | 134 | $temp_array['spotter_id'] = $row['spotter_archive_id']; |
128 | 135 | } elseif (isset($row['spotter_archive_output_id'])) { |
129 | 136 | $temp_array['spotter_id'] = $row['spotter_archive_output_id']; |
130 | - */} |
|
131 | - elseif (isset($row['marineid'])) { |
|
137 | + */} elseif (isset($row['marineid'])) { |
|
132 | 138 | $temp_array['marine_id'] = $row['marineid']; |
133 | 139 | } else { |
134 | 140 | $temp_array['marine_id'] = ''; |
135 | 141 | } |
136 | - if (isset($row['fammarine_id'])) $temp_array['fammarine_id'] = $row['fammarine_id']; |
|
137 | - if (isset($row['mmsi'])) $temp_array['mmsi'] = $row['mmsi']; |
|
138 | - if (isset($row['type'])) $temp_array['type'] = $row['type']; |
|
139 | - if (isset($row['type_id'])) $temp_array['type_id'] = $row['type_id']; |
|
140 | - if (isset($row['ident'])) $temp_array['ident'] = $row['ident']; |
|
141 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
142 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
143 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
142 | + if (isset($row['fammarine_id'])) { |
|
143 | + $temp_array['fammarine_id'] = $row['fammarine_id']; |
|
144 | + } |
|
145 | + if (isset($row['mmsi'])) { |
|
146 | + $temp_array['mmsi'] = $row['mmsi']; |
|
147 | + } |
|
148 | + if (isset($row['type'])) { |
|
149 | + $temp_array['type'] = $row['type']; |
|
150 | + } |
|
151 | + if (isset($row['type_id'])) { |
|
152 | + $temp_array['type_id'] = $row['type_id']; |
|
153 | + } |
|
154 | + if (isset($row['ident'])) { |
|
155 | + $temp_array['ident'] = $row['ident']; |
|
156 | + } |
|
157 | + if (isset($row['latitude'])) { |
|
158 | + $temp_array['latitude'] = $row['latitude']; |
|
159 | + } |
|
160 | + if (isset($row['longitude'])) { |
|
161 | + $temp_array['longitude'] = $row['longitude']; |
|
162 | + } |
|
163 | + if (isset($row['format_source'])) { |
|
164 | + $temp_array['format_source'] = $row['format_source']; |
|
165 | + } |
|
144 | 166 | if (isset($row['heading'])) { |
145 | 167 | $temp_array['heading'] = $row['heading']; |
146 | 168 | $heading_direction = $this->parseDirection($row['heading']); |
147 | - 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']; |
|
148 | 175 | } |
149 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
150 | 176 | |
151 | 177 | if(isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
152 | 178 | { |
153 | 179 | $Image = new Image($this->db); |
154 | - if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
155 | - else $image_array = $Image->getMarineImage($temp_array['mmsi']); |
|
180 | + if (isset($temp_array['ident']) && $temp_array['ident'] != '') { |
|
181 | + $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
182 | + } else { |
|
183 | + $image_array = $Image->getMarineImage($temp_array['mmsi']); |
|
184 | + } |
|
156 | 185 | unset($Image); |
157 | 186 | if (count($image_array) > 0) { |
158 | 187 | $temp_array['image'] = $image_array[0]['image']; |
@@ -204,13 +233,21 @@ discard block |
||
204 | 233 | } |
205 | 234 | |
206 | 235 | $fromsource = NULL; |
207 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
208 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
209 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
236 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
237 | + $temp_array['source_name'] = $row['source_name']; |
|
238 | + } |
|
239 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
240 | + $temp_array['over_country'] = $row['over_country']; |
|
241 | + } |
|
242 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
243 | + $temp_array['distance'] = $row['distance']; |
|
244 | + } |
|
210 | 245 | $temp_array['query_number_rows'] = $num_rows; |
211 | 246 | $spotter_array[] = $temp_array; |
212 | 247 | } |
213 | - if ($num_rows == 0) return array(); |
|
248 | + if ($num_rows == 0) { |
|
249 | + return array(); |
|
250 | + } |
|
214 | 251 | $spotter_array[0]['query_number_rows'] = $num_rows; |
215 | 252 | return $spotter_array; |
216 | 253 | } |
@@ -236,8 +273,12 @@ discard block |
||
236 | 273 | { |
237 | 274 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
238 | 275 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
239 | - } else $limit_query = ""; |
|
240 | - } else $limit_query = ""; |
|
276 | + } else { |
|
277 | + $limit_query = ""; |
|
278 | + } |
|
279 | + } else { |
|
280 | + $limit_query = ""; |
|
281 | + } |
|
241 | 282 | if ($sort != "") |
242 | 283 | { |
243 | 284 | $search_orderby_array = $this->getOrderBy(); |
@@ -261,7 +302,9 @@ discard block |
||
261 | 302 | global $global_query; |
262 | 303 | |
263 | 304 | date_default_timezone_set('UTC'); |
264 | - if ($id == '') return array(); |
|
305 | + if ($id == '') { |
|
306 | + return array(); |
|
307 | + } |
|
265 | 308 | $additional_query = "marine_output.fammarine_id = :id"; |
266 | 309 | $query_values = array(':id' => $id); |
267 | 310 | $query = $global_query." WHERE ".$additional_query." "; |
@@ -404,8 +447,11 @@ discard block |
||
404 | 447 | $query .= " ORDER BY marine_output.source_name ASC"; |
405 | 448 | |
406 | 449 | $sth = $this->db->prepare($query); |
407 | - if (!empty($query_values)) $sth->execute($query_values); |
|
408 | - else $sth->execute(); |
|
450 | + if (!empty($query_values)) { |
|
451 | + $sth->execute($query_values); |
|
452 | + } else { |
|
453 | + $sth->execute(); |
|
454 | + } |
|
409 | 455 | |
410 | 456 | $source_array = array(); |
411 | 457 | $temp_array = array(); |
@@ -460,8 +506,11 @@ discard block |
||
460 | 506 | $sth = $this->db->prepare($query); |
461 | 507 | $sth->execute(array(':mmsi' => $mmsi)); |
462 | 508 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
463 | - if (isset($result[0])) return $result[0]; |
|
464 | - else return array(); |
|
509 | + if (isset($result[0])) { |
|
510 | + return $result[0]; |
|
511 | + } else { |
|
512 | + return array(); |
|
513 | + } |
|
465 | 514 | } |
466 | 515 | |
467 | 516 | /** |
@@ -495,7 +544,9 @@ discard block |
||
495 | 544 | date_default_timezone_set($globalTimezone); |
496 | 545 | $datetime = new DateTime(); |
497 | 546 | $offset = $datetime->format('P'); |
498 | - } else $offset = '+00:00'; |
|
547 | + } else { |
|
548 | + $offset = '+00:00'; |
|
549 | + } |
|
499 | 550 | |
500 | 551 | if ($globalDBdriver == 'mysql') { |
501 | 552 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
@@ -720,9 +771,15 @@ discard block |
||
720 | 771 | $latitude = 0; |
721 | 772 | $longitude = 0; |
722 | 773 | } |
723 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
724 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
725 | - if ($arrival_date == '') $arrival_date = NULL; |
|
774 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
775 | + $heading = 0; |
|
776 | + } |
|
777 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
778 | + $groundspeed = 0; |
|
779 | + } |
|
780 | + if ($arrival_date == '') { |
|
781 | + $arrival_date = NULL; |
|
782 | + } |
|
726 | 783 | $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) |
727 | 784 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)"; |
728 | 785 | |
@@ -830,7 +887,9 @@ discard block |
||
830 | 887 | global $globalDBdriver, $globalArchive; |
831 | 888 | //$filter_query = $this->getFilter($filters,true,true); |
832 | 889 | $Connection= new Connection($this->db); |
833 | - if (!$Connection->tableExists('countries')) return array(); |
|
890 | + if (!$Connection->tableExists('countries')) { |
|
891 | + return array(); |
|
892 | + } |
|
834 | 893 | require_once('class.SpotterLive.php'); |
835 | 894 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
836 | 895 | $MarineLive = new MarineLive($this->db); |
@@ -874,7 +933,9 @@ discard block |
||
874 | 933 | $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 "; |
875 | 934 | } |
876 | 935 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
877 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
936 | + if ($limit) { |
|
937 | + $query .= " LIMIT 10 OFFSET 0"; |
|
938 | + } |
|
878 | 939 | |
879 | 940 | $sth = $this->db->prepare($query); |
880 | 941 | $sth->execute(); |
@@ -908,12 +969,18 @@ discard block |
||
908 | 969 | $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
909 | 970 | FROM marine_output".$filter_query." marine_output.ident <> ''"; |
910 | 971 | if ($olderthanmonths > 0) { |
911 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
912 | - else $query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
972 | + if ($globalDBdriver == 'mysql') { |
|
973 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
974 | + } else { |
|
975 | + $query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
976 | + } |
|
913 | 977 | } |
914 | 978 | if ($sincedate != '') { |
915 | - if ($globalDBdriver == 'mysql') $query .= " AND marine_output.date > '".$sincedate."'"; |
|
916 | - else $query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
979 | + if ($globalDBdriver == 'mysql') { |
|
980 | + $query .= " AND marine_output.date > '".$sincedate."'"; |
|
981 | + } else { |
|
982 | + $query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
983 | + } |
|
917 | 984 | } |
918 | 985 | $query_values = array(); |
919 | 986 | if ($year != '') { |
@@ -944,7 +1011,9 @@ discard block |
||
944 | 1011 | } |
945 | 1012 | } |
946 | 1013 | $query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC"; |
947 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
1014 | + if ($limit) { |
|
1015 | + $query .= " LIMIT 10 OFFSET 0"; |
|
1016 | + } |
|
948 | 1017 | |
949 | 1018 | $sth = $this->db->prepare($query); |
950 | 1019 | $sth->execute($query_values); |
@@ -979,7 +1048,9 @@ discard block |
||
979 | 1048 | date_default_timezone_set($globalTimezone); |
980 | 1049 | $datetime = new DateTime(); |
981 | 1050 | $offset = $datetime->format('P'); |
982 | - } else $offset = '+00:00'; |
|
1051 | + } else { |
|
1052 | + $offset = '+00:00'; |
|
1053 | + } |
|
983 | 1054 | |
984 | 1055 | if ($globalDBdriver == 'mysql') { |
985 | 1056 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1029,7 +1100,9 @@ discard block |
||
1029 | 1100 | date_default_timezone_set($globalTimezone); |
1030 | 1101 | $datetime = new DateTime(); |
1031 | 1102 | $offset = $datetime->format('P'); |
1032 | - } else $offset = '+00:00'; |
|
1103 | + } else { |
|
1104 | + $offset = '+00:00'; |
|
1105 | + } |
|
1033 | 1106 | $filter_query = $this->getFilter($filters,true,true); |
1034 | 1107 | if ($globalDBdriver == 'mysql') { |
1035 | 1108 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1075,7 +1148,9 @@ discard block |
||
1075 | 1148 | date_default_timezone_set($globalTimezone); |
1076 | 1149 | $datetime = new DateTime(); |
1077 | 1150 | $offset = $datetime->format('P'); |
1078 | - } else $offset = '+00:00'; |
|
1151 | + } else { |
|
1152 | + $offset = '+00:00'; |
|
1153 | + } |
|
1079 | 1154 | $filter_query = $this->getFilter($filters,true,true); |
1080 | 1155 | if ($globalDBdriver == 'mysql') { |
1081 | 1156 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1123,7 +1198,9 @@ discard block |
||
1123 | 1198 | date_default_timezone_set($globalTimezone); |
1124 | 1199 | $datetime = new DateTime(); |
1125 | 1200 | $offset = $datetime->format('P'); |
1126 | - } else $offset = '+00:00'; |
|
1201 | + } else { |
|
1202 | + $offset = '+00:00'; |
|
1203 | + } |
|
1127 | 1204 | |
1128 | 1205 | if ($globalDBdriver == 'mysql') { |
1129 | 1206 | $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 |
@@ -1172,7 +1249,9 @@ discard block |
||
1172 | 1249 | date_default_timezone_set($globalTimezone); |
1173 | 1250 | $datetime = new DateTime(); |
1174 | 1251 | $offset = $datetime->format('P'); |
1175 | - } else $offset = '+00:00'; |
|
1252 | + } else { |
|
1253 | + $offset = '+00:00'; |
|
1254 | + } |
|
1176 | 1255 | $filter_query = $this->getFilter($filters,true,true); |
1177 | 1256 | if ($globalDBdriver == 'mysql') { |
1178 | 1257 | $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 |
@@ -1221,7 +1300,9 @@ discard block |
||
1221 | 1300 | date_default_timezone_set($globalTimezone); |
1222 | 1301 | $datetime = new DateTime(); |
1223 | 1302 | $offset = $datetime->format('P'); |
1224 | - } else $offset = '+00:00'; |
|
1303 | + } else { |
|
1304 | + $offset = '+00:00'; |
|
1305 | + } |
|
1225 | 1306 | |
1226 | 1307 | $orderby_sql = ''; |
1227 | 1308 | if ($orderby == "hour") |
@@ -1290,7 +1371,9 @@ discard block |
||
1290 | 1371 | date_default_timezone_set($globalTimezone); |
1291 | 1372 | $datetime = new DateTime($date); |
1292 | 1373 | $offset = $datetime->format('P'); |
1293 | - } else $offset = '+00:00'; |
|
1374 | + } else { |
|
1375 | + $offset = '+00:00'; |
|
1376 | + } |
|
1294 | 1377 | |
1295 | 1378 | if ($globalDBdriver == 'mysql') { |
1296 | 1379 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1338,7 +1421,9 @@ discard block |
||
1338 | 1421 | date_default_timezone_set($globalTimezone); |
1339 | 1422 | $datetime = new DateTime(); |
1340 | 1423 | $offset = $datetime->format('P'); |
1341 | - } else $offset = '+00:00'; |
|
1424 | + } else { |
|
1425 | + $offset = '+00:00'; |
|
1426 | + } |
|
1342 | 1427 | |
1343 | 1428 | if ($globalDBdriver == 'mysql') { |
1344 | 1429 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1403,8 +1488,11 @@ discard block |
||
1403 | 1488 | $query_values = array_merge($query_values,array(':month' => $month)); |
1404 | 1489 | } |
1405 | 1490 | } |
1406 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
1407 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1491 | + if (empty($query_values)) { |
|
1492 | + $queryi .= $this->getFilter($filters); |
|
1493 | + } else { |
|
1494 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1495 | + } |
|
1408 | 1496 | |
1409 | 1497 | $sth = $this->db->prepare($queryi); |
1410 | 1498 | $sth->execute($query_values); |
@@ -1441,8 +1529,11 @@ discard block |
||
1441 | 1529 | $query_values = array_merge($query_values,array(':month' => $month)); |
1442 | 1530 | } |
1443 | 1531 | } |
1444 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
1445 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1532 | + if (empty($query_values)) { |
|
1533 | + $queryi .= $this->getFilter($filters); |
|
1534 | + } else { |
|
1535 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1536 | + } |
|
1446 | 1537 | |
1447 | 1538 | $sth = $this->db->prepare($queryi); |
1448 | 1539 | $sth->execute($query_values); |
@@ -1464,7 +1555,9 @@ discard block |
||
1464 | 1555 | date_default_timezone_set($globalTimezone); |
1465 | 1556 | $datetime = new DateTime(); |
1466 | 1557 | $offset = $datetime->format('P'); |
1467 | - } else $offset = '+00:00'; |
|
1558 | + } else { |
|
1559 | + $offset = '+00:00'; |
|
1560 | + } |
|
1468 | 1561 | |
1469 | 1562 | if ($globalDBdriver == 'mysql') { |
1470 | 1563 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1568,7 +1661,9 @@ discard block |
||
1568 | 1661 | */ |
1569 | 1662 | public function parseDirection($direction = 0) |
1570 | 1663 | { |
1571 | - if ($direction == '') $direction = 0; |
|
1664 | + if ($direction == '') { |
|
1665 | + $direction = 0; |
|
1666 | + } |
|
1572 | 1667 | $direction_array = array(); |
1573 | 1668 | $temp_array = array(); |
1574 | 1669 | |
@@ -1657,7 +1752,9 @@ discard block |
||
1657 | 1752 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1658 | 1753 | |
1659 | 1754 | $Connection = new Connection($this->db); |
1660 | - if (!$Connection->tableExists('countries')) return ''; |
|
1755 | + if (!$Connection->tableExists('countries')) { |
|
1756 | + return ''; |
|
1757 | + } |
|
1661 | 1758 | |
1662 | 1759 | try { |
1663 | 1760 | /* |
@@ -1677,9 +1774,13 @@ discard block |
||
1677 | 1774 | $sth->closeCursor(); |
1678 | 1775 | if (count($row) > 0) { |
1679 | 1776 | return $row; |
1680 | - } else return ''; |
|
1777 | + } else { |
|
1778 | + return ''; |
|
1779 | + } |
|
1681 | 1780 | } catch (PDOException $e) { |
1682 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
1781 | + if (isset($globalDebug) && $globalDebug) { |
|
1782 | + echo 'Error : '.$e->getMessage()."\n"; |
|
1783 | + } |
|
1683 | 1784 | return ''; |
1684 | 1785 | } |
1685 | 1786 | |
@@ -1697,7 +1798,9 @@ discard block |
||
1697 | 1798 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
1698 | 1799 | |
1699 | 1800 | $Connection = new Connection($this->db); |
1700 | - if (!$Connection->tableExists('countries')) return ''; |
|
1801 | + if (!$Connection->tableExists('countries')) { |
|
1802 | + return ''; |
|
1803 | + } |
|
1701 | 1804 | |
1702 | 1805 | try { |
1703 | 1806 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -1709,9 +1812,13 @@ discard block |
||
1709 | 1812 | $sth->closeCursor(); |
1710 | 1813 | if (count($row) > 0) { |
1711 | 1814 | return $row; |
1712 | - } else return ''; |
|
1815 | + } else { |
|
1816 | + return ''; |
|
1817 | + } |
|
1713 | 1818 | } catch (PDOException $e) { |
1714 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
1819 | + if (isset($globalDebug) && $globalDebug) { |
|
1820 | + echo 'Error : '.$e->getMessage()."\n"; |
|
1821 | + } |
|
1715 | 1822 | return ''; |
1716 | 1823 | } |
1717 | 1824 | |
@@ -1729,7 +1836,9 @@ discard block |
||
1729 | 1836 | { |
1730 | 1837 | global $globalBitlyAccessToken; |
1731 | 1838 | |
1732 | - if ($globalBitlyAccessToken == '') return $url; |
|
1839 | + if ($globalBitlyAccessToken == '') { |
|
1840 | + return $url; |
|
1841 | + } |
|
1733 | 1842 | |
1734 | 1843 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
1735 | 1844 | |
@@ -1805,7 +1914,9 @@ discard block |
||
1805 | 1914 | } |
1806 | 1915 | } |
1807 | 1916 | $query .= " GROUP BY marine_output.type ORDER BY marine_type_count DESC"; |
1808 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
1917 | + if ($limit) { |
|
1918 | + $query .= " LIMIT 10 OFFSET 0"; |
|
1919 | + } |
|
1809 | 1920 | $sth = $this->db->prepare($query); |
1810 | 1921 | $sth->execute($query_values); |
1811 | 1922 | $marine_array = array(); |
@@ -1842,9 +1953,15 @@ discard block |
||
1842 | 1953 | foreach ($q_array as $q_item){ |
1843 | 1954 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
1844 | 1955 | $additional_query .= " AND ("; |
1845 | - if (is_int($q_item)) $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
|
1846 | - if (is_int($q_item)) $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
|
1847 | - if (is_int($q_item)) $additional_query .= "(marine_output.imo = '".$q_item."') OR "; |
|
1956 | + if (is_int($q_item)) { |
|
1957 | + $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
|
1958 | + } |
|
1959 | + if (is_int($q_item)) { |
|
1960 | + $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
|
1961 | + } |
|
1962 | + if (is_int($q_item)) { |
|
1963 | + $additional_query .= "(marine_output.imo = '".$q_item."') OR "; |
|
1964 | + } |
|
1848 | 1965 | $additional_query .= "(marine_output.ident like '%".$q_item."%') OR "; |
1849 | 1966 | $additional_query .= ")"; |
1850 | 1967 | } |
@@ -1892,7 +2009,9 @@ discard block |
||
1892 | 2009 | date_default_timezone_set($globalTimezone); |
1893 | 2010 | $datetime = new DateTime(); |
1894 | 2011 | $offset = $datetime->format('P'); |
1895 | - } else $offset = '+00:00'; |
|
2012 | + } else { |
|
2013 | + $offset = '+00:00'; |
|
2014 | + } |
|
1896 | 2015 | if ($date_array[1] != "") |
1897 | 2016 | { |
1898 | 2017 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
@@ -1919,8 +2038,12 @@ discard block |
||
1919 | 2038 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1920 | 2039 | { |
1921 | 2040 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
1922 | - } else $limit_query = ""; |
|
1923 | - } else $limit_query = ""; |
|
2041 | + } else { |
|
2042 | + $limit_query = ""; |
|
2043 | + } |
|
2044 | + } else { |
|
2045 | + $limit_query = ""; |
|
2046 | + } |
|
1924 | 2047 | if ($sort != "") |
1925 | 2048 | { |
1926 | 2049 | $search_orderby_array = $this->getOrderBy(); |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
15 | - * Get SQL query part for filter used |
|
16 | - * @param Array $filter the filter |
|
17 | - * @return Array the SQL part |
|
18 | - */ |
|
15 | + * Get SQL query part for filter used |
|
16 | + * @param Array $filter the filter |
|
17 | + * @return Array the SQL part |
|
18 | + */ |
|
19 | 19 | |
20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
85 | - * Executes the SQL statements to get the spotter information |
|
86 | - * |
|
87 | - * @param String $query the SQL query |
|
88 | - * @param Array $params parameter of the query |
|
89 | - * @param String $limitQuery the limit query |
|
90 | - * @return Array the spotter information |
|
91 | - * |
|
92 | - */ |
|
85 | + * Executes the SQL statements to get the spotter information |
|
86 | + * |
|
87 | + * @param String $query the SQL query |
|
88 | + * @param Array $params parameter of the query |
|
89 | + * @param String $limitQuery the limit query |
|
90 | + * @return Array the spotter information |
|
91 | + * |
|
92 | + */ |
|
93 | 93 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
94 | 94 | { |
95 | 95 | date_default_timezone_set('UTC'); |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | |
218 | 218 | |
219 | 219 | /** |
220 | - * Gets all the spotter information based on the latest data entry |
|
221 | - * |
|
222 | - * @return Array the spotter information |
|
223 | - * |
|
224 | - */ |
|
220 | + * Gets all the spotter information based on the latest data entry |
|
221 | + * |
|
222 | + * @return Array the spotter information |
|
223 | + * |
|
224 | + */ |
|
225 | 225 | public function getLatestMarineData($limit = '', $sort = '', $filter = array()) |
226 | 226 | { |
227 | 227 | global $global_query; |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
273 | - * Gets all the spotter information based on the callsign |
|
274 | - * |
|
275 | - * @return Array the spotter information |
|
276 | - * |
|
277 | - */ |
|
273 | + * Gets all the spotter information based on the callsign |
|
274 | + * |
|
275 | + * @return Array the spotter information |
|
276 | + * |
|
277 | + */ |
|
278 | 278 | public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
279 | 279 | { |
280 | 280 | global $global_query; |
@@ -385,12 +385,12 @@ discard block |
||
385 | 385 | |
386 | 386 | |
387 | 387 | /** |
388 | - * Gets all source name |
|
389 | - * |
|
390 | - * @param String type format of source |
|
391 | - * @return Array list of source name |
|
392 | - * |
|
393 | - */ |
|
388 | + * Gets all source name |
|
389 | + * |
|
390 | + * @param String type format of source |
|
391 | + * @return Array list of source name |
|
392 | + * |
|
393 | + */ |
|
394 | 394 | public function getAllSourceName($type = '',$filters = array()) |
395 | 395 | { |
396 | 396 | $filter_query = $this->getFilter($filters,true,true); |
@@ -420,11 +420,11 @@ discard block |
||
420 | 420 | |
421 | 421 | |
422 | 422 | /** |
423 | - * Gets a list of all idents/callsigns |
|
424 | - * |
|
425 | - * @return Array list of ident/callsign names |
|
426 | - * |
|
427 | - */ |
|
423 | + * Gets a list of all idents/callsigns |
|
424 | + * |
|
425 | + * @return Array list of ident/callsign names |
|
426 | + * |
|
427 | + */ |
|
428 | 428 | public function getAllIdents($filters = array()) |
429 | 429 | { |
430 | 430 | $filter_query = $this->getFilter($filters,true,true); |
@@ -448,11 +448,11 @@ discard block |
||
448 | 448 | } |
449 | 449 | |
450 | 450 | /** |
451 | - * Gets all info from a mmsi |
|
452 | - * |
|
453 | - * @return Array ident |
|
454 | - * |
|
455 | - */ |
|
451 | + * Gets all info from a mmsi |
|
452 | + * |
|
453 | + * @return Array ident |
|
454 | + * |
|
455 | + */ |
|
456 | 456 | public function getIdentity($mmsi) |
457 | 457 | { |
458 | 458 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -465,9 +465,9 @@ discard block |
||
465 | 465 | } |
466 | 466 | |
467 | 467 | /** |
468 | - * Add identity |
|
469 | - * |
|
470 | - */ |
|
468 | + * Add identity |
|
469 | + * |
|
470 | + */ |
|
471 | 471 | public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
472 | 472 | { |
473 | 473 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -533,13 +533,13 @@ discard block |
||
533 | 533 | } |
534 | 534 | |
535 | 535 | /** |
536 | - * Update ident tracker data |
|
537 | - * |
|
538 | - * @param String $fammarine_id the ID |
|
539 | - * @param String $ident the marine ident |
|
540 | - * @return String success or false |
|
541 | - * |
|
542 | - */ |
|
536 | + * Update ident tracker data |
|
537 | + * |
|
538 | + * @param String $fammarine_id the ID |
|
539 | + * @param String $ident the marine ident |
|
540 | + * @return String success or false |
|
541 | + * |
|
542 | + */ |
|
543 | 543 | public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
544 | 544 | { |
545 | 545 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
@@ -554,19 +554,19 @@ discard block |
||
554 | 554 | } |
555 | 555 | |
556 | 556 | /** |
557 | - * Update Status data |
|
558 | - * |
|
559 | - * @param String $fammarine_id the ID |
|
560 | - * @param String $status_id the marine status id |
|
561 | - * @param String $status the marine status |
|
562 | - * @return String success or false |
|
563 | - * |
|
564 | - */ |
|
557 | + * Update Status data |
|
558 | + * |
|
559 | + * @param String $fammarine_id the ID |
|
560 | + * @param String $status_id the marine status id |
|
561 | + * @param String $status the marine status |
|
562 | + * @return String success or false |
|
563 | + * |
|
564 | + */ |
|
565 | 565 | public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
566 | 566 | { |
567 | 567 | |
568 | 568 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
569 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
569 | + $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
570 | 570 | |
571 | 571 | try { |
572 | 572 | $sth = $this->db->prepare($query); |
@@ -579,17 +579,17 @@ discard block |
||
579 | 579 | |
580 | 580 | } |
581 | 581 | /** |
582 | - * Update latest marine data |
|
583 | - * |
|
584 | - * @param String $fammarine_id the ID |
|
585 | - * @param String $ident the marine ident |
|
586 | - * @return String success or false |
|
587 | - * |
|
588 | - */ |
|
582 | + * Update latest marine data |
|
583 | + * |
|
584 | + * @param String $fammarine_id the ID |
|
585 | + * @param String $ident the marine ident |
|
586 | + * @return String success or false |
|
587 | + * |
|
588 | + */ |
|
589 | 589 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
590 | 590 | { |
591 | 591 | $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'; |
592 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
592 | + $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
593 | 593 | |
594 | 594 | try { |
595 | 595 | $sth = $this->db->prepare($query); |
@@ -603,30 +603,30 @@ discard block |
||
603 | 603 | } |
604 | 604 | |
605 | 605 | /** |
606 | - * Adds a new spotter data |
|
607 | - * |
|
608 | - * @param String $fammarine_id the ID |
|
609 | - * @param String $ident the marine ident |
|
610 | - * @param String $departure_airport_icao the departure airport |
|
611 | - * @param String $arrival_airport_icao the arrival airport |
|
612 | - * @param String $latitude latitude of flight |
|
613 | - * @param String $longitude latitude of flight |
|
614 | - * @param String $waypoints waypoints of flight |
|
615 | - * @param String $heading heading of flight |
|
616 | - * @param String $groundspeed speed of flight |
|
617 | - * @param String $date date of flight |
|
618 | - * @param String $departure_airport_time departure time of flight |
|
619 | - * @param String $arrival_airport_time arrival time of flight |
|
620 | - * @param String $squawk squawk code of flight |
|
621 | - * @param String $route_stop route stop of flight |
|
622 | - * @param String $highlight highlight or not |
|
623 | - * @param String $ModeS ModesS code of flight |
|
624 | - * @param String $registration registration code of flight |
|
625 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
626 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
627 | - * @param String $verticalrate vertival rate of flight |
|
628 | - * @return String success or false |
|
629 | - */ |
|
606 | + * Adds a new spotter data |
|
607 | + * |
|
608 | + * @param String $fammarine_id the ID |
|
609 | + * @param String $ident the marine ident |
|
610 | + * @param String $departure_airport_icao the departure airport |
|
611 | + * @param String $arrival_airport_icao the arrival airport |
|
612 | + * @param String $latitude latitude of flight |
|
613 | + * @param String $longitude latitude of flight |
|
614 | + * @param String $waypoints waypoints of flight |
|
615 | + * @param String $heading heading of flight |
|
616 | + * @param String $groundspeed speed of flight |
|
617 | + * @param String $date date of flight |
|
618 | + * @param String $departure_airport_time departure time of flight |
|
619 | + * @param String $arrival_airport_time arrival time of flight |
|
620 | + * @param String $squawk squawk code of flight |
|
621 | + * @param String $route_stop route stop of flight |
|
622 | + * @param String $highlight highlight or not |
|
623 | + * @param String $ModeS ModesS code of flight |
|
624 | + * @param String $registration registration code of flight |
|
625 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
626 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
627 | + * @param String $verticalrate vertival rate of flight |
|
628 | + * @return String success or false |
|
629 | + */ |
|
630 | 630 | 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 = '') |
631 | 631 | { |
632 | 632 | global $globalURL, $globalMarineImageFetch; |
@@ -723,13 +723,13 @@ discard block |
||
723 | 723 | unset($Image); |
724 | 724 | } |
725 | 725 | |
726 | - if ($latitude == '' && $longitude == '') { |
|
727 | - $latitude = 0; |
|
728 | - $longitude = 0; |
|
729 | - } |
|
730 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
731 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
732 | - if ($arrival_date == '') $arrival_date = NULL; |
|
726 | + if ($latitude == '' && $longitude == '') { |
|
727 | + $latitude = 0; |
|
728 | + $longitude = 0; |
|
729 | + } |
|
730 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
731 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
732 | + if ($arrival_date == '') $arrival_date = NULL; |
|
733 | 733 | $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) |
734 | 734 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)"; |
735 | 735 | |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | $sth->execute($query_values); |
741 | 741 | $this->db = null; |
742 | 742 | } catch (PDOException $e) { |
743 | - return "error : ".$e->getMessage(); |
|
743 | + return "error : ".$e->getMessage(); |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | return "success"; |
@@ -749,11 +749,11 @@ discard block |
||
749 | 749 | |
750 | 750 | |
751 | 751 | /** |
752 | - * Gets the aircraft ident within the last hour |
|
753 | - * |
|
754 | - * @return String the ident |
|
755 | - * |
|
756 | - */ |
|
752 | + * Gets the aircraft ident within the last hour |
|
753 | + * |
|
754 | + * @return String the ident |
|
755 | + * |
|
756 | + */ |
|
757 | 757 | public function getIdentFromLastHour($ident) |
758 | 758 | { |
759 | 759 | global $globalDBdriver, $globalTimezone; |
@@ -769,11 +769,11 @@ discard block |
||
769 | 769 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
770 | 770 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
771 | 771 | $query_data = array(':ident' => $ident); |
772 | - } |
|
772 | + } |
|
773 | 773 | |
774 | 774 | $sth = $this->db->prepare($query); |
775 | 775 | $sth->execute($query_data); |
776 | - $ident_result=''; |
|
776 | + $ident_result=''; |
|
777 | 777 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
778 | 778 | { |
779 | 779 | $ident_result = $row['ident']; |
@@ -784,11 +784,11 @@ discard block |
||
784 | 784 | |
785 | 785 | |
786 | 786 | /** |
787 | - * Gets the aircraft data from the last 20 seconds |
|
788 | - * |
|
789 | - * @return Array the spotter data |
|
790 | - * |
|
791 | - */ |
|
787 | + * Gets the aircraft data from the last 20 seconds |
|
788 | + * |
|
789 | + * @return Array the spotter data |
|
790 | + * |
|
791 | + */ |
|
792 | 792 | public function getRealTimeData($q = '') |
793 | 793 | { |
794 | 794 | global $globalDBdriver; |
@@ -826,11 +826,11 @@ discard block |
||
826 | 826 | |
827 | 827 | |
828 | 828 | /** |
829 | - * Gets all number of flight over countries |
|
830 | - * |
|
831 | - * @return Array the airline country list |
|
832 | - * |
|
833 | - */ |
|
829 | + * Gets all number of flight over countries |
|
830 | + * |
|
831 | + * @return Array the airline country list |
|
832 | + * |
|
833 | + */ |
|
834 | 834 | |
835 | 835 | public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
836 | 836 | { |
@@ -903,11 +903,11 @@ discard block |
||
903 | 903 | |
904 | 904 | |
905 | 905 | /** |
906 | - * Gets all callsigns that have flown over |
|
907 | - * |
|
908 | - * @return Array the callsign list |
|
909 | - * |
|
910 | - */ |
|
906 | + * Gets all callsigns that have flown over |
|
907 | + * |
|
908 | + * @return Array the callsign list |
|
909 | + * |
|
910 | + */ |
|
911 | 911 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
912 | 912 | { |
913 | 913 | global $globalDBdriver; |
@@ -974,11 +974,11 @@ discard block |
||
974 | 974 | |
975 | 975 | |
976 | 976 | /** |
977 | - * Counts all dates |
|
978 | - * |
|
979 | - * @return Array the date list |
|
980 | - * |
|
981 | - */ |
|
977 | + * Counts all dates |
|
978 | + * |
|
979 | + * @return Array the date list |
|
980 | + * |
|
981 | + */ |
|
982 | 982 | public function countAllDates($filters = array()) |
983 | 983 | { |
984 | 984 | global $globalTimezone, $globalDBdriver; |
@@ -1024,11 +1024,11 @@ discard block |
||
1024 | 1024 | |
1025 | 1025 | |
1026 | 1026 | /** |
1027 | - * Counts all dates during the last 7 days |
|
1028 | - * |
|
1029 | - * @return Array the date list |
|
1030 | - * |
|
1031 | - */ |
|
1027 | + * Counts all dates during the last 7 days |
|
1028 | + * |
|
1029 | + * @return Array the date list |
|
1030 | + * |
|
1031 | + */ |
|
1032 | 1032 | public function countAllDatesLast7Days($filters = array()) |
1033 | 1033 | { |
1034 | 1034 | global $globalTimezone, $globalDBdriver; |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | $query .= " GROUP BY date_name |
1051 | 1051 | ORDER BY date_name ASC"; |
1052 | 1052 | $query_data = array(':offset' => $offset); |
1053 | - } |
|
1053 | + } |
|
1054 | 1054 | |
1055 | 1055 | $sth = $this->db->prepare($query); |
1056 | 1056 | $sth->execute($query_data); |
@@ -1070,11 +1070,11 @@ discard block |
||
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | /** |
1073 | - * Counts all dates during the last month |
|
1074 | - * |
|
1075 | - * @return Array the date list |
|
1076 | - * |
|
1077 | - */ |
|
1073 | + * Counts all dates during the last month |
|
1074 | + * |
|
1075 | + * @return Array the date list |
|
1076 | + * |
|
1077 | + */ |
|
1078 | 1078 | public function countAllDatesLastMonth($filters = array()) |
1079 | 1079 | { |
1080 | 1080 | global $globalTimezone, $globalDBdriver; |
@@ -1096,7 +1096,7 @@ discard block |
||
1096 | 1096 | $query .= " GROUP BY date_name |
1097 | 1097 | ORDER BY date_name ASC"; |
1098 | 1098 | $query_data = array(':offset' => $offset); |
1099 | - } |
|
1099 | + } |
|
1100 | 1100 | |
1101 | 1101 | $sth = $this->db->prepare($query); |
1102 | 1102 | $sth->execute($query_data); |
@@ -1118,11 +1118,11 @@ discard block |
||
1118 | 1118 | |
1119 | 1119 | |
1120 | 1120 | /** |
1121 | - * Counts all month |
|
1122 | - * |
|
1123 | - * @return Array the month list |
|
1124 | - * |
|
1125 | - */ |
|
1121 | + * Counts all month |
|
1122 | + * |
|
1123 | + * @return Array the month list |
|
1124 | + * |
|
1125 | + */ |
|
1126 | 1126 | public function countAllMonths($filters = array()) |
1127 | 1127 | { |
1128 | 1128 | global $globalTimezone, $globalDBdriver; |
@@ -1167,11 +1167,11 @@ discard block |
||
1167 | 1167 | |
1168 | 1168 | |
1169 | 1169 | /** |
1170 | - * Counts all dates during the last year |
|
1171 | - * |
|
1172 | - * @return Array the date list |
|
1173 | - * |
|
1174 | - */ |
|
1170 | + * Counts all dates during the last year |
|
1171 | + * |
|
1172 | + * @return Array the date list |
|
1173 | + * |
|
1174 | + */ |
|
1175 | 1175 | public function countAllMonthsLastYear($filters) |
1176 | 1176 | { |
1177 | 1177 | global $globalTimezone, $globalDBdriver; |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | $query .= " GROUP BY year_name, month_name |
1194 | 1194 | ORDER BY year_name, month_name ASC"; |
1195 | 1195 | $query_data = array(':offset' => $offset); |
1196 | - } |
|
1196 | + } |
|
1197 | 1197 | |
1198 | 1198 | $sth = $this->db->prepare($query); |
1199 | 1199 | $sth->execute($query_data); |
@@ -1216,11 +1216,11 @@ discard block |
||
1216 | 1216 | |
1217 | 1217 | |
1218 | 1218 | /** |
1219 | - * Counts all hours |
|
1220 | - * |
|
1221 | - * @return Array the hour list |
|
1222 | - * |
|
1223 | - */ |
|
1219 | + * Counts all hours |
|
1220 | + * |
|
1221 | + * @return Array the hour list |
|
1222 | + * |
|
1223 | + */ |
|
1224 | 1224 | public function countAllHours($orderby,$filters = array()) |
1225 | 1225 | { |
1226 | 1226 | global $globalTimezone, $globalDBdriver; |
@@ -1283,11 +1283,11 @@ discard block |
||
1283 | 1283 | |
1284 | 1284 | |
1285 | 1285 | /** |
1286 | - * Counts all hours by date |
|
1287 | - * |
|
1288 | - * @return Array the hour list |
|
1289 | - * |
|
1290 | - */ |
|
1286 | + * Counts all hours by date |
|
1287 | + * |
|
1288 | + * @return Array the hour list |
|
1289 | + * |
|
1290 | + */ |
|
1291 | 1291 | public function countAllHoursByDate($date, $filters = array()) |
1292 | 1292 | { |
1293 | 1293 | global $globalTimezone, $globalDBdriver; |
@@ -1331,11 +1331,11 @@ discard block |
||
1331 | 1331 | |
1332 | 1332 | |
1333 | 1333 | /** |
1334 | - * Counts all hours by a ident/callsign |
|
1335 | - * |
|
1336 | - * @return Array the hour list |
|
1337 | - * |
|
1338 | - */ |
|
1334 | + * Counts all hours by a ident/callsign |
|
1335 | + * |
|
1336 | + * @return Array the hour list |
|
1337 | + * |
|
1338 | + */ |
|
1339 | 1339 | public function countAllHoursByIdent($ident, $filters = array()) |
1340 | 1340 | { |
1341 | 1341 | global $globalTimezone, $globalDBdriver; |
@@ -1380,11 +1380,11 @@ discard block |
||
1380 | 1380 | |
1381 | 1381 | |
1382 | 1382 | /** |
1383 | - * Counts all vessels |
|
1384 | - * |
|
1385 | - * @return Integer the number of vessels |
|
1386 | - * |
|
1387 | - */ |
|
1383 | + * Counts all vessels |
|
1384 | + * |
|
1385 | + * @return Integer the number of vessels |
|
1386 | + * |
|
1387 | + */ |
|
1388 | 1388 | public function countOverallMarine($filters = array(),$year = '',$month = '') |
1389 | 1389 | { |
1390 | 1390 | global $globalDBdriver; |
@@ -1419,11 +1419,11 @@ discard block |
||
1419 | 1419 | } |
1420 | 1420 | |
1421 | 1421 | /** |
1422 | - * Counts all vessel type |
|
1423 | - * |
|
1424 | - * @return Integer the number of vessels |
|
1425 | - * |
|
1426 | - */ |
|
1422 | + * Counts all vessel type |
|
1423 | + * |
|
1424 | + * @return Integer the number of vessels |
|
1425 | + * |
|
1426 | + */ |
|
1427 | 1427 | public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
1428 | 1428 | { |
1429 | 1429 | global $globalDBdriver; |
@@ -1458,11 +1458,11 @@ discard block |
||
1458 | 1458 | |
1459 | 1459 | |
1460 | 1460 | /** |
1461 | - * Counts all hours of today |
|
1462 | - * |
|
1463 | - * @return Array the hour list |
|
1464 | - * |
|
1465 | - */ |
|
1461 | + * Counts all hours of today |
|
1462 | + * |
|
1463 | + * @return Array the hour list |
|
1464 | + * |
|
1465 | + */ |
|
1466 | 1466 | public function countAllHoursFromToday($filters = array()) |
1467 | 1467 | { |
1468 | 1468 | global $globalTimezone, $globalDBdriver; |
@@ -1502,12 +1502,12 @@ discard block |
||
1502 | 1502 | } |
1503 | 1503 | |
1504 | 1504 | |
1505 | - /** |
|
1506 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
1507 | - * |
|
1508 | - * @return Integer the Barrie Spotter ID |
|
1505 | + /** |
|
1506 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
1507 | + * |
|
1508 | + * @return Integer the Barrie Spotter ID |
|
1509 | 1509 | q * |
1510 | - */ |
|
1510 | + */ |
|
1511 | 1511 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
1512 | 1512 | { |
1513 | 1513 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -1528,13 +1528,13 @@ discard block |
||
1528 | 1528 | |
1529 | 1529 | |
1530 | 1530 | /** |
1531 | - * Parses a date string |
|
1532 | - * |
|
1533 | - * @param String $dateString the date string |
|
1534 | - * @param String $timezone the timezone of a user |
|
1535 | - * @return Array the time information |
|
1536 | - * |
|
1537 | - */ |
|
1531 | + * Parses a date string |
|
1532 | + * |
|
1533 | + * @param String $dateString the date string |
|
1534 | + * @param String $timezone the timezone of a user |
|
1535 | + * @return Array the time information |
|
1536 | + * |
|
1537 | + */ |
|
1538 | 1538 | public function parseDateString($dateString, $timezone = '') |
1539 | 1539 | { |
1540 | 1540 | $time_array = array(); |
@@ -1567,12 +1567,12 @@ discard block |
||
1567 | 1567 | } |
1568 | 1568 | |
1569 | 1569 | /** |
1570 | - * Parses the direction degrees to working |
|
1571 | - * |
|
1572 | - * @param Float $direction the direction in degrees |
|
1573 | - * @return Array the direction information |
|
1574 | - * |
|
1575 | - */ |
|
1570 | + * Parses the direction degrees to working |
|
1571 | + * |
|
1572 | + * @param Float $direction the direction in degrees |
|
1573 | + * @return Array the direction information |
|
1574 | + * |
|
1575 | + */ |
|
1576 | 1576 | public function parseDirection($direction = 0) |
1577 | 1577 | { |
1578 | 1578 | if ($direction == '') $direction = 0; |
@@ -1651,12 +1651,12 @@ discard block |
||
1651 | 1651 | |
1652 | 1652 | |
1653 | 1653 | /** |
1654 | - * Gets Country from latitude/longitude |
|
1655 | - * |
|
1656 | - * @param Float $latitude latitute of the flight |
|
1657 | - * @param Float $longitude longitute of the flight |
|
1658 | - * @return String the countrie |
|
1659 | - */ |
|
1654 | + * Gets Country from latitude/longitude |
|
1655 | + * |
|
1656 | + * @param Float $latitude latitute of the flight |
|
1657 | + * @param Float $longitude longitute of the flight |
|
1658 | + * @return String the countrie |
|
1659 | + */ |
|
1660 | 1660 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
1661 | 1661 | { |
1662 | 1662 | global $globalDBdriver, $globalDebug; |
@@ -1693,11 +1693,11 @@ discard block |
||
1693 | 1693 | } |
1694 | 1694 | |
1695 | 1695 | /** |
1696 | - * Gets Country from iso2 |
|
1697 | - * |
|
1698 | - * @param String $iso2 ISO2 country code |
|
1699 | - * @return String the countrie |
|
1700 | - */ |
|
1696 | + * Gets Country from iso2 |
|
1697 | + * |
|
1698 | + * @param String $iso2 ISO2 country code |
|
1699 | + * @return String the countrie |
|
1700 | + */ |
|
1701 | 1701 | public function getCountryFromISO2($iso2) |
1702 | 1702 | { |
1703 | 1703 | global $globalDBdriver, $globalDebug; |
@@ -1726,12 +1726,12 @@ discard block |
||
1726 | 1726 | |
1727 | 1727 | |
1728 | 1728 | /** |
1729 | - * Gets the short url from bit.ly |
|
1730 | - * |
|
1731 | - * @param String $url the full url |
|
1732 | - * @return String the bit.ly url |
|
1733 | - * |
|
1734 | - */ |
|
1729 | + * Gets the short url from bit.ly |
|
1730 | + * |
|
1731 | + * @param String $url the full url |
|
1732 | + * @return String the bit.ly url |
|
1733 | + * |
|
1734 | + */ |
|
1735 | 1735 | public function getBitlyURL($url) |
1736 | 1736 | { |
1737 | 1737 | global $globalBitlyAccessToken; |
@@ -1758,11 +1758,11 @@ discard block |
||
1758 | 1758 | |
1759 | 1759 | |
1760 | 1760 | /** |
1761 | - * Gets all vessels types that have flown over |
|
1762 | - * |
|
1763 | - * @return Array the vessel type list |
|
1764 | - * |
|
1765 | - */ |
|
1761 | + * Gets all vessels types that have flown over |
|
1762 | + * |
|
1763 | + * @return Array the vessel type list |
|
1764 | + * |
|
1765 | + */ |
|
1766 | 1766 | public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
1767 | 1767 | { |
1768 | 1768 | global $globalDBdriver; |
@@ -1827,11 +1827,11 @@ discard block |
||
1827 | 1827 | } |
1828 | 1828 | |
1829 | 1829 | /** |
1830 | - * Gets all the tracker information |
|
1831 | - * |
|
1832 | - * @return Array the tracker information |
|
1833 | - * |
|
1834 | - */ |
|
1830 | + * Gets all the tracker information |
|
1831 | + * |
|
1832 | + * @return Array the tracker information |
|
1833 | + * |
|
1834 | + */ |
|
1835 | 1835 | public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
1836 | 1836 | { |
1837 | 1837 | global $globalTimezone, $globalDBdriver; |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | require_once(dirname(__FILE__).'/class.Image.php'); |
3 | 3 | $global_query = "SELECT marine_output.* FROM marine_output"; |
4 | 4 | |
5 | -class Marine{ |
|
5 | +class Marine { |
|
6 | 6 | public $db; |
7 | 7 | |
8 | 8 | public function __construct($dbc = null) { |
@@ -17,33 +17,33 @@ discard block |
||
17 | 17 | * @return Array the SQL part |
18 | 18 | */ |
19 | 19 | |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
40 | 40 | } else { |
41 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
47 | 47 | } |
48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
76 | 76 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
77 | 77 | if ($filter_query_where != '') { |
78 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
78 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
79 | 79 | } |
80 | 80 | $filter_query = $filter_query_join.$filter_query_where; |
81 | 81 | return $filter_query; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @return Array the spotter information |
91 | 91 | * |
92 | 92 | */ |
93 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
93 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
94 | 94 | { |
95 | 95 | date_default_timezone_set('UTC'); |
96 | 96 | if (!is_string($query)) |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | $sth = $this->db->prepare($query.$limitQuery); |
111 | 111 | $sth->execute($params); |
112 | 112 | } catch (PDOException $e) { |
113 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
113 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
114 | 114 | exit(); |
115 | 115 | } |
116 | 116 | |
117 | 117 | $num_rows = 0; |
118 | 118 | $spotter_array = array(); |
119 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
119 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
120 | 120 | { |
121 | 121 | $num_rows++; |
122 | 122 | $temp_array = array(); |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | } |
149 | 149 | if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
150 | 150 | |
151 | - if(isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
|
151 | + if (isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
|
152 | 152 | { |
153 | 153 | $Image = new Image($this->db); |
154 | - if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
154 | + if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'], '', $temp_array['ident']); |
|
155 | 155 | else $image_array = $Image->getMarineImage($temp_array['mmsi']); |
156 | 156 | unset($Image); |
157 | 157 | if (count($image_array) > 0) { |
@@ -187,17 +187,17 @@ discard block |
||
187 | 187 | { |
188 | 188 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
189 | 189 | } else { |
190 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
190 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
191 | 191 | } |
192 | 192 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
193 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
194 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
193 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
194 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
195 | 195 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
196 | 196 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
197 | 197 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
198 | 198 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
199 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
200 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
199 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
200 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
201 | 201 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
202 | 202 | } |
203 | 203 | } |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | if ($limit != "") |
231 | 231 | { |
232 | 232 | $limit_array = explode(",", $limit); |
233 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
234 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
233 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
234 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
235 | 235 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
236 | 236 | { |
237 | 237 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | } else { |
246 | 246 | $orderby_query = " ORDER BY marine_output.date DESC"; |
247 | 247 | } |
248 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
249 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
248 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
249 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
250 | 250 | return $spotter_array; |
251 | 251 | } |
252 | 252 | |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | if ($id == '') return array(); |
265 | 265 | $additional_query = "marine_output.fammarine_id = :id"; |
266 | 266 | $query_values = array(':id' => $id); |
267 | - $query = $global_query." WHERE ".$additional_query." "; |
|
268 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
267 | + $query = $global_query." WHERE ".$additional_query." "; |
|
268 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
269 | 269 | return $spotter_array; |
270 | 270 | } |
271 | 271 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $query_values = array(); |
285 | 285 | $limit_query = ''; |
286 | 286 | $additional_query = ''; |
287 | - $filter_query = $this->getFilter($filter,true,true); |
|
287 | + $filter_query = $this->getFilter($filter, true, true); |
|
288 | 288 | if ($ident != "") |
289 | 289 | { |
290 | 290 | if (!is_string($ident)) |
@@ -300,8 +300,8 @@ discard block |
||
300 | 300 | { |
301 | 301 | $limit_array = explode(",", $limit); |
302 | 302 | |
303 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
304 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
303 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
304 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
305 | 305 | |
306 | 306 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
307 | 307 | { |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | return $spotter_array; |
326 | 326 | } |
327 | 327 | |
328 | - public function getMarineDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
328 | + public function getMarineDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
329 | 329 | { |
330 | 330 | global $global_query, $globalTimezone, $globalDBdriver; |
331 | 331 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $limit_query = ''; |
334 | 334 | $additional_query = ''; |
335 | 335 | |
336 | - $filter_query = $this->getFilter($filter,true,true); |
|
336 | + $filter_query = $this->getFilter($filter, true, true); |
|
337 | 337 | |
338 | 338 | if ($date != "") |
339 | 339 | { |
@@ -359,8 +359,8 @@ discard block |
||
359 | 359 | { |
360 | 360 | $limit_array = explode(",", $limit); |
361 | 361 | |
362 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
363 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
362 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
363 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
364 | 364 | |
365 | 365 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
366 | 366 | { |
@@ -391,11 +391,11 @@ discard block |
||
391 | 391 | * @return Array list of source name |
392 | 392 | * |
393 | 393 | */ |
394 | - public function getAllSourceName($type = '',$filters = array()) |
|
394 | + public function getAllSourceName($type = '', $filters = array()) |
|
395 | 395 | { |
396 | - $filter_query = $this->getFilter($filters,true,true); |
|
396 | + $filter_query = $this->getFilter($filters, true, true); |
|
397 | 397 | $query_values = array(); |
398 | - $query = "SELECT DISTINCT marine_output.source_name |
|
398 | + $query = "SELECT DISTINCT marine_output.source_name |
|
399 | 399 | FROM marine_output".$filter_query." marine_output.source_name <> ''"; |
400 | 400 | if ($type != '') { |
401 | 401 | $query_values = array(':type' => $type); |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | $source_array = array(); |
411 | 411 | $temp_array = array(); |
412 | 412 | |
413 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
413 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
414 | 414 | { |
415 | 415 | $temp_array['source_name'] = $row['source_name']; |
416 | 416 | $source_array[] = $temp_array; |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | */ |
428 | 428 | public function getAllIdents($filters = array()) |
429 | 429 | { |
430 | - $filter_query = $this->getFilter($filters,true,true); |
|
431 | - $query = "SELECT DISTINCT marine_output.ident |
|
430 | + $filter_query = $this->getFilter($filters, true, true); |
|
431 | + $query = "SELECT DISTINCT marine_output.ident |
|
432 | 432 | FROM marine_output".$filter_query." marine_output.ident <> '' |
433 | 433 | ORDER BY marine_output.date ASC LIMIT 700 OFFSET 0"; |
434 | 434 | |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $ident_array = array(); |
439 | 439 | $temp_array = array(); |
440 | 440 | |
441 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
441 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
442 | 442 | { |
443 | 443 | $temp_array['ident'] = $row['ident']; |
444 | 444 | $ident_array[] = $temp_array; |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | */ |
456 | 456 | public function getIdentity($mmsi) |
457 | 457 | { |
458 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
458 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
459 | 459 | $query = "SELECT * FROM marine_identity WHERE mmsi = :mmsi LIMIT 1"; |
460 | 460 | $sth = $this->db->prepare($query); |
461 | 461 | $sth->execute(array(':mmsi' => $mmsi)); |
@@ -468,23 +468,23 @@ discard block |
||
468 | 468 | * Add identity |
469 | 469 | * |
470 | 470 | */ |
471 | - public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
|
471 | + public function addIdentity($mmsi, $imo, $ident, $callsign, $type) |
|
472 | 472 | { |
473 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
473 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
474 | 474 | if ($mmsi != '') { |
475 | - $imo = filter_var($imo,FILTER_SANITIZE_NUMBER_INT); |
|
476 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
477 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
478 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
475 | + $imo = filter_var($imo, FILTER_SANITIZE_NUMBER_INT); |
|
476 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
477 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
478 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
479 | 479 | $identinfo = $this->getIdentity($mmsi); |
480 | 480 | if (empty($identinfo)) { |
481 | - $query = "INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:type)"; |
|
481 | + $query = "INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:type)"; |
|
482 | 482 | $sth = $this->db->prepare($query); |
483 | - $sth->execute(array(':mmsi' => $mmsi,':imo' => $imo,':call_sign' => $callsign,':ship_name' => $ident,':type' => $type)); |
|
483 | + $sth->execute(array(':mmsi' => $mmsi, ':imo' => $imo, ':call_sign' => $callsign, ':ship_name' => $ident, ':type' => $type)); |
|
484 | 484 | } elseif ($ident != '' && $identinfo['ship_name'] != $ident) { |
485 | - $query = "UPDATE marine_identity SET ship_name = :ship_name,type = :type WHERE mmsi = :mmsi"; |
|
485 | + $query = "UPDATE marine_identity SET ship_name = :ship_name,type = :type WHERE mmsi = :mmsi"; |
|
486 | 486 | $sth = $this->db->prepare($query); |
487 | - $sth->execute(array(':mmsi' => $mmsi,':ship_name' => $ident,':type' => $type)); |
|
487 | + $sth->execute(array(':mmsi' => $mmsi, ':ship_name' => $ident, ':type' => $type)); |
|
488 | 488 | } |
489 | 489 | } |
490 | 490 | } |
@@ -505,12 +505,12 @@ discard block |
||
505 | 505 | } else $offset = '+00:00'; |
506 | 506 | |
507 | 507 | if ($globalDBdriver == 'mysql') { |
508 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
508 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
509 | 509 | FROM marine_output |
510 | 510 | WHERE marine_output.date <> '' |
511 | 511 | ORDER BY marine_output.date ASC LIMIT 0,100"; |
512 | 512 | } else { |
513 | - $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
513 | + $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
514 | 514 | FROM marine_output |
515 | 515 | WHERE marine_output.date <> '' |
516 | 516 | ORDER BY marine_output.date ASC LIMIT 0,100"; |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | $date_array = array(); |
523 | 523 | $temp_array = array(); |
524 | 524 | |
525 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
525 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
526 | 526 | { |
527 | 527 | $temp_array['date'] = $row['date']; |
528 | 528 | |
@@ -540,10 +540,10 @@ discard block |
||
540 | 540 | * @return String success or false |
541 | 541 | * |
542 | 542 | */ |
543 | - public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
|
543 | + public function updateIdentMarineData($fammarine_id = '', $ident = '', $fromsource = NULL) |
|
544 | 544 | { |
545 | 545 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
546 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident); |
|
546 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident); |
|
547 | 547 | try { |
548 | 548 | $sth = $this->db->prepare($query); |
549 | 549 | $sth->execute($query_values); |
@@ -562,11 +562,11 @@ discard block |
||
562 | 562 | * @return String success or false |
563 | 563 | * |
564 | 564 | */ |
565 | - public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
|
565 | + public function updateStatusMarineData($fammarine_id = '', $status_id = '', $status = '') |
|
566 | 566 | { |
567 | 567 | |
568 | 568 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
569 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
569 | + $query_values = array(':fammarine_id' => $fammarine_id, ':status' => $status, ':status_id' => $status_id); |
|
570 | 570 | |
571 | 571 | try { |
572 | 572 | $sth = $this->db->prepare($query); |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
590 | 590 | { |
591 | 591 | $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'; |
592 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
592 | + $query_values = array(':fammarine_id' => $fammarine_id, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident); |
|
593 | 593 | |
594 | 594 | try { |
595 | 595 | $sth = $this->db->prepare($query); |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | * @param String $verticalrate vertival rate of flight |
628 | 628 | * @return String success or false |
629 | 629 | */ |
630 | - 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 = '') |
|
630 | + 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 = '') |
|
631 | 631 | { |
632 | 632 | global $globalURL, $globalMarineImageFetch; |
633 | 633 | |
@@ -694,31 +694,31 @@ discard block |
||
694 | 694 | } |
695 | 695 | |
696 | 696 | |
697 | - if ($date == "" || strtotime($date) < time()-20*60) |
|
697 | + if ($date == "" || strtotime($date) < time() - 20*60) |
|
698 | 698 | { |
699 | 699 | $date = date("Y-m-d H:i:s", time()); |
700 | 700 | } |
701 | 701 | |
702 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
703 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
704 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
705 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
706 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
707 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
708 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
709 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
710 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
711 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
712 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
713 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
714 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
715 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
702 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
703 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
704 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
705 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
706 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
707 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
708 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
709 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
710 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
711 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
712 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
713 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
714 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
715 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
716 | 716 | |
717 | 717 | if (isset($globalMarineImageFetch) && $globalMarineImageFetch === TRUE) { |
718 | 718 | $Image = new Image($this->db); |
719 | - $image_array = $Image->getMarineImage($mmsi,$imo,$ident); |
|
719 | + $image_array = $Image->getMarineImage($mmsi, $imo, $ident); |
|
720 | 720 | if (!isset($image_array[0]['mmsi'])) { |
721 | - $Image->addMarineImage($mmsi,$imo,$ident); |
|
721 | + $Image->addMarineImage($mmsi, $imo, $ident); |
|
722 | 722 | } |
723 | 723 | unset($Image); |
724 | 724 | } |
@@ -730,10 +730,10 @@ discard block |
||
730 | 730 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
731 | 731 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
732 | 732 | if ($arrival_date == '') $arrival_date = NULL; |
733 | - $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) |
|
733 | + $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) |
|
734 | 734 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)"; |
735 | 735 | |
736 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':mmsi' => $mmsi,':type' => $type,':status' => $status,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date); |
|
736 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':mmsi' => $mmsi, ':type' => $type, ':status' => $status, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date); |
|
737 | 737 | try { |
738 | 738 | |
739 | 739 | $sth = $this->db->prepare($query); |
@@ -758,13 +758,13 @@ discard block |
||
758 | 758 | { |
759 | 759 | global $globalDBdriver, $globalTimezone; |
760 | 760 | if ($globalDBdriver == 'mysql') { |
761 | - $query = "SELECT marine_output.ident FROM marine_output |
|
761 | + $query = "SELECT marine_output.ident FROM marine_output |
|
762 | 762 | WHERE marine_output.ident = :ident |
763 | 763 | AND marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
764 | 764 | AND marine_output.date < UTC_TIMESTAMP()"; |
765 | 765 | $query_data = array(':ident' => $ident); |
766 | 766 | } else { |
767 | - $query = "SELECT marine_output.ident FROM marine_output |
|
767 | + $query = "SELECT marine_output.ident FROM marine_output |
|
768 | 768 | WHERE marine_output.ident = :ident |
769 | 769 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
770 | 770 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -773,8 +773,8 @@ discard block |
||
773 | 773 | |
774 | 774 | $sth = $this->db->prepare($query); |
775 | 775 | $sth->execute($query_data); |
776 | - $ident_result=''; |
|
777 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
776 | + $ident_result = ''; |
|
777 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
778 | 778 | { |
779 | 779 | $ident_result = $row['ident']; |
780 | 780 | } |
@@ -800,8 +800,8 @@ discard block |
||
800 | 800 | return false; |
801 | 801 | } else { |
802 | 802 | $q_array = explode(" ", $q); |
803 | - foreach ($q_array as $q_item){ |
|
804 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
803 | + foreach ($q_array as $q_item) { |
|
804 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
805 | 805 | $additional_query .= " AND ("; |
806 | 806 | $additional_query .= "(marine_output.ident like '%".$q_item."%')"; |
807 | 807 | $additional_query .= ")"; |
@@ -809,11 +809,11 @@ discard block |
||
809 | 809 | } |
810 | 810 | } |
811 | 811 | if ($globalDBdriver == 'mysql') { |
812 | - $query = "SELECT marine_output.* FROM marine_output |
|
812 | + $query = "SELECT marine_output.* FROM marine_output |
|
813 | 813 | WHERE marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
814 | 814 | AND marine_output.date < UTC_TIMESTAMP()"; |
815 | 815 | } else { |
816 | - $query = "SELECT marine_output.* FROM marine_output |
|
816 | + $query = "SELECT marine_output.* FROM marine_output |
|
817 | 817 | WHERE marine_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
818 | 818 | AND marine_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
819 | 819 | } |
@@ -832,16 +832,16 @@ discard block |
||
832 | 832 | * |
833 | 833 | */ |
834 | 834 | |
835 | - public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
835 | + public function countAllMarineOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
836 | 836 | { |
837 | 837 | global $globalDBdriver, $globalArchive; |
838 | 838 | //$filter_query = $this->getFilter($filters,true,true); |
839 | - $Connection= new Connection($this->db); |
|
839 | + $Connection = new Connection($this->db); |
|
840 | 840 | if (!$Connection->tableExists('countries')) return array(); |
841 | 841 | require_once('class.SpotterLive.php'); |
842 | 842 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
843 | 843 | $MarineLive = new MarineLive($this->db); |
844 | - $filter_query = $MarineLive->getFilter($filters,true,true); |
|
844 | + $filter_query = $MarineLive->getFilter($filters, true, true); |
|
845 | 845 | $filter_query .= " over_country IS NOT NULL AND over_country <> ''"; |
846 | 846 | if ($olderthanmonths > 0) { |
847 | 847 | if ($globalDBdriver == 'mysql') { |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | } else { |
862 | 862 | require_once(dirname(__FILE__)."/class.MarineArchive.php"); |
863 | 863 | $MarineArchive = new MarineArchive($this->db); |
864 | - $filter_query = $MarineArchive->getFilter($filters,true,true); |
|
864 | + $filter_query = $MarineArchive->getFilter($filters, true, true); |
|
865 | 865 | $filter_query .= " over_country <> ''"; |
866 | 866 | if ($olderthanmonths > 0) { |
867 | 867 | if ($globalDBdriver == 'mysql') { |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | $flight_array = array(); |
890 | 890 | $temp_array = array(); |
891 | 891 | |
892 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
892 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
893 | 893 | { |
894 | 894 | $temp_array['marine_count'] = $row['nb']; |
895 | 895 | $temp_array['marine_country'] = $row['name']; |
@@ -908,11 +908,11 @@ discard block |
||
908 | 908 | * @return Array the callsign list |
909 | 909 | * |
910 | 910 | */ |
911 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
911 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
912 | 912 | { |
913 | 913 | global $globalDBdriver; |
914 | - $filter_query = $this->getFilter($filters,true,true); |
|
915 | - $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
914 | + $filter_query = $this->getFilter($filters, true, true); |
|
915 | + $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
916 | 916 | FROM marine_output".$filter_query." marine_output.ident <> ''"; |
917 | 917 | if ($olderthanmonths > 0) { |
918 | 918 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -926,28 +926,28 @@ discard block |
||
926 | 926 | if ($year != '') { |
927 | 927 | if ($globalDBdriver == 'mysql') { |
928 | 928 | $query .= " AND YEAR(marine_output.date) = :year"; |
929 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
929 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
930 | 930 | } else { |
931 | 931 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
932 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
932 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
933 | 933 | } |
934 | 934 | } |
935 | 935 | if ($month != '') { |
936 | 936 | if ($globalDBdriver == 'mysql') { |
937 | 937 | $query .= " AND MONTH(marine_output.date) = :month"; |
938 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
938 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
939 | 939 | } else { |
940 | 940 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
941 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
941 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
942 | 942 | } |
943 | 943 | } |
944 | 944 | if ($day != '') { |
945 | 945 | if ($globalDBdriver == 'mysql') { |
946 | 946 | $query .= " AND DAY(marine_output.date) = :day"; |
947 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
947 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
948 | 948 | } else { |
949 | 949 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
950 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
950 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
951 | 951 | } |
952 | 952 | } |
953 | 953 | $query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC"; |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | $callsign_array = array(); |
960 | 960 | $temp_array = array(); |
961 | 961 | |
962 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
962 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
963 | 963 | { |
964 | 964 | $temp_array['callsign_icao'] = $row['ident']; |
965 | 965 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | $date_array = array(); |
1012 | 1012 | $temp_array = array(); |
1013 | 1013 | |
1014 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1014 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1015 | 1015 | { |
1016 | 1016 | $temp_array['date_name'] = $row['date_name']; |
1017 | 1017 | $temp_array['date_count'] = $row['date_count']; |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | $datetime = new DateTime(); |
1038 | 1038 | $offset = $datetime->format('P'); |
1039 | 1039 | } else $offset = '+00:00'; |
1040 | - $filter_query = $this->getFilter($filters,true,true); |
|
1040 | + $filter_query = $this->getFilter($filters, true, true); |
|
1041 | 1041 | if ($globalDBdriver == 'mysql') { |
1042 | 1042 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1043 | 1043 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -1058,7 +1058,7 @@ discard block |
||
1058 | 1058 | $date_array = array(); |
1059 | 1059 | $temp_array = array(); |
1060 | 1060 | |
1061 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1061 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1062 | 1062 | { |
1063 | 1063 | $temp_array['date_name'] = $row['date_name']; |
1064 | 1064 | $temp_array['date_count'] = $row['date_count']; |
@@ -1083,7 +1083,7 @@ discard block |
||
1083 | 1083 | $datetime = new DateTime(); |
1084 | 1084 | $offset = $datetime->format('P'); |
1085 | 1085 | } else $offset = '+00:00'; |
1086 | - $filter_query = $this->getFilter($filters,true,true); |
|
1086 | + $filter_query = $this->getFilter($filters, true, true); |
|
1087 | 1087 | if ($globalDBdriver == 'mysql') { |
1088 | 1088 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1089 | 1089 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | $date_array = array(); |
1105 | 1105 | $temp_array = array(); |
1106 | 1106 | |
1107 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1107 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1108 | 1108 | { |
1109 | 1109 | $temp_array['date_name'] = $row['date_name']; |
1110 | 1110 | $temp_array['date_count'] = $row['date_count']; |
@@ -1151,7 +1151,7 @@ discard block |
||
1151 | 1151 | $date_array = array(); |
1152 | 1152 | $temp_array = array(); |
1153 | 1153 | |
1154 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1154 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1155 | 1155 | { |
1156 | 1156 | $temp_array['month_name'] = $row['month_name']; |
1157 | 1157 | $temp_array['year_name'] = $row['year_name']; |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | $datetime = new DateTime(); |
1181 | 1181 | $offset = $datetime->format('P'); |
1182 | 1182 | } else $offset = '+00:00'; |
1183 | - $filter_query = $this->getFilter($filters,true,true); |
|
1183 | + $filter_query = $this->getFilter($filters, true, true); |
|
1184 | 1184 | if ($globalDBdriver == 'mysql') { |
1185 | 1185 | $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 |
1186 | 1186 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | $date_array = array(); |
1202 | 1202 | $temp_array = array(); |
1203 | 1203 | |
1204 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1204 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1205 | 1205 | { |
1206 | 1206 | $temp_array['year_name'] = $row['year_name']; |
1207 | 1207 | $temp_array['month_name'] = $row['month_name']; |
@@ -1221,7 +1221,7 @@ discard block |
||
1221 | 1221 | * @return Array the hour list |
1222 | 1222 | * |
1223 | 1223 | */ |
1224 | - public function countAllHours($orderby,$filters = array()) |
|
1224 | + public function countAllHours($orderby, $filters = array()) |
|
1225 | 1225 | { |
1226 | 1226 | global $globalTimezone, $globalDBdriver; |
1227 | 1227 | if ($globalTimezone != '') { |
@@ -1269,7 +1269,7 @@ discard block |
||
1269 | 1269 | $hour_array = array(); |
1270 | 1270 | $temp_array = array(); |
1271 | 1271 | |
1272 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1272 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1273 | 1273 | { |
1274 | 1274 | $temp_array['hour_name'] = $row['hour_name']; |
1275 | 1275 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1291,8 +1291,8 @@ discard block |
||
1291 | 1291 | public function countAllHoursByDate($date, $filters = array()) |
1292 | 1292 | { |
1293 | 1293 | global $globalTimezone, $globalDBdriver; |
1294 | - $filter_query = $this->getFilter($filters,true,true); |
|
1295 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
1294 | + $filter_query = $this->getFilter($filters, true, true); |
|
1295 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
1296 | 1296 | if ($globalTimezone != '') { |
1297 | 1297 | date_default_timezone_set($globalTimezone); |
1298 | 1298 | $datetime = new DateTime($date); |
@@ -1300,12 +1300,12 @@ discard block |
||
1300 | 1300 | } else $offset = '+00:00'; |
1301 | 1301 | |
1302 | 1302 | if ($globalDBdriver == 'mysql') { |
1303 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1303 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1304 | 1304 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = :date |
1305 | 1305 | GROUP BY hour_name |
1306 | 1306 | ORDER BY hour_name ASC"; |
1307 | 1307 | } else { |
1308 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1308 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1309 | 1309 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
1310 | 1310 | GROUP BY hour_name |
1311 | 1311 | ORDER BY hour_name ASC"; |
@@ -1317,7 +1317,7 @@ discard block |
||
1317 | 1317 | $hour_array = array(); |
1318 | 1318 | $temp_array = array(); |
1319 | 1319 | |
1320 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1320 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1321 | 1321 | { |
1322 | 1322 | $temp_array['hour_name'] = $row['hour_name']; |
1323 | 1323 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1339,8 +1339,8 @@ discard block |
||
1339 | 1339 | public function countAllHoursByIdent($ident, $filters = array()) |
1340 | 1340 | { |
1341 | 1341 | global $globalTimezone, $globalDBdriver; |
1342 | - $filter_query = $this->getFilter($filters,true,true); |
|
1343 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1342 | + $filter_query = $this->getFilter($filters, true, true); |
|
1343 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1344 | 1344 | if ($globalTimezone != '') { |
1345 | 1345 | date_default_timezone_set($globalTimezone); |
1346 | 1346 | $datetime = new DateTime(); |
@@ -1348,12 +1348,12 @@ discard block |
||
1348 | 1348 | } else $offset = '+00:00'; |
1349 | 1349 | |
1350 | 1350 | if ($globalDBdriver == 'mysql') { |
1351 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1351 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1352 | 1352 | FROM marine_output".$filter_query." marine_output.ident = :ident |
1353 | 1353 | GROUP BY hour_name |
1354 | 1354 | ORDER BY hour_name ASC"; |
1355 | 1355 | } else { |
1356 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1356 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1357 | 1357 | FROM marine_output".$filter_query." marine_output.ident = :ident |
1358 | 1358 | GROUP BY hour_name |
1359 | 1359 | ORDER BY hour_name ASC"; |
@@ -1361,12 +1361,12 @@ discard block |
||
1361 | 1361 | |
1362 | 1362 | |
1363 | 1363 | $sth = $this->db->prepare($query); |
1364 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
1364 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
1365 | 1365 | |
1366 | 1366 | $hour_array = array(); |
1367 | 1367 | $temp_array = array(); |
1368 | 1368 | |
1369 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1369 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1370 | 1370 | { |
1371 | 1371 | $temp_array['hour_name'] = $row['hour_name']; |
1372 | 1372 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1385,33 +1385,33 @@ discard block |
||
1385 | 1385 | * @return Integer the number of vessels |
1386 | 1386 | * |
1387 | 1387 | */ |
1388 | - public function countOverallMarine($filters = array(),$year = '',$month = '') |
|
1388 | + public function countOverallMarine($filters = array(), $year = '', $month = '') |
|
1389 | 1389 | { |
1390 | 1390 | global $globalDBdriver; |
1391 | 1391 | //$queryi = "SELECT COUNT(marine_output.marine_id) AS flight_count FROM marine_output"; |
1392 | - $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
1392 | + $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
1393 | 1393 | $query_values = array(); |
1394 | 1394 | $query = ''; |
1395 | 1395 | if ($year != '') { |
1396 | 1396 | if ($globalDBdriver == 'mysql') { |
1397 | 1397 | $query .= " AND YEAR(marine_output.date) = :year"; |
1398 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1398 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1399 | 1399 | } else { |
1400 | 1400 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1401 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1401 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1402 | 1402 | } |
1403 | 1403 | } |
1404 | 1404 | if ($month != '') { |
1405 | 1405 | if ($globalDBdriver == 'mysql') { |
1406 | 1406 | $query .= " AND MONTH(marine_output.date) = :month"; |
1407 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1407 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1408 | 1408 | } else { |
1409 | 1409 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1410 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1410 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1411 | 1411 | } |
1412 | 1412 | } |
1413 | 1413 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1414 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1414 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1415 | 1415 | |
1416 | 1416 | $sth = $this->db->prepare($queryi); |
1417 | 1417 | $sth->execute($query_values); |
@@ -1424,32 +1424,32 @@ discard block |
||
1424 | 1424 | * @return Integer the number of vessels |
1425 | 1425 | * |
1426 | 1426 | */ |
1427 | - public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
|
1427 | + public function countOverallMarineTypes($filters = array(), $year = '', $month = '') |
|
1428 | 1428 | { |
1429 | 1429 | global $globalDBdriver; |
1430 | - $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
1430 | + $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
1431 | 1431 | $query_values = array(); |
1432 | 1432 | $query = ''; |
1433 | 1433 | if ($year != '') { |
1434 | 1434 | if ($globalDBdriver == 'mysql') { |
1435 | 1435 | $query .= " AND YEAR(marine_output.date) = :year"; |
1436 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1436 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1437 | 1437 | } else { |
1438 | 1438 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1439 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1439 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1440 | 1440 | } |
1441 | 1441 | } |
1442 | 1442 | if ($month != '') { |
1443 | 1443 | if ($globalDBdriver == 'mysql') { |
1444 | 1444 | $query .= " AND MONTH(marine_output.date) = :month"; |
1445 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1445 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1446 | 1446 | } else { |
1447 | 1447 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1448 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1448 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1449 | 1449 | } |
1450 | 1450 | } |
1451 | 1451 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1452 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1452 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1453 | 1453 | |
1454 | 1454 | $sth = $this->db->prepare($queryi); |
1455 | 1455 | $sth->execute($query_values); |
@@ -1466,7 +1466,7 @@ discard block |
||
1466 | 1466 | public function countAllHoursFromToday($filters = array()) |
1467 | 1467 | { |
1468 | 1468 | global $globalTimezone, $globalDBdriver; |
1469 | - $filter_query = $this->getFilter($filters,true,true); |
|
1469 | + $filter_query = $this->getFilter($filters, true, true); |
|
1470 | 1470 | if ($globalTimezone != '') { |
1471 | 1471 | date_default_timezone_set($globalTimezone); |
1472 | 1472 | $datetime = new DateTime(); |
@@ -1474,12 +1474,12 @@ discard block |
||
1474 | 1474 | } else $offset = '+00:00'; |
1475 | 1475 | |
1476 | 1476 | if ($globalDBdriver == 'mysql') { |
1477 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1477 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1478 | 1478 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = CURDATE() |
1479 | 1479 | GROUP BY hour_name |
1480 | 1480 | ORDER BY hour_name ASC"; |
1481 | 1481 | } else { |
1482 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1482 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1483 | 1483 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
1484 | 1484 | GROUP BY hour_name |
1485 | 1485 | ORDER BY hour_name ASC"; |
@@ -1491,7 +1491,7 @@ discard block |
||
1491 | 1491 | $hour_array = array(); |
1492 | 1492 | $temp_array = array(); |
1493 | 1493 | |
1494 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1494 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1495 | 1495 | { |
1496 | 1496 | $temp_array['hour_name'] = $row['hour_name']; |
1497 | 1497 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1510,9 +1510,9 @@ discard block |
||
1510 | 1510 | */ |
1511 | 1511 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
1512 | 1512 | { |
1513 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
1513 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
1514 | 1514 | |
1515 | - $query = "SELECT marine_output.marine_id |
|
1515 | + $query = "SELECT marine_output.marine_id |
|
1516 | 1516 | FROM marine_output |
1517 | 1517 | WHERE marine_output.fammarine_id = '".$fammarine_id."'"; |
1518 | 1518 | |
@@ -1520,7 +1520,7 @@ discard block |
||
1520 | 1520 | $sth = $this->db->prepare($query); |
1521 | 1521 | $sth->execute(); |
1522 | 1522 | |
1523 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1523 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1524 | 1524 | { |
1525 | 1525 | return $row['marine_id']; |
1526 | 1526 | } |
@@ -1545,23 +1545,23 @@ discard block |
||
1545 | 1545 | } |
1546 | 1546 | |
1547 | 1547 | $current_date = date("Y-m-d H:i:s"); |
1548 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
1548 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
1549 | 1549 | |
1550 | 1550 | $diff = abs(strtotime($current_date) - strtotime($date)); |
1551 | 1551 | |
1552 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
1552 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
1553 | 1553 | $years = $time_array['years']; |
1554 | 1554 | |
1555 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
1555 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
1556 | 1556 | $months = $time_array['months']; |
1557 | 1557 | |
1558 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
1558 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
1559 | 1559 | $days = $time_array['days']; |
1560 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
1560 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
1561 | 1561 | $hours = $time_array['hours']; |
1562 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
1562 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
1563 | 1563 | $minutes = $time_array['minutes']; |
1564 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1564 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1565 | 1565 | |
1566 | 1566 | return $time_array; |
1567 | 1567 | } |
@@ -1584,63 +1584,63 @@ discard block |
||
1584 | 1584 | $temp_array['direction_degree'] = $direction; |
1585 | 1585 | $temp_array['direction_shortname'] = "N"; |
1586 | 1586 | $temp_array['direction_fullname'] = "North"; |
1587 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
1587 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
1588 | 1588 | $temp_array['direction_degree'] = $direction; |
1589 | 1589 | $temp_array['direction_shortname'] = "NNE"; |
1590 | 1590 | $temp_array['direction_fullname'] = "North-Northeast"; |
1591 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
1591 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
1592 | 1592 | $temp_array['direction_degree'] = $direction; |
1593 | 1593 | $temp_array['direction_shortname'] = "NE"; |
1594 | 1594 | $temp_array['direction_fullname'] = "Northeast"; |
1595 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
1595 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
1596 | 1596 | $temp_array['direction_degree'] = $direction; |
1597 | 1597 | $temp_array['direction_shortname'] = "ENE"; |
1598 | 1598 | $temp_array['direction_fullname'] = "East-Northeast"; |
1599 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
1599 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
1600 | 1600 | $temp_array['direction_degree'] = $direction; |
1601 | 1601 | $temp_array['direction_shortname'] = "E"; |
1602 | 1602 | $temp_array['direction_fullname'] = "East"; |
1603 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
1603 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
1604 | 1604 | $temp_array['direction_degree'] = $direction; |
1605 | 1605 | $temp_array['direction_shortname'] = "ESE"; |
1606 | 1606 | $temp_array['direction_fullname'] = "East-Southeast"; |
1607 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
1607 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
1608 | 1608 | $temp_array['direction_degree'] = $direction; |
1609 | 1609 | $temp_array['direction_shortname'] = "SE"; |
1610 | 1610 | $temp_array['direction_fullname'] = "Southeast"; |
1611 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
1611 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
1612 | 1612 | $temp_array['direction_degree'] = $direction; |
1613 | 1613 | $temp_array['direction_shortname'] = "SSE"; |
1614 | 1614 | $temp_array['direction_fullname'] = "South-Southeast"; |
1615 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
1615 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
1616 | 1616 | $temp_array['direction_degree'] = $direction; |
1617 | 1617 | $temp_array['direction_shortname'] = "S"; |
1618 | 1618 | $temp_array['direction_fullname'] = "South"; |
1619 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
1619 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
1620 | 1620 | $temp_array['direction_degree'] = $direction; |
1621 | 1621 | $temp_array['direction_shortname'] = "SSW"; |
1622 | 1622 | $temp_array['direction_fullname'] = "South-Southwest"; |
1623 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
1623 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
1624 | 1624 | $temp_array['direction_degree'] = $direction; |
1625 | 1625 | $temp_array['direction_shortname'] = "SW"; |
1626 | 1626 | $temp_array['direction_fullname'] = "Southwest"; |
1627 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
1627 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
1628 | 1628 | $temp_array['direction_degree'] = $direction; |
1629 | 1629 | $temp_array['direction_shortname'] = "WSW"; |
1630 | 1630 | $temp_array['direction_fullname'] = "West-Southwest"; |
1631 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
1631 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
1632 | 1632 | $temp_array['direction_degree'] = $direction; |
1633 | 1633 | $temp_array['direction_shortname'] = "W"; |
1634 | 1634 | $temp_array['direction_fullname'] = "West"; |
1635 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
1635 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
1636 | 1636 | $temp_array['direction_degree'] = $direction; |
1637 | 1637 | $temp_array['direction_shortname'] = "WNW"; |
1638 | 1638 | $temp_array['direction_fullname'] = "West-Northwest"; |
1639 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
1639 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
1640 | 1640 | $temp_array['direction_degree'] = $direction; |
1641 | 1641 | $temp_array['direction_shortname'] = "NW"; |
1642 | 1642 | $temp_array['direction_fullname'] = "Northwest"; |
1643 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
1643 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
1644 | 1644 | $temp_array['direction_degree'] = $direction; |
1645 | 1645 | $temp_array['direction_shortname'] = "NNW"; |
1646 | 1646 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -1657,11 +1657,11 @@ discard block |
||
1657 | 1657 | * @param Float $longitude longitute of the flight |
1658 | 1658 | * @return String the countrie |
1659 | 1659 | */ |
1660 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
1660 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
1661 | 1661 | { |
1662 | 1662 | global $globalDBdriver, $globalDebug; |
1663 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1664 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1663 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1664 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1665 | 1665 | |
1666 | 1666 | $Connection = new Connection($this->db); |
1667 | 1667 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1701,7 +1701,7 @@ discard block |
||
1701 | 1701 | public function getCountryFromISO2($iso2) |
1702 | 1702 | { |
1703 | 1703 | global $globalDBdriver, $globalDebug; |
1704 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
1704 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
1705 | 1705 | |
1706 | 1706 | $Connection = new Connection($this->db); |
1707 | 1707 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1749,7 +1749,7 @@ discard block |
||
1749 | 1749 | |
1750 | 1750 | $bitly_data = json_decode($bitly_data); |
1751 | 1751 | $bitly_url = ''; |
1752 | - if ($bitly_data->status_txt = "OK"){ |
|
1752 | + if ($bitly_data->status_txt = "OK") { |
|
1753 | 1753 | $bitly_url = $bitly_data->data->url; |
1754 | 1754 | } |
1755 | 1755 | |
@@ -1763,11 +1763,11 @@ discard block |
||
1763 | 1763 | * @return Array the vessel type list |
1764 | 1764 | * |
1765 | 1765 | */ |
1766 | - public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
1766 | + public function countAllMarineTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
1767 | 1767 | { |
1768 | 1768 | global $globalDBdriver; |
1769 | - $filter_query = $this->getFilter($filters,true,true); |
|
1770 | - $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count |
|
1769 | + $filter_query = $this->getFilter($filters, true, true); |
|
1770 | + $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count |
|
1771 | 1771 | FROM marine_output ".$filter_query." marine_output.type <> ''"; |
1772 | 1772 | if ($olderthanmonths > 0) { |
1773 | 1773 | if ($globalDBdriver == 'mysql') { |
@@ -1787,28 +1787,28 @@ discard block |
||
1787 | 1787 | if ($year != '') { |
1788 | 1788 | if ($globalDBdriver == 'mysql') { |
1789 | 1789 | $query .= " AND YEAR(marine_output.date) = :year"; |
1790 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1790 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1791 | 1791 | } else { |
1792 | 1792 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1793 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1793 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1794 | 1794 | } |
1795 | 1795 | } |
1796 | 1796 | if ($month != '') { |
1797 | 1797 | if ($globalDBdriver == 'mysql') { |
1798 | 1798 | $query .= " AND MONTH(marine_output.date) = :month"; |
1799 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1799 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1800 | 1800 | } else { |
1801 | 1801 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1802 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1802 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1803 | 1803 | } |
1804 | 1804 | } |
1805 | 1805 | if ($day != '') { |
1806 | 1806 | if ($globalDBdriver == 'mysql') { |
1807 | 1807 | $query .= " AND DAY(marine_output.date) = :day"; |
1808 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1808 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1809 | 1809 | } else { |
1810 | 1810 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
1811 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1811 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1812 | 1812 | } |
1813 | 1813 | } |
1814 | 1814 | $query .= " GROUP BY marine_output.type ORDER BY marine_type_count DESC"; |
@@ -1817,7 +1817,7 @@ discard block |
||
1817 | 1817 | $sth->execute($query_values); |
1818 | 1818 | $marine_array = array(); |
1819 | 1819 | $temp_array = array(); |
1820 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1820 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1821 | 1821 | { |
1822 | 1822 | $temp_array['marine_type'] = $row['marine_type']; |
1823 | 1823 | $temp_array['marine_type_count'] = $row['marine_type_count']; |
@@ -1832,13 +1832,13 @@ discard block |
||
1832 | 1832 | * @return Array the tracker information |
1833 | 1833 | * |
1834 | 1834 | */ |
1835 | - public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
|
1835 | + public function searchMarineData($q = '', $callsign = '', $mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
1836 | 1836 | { |
1837 | 1837 | global $globalTimezone, $globalDBdriver; |
1838 | 1838 | date_default_timezone_set('UTC'); |
1839 | 1839 | $query_values = array(); |
1840 | 1840 | $additional_query = ''; |
1841 | - $filter_query = $this->getFilter($filters,true,true); |
|
1841 | + $filter_query = $this->getFilter($filters, true, true); |
|
1842 | 1842 | if ($q != "") |
1843 | 1843 | { |
1844 | 1844 | if (!is_string($q)) |
@@ -1846,8 +1846,8 @@ discard block |
||
1846 | 1846 | return false; |
1847 | 1847 | } else { |
1848 | 1848 | $q_array = explode(" ", $q); |
1849 | - foreach ($q_array as $q_item){ |
|
1850 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
1849 | + foreach ($q_array as $q_item) { |
|
1850 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
1851 | 1851 | $additional_query .= " AND ("; |
1852 | 1852 | if (is_int($q_item)) $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
1853 | 1853 | if (is_int($q_item)) $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
@@ -1859,42 +1859,42 @@ discard block |
||
1859 | 1859 | } |
1860 | 1860 | if ($callsign != "") |
1861 | 1861 | { |
1862 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
1862 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
1863 | 1863 | if (!is_string($callsign)) |
1864 | 1864 | { |
1865 | 1865 | return false; |
1866 | 1866 | } else { |
1867 | 1867 | $additional_query .= " AND marine_output.ident = :callsign"; |
1868 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
1868 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
1869 | 1869 | } |
1870 | 1870 | } |
1871 | 1871 | if ($mmsi != "") |
1872 | 1872 | { |
1873 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
1873 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
1874 | 1874 | if (!is_numeric($mmsi)) |
1875 | 1875 | { |
1876 | 1876 | return false; |
1877 | 1877 | } else { |
1878 | 1878 | $additional_query .= " AND marine_output.mmsi = :mmsi"; |
1879 | - $query_values = array_merge($query_values,array(':mmsi' => $mmsi)); |
|
1879 | + $query_values = array_merge($query_values, array(':mmsi' => $mmsi)); |
|
1880 | 1880 | } |
1881 | 1881 | } |
1882 | 1882 | if ($imo != "") |
1883 | 1883 | { |
1884 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
1884 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
1885 | 1885 | if (!is_numeric($imo)) |
1886 | 1886 | { |
1887 | 1887 | return false; |
1888 | 1888 | } else { |
1889 | 1889 | $additional_query .= " AND marine_output.imo = :imo"; |
1890 | - $query_values = array_merge($query_values,array(':imo' => $imo)); |
|
1890 | + $query_values = array_merge($query_values, array(':imo' => $imo)); |
|
1891 | 1891 | } |
1892 | 1892 | } |
1893 | 1893 | if ($date_posted != "") |
1894 | 1894 | { |
1895 | 1895 | $date_array = explode(",", $date_posted); |
1896 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
1897 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
1896 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
1897 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
1898 | 1898 | if ($globalTimezone != '') { |
1899 | 1899 | date_default_timezone_set($globalTimezone); |
1900 | 1900 | $datetime = new DateTime(); |
@@ -1921,8 +1921,8 @@ discard block |
||
1921 | 1921 | if ($limit != "") |
1922 | 1922 | { |
1923 | 1923 | $limit_array = explode(",", $limit); |
1924 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1925 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1924 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1925 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1926 | 1926 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1927 | 1927 | { |
1928 | 1928 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
@@ -1940,28 +1940,28 @@ discard block |
||
1940 | 1940 | } |
1941 | 1941 | } |
1942 | 1942 | if ($origLat != "" && $origLon != "" && $dist != "") { |
1943 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
1943 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
1944 | 1944 | if ($globalDBdriver == 'mysql') { |
1945 | - $query="SELECT marine_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2))) as distance |
|
1945 | + $query = "SELECT marine_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2))) as distance |
|
1946 | 1946 | FROM marine_archive,marine_output".$filter_query." marine_output.fammarine_id = marine_archive.fammarine_id AND marine_output.ident <> '' ".$additional_query."AND marine_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and marine_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
1947 | 1947 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query; |
1948 | 1948 | } else { |
1949 | - $query="SELECT marine_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
1949 | + $query = "SELECT marine_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
1950 | 1950 | FROM marine_archive,marine_output".$filter_query." marine_output.fammarine_id = marine_archive.fammarine_id AND marine_output.ident <> '' ".$additional_query."AND CAST(marine_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(marine_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
1951 | 1951 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query; |
1952 | 1952 | } |
1953 | 1953 | } else { |
1954 | - $query = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' |
|
1954 | + $query = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' |
|
1955 | 1955 | ".$additional_query." |
1956 | 1956 | ".$orderby_query; |
1957 | 1957 | } |
1958 | - $marine_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
1958 | + $marine_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
1959 | 1959 | return $marine_array; |
1960 | 1960 | } |
1961 | 1961 | |
1962 | 1962 | public function getOrderBy() |
1963 | 1963 | { |
1964 | - $orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY marine_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY marine_output.type DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
1964 | + $orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY marine_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY marine_output.type DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
1965 | 1965 | |
1966 | 1966 | return $orderby; |
1967 | 1967 |