@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | foreach($spotter_array as $spotter_item) |
22 | 22 | { |
23 | 23 | $output .= '<url>'; |
24 | - $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>'; |
|
25 | - $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
26 | - $output .= '<changefreq>weekly</changefreq>'; |
|
24 | + $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>'; |
|
25 | + $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
26 | + $output .= '<changefreq>weekly</changefreq>'; |
|
27 | 27 | $output .= '</url>'; |
28 | 28 | } |
29 | 29 | $output .= '</urlset>'; |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | foreach($aircraft_types as $aircraft_item) |
39 | 39 | { |
40 | 40 | $output .= '<url>'; |
41 | - $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.urlencode($aircraft_item['aircraft_icao']).'</loc>'; |
|
42 | - $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
43 | - $output .= '<changefreq>daily</changefreq>'; |
|
41 | + $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.urlencode($aircraft_item['aircraft_icao']).'</loc>'; |
|
42 | + $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
43 | + $output .= '<changefreq>daily</changefreq>'; |
|
44 | 44 | $output .= '</url>'; |
45 | 45 | } |
46 | 46 | $output .= '</urlset>'; |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | foreach($aircraft_registrations as $aircraft_item) |
56 | 56 | { |
57 | 57 | $output .= '<url>'; |
58 | - $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.urlencode($aircraft_item['registration']).'</loc>'; |
|
59 | - $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
60 | - $output .= '<changefreq>daily</changefreq>'; |
|
58 | + $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.urlencode($aircraft_item['registration']).'</loc>'; |
|
59 | + $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
60 | + $output .= '<changefreq>daily</changefreq>'; |
|
61 | 61 | $output .= '</url>'; |
62 | 62 | } |
63 | 63 | $output .= '</urlset>'; |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | foreach($airline_names as $airline_item) |
72 | 72 | { |
73 | 73 | $output .= '<url>'; |
74 | - $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.urlencode($airline_item['airline_icao']).'</loc>'; |
|
75 | - $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
76 | - $output .= '<changefreq>daily</changefreq>'; |
|
74 | + $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.urlencode($airline_item['airline_icao']).'</loc>'; |
|
75 | + $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
76 | + $output .= '<changefreq>daily</changefreq>'; |
|
77 | 77 | $output .= '</url>'; |
78 | 78 | } |
79 | 79 | $output .= '</urlset>'; |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | foreach($airport_names as $airport_item) |
89 | 89 | { |
90 | 90 | $output .= '<url>'; |
91 | - $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>'; |
|
92 | - $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
93 | - $output .= '<changefreq>daily</changefreq>'; |
|
91 | + $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>'; |
|
92 | + $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
93 | + $output .= '<changefreq>daily</changefreq>'; |
|
94 | 94 | $output .= '</url>'; |
95 | 95 | } |
96 | 96 | $output .= '</urlset>'; |
@@ -34,7 +34,9 @@ discard block |
||
34 | 34 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
35 | 35 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
36 | 36 | $aircraft_types = $Stats->getAllAircraftTypes(); |
37 | - if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
37 | + if (empty($aircraft_types)) { |
|
38 | + $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
39 | + } |
|
38 | 40 | foreach($aircraft_types as $aircraft_item) |
39 | 41 | { |
40 | 42 | $output .= '<url>'; |
@@ -84,7 +86,9 @@ discard block |
||
84 | 86 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
85 | 87 | |
86 | 88 | $airport_names = $Stats->getAllAirportNames(); |
87 | - if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
|
89 | + if (empty($airport_names)) { |
|
90 | + $airport_names = $Spotter->getAllAirportNames(); |
|
91 | + } |
|
88 | 92 | foreach($airport_names as $airport_item) |
89 | 93 | { |
90 | 94 | $output .= '<url>'; |
@@ -99,7 +103,9 @@ discard block |
||
99 | 103 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
100 | 104 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
101 | 105 | $manufacturer_names = $Stats->getAllManufacturers(); |
102 | - if (empty($manufacturer_names)) $manufacturer_names = $Spotter->getAllManufacturers(); |
|
106 | + if (empty($manufacturer_names)) { |
|
107 | + $manufacturer_names = $Spotter->getAllManufacturers(); |
|
108 | + } |
|
103 | 109 | foreach($manufacturer_names as $manufacturer_item) |
104 | 110 | { |
105 | 111 | $output .= '<url>'; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
19 | 19 | |
20 | 20 | $spotter_array = $Spotter->getAllFlightsforSitemap(); |
21 | - foreach($spotter_array as $spotter_item) |
|
21 | + foreach ($spotter_array as $spotter_item) |
|
22 | 22 | { |
23 | 23 | $output .= '<url>'; |
24 | 24 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>'; |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | $output .= '</urlset>'; |
30 | 30 | |
31 | 31 | |
32 | -} else if (isset($_GET['type']) && $_GET['type'] == "aircraft"){ |
|
32 | +} else if (isset($_GET['type']) && $_GET['type'] == "aircraft") { |
|
33 | 33 | |
34 | 34 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
35 | 35 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
36 | 36 | $aircraft_types = $Stats->getAllAircraftTypes(); |
37 | 37 | if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
38 | - foreach($aircraft_types as $aircraft_item) |
|
38 | + foreach ($aircraft_types as $aircraft_item) |
|
39 | 39 | { |
40 | 40 | $output .= '<url>'; |
41 | 41 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.urlencode($aircraft_item['aircraft_icao']).'</loc>'; |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | $output .= '</urlset>'; |
47 | 47 | |
48 | 48 | |
49 | -} else if (isset($_GET['type']) && $_GET['type'] == "registration"){ |
|
49 | +} else if (isset($_GET['type']) && $_GET['type'] == "registration") { |
|
50 | 50 | |
51 | 51 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
52 | 52 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
53 | 53 | |
54 | 54 | $aircraft_registrations = $Spotter->getAllAircraftRegistrations(); |
55 | - foreach($aircraft_registrations as $aircraft_item) |
|
55 | + foreach ($aircraft_registrations as $aircraft_item) |
|
56 | 56 | { |
57 | 57 | $output .= '<url>'; |
58 | 58 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.urlencode($aircraft_item['registration']).'</loc>'; |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | } |
63 | 63 | $output .= '</urlset>'; |
64 | 64 | |
65 | -} else if (isset($_GET['type']) && $_GET['type'] == "airline"){ |
|
65 | +} else if (isset($_GET['type']) && $_GET['type'] == "airline") { |
|
66 | 66 | |
67 | 67 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
68 | 68 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
69 | 69 | |
70 | 70 | $airline_names = $Stats->getAllAirlineNames(); |
71 | - foreach($airline_names as $airline_item) |
|
71 | + foreach ($airline_names as $airline_item) |
|
72 | 72 | { |
73 | 73 | $output .= '<url>'; |
74 | 74 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.urlencode($airline_item['airline_icao']).'</loc>'; |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | } |
79 | 79 | $output .= '</urlset>'; |
80 | 80 | |
81 | -} else if (isset($_GET['type']) && $_GET['type'] == "airport"){ |
|
81 | +} else if (isset($_GET['type']) && $_GET['type'] == "airport") { |
|
82 | 82 | |
83 | 83 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
84 | 84 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
85 | 85 | |
86 | 86 | $airport_names = $Stats->getAllAirportNames(); |
87 | 87 | if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
88 | - foreach($airport_names as $airport_item) |
|
88 | + foreach ($airport_names as $airport_item) |
|
89 | 89 | { |
90 | 90 | $output .= '<url>'; |
91 | 91 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>'; |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | } |
96 | 96 | $output .= '</urlset>'; |
97 | 97 | |
98 | -} else if (isset($_GET['type']) && $_GET['type'] == "manufacturer"){ |
|
98 | +} else if (isset($_GET['type']) && $_GET['type'] == "manufacturer") { |
|
99 | 99 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
100 | 100 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
101 | 101 | $manufacturer_names = $Stats->getAllManufacturers(); |
102 | 102 | if (empty($manufacturer_names)) $manufacturer_names = $Spotter->getAllManufacturers(); |
103 | - foreach($manufacturer_names as $manufacturer_item) |
|
103 | + foreach ($manufacturer_names as $manufacturer_item) |
|
104 | 104 | { |
105 | 105 | $output .= '<url>'; |
106 | 106 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/manufacturer/'.urlencode(strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer']))).'</loc>'; |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | $output .= '</url>'; |
110 | 110 | } |
111 | 111 | $output .= '</urlset>'; |
112 | -} else if (isset($_GET['type']) && $_GET['type'] == "country"){ |
|
112 | +} else if (isset($_GET['type']) && $_GET['type'] == "country") { |
|
113 | 113 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
114 | 114 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
115 | 115 | $country_names = $Spotter->getAllCountries(); |
116 | - foreach($country_names as $country_item) |
|
116 | + foreach ($country_names as $country_item) |
|
117 | 117 | { |
118 | 118 | $output .= '<url>'; |
119 | 119 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/country/'.urlencode(strtolower(str_replace(" ", "-", $country_item['country']))).'</loc>'; |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | $output .= '</url>'; |
123 | 123 | } |
124 | 124 | $output .= '</urlset>'; |
125 | -} else if (isset($_GET['type']) && $_GET['type'] == "ident"){ |
|
125 | +} else if (isset($_GET['type']) && $_GET['type'] == "ident") { |
|
126 | 126 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
127 | 127 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
128 | 128 | $ident_names = $Spotter->getAllIdents(); |
129 | - foreach($ident_names as $ident_item) |
|
129 | + foreach ($ident_names as $ident_item) |
|
130 | 130 | { |
131 | 131 | if (ctype_alnum($ident_item['ident'])) { |
132 | 132 | $output .= '<url>'; |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | } |
138 | 138 | } |
139 | 139 | $output .= '</urlset>'; |
140 | -} else if (isset($_GET['type']) && $_GET['type'] == "marine-ident"){ |
|
140 | +} else if (isset($_GET['type']) && $_GET['type'] == "marine-ident") { |
|
141 | 141 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
142 | 142 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
143 | 143 | $ident_names = $Marine->getAllIdents(); |
144 | - foreach($ident_names as $ident_item) |
|
144 | + foreach ($ident_names as $ident_item) |
|
145 | 145 | { |
146 | 146 | if (ctype_alnum($ident_item['ident'])) { |
147 | 147 | $output .= '<url>'; |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | } |
153 | 153 | } |
154 | 154 | $output .= '</urlset>'; |
155 | -} else if (isset($_GET['type']) && $_GET['type'] == "date"){ |
|
155 | +} else if (isset($_GET['type']) && $_GET['type'] == "date") { |
|
156 | 156 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
157 | 157 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
158 | 158 | $date_names = $Spotter->getAllDates(); |
159 | - foreach($date_names as $date_item) |
|
159 | + foreach ($date_names as $date_item) |
|
160 | 160 | { |
161 | 161 | $output .= '<url>'; |
162 | 162 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>'; |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | $output .= '</url>'; |
166 | 166 | } |
167 | 167 | $output .= '</urlset>'; |
168 | -} else if (isset($_GET['type']) && $_GET['type'] == "marine-date"){ |
|
168 | +} else if (isset($_GET['type']) && $_GET['type'] == "marine-date") { |
|
169 | 169 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
170 | 170 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
171 | 171 | $date_names = $Marine->getAllDates(); |
172 | - foreach($date_names as $date_item) |
|
172 | + foreach ($date_names as $date_item) |
|
173 | 173 | { |
174 | 174 | $output .= '<url>'; |
175 | 175 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/marine/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>'; |
@@ -178,11 +178,11 @@ discard block |
||
178 | 178 | $output .= '</url>'; |
179 | 179 | } |
180 | 180 | $output .= '</urlset>'; |
181 | -} else if (isset($_GET['type']) && $_GET['type'] == "tracker-date"){ |
|
181 | +} else if (isset($_GET['type']) && $_GET['type'] == "tracker-date") { |
|
182 | 182 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
183 | 183 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
184 | 184 | $date_names = $Tracker->getAllDates(); |
185 | - foreach($date_names as $date_item) |
|
185 | + foreach ($date_names as $date_item) |
|
186 | 186 | { |
187 | 187 | $output .= '<url>'; |
188 | 188 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/tracker/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>'; |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | $output .= '</url>'; |
192 | 192 | } |
193 | 193 | $output .= '</urlset>'; |
194 | -} else if (isset($_GET['type']) && $_GET['type'] == "route"){ |
|
194 | +} else if (isset($_GET['type']) && $_GET['type'] == "route") { |
|
195 | 195 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
196 | 196 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
197 | 197 | $route_names = $Spotter->getAllRoutes(); |
198 | - foreach($route_names as $route_item) |
|
198 | + foreach ($route_names as $route_item) |
|
199 | 199 | { |
200 | 200 | $output .= '<url>'; |
201 | 201 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'</loc>'; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $output .= '</url>'; |
205 | 205 | } |
206 | 206 | $output .= '</urlset>'; |
207 | -} else if (isset($_GET['type']) && $_GET['type'] == "static"){ |
|
207 | +} else if (isset($_GET['type']) && $_GET['type'] == "static") { |
|
208 | 208 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
209 | 209 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
210 | 210 | /* STATIC PAGES */ |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | $output .= '<changefreq>daily</changefreq>'; |
323 | 323 | $output .= '</url>'; |
324 | 324 | $output .= '</urlset>'; |
325 | -} else if (isset($_GET['type']) && $_GET['type'] == "marine-static"){ |
|
325 | +} else if (isset($_GET['type']) && $_GET['type'] == "marine-static") { |
|
326 | 326 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
327 | 327 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
328 | 328 | /* STATIC PAGES */ |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | $output .= '<changefreq>daily</changefreq>'; |
349 | 349 | $output .= '</url>'; |
350 | 350 | $output .= '</urlset>'; |
351 | -} else if (isset($_GET['type']) && $_GET['type'] == "tracker-static"){ |
|
351 | +} else if (isset($_GET['type']) && $_GET['type'] == "tracker-static") { |
|
352 | 352 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
353 | 353 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
354 | 354 | /* STATIC PAGES */ |
@@ -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) { |
@@ -584,25 +584,6 @@ discard block |
||
584 | 584 | * |
585 | 585 | * @param String $fammarine_id the ID |
586 | 586 | * @param String $ident the marine ident |
587 | - * @param String $departure_airport_icao the departure airport |
|
588 | - * @param String $arrival_airport_icao the arrival airport |
|
589 | - * @param String $latitude latitude of flight |
|
590 | - * @param String $longitude latitude of flight |
|
591 | - * @param String $waypoints waypoints of flight |
|
592 | - * @param String $heading heading of flight |
|
593 | - * @param String $groundspeed speed of flight |
|
594 | - * @param String $date date of flight |
|
595 | - * @param String $departure_airport_time departure time of flight |
|
596 | - * @param String $arrival_airport_time arrival time of flight |
|
597 | - * @param String $squawk squawk code of flight |
|
598 | - * @param String $route_stop route stop of flight |
|
599 | - * @param String $highlight highlight or not |
|
600 | - * @param String $ModeS ModesS code of flight |
|
601 | - * @param String $registration registration code of flight |
|
602 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
603 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
604 | - * @param String $verticalrate vertival rate of flight |
|
605 | - * @return String success or false |
|
606 | 587 | */ |
607 | 588 | 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 = '') |
608 | 589 | { |
@@ -1195,6 +1176,7 @@ discard block |
||
1195 | 1176 | /** |
1196 | 1177 | * Counts all hours |
1197 | 1178 | * |
1179 | + * @param string $orderby |
|
1198 | 1180 | * @return Array the hour list |
1199 | 1181 | * |
1200 | 1182 | */ |
@@ -1546,7 +1528,7 @@ discard block |
||
1546 | 1528 | /** |
1547 | 1529 | * Parses the direction degrees to working |
1548 | 1530 | * |
1549 | - * @param Float $direction the direction in degrees |
|
1531 | + * @param integer $direction the direction in degrees |
|
1550 | 1532 | * @return Array the direction information |
1551 | 1533 | * |
1552 | 1534 | */ |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
15 | - * Get SQL query part for filter used |
|
16 | - * @param Array $filter the filter |
|
17 | - * @return Array the SQL part |
|
18 | - */ |
|
15 | + * Get SQL query part for filter used |
|
16 | + * @param Array $filter the filter |
|
17 | + * @return Array the SQL part |
|
18 | + */ |
|
19 | 19 | |
20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
85 | - * Executes the SQL statements to get the spotter information |
|
86 | - * |
|
87 | - * @param String $query the SQL query |
|
88 | - * @param Array $params parameter of the query |
|
89 | - * @param String $limitQuery the limit query |
|
90 | - * @return Array the spotter information |
|
91 | - * |
|
92 | - */ |
|
85 | + * Executes the SQL statements to get the spotter information |
|
86 | + * |
|
87 | + * @param String $query the SQL query |
|
88 | + * @param Array $params parameter of the query |
|
89 | + * @param String $limitQuery the limit query |
|
90 | + * @return Array the spotter information |
|
91 | + * |
|
92 | + */ |
|
93 | 93 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
94 | 94 | { |
95 | 95 | date_default_timezone_set('UTC'); |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | |
221 | 221 | |
222 | 222 | /** |
223 | - * Gets all the spotter information based on the latest data entry |
|
224 | - * |
|
225 | - * @return Array the spotter information |
|
226 | - * |
|
227 | - */ |
|
223 | + * Gets all the spotter information based on the latest data entry |
|
224 | + * |
|
225 | + * @return Array the spotter information |
|
226 | + * |
|
227 | + */ |
|
228 | 228 | public function getLatestMarineData($limit = '', $sort = '', $filter = array()) |
229 | 229 | { |
230 | 230 | global $global_query; |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | } |
274 | 274 | |
275 | 275 | /** |
276 | - * Gets all the spotter information based on the callsign |
|
277 | - * |
|
278 | - * @return Array the spotter information |
|
279 | - * |
|
280 | - */ |
|
276 | + * Gets all the spotter information based on the callsign |
|
277 | + * |
|
278 | + * @return Array the spotter information |
|
279 | + * |
|
280 | + */ |
|
281 | 281 | public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
282 | 282 | { |
283 | 283 | global $global_query; |
@@ -329,11 +329,11 @@ discard block |
||
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
332 | - * Gets all the marine information based on the type |
|
333 | - * |
|
334 | - * @return Array the marine information |
|
335 | - * |
|
336 | - */ |
|
332 | + * Gets all the marine information based on the type |
|
333 | + * |
|
334 | + * @return Array the marine information |
|
335 | + * |
|
336 | + */ |
|
337 | 337 | public function getMarineDataByType($type = '', $limit = '', $sort = '', $filter = array()) |
338 | 338 | { |
339 | 339 | global $global_query; |
@@ -441,12 +441,12 @@ discard block |
||
441 | 441 | |
442 | 442 | |
443 | 443 | /** |
444 | - * Gets all source name |
|
445 | - * |
|
446 | - * @param String type format of source |
|
447 | - * @return Array list of source name |
|
448 | - * |
|
449 | - */ |
|
444 | + * Gets all source name |
|
445 | + * |
|
446 | + * @param String type format of source |
|
447 | + * @return Array list of source name |
|
448 | + * |
|
449 | + */ |
|
450 | 450 | public function getAllSourceName($type = '',$filters = array()) |
451 | 451 | { |
452 | 452 | $filter_query = $this->getFilter($filters,true,true); |
@@ -476,11 +476,11 @@ discard block |
||
476 | 476 | |
477 | 477 | |
478 | 478 | /** |
479 | - * Gets a list of all idents/callsigns |
|
480 | - * |
|
481 | - * @return Array list of ident/callsign names |
|
482 | - * |
|
483 | - */ |
|
479 | + * Gets a list of all idents/callsigns |
|
480 | + * |
|
481 | + * @return Array list of ident/callsign names |
|
482 | + * |
|
483 | + */ |
|
484 | 484 | public function getAllIdents($filters = array()) |
485 | 485 | { |
486 | 486 | $filter_query = $this->getFilter($filters,true,true); |
@@ -504,11 +504,11 @@ discard block |
||
504 | 504 | } |
505 | 505 | |
506 | 506 | /** |
507 | - * Gets all info from a mmsi |
|
508 | - * |
|
509 | - * @return Array ident |
|
510 | - * |
|
511 | - */ |
|
507 | + * Gets all info from a mmsi |
|
508 | + * |
|
509 | + * @return Array ident |
|
510 | + * |
|
511 | + */ |
|
512 | 512 | public function getIdentity($mmsi) |
513 | 513 | { |
514 | 514 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -521,9 +521,9 @@ discard block |
||
521 | 521 | } |
522 | 522 | |
523 | 523 | /** |
524 | - * Add identity |
|
525 | - * |
|
526 | - */ |
|
524 | + * Add identity |
|
525 | + * |
|
526 | + */ |
|
527 | 527 | public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
528 | 528 | { |
529 | 529 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -589,13 +589,13 @@ discard block |
||
589 | 589 | } |
590 | 590 | |
591 | 591 | /** |
592 | - * Update ident tracker data |
|
593 | - * |
|
594 | - * @param String $fammarine_id the ID |
|
595 | - * @param String $ident the marine ident |
|
596 | - * @return String success or false |
|
597 | - * |
|
598 | - */ |
|
592 | + * Update ident tracker data |
|
593 | + * |
|
594 | + * @param String $fammarine_id the ID |
|
595 | + * @param String $ident the marine ident |
|
596 | + * @return String success or false |
|
597 | + * |
|
598 | + */ |
|
599 | 599 | public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
600 | 600 | { |
601 | 601 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
@@ -610,13 +610,13 @@ discard block |
||
610 | 610 | } |
611 | 611 | |
612 | 612 | /** |
613 | - * Update arrival marine data |
|
614 | - * |
|
615 | - * @param String $fammarine_id the ID |
|
616 | - * @param String $arrival_code the marine ident |
|
617 | - * @return String success or false |
|
618 | - * |
|
619 | - */ |
|
613 | + * Update arrival marine data |
|
614 | + * |
|
615 | + * @param String $fammarine_id the ID |
|
616 | + * @param String $arrival_code the marine ident |
|
617 | + * @return String success or false |
|
618 | + * |
|
619 | + */ |
|
620 | 620 | public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL) |
621 | 621 | { |
622 | 622 | $query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id'; |
@@ -631,19 +631,19 @@ discard block |
||
631 | 631 | } |
632 | 632 | |
633 | 633 | /** |
634 | - * Update Status data |
|
635 | - * |
|
636 | - * @param String $fammarine_id the ID |
|
637 | - * @param String $status_id the marine status id |
|
638 | - * @param String $status the marine status |
|
639 | - * @return String success or false |
|
640 | - * |
|
641 | - */ |
|
634 | + * Update Status data |
|
635 | + * |
|
636 | + * @param String $fammarine_id the ID |
|
637 | + * @param String $status_id the marine status id |
|
638 | + * @param String $status the marine status |
|
639 | + * @return String success or false |
|
640 | + * |
|
641 | + */ |
|
642 | 642 | public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
643 | 643 | { |
644 | 644 | |
645 | 645 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
646 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
646 | + $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
647 | 647 | |
648 | 648 | try { |
649 | 649 | $sth = $this->db->prepare($query); |
@@ -656,17 +656,17 @@ discard block |
||
656 | 656 | |
657 | 657 | } |
658 | 658 | /** |
659 | - * Update latest marine data |
|
660 | - * |
|
661 | - * @param String $fammarine_id the ID |
|
662 | - * @param String $ident the marine ident |
|
663 | - * @return String success or false |
|
664 | - * |
|
665 | - */ |
|
659 | + * Update latest marine data |
|
660 | + * |
|
661 | + * @param String $fammarine_id the ID |
|
662 | + * @param String $ident the marine ident |
|
663 | + * @return String success or false |
|
664 | + * |
|
665 | + */ |
|
666 | 666 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
667 | 667 | { |
668 | 668 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id'; |
669 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
669 | + $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
670 | 670 | |
671 | 671 | try { |
672 | 672 | $sth = $this->db->prepare($query); |
@@ -680,30 +680,30 @@ discard block |
||
680 | 680 | } |
681 | 681 | |
682 | 682 | /** |
683 | - * Adds a new spotter data |
|
684 | - * |
|
685 | - * @param String $fammarine_id the ID |
|
686 | - * @param String $ident the marine ident |
|
687 | - * @param String $departure_airport_icao the departure airport |
|
688 | - * @param String $arrival_airport_icao the arrival airport |
|
689 | - * @param String $latitude latitude of flight |
|
690 | - * @param String $longitude latitude of flight |
|
691 | - * @param String $waypoints waypoints of flight |
|
692 | - * @param String $heading heading of flight |
|
693 | - * @param String $groundspeed speed of flight |
|
694 | - * @param String $date date of flight |
|
695 | - * @param String $departure_airport_time departure time of flight |
|
696 | - * @param String $arrival_airport_time arrival time of flight |
|
697 | - * @param String $squawk squawk code of flight |
|
698 | - * @param String $route_stop route stop of flight |
|
699 | - * @param String $highlight highlight or not |
|
700 | - * @param String $ModeS ModesS code of flight |
|
701 | - * @param String $registration registration code of flight |
|
702 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
703 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
704 | - * @param String $verticalrate vertival rate of flight |
|
705 | - * @return String success or false |
|
706 | - */ |
|
683 | + * Adds a new spotter data |
|
684 | + * |
|
685 | + * @param String $fammarine_id the ID |
|
686 | + * @param String $ident the marine ident |
|
687 | + * @param String $departure_airport_icao the departure airport |
|
688 | + * @param String $arrival_airport_icao the arrival airport |
|
689 | + * @param String $latitude latitude of flight |
|
690 | + * @param String $longitude latitude of flight |
|
691 | + * @param String $waypoints waypoints of flight |
|
692 | + * @param String $heading heading of flight |
|
693 | + * @param String $groundspeed speed of flight |
|
694 | + * @param String $date date of flight |
|
695 | + * @param String $departure_airport_time departure time of flight |
|
696 | + * @param String $arrival_airport_time arrival time of flight |
|
697 | + * @param String $squawk squawk code of flight |
|
698 | + * @param String $route_stop route stop of flight |
|
699 | + * @param String $highlight highlight or not |
|
700 | + * @param String $ModeS ModesS code of flight |
|
701 | + * @param String $registration registration code of flight |
|
702 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
703 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
704 | + * @param String $verticalrate vertival rate of flight |
|
705 | + * @return String success or false |
|
706 | + */ |
|
707 | 707 | public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '') |
708 | 708 | { |
709 | 709 | global $globalURL, $globalMarineImageFetch; |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | $sth->execute($query_values); |
819 | 819 | $this->db = null; |
820 | 820 | } catch (PDOException $e) { |
821 | - return "error : ".$e->getMessage(); |
|
821 | + return "error : ".$e->getMessage(); |
|
822 | 822 | } |
823 | 823 | |
824 | 824 | return "success"; |
@@ -827,11 +827,11 @@ discard block |
||
827 | 827 | |
828 | 828 | |
829 | 829 | /** |
830 | - * Gets the aircraft ident within the last hour |
|
831 | - * |
|
832 | - * @return String the ident |
|
833 | - * |
|
834 | - */ |
|
830 | + * Gets the aircraft ident within the last hour |
|
831 | + * |
|
832 | + * @return String the ident |
|
833 | + * |
|
834 | + */ |
|
835 | 835 | public function getIdentFromLastHour($ident) |
836 | 836 | { |
837 | 837 | global $globalDBdriver, $globalTimezone; |
@@ -847,11 +847,11 @@ discard block |
||
847 | 847 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
848 | 848 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
849 | 849 | $query_data = array(':ident' => $ident); |
850 | - } |
|
850 | + } |
|
851 | 851 | |
852 | 852 | $sth = $this->db->prepare($query); |
853 | 853 | $sth->execute($query_data); |
854 | - $ident_result=''; |
|
854 | + $ident_result=''; |
|
855 | 855 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
856 | 856 | { |
857 | 857 | $ident_result = $row['ident']; |
@@ -862,11 +862,11 @@ discard block |
||
862 | 862 | |
863 | 863 | |
864 | 864 | /** |
865 | - * Gets the aircraft data from the last 20 seconds |
|
866 | - * |
|
867 | - * @return Array the spotter data |
|
868 | - * |
|
869 | - */ |
|
865 | + * Gets the aircraft data from the last 20 seconds |
|
866 | + * |
|
867 | + * @return Array the spotter data |
|
868 | + * |
|
869 | + */ |
|
870 | 870 | public function getRealTimeData($q = '') |
871 | 871 | { |
872 | 872 | global $globalDBdriver; |
@@ -904,11 +904,11 @@ discard block |
||
904 | 904 | |
905 | 905 | |
906 | 906 | /** |
907 | - * Gets all number of flight over countries |
|
908 | - * |
|
909 | - * @return Array the airline country list |
|
910 | - * |
|
911 | - */ |
|
907 | + * Gets all number of flight over countries |
|
908 | + * |
|
909 | + * @return Array the airline country list |
|
910 | + * |
|
911 | + */ |
|
912 | 912 | |
913 | 913 | public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
914 | 914 | { |
@@ -981,11 +981,11 @@ discard block |
||
981 | 981 | |
982 | 982 | |
983 | 983 | /** |
984 | - * Gets all callsigns that have flown over |
|
985 | - * |
|
986 | - * @return Array the callsign list |
|
987 | - * |
|
988 | - */ |
|
984 | + * Gets all callsigns that have flown over |
|
985 | + * |
|
986 | + * @return Array the callsign list |
|
987 | + * |
|
988 | + */ |
|
989 | 989 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
990 | 990 | { |
991 | 991 | global $globalDBdriver; |
@@ -1052,11 +1052,11 @@ discard block |
||
1052 | 1052 | |
1053 | 1053 | |
1054 | 1054 | /** |
1055 | - * Counts all dates |
|
1056 | - * |
|
1057 | - * @return Array the date list |
|
1058 | - * |
|
1059 | - */ |
|
1055 | + * Counts all dates |
|
1056 | + * |
|
1057 | + * @return Array the date list |
|
1058 | + * |
|
1059 | + */ |
|
1060 | 1060 | public function countAllDates($filters = array()) |
1061 | 1061 | { |
1062 | 1062 | global $globalTimezone, $globalDBdriver; |
@@ -1102,11 +1102,11 @@ discard block |
||
1102 | 1102 | |
1103 | 1103 | |
1104 | 1104 | /** |
1105 | - * Counts all dates during the last 7 days |
|
1106 | - * |
|
1107 | - * @return Array the date list |
|
1108 | - * |
|
1109 | - */ |
|
1105 | + * Counts all dates during the last 7 days |
|
1106 | + * |
|
1107 | + * @return Array the date list |
|
1108 | + * |
|
1109 | + */ |
|
1110 | 1110 | public function countAllDatesLast7Days($filters = array()) |
1111 | 1111 | { |
1112 | 1112 | global $globalTimezone, $globalDBdriver; |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | $query .= " GROUP BY date_name |
1129 | 1129 | ORDER BY date_name ASC"; |
1130 | 1130 | $query_data = array(':offset' => $offset); |
1131 | - } |
|
1131 | + } |
|
1132 | 1132 | |
1133 | 1133 | $sth = $this->db->prepare($query); |
1134 | 1134 | $sth->execute($query_data); |
@@ -1148,11 +1148,11 @@ discard block |
||
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | /** |
1151 | - * Counts all dates during the last month |
|
1152 | - * |
|
1153 | - * @return Array the date list |
|
1154 | - * |
|
1155 | - */ |
|
1151 | + * Counts all dates during the last month |
|
1152 | + * |
|
1153 | + * @return Array the date list |
|
1154 | + * |
|
1155 | + */ |
|
1156 | 1156 | public function countAllDatesLastMonth($filters = array()) |
1157 | 1157 | { |
1158 | 1158 | global $globalTimezone, $globalDBdriver; |
@@ -1174,7 +1174,7 @@ discard block |
||
1174 | 1174 | $query .= " GROUP BY date_name |
1175 | 1175 | ORDER BY date_name ASC"; |
1176 | 1176 | $query_data = array(':offset' => $offset); |
1177 | - } |
|
1177 | + } |
|
1178 | 1178 | |
1179 | 1179 | $sth = $this->db->prepare($query); |
1180 | 1180 | $sth->execute($query_data); |
@@ -1196,11 +1196,11 @@ discard block |
||
1196 | 1196 | |
1197 | 1197 | |
1198 | 1198 | /** |
1199 | - * Counts all month |
|
1200 | - * |
|
1201 | - * @return Array the month list |
|
1202 | - * |
|
1203 | - */ |
|
1199 | + * Counts all month |
|
1200 | + * |
|
1201 | + * @return Array the month list |
|
1202 | + * |
|
1203 | + */ |
|
1204 | 1204 | public function countAllMonths($filters = array()) |
1205 | 1205 | { |
1206 | 1206 | global $globalTimezone, $globalDBdriver; |
@@ -1245,11 +1245,11 @@ discard block |
||
1245 | 1245 | |
1246 | 1246 | |
1247 | 1247 | /** |
1248 | - * Counts all dates during the last year |
|
1249 | - * |
|
1250 | - * @return Array the date list |
|
1251 | - * |
|
1252 | - */ |
|
1248 | + * Counts all dates during the last year |
|
1249 | + * |
|
1250 | + * @return Array the date list |
|
1251 | + * |
|
1252 | + */ |
|
1253 | 1253 | public function countAllMonthsLastYear($filters) |
1254 | 1254 | { |
1255 | 1255 | global $globalTimezone, $globalDBdriver; |
@@ -1271,7 +1271,7 @@ discard block |
||
1271 | 1271 | $query .= " GROUP BY year_name, month_name |
1272 | 1272 | ORDER BY year_name, month_name ASC"; |
1273 | 1273 | $query_data = array(':offset' => $offset); |
1274 | - } |
|
1274 | + } |
|
1275 | 1275 | |
1276 | 1276 | $sth = $this->db->prepare($query); |
1277 | 1277 | $sth->execute($query_data); |
@@ -1294,11 +1294,11 @@ discard block |
||
1294 | 1294 | |
1295 | 1295 | |
1296 | 1296 | /** |
1297 | - * Counts all hours |
|
1298 | - * |
|
1299 | - * @return Array the hour list |
|
1300 | - * |
|
1301 | - */ |
|
1297 | + * Counts all hours |
|
1298 | + * |
|
1299 | + * @return Array the hour list |
|
1300 | + * |
|
1301 | + */ |
|
1302 | 1302 | public function countAllHours($orderby,$filters = array()) |
1303 | 1303 | { |
1304 | 1304 | global $globalTimezone, $globalDBdriver; |
@@ -1361,11 +1361,11 @@ discard block |
||
1361 | 1361 | |
1362 | 1362 | |
1363 | 1363 | /** |
1364 | - * Counts all hours by date |
|
1365 | - * |
|
1366 | - * @return Array the hour list |
|
1367 | - * |
|
1368 | - */ |
|
1364 | + * Counts all hours by date |
|
1365 | + * |
|
1366 | + * @return Array the hour list |
|
1367 | + * |
|
1368 | + */ |
|
1369 | 1369 | public function countAllHoursByDate($date, $filters = array()) |
1370 | 1370 | { |
1371 | 1371 | global $globalTimezone, $globalDBdriver; |
@@ -1409,11 +1409,11 @@ discard block |
||
1409 | 1409 | |
1410 | 1410 | |
1411 | 1411 | /** |
1412 | - * Counts all hours by a ident/callsign |
|
1413 | - * |
|
1414 | - * @return Array the hour list |
|
1415 | - * |
|
1416 | - */ |
|
1412 | + * Counts all hours by a ident/callsign |
|
1413 | + * |
|
1414 | + * @return Array the hour list |
|
1415 | + * |
|
1416 | + */ |
|
1417 | 1417 | public function countAllHoursByIdent($ident, $filters = array()) |
1418 | 1418 | { |
1419 | 1419 | global $globalTimezone, $globalDBdriver; |
@@ -1458,11 +1458,11 @@ discard block |
||
1458 | 1458 | |
1459 | 1459 | |
1460 | 1460 | /** |
1461 | - * Counts all vessels |
|
1462 | - * |
|
1463 | - * @return Integer the number of vessels |
|
1464 | - * |
|
1465 | - */ |
|
1461 | + * Counts all vessels |
|
1462 | + * |
|
1463 | + * @return Integer the number of vessels |
|
1464 | + * |
|
1465 | + */ |
|
1466 | 1466 | public function countOverallMarine($filters = array(),$year = '',$month = '') |
1467 | 1467 | { |
1468 | 1468 | global $globalDBdriver; |
@@ -1497,11 +1497,11 @@ discard block |
||
1497 | 1497 | } |
1498 | 1498 | |
1499 | 1499 | /** |
1500 | - * Counts all vessel type |
|
1501 | - * |
|
1502 | - * @return Integer the number of vessels |
|
1503 | - * |
|
1504 | - */ |
|
1500 | + * Counts all vessel type |
|
1501 | + * |
|
1502 | + * @return Integer the number of vessels |
|
1503 | + * |
|
1504 | + */ |
|
1505 | 1505 | public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
1506 | 1506 | { |
1507 | 1507 | global $globalDBdriver; |
@@ -1536,11 +1536,11 @@ discard block |
||
1536 | 1536 | |
1537 | 1537 | |
1538 | 1538 | /** |
1539 | - * Counts all hours of today |
|
1540 | - * |
|
1541 | - * @return Array the hour list |
|
1542 | - * |
|
1543 | - */ |
|
1539 | + * Counts all hours of today |
|
1540 | + * |
|
1541 | + * @return Array the hour list |
|
1542 | + * |
|
1543 | + */ |
|
1544 | 1544 | public function countAllHoursFromToday($filters = array()) |
1545 | 1545 | { |
1546 | 1546 | global $globalTimezone, $globalDBdriver; |
@@ -1580,12 +1580,12 @@ discard block |
||
1580 | 1580 | } |
1581 | 1581 | |
1582 | 1582 | |
1583 | - /** |
|
1584 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
1585 | - * |
|
1586 | - * @return Integer the Barrie Spotter ID |
|
1583 | + /** |
|
1584 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
1585 | + * |
|
1586 | + * @return Integer the Barrie Spotter ID |
|
1587 | 1587 | q * |
1588 | - */ |
|
1588 | + */ |
|
1589 | 1589 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
1590 | 1590 | { |
1591 | 1591 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -1606,13 +1606,13 @@ discard block |
||
1606 | 1606 | |
1607 | 1607 | |
1608 | 1608 | /** |
1609 | - * Parses a date string |
|
1610 | - * |
|
1611 | - * @param String $dateString the date string |
|
1612 | - * @param String $timezone the timezone of a user |
|
1613 | - * @return Array the time information |
|
1614 | - * |
|
1615 | - */ |
|
1609 | + * Parses a date string |
|
1610 | + * |
|
1611 | + * @param String $dateString the date string |
|
1612 | + * @param String $timezone the timezone of a user |
|
1613 | + * @return Array the time information |
|
1614 | + * |
|
1615 | + */ |
|
1616 | 1616 | public function parseDateString($dateString, $timezone = '') |
1617 | 1617 | { |
1618 | 1618 | $time_array = array(); |
@@ -1645,12 +1645,12 @@ discard block |
||
1645 | 1645 | } |
1646 | 1646 | |
1647 | 1647 | /** |
1648 | - * Parses the direction degrees to working |
|
1649 | - * |
|
1650 | - * @param Float $direction the direction in degrees |
|
1651 | - * @return Array the direction information |
|
1652 | - * |
|
1653 | - */ |
|
1648 | + * Parses the direction degrees to working |
|
1649 | + * |
|
1650 | + * @param Float $direction the direction in degrees |
|
1651 | + * @return Array the direction information |
|
1652 | + * |
|
1653 | + */ |
|
1654 | 1654 | public function parseDirection($direction = 0) |
1655 | 1655 | { |
1656 | 1656 | if ($direction == '') $direction = 0; |
@@ -1729,12 +1729,12 @@ discard block |
||
1729 | 1729 | |
1730 | 1730 | |
1731 | 1731 | /** |
1732 | - * Gets Country from latitude/longitude |
|
1733 | - * |
|
1734 | - * @param Float $latitude latitute of the flight |
|
1735 | - * @param Float $longitude longitute of the flight |
|
1736 | - * @return String the countrie |
|
1737 | - */ |
|
1732 | + * Gets Country from latitude/longitude |
|
1733 | + * |
|
1734 | + * @param Float $latitude latitute of the flight |
|
1735 | + * @param Float $longitude longitute of the flight |
|
1736 | + * @return String the countrie |
|
1737 | + */ |
|
1738 | 1738 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
1739 | 1739 | { |
1740 | 1740 | global $globalDBdriver, $globalDebug; |
@@ -1771,11 +1771,11 @@ discard block |
||
1771 | 1771 | } |
1772 | 1772 | |
1773 | 1773 | /** |
1774 | - * Gets Country from iso2 |
|
1775 | - * |
|
1776 | - * @param String $iso2 ISO2 country code |
|
1777 | - * @return String the countrie |
|
1778 | - */ |
|
1774 | + * Gets Country from iso2 |
|
1775 | + * |
|
1776 | + * @param String $iso2 ISO2 country code |
|
1777 | + * @return String the countrie |
|
1778 | + */ |
|
1779 | 1779 | public function getCountryFromISO2($iso2) |
1780 | 1780 | { |
1781 | 1781 | global $globalDBdriver, $globalDebug; |
@@ -1804,12 +1804,12 @@ discard block |
||
1804 | 1804 | |
1805 | 1805 | |
1806 | 1806 | /** |
1807 | - * Gets the short url from bit.ly |
|
1808 | - * |
|
1809 | - * @param String $url the full url |
|
1810 | - * @return String the bit.ly url |
|
1811 | - * |
|
1812 | - */ |
|
1807 | + * Gets the short url from bit.ly |
|
1808 | + * |
|
1809 | + * @param String $url the full url |
|
1810 | + * @return String the bit.ly url |
|
1811 | + * |
|
1812 | + */ |
|
1813 | 1813 | public function getBitlyURL($url) |
1814 | 1814 | { |
1815 | 1815 | global $globalBitlyAccessToken; |
@@ -1836,11 +1836,11 @@ discard block |
||
1836 | 1836 | |
1837 | 1837 | |
1838 | 1838 | /** |
1839 | - * Gets all vessels types that have flown over |
|
1840 | - * |
|
1841 | - * @return Array the vessel type list |
|
1842 | - * |
|
1843 | - */ |
|
1839 | + * Gets all vessels types that have flown over |
|
1840 | + * |
|
1841 | + * @return Array the vessel type list |
|
1842 | + * |
|
1843 | + */ |
|
1844 | 1844 | public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
1845 | 1845 | { |
1846 | 1846 | global $globalDBdriver; |
@@ -1906,11 +1906,11 @@ discard block |
||
1906 | 1906 | } |
1907 | 1907 | |
1908 | 1908 | /** |
1909 | - * Gets all the tracker information |
|
1910 | - * |
|
1911 | - * @return Array the tracker information |
|
1912 | - * |
|
1913 | - */ |
|
1909 | + * Gets all the tracker information |
|
1910 | + * |
|
1911 | + * @return Array the tracker information |
|
1912 | + * |
|
1913 | + */ |
|
1914 | 1914 | public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
1915 | 1915 | { |
1916 | 1916 | global $globalTimezone, $globalDBdriver; |
@@ -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(); |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | } |
152 | 152 | if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
153 | 153 | |
154 | - if(isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
|
154 | + if (isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
|
155 | 155 | { |
156 | 156 | $Image = new Image($this->db); |
157 | - if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
157 | + if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'], '', $temp_array['ident']); |
|
158 | 158 | else $image_array = $Image->getMarineImage($temp_array['mmsi']); |
159 | 159 | unset($Image); |
160 | 160 | if (count($image_array) > 0) { |
@@ -190,17 +190,17 @@ discard block |
||
190 | 190 | { |
191 | 191 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
192 | 192 | } else { |
193 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
193 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
194 | 194 | } |
195 | 195 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
196 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
197 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
196 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
197 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
198 | 198 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
199 | 199 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
200 | 200 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
201 | 201 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
202 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
203 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
202 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
203 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
204 | 204 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
205 | 205 | } |
206 | 206 | } |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | if ($limit != "") |
234 | 234 | { |
235 | 235 | $limit_array = explode(",", $limit); |
236 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
237 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
236 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
237 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
238 | 238 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
239 | 239 | { |
240 | 240 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | } else { |
249 | 249 | $orderby_query = " ORDER BY marine_output.date DESC"; |
250 | 250 | } |
251 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
252 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
251 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
252 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
253 | 253 | return $spotter_array; |
254 | 254 | } |
255 | 255 | |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | if ($id == '') return array(); |
268 | 268 | $additional_query = "marine_output.fammarine_id = :id"; |
269 | 269 | $query_values = array(':id' => $id); |
270 | - $query = $global_query." WHERE ".$additional_query." "; |
|
271 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
270 | + $query = $global_query." WHERE ".$additional_query." "; |
|
271 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
272 | 272 | return $spotter_array; |
273 | 273 | } |
274 | 274 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $query_values = array(); |
288 | 288 | $limit_query = ''; |
289 | 289 | $additional_query = ''; |
290 | - $filter_query = $this->getFilter($filter,true,true); |
|
290 | + $filter_query = $this->getFilter($filter, true, true); |
|
291 | 291 | if ($ident != "") |
292 | 292 | { |
293 | 293 | if (!is_string($ident)) |
@@ -303,8 +303,8 @@ discard block |
||
303 | 303 | { |
304 | 304 | $limit_array = explode(",", $limit); |
305 | 305 | |
306 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
307 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
306 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
307 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
308 | 308 | |
309 | 309 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
310 | 310 | { |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $query_values = array(); |
344 | 344 | $limit_query = ''; |
345 | 345 | $additional_query = ''; |
346 | - $filter_query = $this->getFilter($filter,true,true); |
|
346 | + $filter_query = $this->getFilter($filter, true, true); |
|
347 | 347 | if (!is_string($type)) |
348 | 348 | { |
349 | 349 | return false; |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | { |
357 | 357 | $limit_array = explode(",", $limit); |
358 | 358 | |
359 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
360 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
359 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
360 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
361 | 361 | |
362 | 362 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
363 | 363 | { |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | return $spotter_array; |
382 | 382 | } |
383 | 383 | |
384 | - public function getMarineDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
384 | + public function getMarineDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
385 | 385 | { |
386 | 386 | global $global_query, $globalTimezone, $globalDBdriver; |
387 | 387 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | $limit_query = ''; |
390 | 390 | $additional_query = ''; |
391 | 391 | |
392 | - $filter_query = $this->getFilter($filter,true,true); |
|
392 | + $filter_query = $this->getFilter($filter, true, true); |
|
393 | 393 | |
394 | 394 | if ($date != "") |
395 | 395 | { |
@@ -415,8 +415,8 @@ discard block |
||
415 | 415 | { |
416 | 416 | $limit_array = explode(",", $limit); |
417 | 417 | |
418 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
419 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
418 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
419 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
420 | 420 | |
421 | 421 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
422 | 422 | { |
@@ -447,11 +447,11 @@ discard block |
||
447 | 447 | * @return Array list of source name |
448 | 448 | * |
449 | 449 | */ |
450 | - public function getAllSourceName($type = '',$filters = array()) |
|
450 | + public function getAllSourceName($type = '', $filters = array()) |
|
451 | 451 | { |
452 | - $filter_query = $this->getFilter($filters,true,true); |
|
452 | + $filter_query = $this->getFilter($filters, true, true); |
|
453 | 453 | $query_values = array(); |
454 | - $query = "SELECT DISTINCT marine_output.source_name |
|
454 | + $query = "SELECT DISTINCT marine_output.source_name |
|
455 | 455 | FROM marine_output".$filter_query." marine_output.source_name <> ''"; |
456 | 456 | if ($type != '') { |
457 | 457 | $query_values = array(':type' => $type); |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | $source_array = array(); |
467 | 467 | $temp_array = array(); |
468 | 468 | |
469 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
469 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
470 | 470 | { |
471 | 471 | $temp_array['source_name'] = $row['source_name']; |
472 | 472 | $source_array[] = $temp_array; |
@@ -483,8 +483,8 @@ discard block |
||
483 | 483 | */ |
484 | 484 | public function getAllIdents($filters = array()) |
485 | 485 | { |
486 | - $filter_query = $this->getFilter($filters,true,true); |
|
487 | - $query = "SELECT DISTINCT marine_output.ident |
|
486 | + $filter_query = $this->getFilter($filters, true, true); |
|
487 | + $query = "SELECT DISTINCT marine_output.ident |
|
488 | 488 | FROM marine_output".$filter_query." marine_output.ident <> '' |
489 | 489 | ORDER BY marine_output.date ASC LIMIT 700 OFFSET 0"; |
490 | 490 | |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | $ident_array = array(); |
495 | 495 | $temp_array = array(); |
496 | 496 | |
497 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
497 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
498 | 498 | { |
499 | 499 | $temp_array['ident'] = $row['ident']; |
500 | 500 | $ident_array[] = $temp_array; |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | */ |
512 | 512 | public function getIdentity($mmsi) |
513 | 513 | { |
514 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
514 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
515 | 515 | $query = "SELECT * FROM marine_identity WHERE mmsi = :mmsi LIMIT 1"; |
516 | 516 | $sth = $this->db->prepare($query); |
517 | 517 | $sth->execute(array(':mmsi' => $mmsi)); |
@@ -524,23 +524,23 @@ discard block |
||
524 | 524 | * Add identity |
525 | 525 | * |
526 | 526 | */ |
527 | - public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
|
527 | + public function addIdentity($mmsi, $imo, $ident, $callsign, $type) |
|
528 | 528 | { |
529 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
529 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
530 | 530 | if ($mmsi != '') { |
531 | - $imo = filter_var($imo,FILTER_SANITIZE_NUMBER_INT); |
|
532 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
533 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
534 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
531 | + $imo = filter_var($imo, FILTER_SANITIZE_NUMBER_INT); |
|
532 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
533 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
534 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
535 | 535 | $identinfo = $this->getIdentity($mmsi); |
536 | 536 | if (empty($identinfo)) { |
537 | - $query = "INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:type)"; |
|
537 | + $query = "INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:type)"; |
|
538 | 538 | $sth = $this->db->prepare($query); |
539 | - $sth->execute(array(':mmsi' => $mmsi,':imo' => $imo,':call_sign' => $callsign,':ship_name' => $ident,':type' => $type)); |
|
539 | + $sth->execute(array(':mmsi' => $mmsi, ':imo' => $imo, ':call_sign' => $callsign, ':ship_name' => $ident, ':type' => $type)); |
|
540 | 540 | } elseif ($ident != '' && $identinfo['ship_name'] != $ident) { |
541 | - $query = "UPDATE marine_identity SET ship_name = :ship_name,type = :type WHERE mmsi = :mmsi"; |
|
541 | + $query = "UPDATE marine_identity SET ship_name = :ship_name,type = :type WHERE mmsi = :mmsi"; |
|
542 | 542 | $sth = $this->db->prepare($query); |
543 | - $sth->execute(array(':mmsi' => $mmsi,':ship_name' => $ident,':type' => $type)); |
|
543 | + $sth->execute(array(':mmsi' => $mmsi, ':ship_name' => $ident, ':type' => $type)); |
|
544 | 544 | } |
545 | 545 | } |
546 | 546 | } |
@@ -561,12 +561,12 @@ discard block |
||
561 | 561 | } else $offset = '+00:00'; |
562 | 562 | |
563 | 563 | if ($globalDBdriver == 'mysql') { |
564 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
564 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
565 | 565 | FROM marine_output |
566 | 566 | WHERE marine_output.date <> '' |
567 | 567 | ORDER BY marine_output.date ASC LIMIT 0,100"; |
568 | 568 | } else { |
569 | - $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
569 | + $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
570 | 570 | FROM marine_output |
571 | 571 | WHERE marine_output.date <> '' |
572 | 572 | ORDER BY marine_output.date ASC LIMIT 0,100"; |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | $date_array = array(); |
579 | 579 | $temp_array = array(); |
580 | 580 | |
581 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
581 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
582 | 582 | { |
583 | 583 | $temp_array['date'] = $row['date']; |
584 | 584 | |
@@ -596,10 +596,10 @@ discard block |
||
596 | 596 | * @return String success or false |
597 | 597 | * |
598 | 598 | */ |
599 | - public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
|
599 | + public function updateIdentMarineData($fammarine_id = '', $ident = '', $fromsource = NULL) |
|
600 | 600 | { |
601 | 601 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
602 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident); |
|
602 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident); |
|
603 | 603 | try { |
604 | 604 | $sth = $this->db->prepare($query); |
605 | 605 | $sth->execute($query_values); |
@@ -617,10 +617,10 @@ discard block |
||
617 | 617 | * @return String success or false |
618 | 618 | * |
619 | 619 | */ |
620 | - public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL) |
|
620 | + public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '', $fromsource = NULL) |
|
621 | 621 | { |
622 | 622 | $query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id'; |
623 | - $query_values = array(':fammarine_id' => $fammarine_id,':arrival_code' => $arrival_code); |
|
623 | + $query_values = array(':fammarine_id' => $fammarine_id, ':arrival_code' => $arrival_code); |
|
624 | 624 | try { |
625 | 625 | $sth = $this->db->prepare($query); |
626 | 626 | $sth->execute($query_values); |
@@ -639,11 +639,11 @@ discard block |
||
639 | 639 | * @return String success or false |
640 | 640 | * |
641 | 641 | */ |
642 | - public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
|
642 | + public function updateStatusMarineData($fammarine_id = '', $status_id = '', $status = '') |
|
643 | 643 | { |
644 | 644 | |
645 | 645 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
646 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
646 | + $query_values = array(':fammarine_id' => $fammarine_id, ':status' => $status, ':status_id' => $status_id); |
|
647 | 647 | |
648 | 648 | try { |
649 | 649 | $sth = $this->db->prepare($query); |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
667 | 667 | { |
668 | 668 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id'; |
669 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
669 | + $query_values = array(':fammarine_id' => $fammarine_id, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident); |
|
670 | 670 | |
671 | 671 | try { |
672 | 672 | $sth = $this->db->prepare($query); |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | * @param String $verticalrate vertival rate of flight |
705 | 705 | * @return String success or false |
706 | 706 | */ |
707 | - public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '') |
|
707 | + public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $format_source = '', $source_name = '') |
|
708 | 708 | { |
709 | 709 | global $globalURL, $globalMarineImageFetch; |
710 | 710 | |
@@ -771,32 +771,32 @@ discard block |
||
771 | 771 | } |
772 | 772 | |
773 | 773 | |
774 | - if ($date == "" || strtotime($date) < time()-20*60) |
|
774 | + if ($date == "" || strtotime($date) < time() - 20*60) |
|
775 | 775 | { |
776 | 776 | $date = date("Y-m-d H:i:s", time()); |
777 | 777 | } |
778 | 778 | |
779 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
780 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
781 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
782 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
783 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
784 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
785 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
786 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
787 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
788 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
789 | - $type_id = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT); |
|
790 | - $status_id = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT); |
|
791 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
792 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
793 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
794 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
779 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
780 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
781 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
782 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
783 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
784 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
785 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
786 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
787 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
788 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
789 | + $type_id = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT); |
|
790 | + $status_id = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT); |
|
791 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
792 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
793 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
794 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
795 | 795 | if (isset($globalMarineImageFetch) && $globalMarineImageFetch === TRUE) { |
796 | 796 | $Image = new Image($this->db); |
797 | - $image_array = $Image->getMarineImage($mmsi,$imo,$ident); |
|
797 | + $image_array = $Image->getMarineImage($mmsi, $imo, $ident); |
|
798 | 798 | if (!isset($image_array[0]['mmsi'])) { |
799 | - $Image->addMarineImage($mmsi,$imo,$ident); |
|
799 | + $Image->addMarineImage($mmsi, $imo, $ident); |
|
800 | 800 | } |
801 | 801 | unset($Image); |
802 | 802 | } |
@@ -809,10 +809,10 @@ discard block |
||
809 | 809 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
810 | 810 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
811 | 811 | if ($arrival_date == '') $arrival_date = NULL; |
812 | - $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date) |
|
812 | + $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date) |
|
813 | 813 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:type_id,:status,:status_id,:imo,:arrival_port_name,:arrival_port_date)"; |
814 | 814 | |
815 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':mmsi' => $mmsi,':type' => $type,':type_id' => $type_id,':status' => $status,':status_id' => $status_id,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date); |
|
815 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':mmsi' => $mmsi, ':type' => $type, ':type_id' => $type_id, ':status' => $status, ':status_id' => $status_id, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date); |
|
816 | 816 | try { |
817 | 817 | $sth = $this->db->prepare($query); |
818 | 818 | $sth->execute($query_values); |
@@ -836,13 +836,13 @@ discard block |
||
836 | 836 | { |
837 | 837 | global $globalDBdriver, $globalTimezone; |
838 | 838 | if ($globalDBdriver == 'mysql') { |
839 | - $query = "SELECT marine_output.ident FROM marine_output |
|
839 | + $query = "SELECT marine_output.ident FROM marine_output |
|
840 | 840 | WHERE marine_output.ident = :ident |
841 | 841 | AND marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
842 | 842 | AND marine_output.date < UTC_TIMESTAMP()"; |
843 | 843 | $query_data = array(':ident' => $ident); |
844 | 844 | } else { |
845 | - $query = "SELECT marine_output.ident FROM marine_output |
|
845 | + $query = "SELECT marine_output.ident FROM marine_output |
|
846 | 846 | WHERE marine_output.ident = :ident |
847 | 847 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
848 | 848 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -851,8 +851,8 @@ discard block |
||
851 | 851 | |
852 | 852 | $sth = $this->db->prepare($query); |
853 | 853 | $sth->execute($query_data); |
854 | - $ident_result=''; |
|
855 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
854 | + $ident_result = ''; |
|
855 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
856 | 856 | { |
857 | 857 | $ident_result = $row['ident']; |
858 | 858 | } |
@@ -878,8 +878,8 @@ discard block |
||
878 | 878 | return false; |
879 | 879 | } else { |
880 | 880 | $q_array = explode(" ", $q); |
881 | - foreach ($q_array as $q_item){ |
|
882 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
881 | + foreach ($q_array as $q_item) { |
|
882 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
883 | 883 | $additional_query .= " AND ("; |
884 | 884 | $additional_query .= "(marine_output.ident like '%".$q_item."%')"; |
885 | 885 | $additional_query .= ")"; |
@@ -887,11 +887,11 @@ discard block |
||
887 | 887 | } |
888 | 888 | } |
889 | 889 | if ($globalDBdriver == 'mysql') { |
890 | - $query = "SELECT marine_output.* FROM marine_output |
|
890 | + $query = "SELECT marine_output.* FROM marine_output |
|
891 | 891 | WHERE marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
892 | 892 | AND marine_output.date < UTC_TIMESTAMP()"; |
893 | 893 | } else { |
894 | - $query = "SELECT marine_output.* FROM marine_output |
|
894 | + $query = "SELECT marine_output.* FROM marine_output |
|
895 | 895 | WHERE marine_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
896 | 896 | AND marine_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
897 | 897 | } |
@@ -910,16 +910,16 @@ discard block |
||
910 | 910 | * |
911 | 911 | */ |
912 | 912 | |
913 | - public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
913 | + public function countAllMarineOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
914 | 914 | { |
915 | 915 | global $globalDBdriver, $globalArchive; |
916 | 916 | //$filter_query = $this->getFilter($filters,true,true); |
917 | - $Connection= new Connection($this->db); |
|
917 | + $Connection = new Connection($this->db); |
|
918 | 918 | if (!$Connection->tableExists('countries')) return array(); |
919 | 919 | require_once('class.SpotterLive.php'); |
920 | 920 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
921 | 921 | $MarineLive = new MarineLive($this->db); |
922 | - $filter_query = $MarineLive->getFilter($filters,true,true); |
|
922 | + $filter_query = $MarineLive->getFilter($filters, true, true); |
|
923 | 923 | $filter_query .= " over_country IS NOT NULL AND over_country <> ''"; |
924 | 924 | if ($olderthanmonths > 0) { |
925 | 925 | if ($globalDBdriver == 'mysql') { |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | } else { |
940 | 940 | require_once(dirname(__FILE__)."/class.MarineArchive.php"); |
941 | 941 | $MarineArchive = new MarineArchive($this->db); |
942 | - $filter_query = $MarineArchive->getFilter($filters,true,true); |
|
942 | + $filter_query = $MarineArchive->getFilter($filters, true, true); |
|
943 | 943 | $filter_query .= " over_country <> ''"; |
944 | 944 | if ($olderthanmonths > 0) { |
945 | 945 | if ($globalDBdriver == 'mysql') { |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | $flight_array = array(); |
968 | 968 | $temp_array = array(); |
969 | 969 | |
970 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
970 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
971 | 971 | { |
972 | 972 | $temp_array['marine_count'] = $row['nb']; |
973 | 973 | $temp_array['marine_country'] = $row['name']; |
@@ -986,11 +986,11 @@ discard block |
||
986 | 986 | * @return Array the callsign list |
987 | 987 | * |
988 | 988 | */ |
989 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
989 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
990 | 990 | { |
991 | 991 | global $globalDBdriver; |
992 | - $filter_query = $this->getFilter($filters,true,true); |
|
993 | - $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
992 | + $filter_query = $this->getFilter($filters, true, true); |
|
993 | + $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
994 | 994 | FROM marine_output".$filter_query." marine_output.ident <> ''"; |
995 | 995 | if ($olderthanmonths > 0) { |
996 | 996 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -1004,28 +1004,28 @@ discard block |
||
1004 | 1004 | if ($year != '') { |
1005 | 1005 | if ($globalDBdriver == 'mysql') { |
1006 | 1006 | $query .= " AND YEAR(marine_output.date) = :year"; |
1007 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1007 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1008 | 1008 | } else { |
1009 | 1009 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1010 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1010 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1011 | 1011 | } |
1012 | 1012 | } |
1013 | 1013 | if ($month != '') { |
1014 | 1014 | if ($globalDBdriver == 'mysql') { |
1015 | 1015 | $query .= " AND MONTH(marine_output.date) = :month"; |
1016 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1016 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1017 | 1017 | } else { |
1018 | 1018 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1019 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1019 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1020 | 1020 | } |
1021 | 1021 | } |
1022 | 1022 | if ($day != '') { |
1023 | 1023 | if ($globalDBdriver == 'mysql') { |
1024 | 1024 | $query .= " AND DAY(marine_output.date) = :day"; |
1025 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1025 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1026 | 1026 | } else { |
1027 | 1027 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
1028 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1028 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1029 | 1029 | } |
1030 | 1030 | } |
1031 | 1031 | $query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC"; |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | $callsign_array = array(); |
1038 | 1038 | $temp_array = array(); |
1039 | 1039 | |
1040 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1040 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1041 | 1041 | { |
1042 | 1042 | $temp_array['callsign_icao'] = $row['ident']; |
1043 | 1043 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -1089,7 +1089,7 @@ discard block |
||
1089 | 1089 | $date_array = array(); |
1090 | 1090 | $temp_array = array(); |
1091 | 1091 | |
1092 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1092 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1093 | 1093 | { |
1094 | 1094 | $temp_array['date_name'] = $row['date_name']; |
1095 | 1095 | $temp_array['date_count'] = $row['date_count']; |
@@ -1115,7 +1115,7 @@ discard block |
||
1115 | 1115 | $datetime = new DateTime(); |
1116 | 1116 | $offset = $datetime->format('P'); |
1117 | 1117 | } else $offset = '+00:00'; |
1118 | - $filter_query = $this->getFilter($filters,true,true); |
|
1118 | + $filter_query = $this->getFilter($filters, true, true); |
|
1119 | 1119 | if ($globalDBdriver == 'mysql') { |
1120 | 1120 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1121 | 1121 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -1136,7 +1136,7 @@ discard block |
||
1136 | 1136 | $date_array = array(); |
1137 | 1137 | $temp_array = array(); |
1138 | 1138 | |
1139 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1139 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1140 | 1140 | { |
1141 | 1141 | $temp_array['date_name'] = $row['date_name']; |
1142 | 1142 | $temp_array['date_count'] = $row['date_count']; |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | $datetime = new DateTime(); |
1162 | 1162 | $offset = $datetime->format('P'); |
1163 | 1163 | } else $offset = '+00:00'; |
1164 | - $filter_query = $this->getFilter($filters,true,true); |
|
1164 | + $filter_query = $this->getFilter($filters, true, true); |
|
1165 | 1165 | if ($globalDBdriver == 'mysql') { |
1166 | 1166 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1167 | 1167 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | $date_array = array(); |
1183 | 1183 | $temp_array = array(); |
1184 | 1184 | |
1185 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1185 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1186 | 1186 | { |
1187 | 1187 | $temp_array['date_name'] = $row['date_name']; |
1188 | 1188 | $temp_array['date_count'] = $row['date_count']; |
@@ -1229,7 +1229,7 @@ discard block |
||
1229 | 1229 | $date_array = array(); |
1230 | 1230 | $temp_array = array(); |
1231 | 1231 | |
1232 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1232 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1233 | 1233 | { |
1234 | 1234 | $temp_array['month_name'] = $row['month_name']; |
1235 | 1235 | $temp_array['year_name'] = $row['year_name']; |
@@ -1258,7 +1258,7 @@ discard block |
||
1258 | 1258 | $datetime = new DateTime(); |
1259 | 1259 | $offset = $datetime->format('P'); |
1260 | 1260 | } else $offset = '+00:00'; |
1261 | - $filter_query = $this->getFilter($filters,true,true); |
|
1261 | + $filter_query = $this->getFilter($filters, true, true); |
|
1262 | 1262 | if ($globalDBdriver == 'mysql') { |
1263 | 1263 | $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 |
1264 | 1264 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -1279,7 +1279,7 @@ discard block |
||
1279 | 1279 | $date_array = array(); |
1280 | 1280 | $temp_array = array(); |
1281 | 1281 | |
1282 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1282 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1283 | 1283 | { |
1284 | 1284 | $temp_array['year_name'] = $row['year_name']; |
1285 | 1285 | $temp_array['month_name'] = $row['month_name']; |
@@ -1299,7 +1299,7 @@ discard block |
||
1299 | 1299 | * @return Array the hour list |
1300 | 1300 | * |
1301 | 1301 | */ |
1302 | - public function countAllHours($orderby,$filters = array()) |
|
1302 | + public function countAllHours($orderby, $filters = array()) |
|
1303 | 1303 | { |
1304 | 1304 | global $globalTimezone, $globalDBdriver; |
1305 | 1305 | if ($globalTimezone != '') { |
@@ -1347,7 +1347,7 @@ discard block |
||
1347 | 1347 | $hour_array = array(); |
1348 | 1348 | $temp_array = array(); |
1349 | 1349 | |
1350 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1350 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1351 | 1351 | { |
1352 | 1352 | $temp_array['hour_name'] = $row['hour_name']; |
1353 | 1353 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1369,8 +1369,8 @@ discard block |
||
1369 | 1369 | public function countAllHoursByDate($date, $filters = array()) |
1370 | 1370 | { |
1371 | 1371 | global $globalTimezone, $globalDBdriver; |
1372 | - $filter_query = $this->getFilter($filters,true,true); |
|
1373 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
1372 | + $filter_query = $this->getFilter($filters, true, true); |
|
1373 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
1374 | 1374 | if ($globalTimezone != '') { |
1375 | 1375 | date_default_timezone_set($globalTimezone); |
1376 | 1376 | $datetime = new DateTime($date); |
@@ -1378,12 +1378,12 @@ discard block |
||
1378 | 1378 | } else $offset = '+00:00'; |
1379 | 1379 | |
1380 | 1380 | if ($globalDBdriver == 'mysql') { |
1381 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1381 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1382 | 1382 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = :date |
1383 | 1383 | GROUP BY hour_name |
1384 | 1384 | ORDER BY hour_name ASC"; |
1385 | 1385 | } else { |
1386 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1386 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1387 | 1387 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
1388 | 1388 | GROUP BY hour_name |
1389 | 1389 | ORDER BY hour_name ASC"; |
@@ -1395,7 +1395,7 @@ discard block |
||
1395 | 1395 | $hour_array = array(); |
1396 | 1396 | $temp_array = array(); |
1397 | 1397 | |
1398 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1398 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1399 | 1399 | { |
1400 | 1400 | $temp_array['hour_name'] = $row['hour_name']; |
1401 | 1401 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1417,8 +1417,8 @@ discard block |
||
1417 | 1417 | public function countAllHoursByIdent($ident, $filters = array()) |
1418 | 1418 | { |
1419 | 1419 | global $globalTimezone, $globalDBdriver; |
1420 | - $filter_query = $this->getFilter($filters,true,true); |
|
1421 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1420 | + $filter_query = $this->getFilter($filters, true, true); |
|
1421 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1422 | 1422 | if ($globalTimezone != '') { |
1423 | 1423 | date_default_timezone_set($globalTimezone); |
1424 | 1424 | $datetime = new DateTime(); |
@@ -1426,12 +1426,12 @@ discard block |
||
1426 | 1426 | } else $offset = '+00:00'; |
1427 | 1427 | |
1428 | 1428 | if ($globalDBdriver == 'mysql') { |
1429 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1429 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1430 | 1430 | FROM marine_output".$filter_query." marine_output.ident = :ident |
1431 | 1431 | GROUP BY hour_name |
1432 | 1432 | ORDER BY hour_name ASC"; |
1433 | 1433 | } else { |
1434 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1434 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1435 | 1435 | FROM marine_output".$filter_query." marine_output.ident = :ident |
1436 | 1436 | GROUP BY hour_name |
1437 | 1437 | ORDER BY hour_name ASC"; |
@@ -1439,12 +1439,12 @@ discard block |
||
1439 | 1439 | |
1440 | 1440 | |
1441 | 1441 | $sth = $this->db->prepare($query); |
1442 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
1442 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
1443 | 1443 | |
1444 | 1444 | $hour_array = array(); |
1445 | 1445 | $temp_array = array(); |
1446 | 1446 | |
1447 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1447 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1448 | 1448 | { |
1449 | 1449 | $temp_array['hour_name'] = $row['hour_name']; |
1450 | 1450 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1463,33 +1463,33 @@ discard block |
||
1463 | 1463 | * @return Integer the number of vessels |
1464 | 1464 | * |
1465 | 1465 | */ |
1466 | - public function countOverallMarine($filters = array(),$year = '',$month = '') |
|
1466 | + public function countOverallMarine($filters = array(), $year = '', $month = '') |
|
1467 | 1467 | { |
1468 | 1468 | global $globalDBdriver; |
1469 | 1469 | //$queryi = "SELECT COUNT(marine_output.marine_id) AS flight_count FROM marine_output"; |
1470 | - $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
1470 | + $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
1471 | 1471 | $query_values = array(); |
1472 | 1472 | $query = ''; |
1473 | 1473 | if ($year != '') { |
1474 | 1474 | if ($globalDBdriver == 'mysql') { |
1475 | 1475 | $query .= " AND YEAR(marine_output.date) = :year"; |
1476 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1476 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1477 | 1477 | } else { |
1478 | 1478 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1479 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1479 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1480 | 1480 | } |
1481 | 1481 | } |
1482 | 1482 | if ($month != '') { |
1483 | 1483 | if ($globalDBdriver == 'mysql') { |
1484 | 1484 | $query .= " AND MONTH(marine_output.date) = :month"; |
1485 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1485 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1486 | 1486 | } else { |
1487 | 1487 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1488 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1488 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1489 | 1489 | } |
1490 | 1490 | } |
1491 | 1491 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1492 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1492 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1493 | 1493 | |
1494 | 1494 | $sth = $this->db->prepare($queryi); |
1495 | 1495 | $sth->execute($query_values); |
@@ -1502,32 +1502,32 @@ discard block |
||
1502 | 1502 | * @return Integer the number of vessels |
1503 | 1503 | * |
1504 | 1504 | */ |
1505 | - public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
|
1505 | + public function countOverallMarineTypes($filters = array(), $year = '', $month = '') |
|
1506 | 1506 | { |
1507 | 1507 | global $globalDBdriver; |
1508 | - $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
1508 | + $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
1509 | 1509 | $query_values = array(); |
1510 | 1510 | $query = ''; |
1511 | 1511 | if ($year != '') { |
1512 | 1512 | if ($globalDBdriver == 'mysql') { |
1513 | 1513 | $query .= " AND YEAR(marine_output.date) = :year"; |
1514 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1514 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1515 | 1515 | } else { |
1516 | 1516 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1517 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1517 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1518 | 1518 | } |
1519 | 1519 | } |
1520 | 1520 | if ($month != '') { |
1521 | 1521 | if ($globalDBdriver == 'mysql') { |
1522 | 1522 | $query .= " AND MONTH(marine_output.date) = :month"; |
1523 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1523 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1524 | 1524 | } else { |
1525 | 1525 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1526 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1526 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1527 | 1527 | } |
1528 | 1528 | } |
1529 | 1529 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1530 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1530 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1531 | 1531 | |
1532 | 1532 | $sth = $this->db->prepare($queryi); |
1533 | 1533 | $sth->execute($query_values); |
@@ -1544,7 +1544,7 @@ discard block |
||
1544 | 1544 | public function countAllHoursFromToday($filters = array()) |
1545 | 1545 | { |
1546 | 1546 | global $globalTimezone, $globalDBdriver; |
1547 | - $filter_query = $this->getFilter($filters,true,true); |
|
1547 | + $filter_query = $this->getFilter($filters, true, true); |
|
1548 | 1548 | if ($globalTimezone != '') { |
1549 | 1549 | date_default_timezone_set($globalTimezone); |
1550 | 1550 | $datetime = new DateTime(); |
@@ -1552,12 +1552,12 @@ discard block |
||
1552 | 1552 | } else $offset = '+00:00'; |
1553 | 1553 | |
1554 | 1554 | if ($globalDBdriver == 'mysql') { |
1555 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1555 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1556 | 1556 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = CURDATE() |
1557 | 1557 | GROUP BY hour_name |
1558 | 1558 | ORDER BY hour_name ASC"; |
1559 | 1559 | } else { |
1560 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1560 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1561 | 1561 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
1562 | 1562 | GROUP BY hour_name |
1563 | 1563 | ORDER BY hour_name ASC"; |
@@ -1569,7 +1569,7 @@ discard block |
||
1569 | 1569 | $hour_array = array(); |
1570 | 1570 | $temp_array = array(); |
1571 | 1571 | |
1572 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1572 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1573 | 1573 | { |
1574 | 1574 | $temp_array['hour_name'] = $row['hour_name']; |
1575 | 1575 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1588,9 +1588,9 @@ discard block |
||
1588 | 1588 | */ |
1589 | 1589 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
1590 | 1590 | { |
1591 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
1591 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
1592 | 1592 | |
1593 | - $query = "SELECT marine_output.marine_id |
|
1593 | + $query = "SELECT marine_output.marine_id |
|
1594 | 1594 | FROM marine_output |
1595 | 1595 | WHERE marine_output.fammarine_id = '".$fammarine_id."'"; |
1596 | 1596 | |
@@ -1598,7 +1598,7 @@ discard block |
||
1598 | 1598 | $sth = $this->db->prepare($query); |
1599 | 1599 | $sth->execute(); |
1600 | 1600 | |
1601 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1601 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1602 | 1602 | { |
1603 | 1603 | return $row['marine_id']; |
1604 | 1604 | } |
@@ -1623,23 +1623,23 @@ discard block |
||
1623 | 1623 | } |
1624 | 1624 | |
1625 | 1625 | $current_date = date("Y-m-d H:i:s"); |
1626 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
1626 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
1627 | 1627 | |
1628 | 1628 | $diff = abs(strtotime($current_date) - strtotime($date)); |
1629 | 1629 | |
1630 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
1630 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
1631 | 1631 | $years = $time_array['years']; |
1632 | 1632 | |
1633 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
1633 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
1634 | 1634 | $months = $time_array['months']; |
1635 | 1635 | |
1636 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
1636 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
1637 | 1637 | $days = $time_array['days']; |
1638 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
1638 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
1639 | 1639 | $hours = $time_array['hours']; |
1640 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
1640 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
1641 | 1641 | $minutes = $time_array['minutes']; |
1642 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1642 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1643 | 1643 | |
1644 | 1644 | return $time_array; |
1645 | 1645 | } |
@@ -1662,63 +1662,63 @@ discard block |
||
1662 | 1662 | $temp_array['direction_degree'] = $direction; |
1663 | 1663 | $temp_array['direction_shortname'] = "N"; |
1664 | 1664 | $temp_array['direction_fullname'] = "North"; |
1665 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
1665 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
1666 | 1666 | $temp_array['direction_degree'] = $direction; |
1667 | 1667 | $temp_array['direction_shortname'] = "NNE"; |
1668 | 1668 | $temp_array['direction_fullname'] = "North-Northeast"; |
1669 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
1669 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
1670 | 1670 | $temp_array['direction_degree'] = $direction; |
1671 | 1671 | $temp_array['direction_shortname'] = "NE"; |
1672 | 1672 | $temp_array['direction_fullname'] = "Northeast"; |
1673 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
1673 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
1674 | 1674 | $temp_array['direction_degree'] = $direction; |
1675 | 1675 | $temp_array['direction_shortname'] = "ENE"; |
1676 | 1676 | $temp_array['direction_fullname'] = "East-Northeast"; |
1677 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
1677 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
1678 | 1678 | $temp_array['direction_degree'] = $direction; |
1679 | 1679 | $temp_array['direction_shortname'] = "E"; |
1680 | 1680 | $temp_array['direction_fullname'] = "East"; |
1681 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
1681 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
1682 | 1682 | $temp_array['direction_degree'] = $direction; |
1683 | 1683 | $temp_array['direction_shortname'] = "ESE"; |
1684 | 1684 | $temp_array['direction_fullname'] = "East-Southeast"; |
1685 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
1685 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
1686 | 1686 | $temp_array['direction_degree'] = $direction; |
1687 | 1687 | $temp_array['direction_shortname'] = "SE"; |
1688 | 1688 | $temp_array['direction_fullname'] = "Southeast"; |
1689 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
1689 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
1690 | 1690 | $temp_array['direction_degree'] = $direction; |
1691 | 1691 | $temp_array['direction_shortname'] = "SSE"; |
1692 | 1692 | $temp_array['direction_fullname'] = "South-Southeast"; |
1693 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
1693 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
1694 | 1694 | $temp_array['direction_degree'] = $direction; |
1695 | 1695 | $temp_array['direction_shortname'] = "S"; |
1696 | 1696 | $temp_array['direction_fullname'] = "South"; |
1697 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
1697 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
1698 | 1698 | $temp_array['direction_degree'] = $direction; |
1699 | 1699 | $temp_array['direction_shortname'] = "SSW"; |
1700 | 1700 | $temp_array['direction_fullname'] = "South-Southwest"; |
1701 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
1701 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
1702 | 1702 | $temp_array['direction_degree'] = $direction; |
1703 | 1703 | $temp_array['direction_shortname'] = "SW"; |
1704 | 1704 | $temp_array['direction_fullname'] = "Southwest"; |
1705 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
1705 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
1706 | 1706 | $temp_array['direction_degree'] = $direction; |
1707 | 1707 | $temp_array['direction_shortname'] = "WSW"; |
1708 | 1708 | $temp_array['direction_fullname'] = "West-Southwest"; |
1709 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
1709 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
1710 | 1710 | $temp_array['direction_degree'] = $direction; |
1711 | 1711 | $temp_array['direction_shortname'] = "W"; |
1712 | 1712 | $temp_array['direction_fullname'] = "West"; |
1713 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
1713 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
1714 | 1714 | $temp_array['direction_degree'] = $direction; |
1715 | 1715 | $temp_array['direction_shortname'] = "WNW"; |
1716 | 1716 | $temp_array['direction_fullname'] = "West-Northwest"; |
1717 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
1717 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
1718 | 1718 | $temp_array['direction_degree'] = $direction; |
1719 | 1719 | $temp_array['direction_shortname'] = "NW"; |
1720 | 1720 | $temp_array['direction_fullname'] = "Northwest"; |
1721 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
1721 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
1722 | 1722 | $temp_array['direction_degree'] = $direction; |
1723 | 1723 | $temp_array['direction_shortname'] = "NNW"; |
1724 | 1724 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -1735,11 +1735,11 @@ discard block |
||
1735 | 1735 | * @param Float $longitude longitute of the flight |
1736 | 1736 | * @return String the countrie |
1737 | 1737 | */ |
1738 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
1738 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
1739 | 1739 | { |
1740 | 1740 | global $globalDBdriver, $globalDebug; |
1741 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1742 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1741 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1742 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1743 | 1743 | |
1744 | 1744 | $Connection = new Connection($this->db); |
1745 | 1745 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1779,7 +1779,7 @@ discard block |
||
1779 | 1779 | public function getCountryFromISO2($iso2) |
1780 | 1780 | { |
1781 | 1781 | global $globalDBdriver, $globalDebug; |
1782 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
1782 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
1783 | 1783 | |
1784 | 1784 | $Connection = new Connection($this->db); |
1785 | 1785 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1827,7 +1827,7 @@ discard block |
||
1827 | 1827 | |
1828 | 1828 | $bitly_data = json_decode($bitly_data); |
1829 | 1829 | $bitly_url = ''; |
1830 | - if ($bitly_data->status_txt = "OK"){ |
|
1830 | + if ($bitly_data->status_txt = "OK") { |
|
1831 | 1831 | $bitly_url = $bitly_data->data->url; |
1832 | 1832 | } |
1833 | 1833 | |
@@ -1841,11 +1841,11 @@ discard block |
||
1841 | 1841 | * @return Array the vessel type list |
1842 | 1842 | * |
1843 | 1843 | */ |
1844 | - public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
1844 | + public function countAllMarineTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
1845 | 1845 | { |
1846 | 1846 | global $globalDBdriver; |
1847 | - $filter_query = $this->getFilter($filters,true,true); |
|
1848 | - $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count, marine_output.type_id AS marine_type_id |
|
1847 | + $filter_query = $this->getFilter($filters, true, true); |
|
1848 | + $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count, marine_output.type_id AS marine_type_id |
|
1849 | 1849 | FROM marine_output ".$filter_query." marine_output.type <> '' AND marine_output.type_id IS NOT NULL"; |
1850 | 1850 | if ($olderthanmonths > 0) { |
1851 | 1851 | if ($globalDBdriver == 'mysql') { |
@@ -1865,28 +1865,28 @@ discard block |
||
1865 | 1865 | if ($year != '') { |
1866 | 1866 | if ($globalDBdriver == 'mysql') { |
1867 | 1867 | $query .= " AND YEAR(marine_output.date) = :year"; |
1868 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1868 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1869 | 1869 | } else { |
1870 | 1870 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1871 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1871 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1872 | 1872 | } |
1873 | 1873 | } |
1874 | 1874 | if ($month != '') { |
1875 | 1875 | if ($globalDBdriver == 'mysql') { |
1876 | 1876 | $query .= " AND MONTH(marine_output.date) = :month"; |
1877 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1877 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1878 | 1878 | } else { |
1879 | 1879 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1880 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1880 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1881 | 1881 | } |
1882 | 1882 | } |
1883 | 1883 | if ($day != '') { |
1884 | 1884 | if ($globalDBdriver == 'mysql') { |
1885 | 1885 | $query .= " AND DAY(marine_output.date) = :day"; |
1886 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1886 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1887 | 1887 | } else { |
1888 | 1888 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
1889 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1889 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1890 | 1890 | } |
1891 | 1891 | } |
1892 | 1892 | $query .= " GROUP BY marine_output.type, marine_output.type_id ORDER BY marine_type_count DESC"; |
@@ -1895,7 +1895,7 @@ discard block |
||
1895 | 1895 | $sth->execute($query_values); |
1896 | 1896 | $marine_array = array(); |
1897 | 1897 | $temp_array = array(); |
1898 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1898 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1899 | 1899 | { |
1900 | 1900 | $temp_array['marine_type'] = $row['marine_type']; |
1901 | 1901 | $temp_array['marine_type_id'] = $row['marine_type_id']; |
@@ -1911,13 +1911,13 @@ discard block |
||
1911 | 1911 | * @return Array the tracker information |
1912 | 1912 | * |
1913 | 1913 | */ |
1914 | - public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
|
1914 | + public function searchMarineData($q = '', $callsign = '', $mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
1915 | 1915 | { |
1916 | 1916 | global $globalTimezone, $globalDBdriver; |
1917 | 1917 | date_default_timezone_set('UTC'); |
1918 | 1918 | $query_values = array(); |
1919 | 1919 | $additional_query = ''; |
1920 | - $filter_query = $this->getFilter($filters,true,true); |
|
1920 | + $filter_query = $this->getFilter($filters, true, true); |
|
1921 | 1921 | if ($q != "") |
1922 | 1922 | { |
1923 | 1923 | if (!is_string($q)) |
@@ -1925,8 +1925,8 @@ discard block |
||
1925 | 1925 | return false; |
1926 | 1926 | } else { |
1927 | 1927 | $q_array = explode(" ", $q); |
1928 | - foreach ($q_array as $q_item){ |
|
1929 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
1928 | + foreach ($q_array as $q_item) { |
|
1929 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
1930 | 1930 | $additional_query .= " AND ("; |
1931 | 1931 | if (is_int($q_item)) $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
1932 | 1932 | if (is_int($q_item)) $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
@@ -1938,42 +1938,42 @@ discard block |
||
1938 | 1938 | } |
1939 | 1939 | if ($callsign != "") |
1940 | 1940 | { |
1941 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
1941 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
1942 | 1942 | if (!is_string($callsign)) |
1943 | 1943 | { |
1944 | 1944 | return false; |
1945 | 1945 | } else { |
1946 | 1946 | $additional_query .= " AND marine_output.ident = :callsign"; |
1947 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
1947 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
1948 | 1948 | } |
1949 | 1949 | } |
1950 | 1950 | if ($mmsi != "") |
1951 | 1951 | { |
1952 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
1952 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
1953 | 1953 | if (!is_numeric($mmsi)) |
1954 | 1954 | { |
1955 | 1955 | return false; |
1956 | 1956 | } else { |
1957 | 1957 | $additional_query .= " AND marine_output.mmsi = :mmsi"; |
1958 | - $query_values = array_merge($query_values,array(':mmsi' => $mmsi)); |
|
1958 | + $query_values = array_merge($query_values, array(':mmsi' => $mmsi)); |
|
1959 | 1959 | } |
1960 | 1960 | } |
1961 | 1961 | if ($imo != "") |
1962 | 1962 | { |
1963 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
1963 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
1964 | 1964 | if (!is_numeric($imo)) |
1965 | 1965 | { |
1966 | 1966 | return false; |
1967 | 1967 | } else { |
1968 | 1968 | $additional_query .= " AND marine_output.imo = :imo"; |
1969 | - $query_values = array_merge($query_values,array(':imo' => $imo)); |
|
1969 | + $query_values = array_merge($query_values, array(':imo' => $imo)); |
|
1970 | 1970 | } |
1971 | 1971 | } |
1972 | 1972 | if ($date_posted != "") |
1973 | 1973 | { |
1974 | 1974 | $date_array = explode(",", $date_posted); |
1975 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
1976 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
1975 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
1976 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
1977 | 1977 | if ($globalTimezone != '') { |
1978 | 1978 | date_default_timezone_set($globalTimezone); |
1979 | 1979 | $datetime = new DateTime(); |
@@ -2000,8 +2000,8 @@ discard block |
||
2000 | 2000 | if ($limit != "") |
2001 | 2001 | { |
2002 | 2002 | $limit_array = explode(",", $limit); |
2003 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
2004 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
2003 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
2004 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
2005 | 2005 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
2006 | 2006 | { |
2007 | 2007 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
@@ -2019,28 +2019,28 @@ discard block |
||
2019 | 2019 | } |
2020 | 2020 | } |
2021 | 2021 | if ($origLat != "" && $origLon != "" && $dist != "") { |
2022 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
2022 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
2023 | 2023 | if ($globalDBdriver == 'mysql') { |
2024 | - $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 |
|
2024 | + $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 |
|
2025 | 2025 | 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)) |
2026 | 2026 | 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; |
2027 | 2027 | } else { |
2028 | - $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 |
|
2028 | + $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 |
|
2029 | 2029 | 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)) |
2030 | 2030 | 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; |
2031 | 2031 | } |
2032 | 2032 | } else { |
2033 | - $query = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' |
|
2033 | + $query = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' |
|
2034 | 2034 | ".$additional_query." |
2035 | 2035 | ".$orderby_query; |
2036 | 2036 | } |
2037 | - $marine_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
2037 | + $marine_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
2038 | 2038 | return $marine_array; |
2039 | 2039 | } |
2040 | 2040 | |
2041 | 2041 | public function getOrderBy() |
2042 | 2042 | { |
2043 | - $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")); |
|
2043 | + $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")); |
|
2044 | 2044 | |
2045 | 2045 | return $orderby; |
2046 | 2046 |
@@ -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,35 +134,63 @@ 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['status'])) $temp_array['status'] = $row['status']; |
|
141 | - if (isset($row['status_id'])) $temp_array['status_id'] = $row['status_id']; |
|
142 | - if (isset($row['ident'])) $temp_array['ident'] = $row['ident']; |
|
143 | - if (isset($row['arrival_port_name'])) $temp_array['arrival_port_name'] = $row['arrival_port_name']; |
|
144 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
145 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
146 | - 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['status'])) { |
|
155 | + $temp_array['status'] = $row['status']; |
|
156 | + } |
|
157 | + if (isset($row['status_id'])) { |
|
158 | + $temp_array['status_id'] = $row['status_id']; |
|
159 | + } |
|
160 | + if (isset($row['ident'])) { |
|
161 | + $temp_array['ident'] = $row['ident']; |
|
162 | + } |
|
163 | + if (isset($row['arrival_port_name'])) { |
|
164 | + $temp_array['arrival_port_name'] = $row['arrival_port_name']; |
|
165 | + } |
|
166 | + if (isset($row['latitude'])) { |
|
167 | + $temp_array['latitude'] = $row['latitude']; |
|
168 | + } |
|
169 | + if (isset($row['longitude'])) { |
|
170 | + $temp_array['longitude'] = $row['longitude']; |
|
171 | + } |
|
172 | + if (isset($row['format_source'])) { |
|
173 | + $temp_array['format_source'] = $row['format_source']; |
|
174 | + } |
|
147 | 175 | if (isset($row['heading'])) { |
148 | 176 | $temp_array['heading'] = $row['heading']; |
149 | 177 | $heading_direction = $this->parseDirection($row['heading']); |
150 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
178 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
179 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
180 | + } |
|
181 | + } |
|
182 | + if (isset($row['ground_speed'])) { |
|
183 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
151 | 184 | } |
152 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
153 | 185 | |
154 | 186 | if(isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
155 | 187 | { |
156 | 188 | $Image = new Image($this->db); |
157 | - if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
158 | - else $image_array = $Image->getMarineImage($temp_array['mmsi']); |
|
189 | + if (isset($temp_array['ident']) && $temp_array['ident'] != '') { |
|
190 | + $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
191 | + } else { |
|
192 | + $image_array = $Image->getMarineImage($temp_array['mmsi']); |
|
193 | + } |
|
159 | 194 | unset($Image); |
160 | 195 | if (count($image_array) > 0) { |
161 | 196 | $temp_array['image'] = $image_array[0]['image']; |
@@ -207,13 +242,21 @@ discard block |
||
207 | 242 | } |
208 | 243 | |
209 | 244 | $fromsource = NULL; |
210 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
211 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
212 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
245 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
246 | + $temp_array['source_name'] = $row['source_name']; |
|
247 | + } |
|
248 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
249 | + $temp_array['over_country'] = $row['over_country']; |
|
250 | + } |
|
251 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
252 | + $temp_array['distance'] = $row['distance']; |
|
253 | + } |
|
213 | 254 | $temp_array['query_number_rows'] = $num_rows; |
214 | 255 | $spotter_array[] = $temp_array; |
215 | 256 | } |
216 | - if ($num_rows == 0) return array(); |
|
257 | + if ($num_rows == 0) { |
|
258 | + return array(); |
|
259 | + } |
|
217 | 260 | $spotter_array[0]['query_number_rows'] = $num_rows; |
218 | 261 | return $spotter_array; |
219 | 262 | } |
@@ -239,8 +282,12 @@ discard block |
||
239 | 282 | { |
240 | 283 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
241 | 284 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
242 | - } else $limit_query = ""; |
|
243 | - } else $limit_query = ""; |
|
285 | + } else { |
|
286 | + $limit_query = ""; |
|
287 | + } |
|
288 | + } else { |
|
289 | + $limit_query = ""; |
|
290 | + } |
|
244 | 291 | if ($sort != "") |
245 | 292 | { |
246 | 293 | $search_orderby_array = $this->getOrderBy(); |
@@ -264,7 +311,9 @@ discard block |
||
264 | 311 | global $global_query; |
265 | 312 | |
266 | 313 | date_default_timezone_set('UTC'); |
267 | - if ($id == '') return array(); |
|
314 | + if ($id == '') { |
|
315 | + return array(); |
|
316 | + } |
|
268 | 317 | $additional_query = "marine_output.fammarine_id = :id"; |
269 | 318 | $query_values = array(':id' => $id); |
270 | 319 | $query = $global_query." WHERE ".$additional_query." "; |
@@ -460,8 +509,11 @@ discard block |
||
460 | 509 | $query .= " ORDER BY marine_output.source_name ASC"; |
461 | 510 | |
462 | 511 | $sth = $this->db->prepare($query); |
463 | - if (!empty($query_values)) $sth->execute($query_values); |
|
464 | - else $sth->execute(); |
|
512 | + if (!empty($query_values)) { |
|
513 | + $sth->execute($query_values); |
|
514 | + } else { |
|
515 | + $sth->execute(); |
|
516 | + } |
|
465 | 517 | |
466 | 518 | $source_array = array(); |
467 | 519 | $temp_array = array(); |
@@ -516,8 +568,11 @@ discard block |
||
516 | 568 | $sth = $this->db->prepare($query); |
517 | 569 | $sth->execute(array(':mmsi' => $mmsi)); |
518 | 570 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
519 | - if (isset($result[0])) return $result[0]; |
|
520 | - else return array(); |
|
571 | + if (isset($result[0])) { |
|
572 | + return $result[0]; |
|
573 | + } else { |
|
574 | + return array(); |
|
575 | + } |
|
521 | 576 | } |
522 | 577 | |
523 | 578 | /** |
@@ -558,7 +613,9 @@ discard block |
||
558 | 613 | date_default_timezone_set($globalTimezone); |
559 | 614 | $datetime = new DateTime(); |
560 | 615 | $offset = $datetime->format('P'); |
561 | - } else $offset = '+00:00'; |
|
616 | + } else { |
|
617 | + $offset = '+00:00'; |
|
618 | + } |
|
562 | 619 | |
563 | 620 | if ($globalDBdriver == 'mysql') { |
564 | 621 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
@@ -804,11 +861,21 @@ discard block |
||
804 | 861 | $latitude = 0; |
805 | 862 | $longitude = 0; |
806 | 863 | } |
807 | - if ($type_id == '') $type_id = NULL; |
|
808 | - if ($status_id == '') $status_id = NULL; |
|
809 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
810 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
811 | - if ($arrival_date == '') $arrival_date = NULL; |
|
864 | + if ($type_id == '') { |
|
865 | + $type_id = NULL; |
|
866 | + } |
|
867 | + if ($status_id == '') { |
|
868 | + $status_id = NULL; |
|
869 | + } |
|
870 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
871 | + $heading = 0; |
|
872 | + } |
|
873 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
874 | + $groundspeed = 0; |
|
875 | + } |
|
876 | + if ($arrival_date == '') { |
|
877 | + $arrival_date = NULL; |
|
878 | + } |
|
812 | 879 | $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date) |
813 | 880 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:type_id,:status,:status_id,:imo,:arrival_port_name,:arrival_port_date)"; |
814 | 881 | |
@@ -915,7 +982,9 @@ discard block |
||
915 | 982 | global $globalDBdriver, $globalArchive; |
916 | 983 | //$filter_query = $this->getFilter($filters,true,true); |
917 | 984 | $Connection= new Connection($this->db); |
918 | - if (!$Connection->tableExists('countries')) return array(); |
|
985 | + if (!$Connection->tableExists('countries')) { |
|
986 | + return array(); |
|
987 | + } |
|
919 | 988 | require_once('class.SpotterLive.php'); |
920 | 989 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
921 | 990 | $MarineLive = new MarineLive($this->db); |
@@ -959,7 +1028,9 @@ discard block |
||
959 | 1028 | $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 "; |
960 | 1029 | } |
961 | 1030 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
962 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
1031 | + if ($limit) { |
|
1032 | + $query .= " LIMIT 10 OFFSET 0"; |
|
1033 | + } |
|
963 | 1034 | |
964 | 1035 | $sth = $this->db->prepare($query); |
965 | 1036 | $sth->execute(); |
@@ -993,12 +1064,18 @@ discard block |
||
993 | 1064 | $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
994 | 1065 | FROM marine_output".$filter_query." marine_output.ident <> ''"; |
995 | 1066 | if ($olderthanmonths > 0) { |
996 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
997 | - else $query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
1067 | + if ($globalDBdriver == 'mysql') { |
|
1068 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
1069 | + } else { |
|
1070 | + $query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
1071 | + } |
|
998 | 1072 | } |
999 | 1073 | if ($sincedate != '') { |
1000 | - if ($globalDBdriver == 'mysql') $query .= " AND marine_output.date > '".$sincedate."'"; |
|
1001 | - else $query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
1074 | + if ($globalDBdriver == 'mysql') { |
|
1075 | + $query .= " AND marine_output.date > '".$sincedate."'"; |
|
1076 | + } else { |
|
1077 | + $query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
1078 | + } |
|
1002 | 1079 | } |
1003 | 1080 | $query_values = array(); |
1004 | 1081 | if ($year != '') { |
@@ -1029,7 +1106,9 @@ discard block |
||
1029 | 1106 | } |
1030 | 1107 | } |
1031 | 1108 | $query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC"; |
1032 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
1109 | + if ($limit) { |
|
1110 | + $query .= " LIMIT 10 OFFSET 0"; |
|
1111 | + } |
|
1033 | 1112 | |
1034 | 1113 | $sth = $this->db->prepare($query); |
1035 | 1114 | $sth->execute($query_values); |
@@ -1064,7 +1143,9 @@ discard block |
||
1064 | 1143 | date_default_timezone_set($globalTimezone); |
1065 | 1144 | $datetime = new DateTime(); |
1066 | 1145 | $offset = $datetime->format('P'); |
1067 | - } else $offset = '+00:00'; |
|
1146 | + } else { |
|
1147 | + $offset = '+00:00'; |
|
1148 | + } |
|
1068 | 1149 | |
1069 | 1150 | if ($globalDBdriver == 'mysql') { |
1070 | 1151 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1114,7 +1195,9 @@ discard block |
||
1114 | 1195 | date_default_timezone_set($globalTimezone); |
1115 | 1196 | $datetime = new DateTime(); |
1116 | 1197 | $offset = $datetime->format('P'); |
1117 | - } else $offset = '+00:00'; |
|
1198 | + } else { |
|
1199 | + $offset = '+00:00'; |
|
1200 | + } |
|
1118 | 1201 | $filter_query = $this->getFilter($filters,true,true); |
1119 | 1202 | if ($globalDBdriver == 'mysql') { |
1120 | 1203 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1160,7 +1243,9 @@ discard block |
||
1160 | 1243 | date_default_timezone_set($globalTimezone); |
1161 | 1244 | $datetime = new DateTime(); |
1162 | 1245 | $offset = $datetime->format('P'); |
1163 | - } else $offset = '+00:00'; |
|
1246 | + } else { |
|
1247 | + $offset = '+00:00'; |
|
1248 | + } |
|
1164 | 1249 | $filter_query = $this->getFilter($filters,true,true); |
1165 | 1250 | if ($globalDBdriver == 'mysql') { |
1166 | 1251 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1208,7 +1293,9 @@ discard block |
||
1208 | 1293 | date_default_timezone_set($globalTimezone); |
1209 | 1294 | $datetime = new DateTime(); |
1210 | 1295 | $offset = $datetime->format('P'); |
1211 | - } else $offset = '+00:00'; |
|
1296 | + } else { |
|
1297 | + $offset = '+00:00'; |
|
1298 | + } |
|
1212 | 1299 | |
1213 | 1300 | if ($globalDBdriver == 'mysql') { |
1214 | 1301 | $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 |
@@ -1257,7 +1344,9 @@ discard block |
||
1257 | 1344 | date_default_timezone_set($globalTimezone); |
1258 | 1345 | $datetime = new DateTime(); |
1259 | 1346 | $offset = $datetime->format('P'); |
1260 | - } else $offset = '+00:00'; |
|
1347 | + } else { |
|
1348 | + $offset = '+00:00'; |
|
1349 | + } |
|
1261 | 1350 | $filter_query = $this->getFilter($filters,true,true); |
1262 | 1351 | if ($globalDBdriver == 'mysql') { |
1263 | 1352 | $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 |
@@ -1306,7 +1395,9 @@ discard block |
||
1306 | 1395 | date_default_timezone_set($globalTimezone); |
1307 | 1396 | $datetime = new DateTime(); |
1308 | 1397 | $offset = $datetime->format('P'); |
1309 | - } else $offset = '+00:00'; |
|
1398 | + } else { |
|
1399 | + $offset = '+00:00'; |
|
1400 | + } |
|
1310 | 1401 | |
1311 | 1402 | $orderby_sql = ''; |
1312 | 1403 | if ($orderby == "hour") |
@@ -1375,7 +1466,9 @@ discard block |
||
1375 | 1466 | date_default_timezone_set($globalTimezone); |
1376 | 1467 | $datetime = new DateTime($date); |
1377 | 1468 | $offset = $datetime->format('P'); |
1378 | - } else $offset = '+00:00'; |
|
1469 | + } else { |
|
1470 | + $offset = '+00:00'; |
|
1471 | + } |
|
1379 | 1472 | |
1380 | 1473 | if ($globalDBdriver == 'mysql') { |
1381 | 1474 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1423,7 +1516,9 @@ discard block |
||
1423 | 1516 | date_default_timezone_set($globalTimezone); |
1424 | 1517 | $datetime = new DateTime(); |
1425 | 1518 | $offset = $datetime->format('P'); |
1426 | - } else $offset = '+00:00'; |
|
1519 | + } else { |
|
1520 | + $offset = '+00:00'; |
|
1521 | + } |
|
1427 | 1522 | |
1428 | 1523 | if ($globalDBdriver == 'mysql') { |
1429 | 1524 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1488,8 +1583,11 @@ discard block |
||
1488 | 1583 | $query_values = array_merge($query_values,array(':month' => $month)); |
1489 | 1584 | } |
1490 | 1585 | } |
1491 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
1492 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1586 | + if (empty($query_values)) { |
|
1587 | + $queryi .= $this->getFilter($filters); |
|
1588 | + } else { |
|
1589 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1590 | + } |
|
1493 | 1591 | |
1494 | 1592 | $sth = $this->db->prepare($queryi); |
1495 | 1593 | $sth->execute($query_values); |
@@ -1526,8 +1624,11 @@ discard block |
||
1526 | 1624 | $query_values = array_merge($query_values,array(':month' => $month)); |
1527 | 1625 | } |
1528 | 1626 | } |
1529 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
1530 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1627 | + if (empty($query_values)) { |
|
1628 | + $queryi .= $this->getFilter($filters); |
|
1629 | + } else { |
|
1630 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1631 | + } |
|
1531 | 1632 | |
1532 | 1633 | $sth = $this->db->prepare($queryi); |
1533 | 1634 | $sth->execute($query_values); |
@@ -1549,7 +1650,9 @@ discard block |
||
1549 | 1650 | date_default_timezone_set($globalTimezone); |
1550 | 1651 | $datetime = new DateTime(); |
1551 | 1652 | $offset = $datetime->format('P'); |
1552 | - } else $offset = '+00:00'; |
|
1653 | + } else { |
|
1654 | + $offset = '+00:00'; |
|
1655 | + } |
|
1553 | 1656 | |
1554 | 1657 | if ($globalDBdriver == 'mysql') { |
1555 | 1658 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1653,7 +1756,9 @@ discard block |
||
1653 | 1756 | */ |
1654 | 1757 | public function parseDirection($direction = 0) |
1655 | 1758 | { |
1656 | - if ($direction == '') $direction = 0; |
|
1759 | + if ($direction == '') { |
|
1760 | + $direction = 0; |
|
1761 | + } |
|
1657 | 1762 | $direction_array = array(); |
1658 | 1763 | $temp_array = array(); |
1659 | 1764 | |
@@ -1742,7 +1847,9 @@ discard block |
||
1742 | 1847 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1743 | 1848 | |
1744 | 1849 | $Connection = new Connection($this->db); |
1745 | - if (!$Connection->tableExists('countries')) return ''; |
|
1850 | + if (!$Connection->tableExists('countries')) { |
|
1851 | + return ''; |
|
1852 | + } |
|
1746 | 1853 | |
1747 | 1854 | try { |
1748 | 1855 | /* |
@@ -1762,9 +1869,13 @@ discard block |
||
1762 | 1869 | $sth->closeCursor(); |
1763 | 1870 | if (count($row) > 0) { |
1764 | 1871 | return $row; |
1765 | - } else return ''; |
|
1872 | + } else { |
|
1873 | + return ''; |
|
1874 | + } |
|
1766 | 1875 | } catch (PDOException $e) { |
1767 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
1876 | + if (isset($globalDebug) && $globalDebug) { |
|
1877 | + echo 'Error : '.$e->getMessage()."\n"; |
|
1878 | + } |
|
1768 | 1879 | return ''; |
1769 | 1880 | } |
1770 | 1881 | |
@@ -1782,7 +1893,9 @@ discard block |
||
1782 | 1893 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
1783 | 1894 | |
1784 | 1895 | $Connection = new Connection($this->db); |
1785 | - if (!$Connection->tableExists('countries')) return ''; |
|
1896 | + if (!$Connection->tableExists('countries')) { |
|
1897 | + return ''; |
|
1898 | + } |
|
1786 | 1899 | |
1787 | 1900 | try { |
1788 | 1901 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -1794,9 +1907,13 @@ discard block |
||
1794 | 1907 | $sth->closeCursor(); |
1795 | 1908 | if (count($row) > 0) { |
1796 | 1909 | return $row; |
1797 | - } else return ''; |
|
1910 | + } else { |
|
1911 | + return ''; |
|
1912 | + } |
|
1798 | 1913 | } catch (PDOException $e) { |
1799 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
1914 | + if (isset($globalDebug) && $globalDebug) { |
|
1915 | + echo 'Error : '.$e->getMessage()."\n"; |
|
1916 | + } |
|
1800 | 1917 | return ''; |
1801 | 1918 | } |
1802 | 1919 | |
@@ -1814,7 +1931,9 @@ discard block |
||
1814 | 1931 | { |
1815 | 1932 | global $globalBitlyAccessToken; |
1816 | 1933 | |
1817 | - if ($globalBitlyAccessToken == '') return $url; |
|
1934 | + if ($globalBitlyAccessToken == '') { |
|
1935 | + return $url; |
|
1936 | + } |
|
1818 | 1937 | |
1819 | 1938 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
1820 | 1939 | |
@@ -1890,7 +2009,9 @@ discard block |
||
1890 | 2009 | } |
1891 | 2010 | } |
1892 | 2011 | $query .= " GROUP BY marine_output.type, marine_output.type_id ORDER BY marine_type_count DESC"; |
1893 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
2012 | + if ($limit) { |
|
2013 | + $query .= " LIMIT 10 OFFSET 0"; |
|
2014 | + } |
|
1894 | 2015 | $sth = $this->db->prepare($query); |
1895 | 2016 | $sth->execute($query_values); |
1896 | 2017 | $marine_array = array(); |
@@ -1928,9 +2049,15 @@ discard block |
||
1928 | 2049 | foreach ($q_array as $q_item){ |
1929 | 2050 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
1930 | 2051 | $additional_query .= " AND ("; |
1931 | - if (is_int($q_item)) $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
|
1932 | - if (is_int($q_item)) $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
|
1933 | - if (is_int($q_item)) $additional_query .= "(marine_output.imo = '".$q_item."') OR "; |
|
2052 | + if (is_int($q_item)) { |
|
2053 | + $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
|
2054 | + } |
|
2055 | + if (is_int($q_item)) { |
|
2056 | + $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
|
2057 | + } |
|
2058 | + if (is_int($q_item)) { |
|
2059 | + $additional_query .= "(marine_output.imo = '".$q_item."') OR "; |
|
2060 | + } |
|
1934 | 2061 | $additional_query .= "(marine_output.ident like '%".$q_item."%') OR "; |
1935 | 2062 | $additional_query .= ")"; |
1936 | 2063 | } |
@@ -1978,7 +2105,9 @@ discard block |
||
1978 | 2105 | date_default_timezone_set($globalTimezone); |
1979 | 2106 | $datetime = new DateTime(); |
1980 | 2107 | $offset = $datetime->format('P'); |
1981 | - } else $offset = '+00:00'; |
|
2108 | + } else { |
|
2109 | + $offset = '+00:00'; |
|
2110 | + } |
|
1982 | 2111 | if ($date_array[1] != "") |
1983 | 2112 | { |
1984 | 2113 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
@@ -2005,8 +2134,12 @@ discard block |
||
2005 | 2134 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
2006 | 2135 | { |
2007 | 2136 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
2008 | - } else $limit_query = ""; |
|
2009 | - } else $limit_query = ""; |
|
2137 | + } else { |
|
2138 | + $limit_query = ""; |
|
2139 | + } |
|
2140 | + } else { |
|
2141 | + $limit_query = ""; |
|
2142 | + } |
|
2010 | 2143 | if ($sort != "") |
2011 | 2144 | { |
2012 | 2145 | $search_orderby_array = $this->getOrderBy(); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * Get SQL query part for filter used |
18 | 18 | * @param Array $filter the filter |
19 | - * @return Array the SQL part |
|
19 | + * @return string the SQL part |
|
20 | 20 | */ |
21 | 21 | |
22 | 22 | public function getFilter($filter = array(),$where = false,$and = false) { |
@@ -487,9 +487,6 @@ discard block |
||
487 | 487 | /** |
488 | 488 | * Update ident tracker data |
489 | 489 | * |
490 | - * @param String $flightaware_id the ID from flightaware |
|
491 | - * @param String $ident the flight ident |
|
492 | - * @return String success or false |
|
493 | 490 | * |
494 | 491 | */ |
495 | 492 | public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL) |
@@ -511,10 +508,6 @@ discard block |
||
511 | 508 | /** |
512 | 509 | * Update latest tracker data |
513 | 510 | * |
514 | - * @param String $flightaware_id the ID from flightaware |
|
515 | - * @param String $ident the flight ident |
|
516 | - * @param String $arrival_airport_icao the arrival airport |
|
517 | - * @return String success or false |
|
518 | 511 | * |
519 | 512 | */ |
520 | 513 | public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '') |
@@ -536,29 +529,6 @@ discard block |
||
536 | 529 | /** |
537 | 530 | * Adds a new tracker data |
538 | 531 | * |
539 | - * @param String $flightaware_id the ID from flightaware |
|
540 | - * @param String $ident the flight ident |
|
541 | - * @param String $aircraft_icao the aircraft type |
|
542 | - * @param String $departure_airport_icao the departure airport |
|
543 | - * @param String $arrival_airport_icao the arrival airport |
|
544 | - * @param String $latitude latitude of flight |
|
545 | - * @param String $longitude latitude of flight |
|
546 | - * @param String $waypoints waypoints of flight |
|
547 | - * @param String $altitude altitude of flight |
|
548 | - * @param String $heading heading of flight |
|
549 | - * @param String $groundspeed speed of flight |
|
550 | - * @param String $date date of flight |
|
551 | - * @param String $departure_airport_time departure time of flight |
|
552 | - * @param String $arrival_airport_time arrival time of flight |
|
553 | - * @param String $squawk squawk code of flight |
|
554 | - * @param String $route_stop route stop of flight |
|
555 | - * @param String $highlight highlight or not |
|
556 | - * @param String $ModeS ModesS code of flight |
|
557 | - * @param String $registration registration code of flight |
|
558 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
559 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
560 | - * @param String $verticalrate vertival rate of flight |
|
561 | - * @return String success or false |
|
562 | 532 | */ |
563 | 533 | public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '') |
564 | 534 | { |
@@ -1132,6 +1102,7 @@ discard block |
||
1132 | 1102 | /** |
1133 | 1103 | * Counts all hours |
1134 | 1104 | * |
1105 | + * @param string $orderby |
|
1135 | 1106 | * @return Array the hour list |
1136 | 1107 | * |
1137 | 1108 | */ |
@@ -1483,7 +1454,7 @@ discard block |
||
1483 | 1454 | /** |
1484 | 1455 | * Parses the direction degrees to working |
1485 | 1456 | * |
1486 | - * @param Float $direction the direction in degrees |
|
1457 | + * @param integer $direction the direction in degrees |
|
1487 | 1458 | * @return Array the direction information |
1488 | 1459 | * |
1489 | 1460 | */ |
@@ -14,10 +14,10 @@ discard block |
||
14 | 14 | } |
15 | 15 | |
16 | 16 | /** |
17 | - * Get SQL query part for filter used |
|
18 | - * @param Array $filter the filter |
|
19 | - * @return Array the SQL part |
|
20 | - */ |
|
17 | + * Get SQL query part for filter used |
|
18 | + * @param Array $filter the filter |
|
19 | + * @return Array the SQL part |
|
20 | + */ |
|
21 | 21 | |
22 | 22 | public function getFilter($filter = array(),$where = false,$and = false) { |
23 | 23 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
84 | - * Executes the SQL statements to get the tracker information |
|
85 | - * |
|
86 | - * @param String $query the SQL query |
|
87 | - * @param Array $params parameter of the query |
|
88 | - * @param String $limitQuery the limit query |
|
89 | - * @return Array the tracker information |
|
90 | - * |
|
91 | - */ |
|
84 | + * Executes the SQL statements to get the tracker information |
|
85 | + * |
|
86 | + * @param String $query the SQL query |
|
87 | + * @param Array $params parameter of the query |
|
88 | + * @param String $limitQuery the limit query |
|
89 | + * @return Array the tracker information |
|
90 | + * |
|
91 | + */ |
|
92 | 92 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
93 | 93 | { |
94 | 94 | date_default_timezone_set('UTC'); |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | |
202 | 202 | |
203 | 203 | /** |
204 | - * Gets all the tracker information based on the latest data entry |
|
205 | - * |
|
206 | - * @return Array the tracker information |
|
207 | - * |
|
208 | - */ |
|
204 | + * Gets all the tracker information based on the latest data entry |
|
205 | + * |
|
206 | + * @return Array the tracker information |
|
207 | + * |
|
208 | + */ |
|
209 | 209 | public function getLatestTrackerData($limit = '', $sort = '', $filter = array()) |
210 | 210 | { |
211 | 211 | global $global_query; |
@@ -263,11 +263,11 @@ discard block |
||
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
266 | - * Gets all the tracker information based on the callsign |
|
267 | - * |
|
268 | - * @return Array the tracker information |
|
269 | - * |
|
270 | - */ |
|
266 | + * Gets all the tracker information based on the callsign |
|
267 | + * |
|
268 | + * @return Array the tracker information |
|
269 | + * |
|
270 | + */ |
|
271 | 271 | public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
272 | 272 | { |
273 | 273 | global $global_query; |
@@ -378,12 +378,12 @@ discard block |
||
378 | 378 | |
379 | 379 | |
380 | 380 | /** |
381 | - * Gets all source name |
|
382 | - * |
|
383 | - * @param String type format of source |
|
384 | - * @return Array list of source name |
|
385 | - * |
|
386 | - */ |
|
381 | + * Gets all source name |
|
382 | + * |
|
383 | + * @param String type format of source |
|
384 | + * @return Array list of source name |
|
385 | + * |
|
386 | + */ |
|
387 | 387 | public function getAllSourceName($type = '',$filters = array()) |
388 | 388 | { |
389 | 389 | $filter_query = $this->getFilter($filters,true,true); |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | |
414 | 414 | |
415 | 415 | /** |
416 | - * Gets a list of all idents/callsigns |
|
417 | - * |
|
418 | - * @return Array list of ident/callsign names |
|
419 | - * |
|
420 | - */ |
|
416 | + * Gets a list of all idents/callsigns |
|
417 | + * |
|
418 | + * @return Array list of ident/callsign names |
|
419 | + * |
|
420 | + */ |
|
421 | 421 | public function getAllIdents($filters = array()) |
422 | 422 | { |
423 | 423 | $filter_query = $this->getFilter($filters,true,true); |
@@ -485,18 +485,18 @@ discard block |
||
485 | 485 | |
486 | 486 | |
487 | 487 | /** |
488 | - * Update ident tracker data |
|
489 | - * |
|
490 | - * @param String $flightaware_id the ID from flightaware |
|
491 | - * @param String $ident the flight ident |
|
492 | - * @return String success or false |
|
493 | - * |
|
494 | - */ |
|
488 | + * Update ident tracker data |
|
489 | + * |
|
490 | + * @param String $flightaware_id the ID from flightaware |
|
491 | + * @param String $ident the flight ident |
|
492 | + * @return String success or false |
|
493 | + * |
|
494 | + */ |
|
495 | 495 | public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL) |
496 | 496 | { |
497 | 497 | |
498 | 498 | $query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid'; |
499 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident); |
|
499 | + $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident); |
|
500 | 500 | |
501 | 501 | try { |
502 | 502 | $sth = $this->db->prepare($query); |
@@ -509,18 +509,18 @@ discard block |
||
509 | 509 | |
510 | 510 | } |
511 | 511 | /** |
512 | - * Update latest tracker data |
|
513 | - * |
|
514 | - * @param String $flightaware_id the ID from flightaware |
|
515 | - * @param String $ident the flight ident |
|
516 | - * @param String $arrival_airport_icao the arrival airport |
|
517 | - * @return String success or false |
|
518 | - * |
|
519 | - */ |
|
512 | + * Update latest tracker data |
|
513 | + * |
|
514 | + * @param String $flightaware_id the ID from flightaware |
|
515 | + * @param String $ident the flight ident |
|
516 | + * @param String $arrival_airport_icao the arrival airport |
|
517 | + * @return String success or false |
|
518 | + * |
|
519 | + */ |
|
520 | 520 | public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '') |
521 | 521 | { |
522 | 522 | $query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid'; |
523 | - $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
523 | + $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
524 | 524 | |
525 | 525 | try { |
526 | 526 | $sth = $this->db->prepare($query); |
@@ -534,32 +534,32 @@ discard block |
||
534 | 534 | } |
535 | 535 | |
536 | 536 | /** |
537 | - * Adds a new tracker data |
|
538 | - * |
|
539 | - * @param String $flightaware_id the ID from flightaware |
|
540 | - * @param String $ident the flight ident |
|
541 | - * @param String $aircraft_icao the aircraft type |
|
542 | - * @param String $departure_airport_icao the departure airport |
|
543 | - * @param String $arrival_airport_icao the arrival airport |
|
544 | - * @param String $latitude latitude of flight |
|
545 | - * @param String $longitude latitude of flight |
|
546 | - * @param String $waypoints waypoints of flight |
|
547 | - * @param String $altitude altitude of flight |
|
548 | - * @param String $heading heading of flight |
|
549 | - * @param String $groundspeed speed of flight |
|
550 | - * @param String $date date of flight |
|
551 | - * @param String $departure_airport_time departure time of flight |
|
552 | - * @param String $arrival_airport_time arrival time of flight |
|
553 | - * @param String $squawk squawk code of flight |
|
554 | - * @param String $route_stop route stop of flight |
|
555 | - * @param String $highlight highlight or not |
|
556 | - * @param String $ModeS ModesS code of flight |
|
557 | - * @param String $registration registration code of flight |
|
558 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
559 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
560 | - * @param String $verticalrate vertival rate of flight |
|
561 | - * @return String success or false |
|
562 | - */ |
|
537 | + * Adds a new tracker data |
|
538 | + * |
|
539 | + * @param String $flightaware_id the ID from flightaware |
|
540 | + * @param String $ident the flight ident |
|
541 | + * @param String $aircraft_icao the aircraft type |
|
542 | + * @param String $departure_airport_icao the departure airport |
|
543 | + * @param String $arrival_airport_icao the arrival airport |
|
544 | + * @param String $latitude latitude of flight |
|
545 | + * @param String $longitude latitude of flight |
|
546 | + * @param String $waypoints waypoints of flight |
|
547 | + * @param String $altitude altitude of flight |
|
548 | + * @param String $heading heading of flight |
|
549 | + * @param String $groundspeed speed of flight |
|
550 | + * @param String $date date of flight |
|
551 | + * @param String $departure_airport_time departure time of flight |
|
552 | + * @param String $arrival_airport_time arrival time of flight |
|
553 | + * @param String $squawk squawk code of flight |
|
554 | + * @param String $route_stop route stop of flight |
|
555 | + * @param String $highlight highlight or not |
|
556 | + * @param String $ModeS ModesS code of flight |
|
557 | + * @param String $registration registration code of flight |
|
558 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
559 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
560 | + * @param String $verticalrate vertival rate of flight |
|
561 | + * @return String success or false |
|
562 | + */ |
|
563 | 563 | public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '') |
564 | 564 | { |
565 | 565 | global $globalURL; |
@@ -644,16 +644,16 @@ discard block |
||
644 | 644 | $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
645 | 645 | $type = filter_var($type,FILTER_SANITIZE_STRING); |
646 | 646 | |
647 | - if ($latitude == '' && $longitude == '') { |
|
648 | - $latitude = 0; |
|
649 | - $longitude = 0; |
|
650 | - } |
|
651 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
652 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
653 | - $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
647 | + if ($latitude == '' && $longitude == '') { |
|
648 | + $latitude = 0; |
|
649 | + $longitude = 0; |
|
650 | + } |
|
651 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
652 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
653 | + $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
654 | 654 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
655 | 655 | |
656 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type); |
|
656 | + $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type); |
|
657 | 657 | |
658 | 658 | try { |
659 | 659 | |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | $sth->execute($query_values); |
662 | 662 | $this->db = null; |
663 | 663 | } catch (PDOException $e) { |
664 | - return "error : ".$e->getMessage(); |
|
664 | + return "error : ".$e->getMessage(); |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | return "success"; |
@@ -670,11 +670,11 @@ discard block |
||
670 | 670 | |
671 | 671 | |
672 | 672 | /** |
673 | - * Gets the aircraft ident within the last hour |
|
674 | - * |
|
675 | - * @return String the ident |
|
676 | - * |
|
677 | - */ |
|
673 | + * Gets the aircraft ident within the last hour |
|
674 | + * |
|
675 | + * @return String the ident |
|
676 | + * |
|
677 | + */ |
|
678 | 678 | public function getIdentFromLastHour($ident) |
679 | 679 | { |
680 | 680 | global $globalDBdriver, $globalTimezone; |
@@ -690,11 +690,11 @@ discard block |
||
690 | 690 | AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
691 | 691 | AND tracker_output.date < now() AT TIME ZONE 'UTC'"; |
692 | 692 | $query_data = array(':ident' => $ident); |
693 | - } |
|
693 | + } |
|
694 | 694 | |
695 | 695 | $sth = $this->db->prepare($query); |
696 | 696 | $sth->execute($query_data); |
697 | - $ident_result=''; |
|
697 | + $ident_result=''; |
|
698 | 698 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
699 | 699 | { |
700 | 700 | $ident_result = $row['ident']; |
@@ -705,11 +705,11 @@ discard block |
||
705 | 705 | |
706 | 706 | |
707 | 707 | /** |
708 | - * Gets the aircraft data from the last 20 seconds |
|
709 | - * |
|
710 | - * @return Array the tracker data |
|
711 | - * |
|
712 | - */ |
|
708 | + * Gets the aircraft data from the last 20 seconds |
|
709 | + * |
|
710 | + * @return Array the tracker data |
|
711 | + * |
|
712 | + */ |
|
713 | 713 | public function getRealTimeData($q = '') |
714 | 714 | { |
715 | 715 | global $globalDBdriver; |
@@ -743,11 +743,11 @@ discard block |
||
743 | 743 | } |
744 | 744 | |
745 | 745 | /** |
746 | - * Gets all number of flight over countries |
|
747 | - * |
|
748 | - * @return Array the airline country list |
|
749 | - * |
|
750 | - */ |
|
746 | + * Gets all number of flight over countries |
|
747 | + * |
|
748 | + * @return Array the airline country list |
|
749 | + * |
|
750 | + */ |
|
751 | 751 | public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
752 | 752 | { |
753 | 753 | global $globalDBdriver, $globalArchive; |
@@ -817,11 +817,11 @@ discard block |
||
817 | 817 | } |
818 | 818 | |
819 | 819 | /** |
820 | - * Gets all callsigns that have flown over |
|
821 | - * |
|
822 | - * @return Array the callsign list |
|
823 | - * |
|
824 | - */ |
|
820 | + * Gets all callsigns that have flown over |
|
821 | + * |
|
822 | + * @return Array the callsign list |
|
823 | + * |
|
824 | + */ |
|
825 | 825 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
826 | 826 | { |
827 | 827 | global $globalDBdriver; |
@@ -888,11 +888,11 @@ discard block |
||
888 | 888 | |
889 | 889 | |
890 | 890 | /** |
891 | - * Counts all dates |
|
892 | - * |
|
893 | - * @return Array the date list |
|
894 | - * |
|
895 | - */ |
|
891 | + * Counts all dates |
|
892 | + * |
|
893 | + * @return Array the date list |
|
894 | + * |
|
895 | + */ |
|
896 | 896 | public function countAllDates($filters = array()) |
897 | 897 | { |
898 | 898 | global $globalTimezone, $globalDBdriver; |
@@ -938,11 +938,11 @@ discard block |
||
938 | 938 | |
939 | 939 | |
940 | 940 | /** |
941 | - * Counts all dates during the last 7 days |
|
942 | - * |
|
943 | - * @return Array the date list |
|
944 | - * |
|
945 | - */ |
|
941 | + * Counts all dates during the last 7 days |
|
942 | + * |
|
943 | + * @return Array the date list |
|
944 | + * |
|
945 | + */ |
|
946 | 946 | public function countAllDatesLast7Days($filters = array()) |
947 | 947 | { |
948 | 948 | global $globalTimezone, $globalDBdriver; |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | $query .= " GROUP BY date_name |
965 | 965 | ORDER BY date_name ASC"; |
966 | 966 | $query_data = array(':offset' => $offset); |
967 | - } |
|
967 | + } |
|
968 | 968 | |
969 | 969 | $sth = $this->db->prepare($query); |
970 | 970 | $sth->execute($query_data); |
@@ -984,11 +984,11 @@ discard block |
||
984 | 984 | } |
985 | 985 | |
986 | 986 | /** |
987 | - * Counts all dates during the last month |
|
988 | - * |
|
989 | - * @return Array the date list |
|
990 | - * |
|
991 | - */ |
|
987 | + * Counts all dates during the last month |
|
988 | + * |
|
989 | + * @return Array the date list |
|
990 | + * |
|
991 | + */ |
|
992 | 992 | public function countAllDatesLastMonth($filters = array()) |
993 | 993 | { |
994 | 994 | global $globalTimezone, $globalDBdriver; |
@@ -1010,7 +1010,7 @@ discard block |
||
1010 | 1010 | $query .= " GROUP BY date_name |
1011 | 1011 | ORDER BY date_name ASC"; |
1012 | 1012 | $query_data = array(':offset' => $offset); |
1013 | - } |
|
1013 | + } |
|
1014 | 1014 | |
1015 | 1015 | $sth = $this->db->prepare($query); |
1016 | 1016 | $sth->execute($query_data); |
@@ -1032,11 +1032,11 @@ discard block |
||
1032 | 1032 | |
1033 | 1033 | |
1034 | 1034 | /** |
1035 | - * Counts all month |
|
1036 | - * |
|
1037 | - * @return Array the month list |
|
1038 | - * |
|
1039 | - */ |
|
1035 | + * Counts all month |
|
1036 | + * |
|
1037 | + * @return Array the month list |
|
1038 | + * |
|
1039 | + */ |
|
1040 | 1040 | public function countAllMonths($filters = array()) |
1041 | 1041 | { |
1042 | 1042 | global $globalTimezone, $globalDBdriver; |
@@ -1081,11 +1081,11 @@ discard block |
||
1081 | 1081 | |
1082 | 1082 | |
1083 | 1083 | /** |
1084 | - * Counts all dates during the last year |
|
1085 | - * |
|
1086 | - * @return Array the date list |
|
1087 | - * |
|
1088 | - */ |
|
1084 | + * Counts all dates during the last year |
|
1085 | + * |
|
1086 | + * @return Array the date list |
|
1087 | + * |
|
1088 | + */ |
|
1089 | 1089 | public function countAllMonthsLastYear($filters) |
1090 | 1090 | { |
1091 | 1091 | global $globalTimezone, $globalDBdriver; |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | $query .= " GROUP BY year_name, month_name |
1108 | 1108 | ORDER BY year_name, month_name ASC"; |
1109 | 1109 | $query_data = array(':offset' => $offset); |
1110 | - } |
|
1110 | + } |
|
1111 | 1111 | |
1112 | 1112 | $sth = $this->db->prepare($query); |
1113 | 1113 | $sth->execute($query_data); |
@@ -1130,11 +1130,11 @@ discard block |
||
1130 | 1130 | |
1131 | 1131 | |
1132 | 1132 | /** |
1133 | - * Counts all hours |
|
1134 | - * |
|
1135 | - * @return Array the hour list |
|
1136 | - * |
|
1137 | - */ |
|
1133 | + * Counts all hours |
|
1134 | + * |
|
1135 | + * @return Array the hour list |
|
1136 | + * |
|
1137 | + */ |
|
1138 | 1138 | public function countAllHours($orderby,$filters = array()) |
1139 | 1139 | { |
1140 | 1140 | global $globalTimezone, $globalDBdriver; |
@@ -1197,11 +1197,11 @@ discard block |
||
1197 | 1197 | |
1198 | 1198 | |
1199 | 1199 | /** |
1200 | - * Counts all hours by date |
|
1201 | - * |
|
1202 | - * @return Array the hour list |
|
1203 | - * |
|
1204 | - */ |
|
1200 | + * Counts all hours by date |
|
1201 | + * |
|
1202 | + * @return Array the hour list |
|
1203 | + * |
|
1204 | + */ |
|
1205 | 1205 | public function countAllHoursByDate($date, $filters = array()) |
1206 | 1206 | { |
1207 | 1207 | global $globalTimezone, $globalDBdriver; |
@@ -1245,11 +1245,11 @@ discard block |
||
1245 | 1245 | |
1246 | 1246 | |
1247 | 1247 | /** |
1248 | - * Counts all hours by a ident/callsign |
|
1249 | - * |
|
1250 | - * @return Array the hour list |
|
1251 | - * |
|
1252 | - */ |
|
1248 | + * Counts all hours by a ident/callsign |
|
1249 | + * |
|
1250 | + * @return Array the hour list |
|
1251 | + * |
|
1252 | + */ |
|
1253 | 1253 | public function countAllHoursByIdent($ident, $filters = array()) |
1254 | 1254 | { |
1255 | 1255 | global $globalTimezone, $globalDBdriver; |
@@ -1294,11 +1294,11 @@ discard block |
||
1294 | 1294 | |
1295 | 1295 | |
1296 | 1296 | /** |
1297 | - * Counts all trackers that have flown over |
|
1298 | - * |
|
1299 | - * @return Integer the number of trackers |
|
1300 | - * |
|
1301 | - */ |
|
1297 | + * Counts all trackers that have flown over |
|
1298 | + * |
|
1299 | + * @return Integer the number of trackers |
|
1300 | + * |
|
1301 | + */ |
|
1302 | 1302 | public function countOverallTracker($filters = array(),$year = '',$month = '') |
1303 | 1303 | { |
1304 | 1304 | global $globalDBdriver; |
@@ -1333,11 +1333,11 @@ discard block |
||
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | /** |
1336 | - * Counts all trackers type that have flown over |
|
1337 | - * |
|
1338 | - * @return Integer the number of flights |
|
1339 | - * |
|
1340 | - */ |
|
1336 | + * Counts all trackers type that have flown over |
|
1337 | + * |
|
1338 | + * @return Integer the number of flights |
|
1339 | + * |
|
1340 | + */ |
|
1341 | 1341 | public function countOverallTrackerTypes($filters = array(),$year = '',$month = '') |
1342 | 1342 | { |
1343 | 1343 | global $globalDBdriver; |
@@ -1372,11 +1372,11 @@ discard block |
||
1372 | 1372 | |
1373 | 1373 | |
1374 | 1374 | /** |
1375 | - * Counts all hours of today |
|
1376 | - * |
|
1377 | - * @return Array the hour list |
|
1378 | - * |
|
1379 | - */ |
|
1375 | + * Counts all hours of today |
|
1376 | + * |
|
1377 | + * @return Array the hour list |
|
1378 | + * |
|
1379 | + */ |
|
1380 | 1380 | public function countAllHoursFromToday($filters = array()) |
1381 | 1381 | { |
1382 | 1382 | global $globalTimezone, $globalDBdriver; |
@@ -1416,12 +1416,12 @@ discard block |
||
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | |
1419 | - /** |
|
1420 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
1421 | - * |
|
1422 | - * @return Integer the Barrie Spotter ID |
|
1419 | + /** |
|
1420 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
1421 | + * |
|
1422 | + * @return Integer the Barrie Spotter ID |
|
1423 | 1423 | q * |
1424 | - */ |
|
1424 | + */ |
|
1425 | 1425 | public function getTrackerIDBasedOnFamTrackID($famtrackid) |
1426 | 1426 | { |
1427 | 1427 | $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
@@ -1442,13 +1442,13 @@ discard block |
||
1442 | 1442 | |
1443 | 1443 | |
1444 | 1444 | /** |
1445 | - * Parses a date string |
|
1446 | - * |
|
1447 | - * @param String $dateString the date string |
|
1448 | - * @param String $timezone the timezone of a user |
|
1449 | - * @return Array the time information |
|
1450 | - * |
|
1451 | - */ |
|
1445 | + * Parses a date string |
|
1446 | + * |
|
1447 | + * @param String $dateString the date string |
|
1448 | + * @param String $timezone the timezone of a user |
|
1449 | + * @return Array the time information |
|
1450 | + * |
|
1451 | + */ |
|
1452 | 1452 | public function parseDateString($dateString, $timezone = '') |
1453 | 1453 | { |
1454 | 1454 | $time_array = array(); |
@@ -1481,12 +1481,12 @@ discard block |
||
1481 | 1481 | } |
1482 | 1482 | |
1483 | 1483 | /** |
1484 | - * Parses the direction degrees to working |
|
1485 | - * |
|
1486 | - * @param Float $direction the direction in degrees |
|
1487 | - * @return Array the direction information |
|
1488 | - * |
|
1489 | - */ |
|
1484 | + * Parses the direction degrees to working |
|
1485 | + * |
|
1486 | + * @param Float $direction the direction in degrees |
|
1487 | + * @return Array the direction information |
|
1488 | + * |
|
1489 | + */ |
|
1490 | 1490 | public function parseDirection($direction = 0) |
1491 | 1491 | { |
1492 | 1492 | if ($direction == '') $direction = 0; |
@@ -1565,12 +1565,12 @@ discard block |
||
1565 | 1565 | |
1566 | 1566 | |
1567 | 1567 | /** |
1568 | - * Gets Country from latitude/longitude |
|
1569 | - * |
|
1570 | - * @param Float $latitude latitute of the flight |
|
1571 | - * @param Float $longitude longitute of the flight |
|
1572 | - * @return String the countrie |
|
1573 | - */ |
|
1568 | + * Gets Country from latitude/longitude |
|
1569 | + * |
|
1570 | + * @param Float $latitude latitute of the flight |
|
1571 | + * @param Float $longitude longitute of the flight |
|
1572 | + * @return String the countrie |
|
1573 | + */ |
|
1574 | 1574 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
1575 | 1575 | { |
1576 | 1576 | global $globalDBdriver, $globalDebug; |
@@ -1607,11 +1607,11 @@ discard block |
||
1607 | 1607 | } |
1608 | 1608 | |
1609 | 1609 | /** |
1610 | - * Gets Country from iso2 |
|
1611 | - * |
|
1612 | - * @param String $iso2 ISO2 country code |
|
1613 | - * @return String the countrie |
|
1614 | - */ |
|
1610 | + * Gets Country from iso2 |
|
1611 | + * |
|
1612 | + * @param String $iso2 ISO2 country code |
|
1613 | + * @return String the countrie |
|
1614 | + */ |
|
1615 | 1615 | public function getCountryFromISO2($iso2) |
1616 | 1616 | { |
1617 | 1617 | global $globalDBdriver, $globalDebug; |
@@ -1639,11 +1639,11 @@ discard block |
||
1639 | 1639 | } |
1640 | 1640 | |
1641 | 1641 | /** |
1642 | - * Gets all vessels types that have flown over |
|
1643 | - * |
|
1644 | - * @return Array the vessel type list |
|
1645 | - * |
|
1646 | - */ |
|
1642 | + * Gets all vessels types that have flown over |
|
1643 | + * |
|
1644 | + * @return Array the vessel type list |
|
1645 | + * |
|
1646 | + */ |
|
1647 | 1647 | public function countAllTrackerTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
1648 | 1648 | { |
1649 | 1649 | global $globalDBdriver; |
@@ -1708,11 +1708,11 @@ discard block |
||
1708 | 1708 | } |
1709 | 1709 | |
1710 | 1710 | /** |
1711 | - * Gets all the tracker information |
|
1712 | - * |
|
1713 | - * @return Array the tracker information |
|
1714 | - * |
|
1715 | - */ |
|
1711 | + * Gets all the tracker information |
|
1712 | + * |
|
1713 | + * @return Array the tracker information |
|
1714 | + * |
|
1715 | + */ |
|
1716 | 1716 | public function searchTrackerData($q = '', $callsign = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
1717 | 1717 | { |
1718 | 1718 | global $globalTimezone, $globalDBdriver; |
@@ -1817,12 +1817,12 @@ discard block |
||
1817 | 1817 | } |
1818 | 1818 | |
1819 | 1819 | /** |
1820 | - * Gets the short url from bit.ly |
|
1821 | - * |
|
1822 | - * @param String $url the full url |
|
1823 | - * @return String the bit.ly url |
|
1824 | - * |
|
1825 | - */ |
|
1820 | + * Gets the short url from bit.ly |
|
1821 | + * |
|
1822 | + * @param String $url the full url |
|
1823 | + * @return String the bit.ly url |
|
1824 | + * |
|
1825 | + */ |
|
1826 | 1826 | public function getBitlyURL($url) |
1827 | 1827 | { |
1828 | 1828 | global $globalBitlyAccessToken; |
@@ -10,7 +10,9 @@ discard block |
||
10 | 10 | public function __construct($dbc = null) { |
11 | 11 | $Connection = new Connection($dbc); |
12 | 12 | $this->db = $Connection->db(); |
13 | - if ($this->db === null) die('Error: No DB connection. (Tracker)'); |
|
13 | + if ($this->db === null) { |
|
14 | + die('Error: No DB connection. (Tracker)'); |
|
15 | + } |
|
14 | 16 | } |
15 | 17 | |
16 | 18 | /** |
@@ -32,7 +34,9 @@ discard block |
||
32 | 34 | if (isset($filter[0]['source'])) { |
33 | 35 | $filters = array_merge($filters,$filter); |
34 | 36 | } |
35 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
37 | + if (is_array($globalFilter)) { |
|
38 | + $filter = array_merge($filter,$globalFilter); |
|
39 | + } |
|
36 | 40 | $filter_query_join = ''; |
37 | 41 | $filter_query_where = ''; |
38 | 42 | foreach($filters as $flt) { |
@@ -71,8 +75,11 @@ discard block |
||
71 | 75 | $filter_query_where .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; |
72 | 76 | } |
73 | 77 | } |
74 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
75 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
78 | + if ($filter_query_where == '' && $where) { |
|
79 | + $filter_query_where = ' WHERE'; |
|
80 | + } elseif ($filter_query_where != '' && $and) { |
|
81 | + $filter_query_where .= ' AND'; |
|
82 | + } |
|
76 | 83 | if ($filter_query_where != '') { |
77 | 84 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
78 | 85 | } |
@@ -126,26 +133,43 @@ discard block |
||
126 | 133 | $temp_array['tracker_id'] = $row['tracker_archive_id']; |
127 | 134 | } elseif (isset($row['tracker_archive_output_id'])) { |
128 | 135 | $temp_array['tracker_id'] = $row['tracker_archive_output_id']; |
129 | - */} |
|
130 | - elseif (isset($row['trackerid'])) { |
|
136 | + */} elseif (isset($row['trackerid'])) { |
|
131 | 137 | $temp_array['trackerid'] = $row['trackerid']; |
132 | 138 | } else { |
133 | 139 | $temp_array['trackerid'] = ''; |
134 | 140 | } |
135 | - if (isset($row['famtrackid'])) $temp_array['famtrackid'] = $row['famtrackid']; |
|
136 | - if (isset($row['type'])) $temp_array['type'] = $row['type']; |
|
137 | - if (isset($row['comment'])) $temp_array['comment'] = $row['comment']; |
|
141 | + if (isset($row['famtrackid'])) { |
|
142 | + $temp_array['famtrackid'] = $row['famtrackid']; |
|
143 | + } |
|
144 | + if (isset($row['type'])) { |
|
145 | + $temp_array['type'] = $row['type']; |
|
146 | + } |
|
147 | + if (isset($row['comment'])) { |
|
148 | + $temp_array['comment'] = $row['comment']; |
|
149 | + } |
|
138 | 150 | $temp_array['ident'] = $row['ident']; |
139 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
140 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
141 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
142 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
151 | + if (isset($row['latitude'])) { |
|
152 | + $temp_array['latitude'] = $row['latitude']; |
|
153 | + } |
|
154 | + if (isset($row['longitude'])) { |
|
155 | + $temp_array['longitude'] = $row['longitude']; |
|
156 | + } |
|
157 | + if (isset($row['format_source'])) { |
|
158 | + $temp_array['format_source'] = $row['format_source']; |
|
159 | + } |
|
160 | + if (isset($row['altitude'])) { |
|
161 | + $temp_array['altitude'] = $row['altitude']; |
|
162 | + } |
|
143 | 163 | if (isset($row['heading'])) { |
144 | 164 | $temp_array['heading'] = $row['heading']; |
145 | 165 | $heading_direction = $this->parseDirection($row['heading']); |
146 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
166 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
167 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
168 | + } |
|
169 | + } |
|
170 | + if (isset($row['ground_speed'])) { |
|
171 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
147 | 172 | } |
148 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
149 | 173 | |
150 | 174 | if (isset($row['date'])) { |
151 | 175 | $dateArray = $this->parseDateString($row['date']); |
@@ -188,13 +212,21 @@ discard block |
||
188 | 212 | } |
189 | 213 | |
190 | 214 | $fromsource = NULL; |
191 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
192 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
193 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
215 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
216 | + $temp_array['source_name'] = $row['source_name']; |
|
217 | + } |
|
218 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
219 | + $temp_array['over_country'] = $row['over_country']; |
|
220 | + } |
|
221 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
222 | + $temp_array['distance'] = $row['distance']; |
|
223 | + } |
|
194 | 224 | $temp_array['query_number_rows'] = $num_rows; |
195 | 225 | $tracker_array[] = $temp_array; |
196 | 226 | } |
197 | - if ($num_rows == 0) return array(); |
|
227 | + if ($num_rows == 0) { |
|
228 | + return array(); |
|
229 | + } |
|
198 | 230 | $tracker_array[0]['query_number_rows'] = $num_rows; |
199 | 231 | return $tracker_array; |
200 | 232 | } |
@@ -225,8 +257,12 @@ discard block |
||
225 | 257 | { |
226 | 258 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
227 | 259 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
228 | - } else $limit_query = ""; |
|
229 | - } else $limit_query = ""; |
|
260 | + } else { |
|
261 | + $limit_query = ""; |
|
262 | + } |
|
263 | + } else { |
|
264 | + $limit_query = ""; |
|
265 | + } |
|
230 | 266 | |
231 | 267 | if ($sort != "") |
232 | 268 | { |
@@ -254,7 +290,9 @@ discard block |
||
254 | 290 | global $global_query; |
255 | 291 | |
256 | 292 | date_default_timezone_set('UTC'); |
257 | - if ($id == '') return array(); |
|
293 | + if ($id == '') { |
|
294 | + return array(); |
|
295 | + } |
|
258 | 296 | $additional_query = "tracker_output.famtrackid = :id"; |
259 | 297 | $query_values = array(':id' => $id); |
260 | 298 | $query = $global_query." WHERE ".$additional_query." "; |
@@ -397,8 +435,11 @@ discard block |
||
397 | 435 | $query .= " ORDER BY tracker_output.source_name ASC"; |
398 | 436 | |
399 | 437 | $sth = $this->db->prepare($query); |
400 | - if (!empty($query_values)) $sth->execute($query_values); |
|
401 | - else $sth->execute(); |
|
438 | + if (!empty($query_values)) { |
|
439 | + $sth->execute($query_values); |
|
440 | + } else { |
|
441 | + $sth->execute(); |
|
442 | + } |
|
402 | 443 | |
403 | 444 | $source_array = array(); |
404 | 445 | $temp_array = array(); |
@@ -453,7 +494,9 @@ discard block |
||
453 | 494 | date_default_timezone_set($globalTimezone); |
454 | 495 | $datetime = new DateTime(); |
455 | 496 | $offset = $datetime->format('P'); |
456 | - } else $offset = '+00:00'; |
|
497 | + } else { |
|
498 | + $offset = '+00:00'; |
|
499 | + } |
|
457 | 500 | |
458 | 501 | if ($globalDBdriver == 'mysql') { |
459 | 502 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
@@ -609,7 +652,9 @@ discard block |
||
609 | 652 | { |
610 | 653 | return false; |
611 | 654 | } |
612 | - } else $altitude = 0; |
|
655 | + } else { |
|
656 | + $altitude = 0; |
|
657 | + } |
|
613 | 658 | |
614 | 659 | if ($heading != "") |
615 | 660 | { |
@@ -648,8 +693,12 @@ discard block |
||
648 | 693 | $latitude = 0; |
649 | 694 | $longitude = 0; |
650 | 695 | } |
651 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
652 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
696 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
697 | + $heading = 0; |
|
698 | + } |
|
699 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
700 | + $groundspeed = 0; |
|
701 | + } |
|
653 | 702 | $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
654 | 703 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
655 | 704 | |
@@ -753,7 +802,9 @@ discard block |
||
753 | 802 | global $globalDBdriver, $globalArchive; |
754 | 803 | //$filter_query = $this->getFilter($filters,true,true); |
755 | 804 | $Connection= new Connection($this->db); |
756 | - if (!$Connection->tableExists('countries')) return array(); |
|
805 | + if (!$Connection->tableExists('countries')) { |
|
806 | + return array(); |
|
807 | + } |
|
757 | 808 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
758 | 809 | require_once('class.TrackerLive.php'); |
759 | 810 | $TrackerLive = new TrackerLive($this->db); |
@@ -796,7 +847,9 @@ discard block |
||
796 | 847 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT famtrackid,over_country FROM tracker_archive".$filter_query.") l ON c.iso2 = l.over_country "; |
797 | 848 | } |
798 | 849 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
799 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
850 | + if ($limit) { |
|
851 | + $query .= " LIMIT 10 OFFSET 0"; |
|
852 | + } |
|
800 | 853 | |
801 | 854 | |
802 | 855 | $sth = $this->db->prepare($query); |
@@ -829,12 +882,18 @@ discard block |
||
829 | 882 | $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
830 | 883 | FROM tracker_output".$filter_query." tracker_output.ident <> ''"; |
831 | 884 | if ($olderthanmonths > 0) { |
832 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
833 | - else $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
885 | + if ($globalDBdriver == 'mysql') { |
|
886 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
887 | + } else { |
|
888 | + $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
889 | + } |
|
834 | 890 | } |
835 | 891 | if ($sincedate != '') { |
836 | - if ($globalDBdriver == 'mysql') $query .= " AND tracker_output.date > '".$sincedate."'"; |
|
837 | - else $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
892 | + if ($globalDBdriver == 'mysql') { |
|
893 | + $query .= " AND tracker_output.date > '".$sincedate."'"; |
|
894 | + } else { |
|
895 | + $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
896 | + } |
|
838 | 897 | } |
839 | 898 | $query_values = array(); |
840 | 899 | if ($year != '') { |
@@ -865,7 +924,9 @@ discard block |
||
865 | 924 | } |
866 | 925 | } |
867 | 926 | $query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC"; |
868 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
927 | + if ($limit) { |
|
928 | + $query .= " LIMIT 10 OFFSET 0"; |
|
929 | + } |
|
869 | 930 | |
870 | 931 | $sth = $this->db->prepare($query); |
871 | 932 | $sth->execute($query_values); |
@@ -900,7 +961,9 @@ discard block |
||
900 | 961 | date_default_timezone_set($globalTimezone); |
901 | 962 | $datetime = new DateTime(); |
902 | 963 | $offset = $datetime->format('P'); |
903 | - } else $offset = '+00:00'; |
|
964 | + } else { |
|
965 | + $offset = '+00:00'; |
|
966 | + } |
|
904 | 967 | |
905 | 968 | if ($globalDBdriver == 'mysql') { |
906 | 969 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -950,7 +1013,9 @@ discard block |
||
950 | 1013 | date_default_timezone_set($globalTimezone); |
951 | 1014 | $datetime = new DateTime(); |
952 | 1015 | $offset = $datetime->format('P'); |
953 | - } else $offset = '+00:00'; |
|
1016 | + } else { |
|
1017 | + $offset = '+00:00'; |
|
1018 | + } |
|
954 | 1019 | $filter_query = $this->getFilter($filters,true,true); |
955 | 1020 | if ($globalDBdriver == 'mysql') { |
956 | 1021 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -996,7 +1061,9 @@ discard block |
||
996 | 1061 | date_default_timezone_set($globalTimezone); |
997 | 1062 | $datetime = new DateTime(); |
998 | 1063 | $offset = $datetime->format('P'); |
999 | - } else $offset = '+00:00'; |
|
1064 | + } else { |
|
1065 | + $offset = '+00:00'; |
|
1066 | + } |
|
1000 | 1067 | $filter_query = $this->getFilter($filters,true,true); |
1001 | 1068 | if ($globalDBdriver == 'mysql') { |
1002 | 1069 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1044,7 +1111,9 @@ discard block |
||
1044 | 1111 | date_default_timezone_set($globalTimezone); |
1045 | 1112 | $datetime = new DateTime(); |
1046 | 1113 | $offset = $datetime->format('P'); |
1047 | - } else $offset = '+00:00'; |
|
1114 | + } else { |
|
1115 | + $offset = '+00:00'; |
|
1116 | + } |
|
1048 | 1117 | |
1049 | 1118 | if ($globalDBdriver == 'mysql') { |
1050 | 1119 | $query = "SELECT YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -1093,7 +1162,9 @@ discard block |
||
1093 | 1162 | date_default_timezone_set($globalTimezone); |
1094 | 1163 | $datetime = new DateTime(); |
1095 | 1164 | $offset = $datetime->format('P'); |
1096 | - } else $offset = '+00:00'; |
|
1165 | + } else { |
|
1166 | + $offset = '+00:00'; |
|
1167 | + } |
|
1097 | 1168 | $filter_query = $this->getFilter($filters,true,true); |
1098 | 1169 | if ($globalDBdriver == 'mysql') { |
1099 | 1170 | $query = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -1142,7 +1213,9 @@ discard block |
||
1142 | 1213 | date_default_timezone_set($globalTimezone); |
1143 | 1214 | $datetime = new DateTime(); |
1144 | 1215 | $offset = $datetime->format('P'); |
1145 | - } else $offset = '+00:00'; |
|
1216 | + } else { |
|
1217 | + $offset = '+00:00'; |
|
1218 | + } |
|
1146 | 1219 | |
1147 | 1220 | $orderby_sql = ''; |
1148 | 1221 | if ($orderby == "hour") |
@@ -1211,7 +1284,9 @@ discard block |
||
1211 | 1284 | date_default_timezone_set($globalTimezone); |
1212 | 1285 | $datetime = new DateTime($date); |
1213 | 1286 | $offset = $datetime->format('P'); |
1214 | - } else $offset = '+00:00'; |
|
1287 | + } else { |
|
1288 | + $offset = '+00:00'; |
|
1289 | + } |
|
1215 | 1290 | |
1216 | 1291 | if ($globalDBdriver == 'mysql') { |
1217 | 1292 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1259,7 +1334,9 @@ discard block |
||
1259 | 1334 | date_default_timezone_set($globalTimezone); |
1260 | 1335 | $datetime = new DateTime(); |
1261 | 1336 | $offset = $datetime->format('P'); |
1262 | - } else $offset = '+00:00'; |
|
1337 | + } else { |
|
1338 | + $offset = '+00:00'; |
|
1339 | + } |
|
1263 | 1340 | |
1264 | 1341 | if ($globalDBdriver == 'mysql') { |
1265 | 1342 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1324,8 +1401,11 @@ discard block |
||
1324 | 1401 | $query_values = array_merge($query_values,array(':month' => $month)); |
1325 | 1402 | } |
1326 | 1403 | } |
1327 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
1328 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1404 | + if (empty($query_values)) { |
|
1405 | + $queryi .= $this->getFilter($filters); |
|
1406 | + } else { |
|
1407 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1408 | + } |
|
1329 | 1409 | |
1330 | 1410 | $sth = $this->db->prepare($queryi); |
1331 | 1411 | $sth->execute($query_values); |
@@ -1362,8 +1442,11 @@ discard block |
||
1362 | 1442 | $query_values = array_merge($query_values,array(':month' => $month)); |
1363 | 1443 | } |
1364 | 1444 | } |
1365 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
1366 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1445 | + if (empty($query_values)) { |
|
1446 | + $queryi .= $this->getFilter($filters); |
|
1447 | + } else { |
|
1448 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1449 | + } |
|
1367 | 1450 | |
1368 | 1451 | $sth = $this->db->prepare($queryi); |
1369 | 1452 | $sth->execute($query_values); |
@@ -1385,7 +1468,9 @@ discard block |
||
1385 | 1468 | date_default_timezone_set($globalTimezone); |
1386 | 1469 | $datetime = new DateTime(); |
1387 | 1470 | $offset = $datetime->format('P'); |
1388 | - } else $offset = '+00:00'; |
|
1471 | + } else { |
|
1472 | + $offset = '+00:00'; |
|
1473 | + } |
|
1389 | 1474 | |
1390 | 1475 | if ($globalDBdriver == 'mysql') { |
1391 | 1476 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1489,7 +1574,9 @@ discard block |
||
1489 | 1574 | */ |
1490 | 1575 | public function parseDirection($direction = 0) |
1491 | 1576 | { |
1492 | - if ($direction == '') $direction = 0; |
|
1577 | + if ($direction == '') { |
|
1578 | + $direction = 0; |
|
1579 | + } |
|
1493 | 1580 | $direction_array = array(); |
1494 | 1581 | $temp_array = array(); |
1495 | 1582 | |
@@ -1578,7 +1665,9 @@ discard block |
||
1578 | 1665 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1579 | 1666 | |
1580 | 1667 | $Connection = new Connection($this->db); |
1581 | - if (!$Connection->tableExists('countries')) return ''; |
|
1668 | + if (!$Connection->tableExists('countries')) { |
|
1669 | + return ''; |
|
1670 | + } |
|
1582 | 1671 | |
1583 | 1672 | try { |
1584 | 1673 | /* |
@@ -1598,9 +1687,13 @@ discard block |
||
1598 | 1687 | $sth->closeCursor(); |
1599 | 1688 | if (count($row) > 0) { |
1600 | 1689 | return $row; |
1601 | - } else return ''; |
|
1690 | + } else { |
|
1691 | + return ''; |
|
1692 | + } |
|
1602 | 1693 | } catch (PDOException $e) { |
1603 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
1694 | + if (isset($globalDebug) && $globalDebug) { |
|
1695 | + echo 'Error : '.$e->getMessage()."\n"; |
|
1696 | + } |
|
1604 | 1697 | return ''; |
1605 | 1698 | } |
1606 | 1699 | |
@@ -1618,7 +1711,9 @@ discard block |
||
1618 | 1711 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
1619 | 1712 | |
1620 | 1713 | $Connection = new Connection($this->db); |
1621 | - if (!$Connection->tableExists('countries')) return ''; |
|
1714 | + if (!$Connection->tableExists('countries')) { |
|
1715 | + return ''; |
|
1716 | + } |
|
1622 | 1717 | |
1623 | 1718 | try { |
1624 | 1719 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -1630,9 +1725,13 @@ discard block |
||
1630 | 1725 | $sth->closeCursor(); |
1631 | 1726 | if (count($row) > 0) { |
1632 | 1727 | return $row; |
1633 | - } else return ''; |
|
1728 | + } else { |
|
1729 | + return ''; |
|
1730 | + } |
|
1634 | 1731 | } catch (PDOException $e) { |
1635 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
1732 | + if (isset($globalDebug) && $globalDebug) { |
|
1733 | + echo 'Error : '.$e->getMessage()."\n"; |
|
1734 | + } |
|
1636 | 1735 | return ''; |
1637 | 1736 | } |
1638 | 1737 | |
@@ -1693,7 +1792,9 @@ discard block |
||
1693 | 1792 | } |
1694 | 1793 | } |
1695 | 1794 | $query .= " GROUP BY tracker_output.type ORDER BY tracker_type_count DESC"; |
1696 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
1795 | + if ($limit) { |
|
1796 | + $query .= " LIMIT 10 OFFSET 0"; |
|
1797 | + } |
|
1697 | 1798 | $sth = $this->db->prepare($query); |
1698 | 1799 | $sth->execute($query_values); |
1699 | 1800 | $tracker_array = array(); |
@@ -1730,7 +1831,9 @@ discard block |
||
1730 | 1831 | foreach ($q_array as $q_item){ |
1731 | 1832 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
1732 | 1833 | $additional_query .= " AND ("; |
1733 | - if (is_int($q_item)) $additional_query .= "(tracker_output.tracker_id = '".$q_item."') OR "; |
|
1834 | + if (is_int($q_item)) { |
|
1835 | + $additional_query .= "(tracker_output.tracker_id = '".$q_item."') OR "; |
|
1836 | + } |
|
1734 | 1837 | $additional_query .= "(tracker_output.ident like '%".$q_item."%') OR "; |
1735 | 1838 | $additional_query .= ")"; |
1736 | 1839 | } |
@@ -1756,7 +1859,9 @@ discard block |
||
1756 | 1859 | date_default_timezone_set($globalTimezone); |
1757 | 1860 | $datetime = new DateTime(); |
1758 | 1861 | $offset = $datetime->format('P'); |
1759 | - } else $offset = '+00:00'; |
|
1862 | + } else { |
|
1863 | + $offset = '+00:00'; |
|
1864 | + } |
|
1760 | 1865 | if ($date_array[1] != "") |
1761 | 1866 | { |
1762 | 1867 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
@@ -1783,8 +1888,12 @@ discard block |
||
1783 | 1888 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1784 | 1889 | { |
1785 | 1890 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
1786 | - } else $limit_query = ""; |
|
1787 | - } else $limit_query = ""; |
|
1891 | + } else { |
|
1892 | + $limit_query = ""; |
|
1893 | + } |
|
1894 | + } else { |
|
1895 | + $limit_query = ""; |
|
1896 | + } |
|
1788 | 1897 | if ($sort != "") |
1789 | 1898 | { |
1790 | 1899 | $search_orderby_array = $this->getOrderBy(); |
@@ -1827,7 +1936,9 @@ discard block |
||
1827 | 1936 | { |
1828 | 1937 | global $globalBitlyAccessToken; |
1829 | 1938 | |
1830 | - if ($globalBitlyAccessToken == '') return $url; |
|
1939 | + if ($globalBitlyAccessToken == '') { |
|
1940 | + return $url; |
|
1941 | + } |
|
1831 | 1942 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
1832 | 1943 | $ch = curl_init(); |
1833 | 1944 | curl_setopt($ch, CURLOPT_HEADER, 0); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
5 | 5 | $global_query = "SELECT tracker_output.* FROM tracker_output"; |
6 | 6 | |
7 | -class Tracker{ |
|
7 | +class Tracker { |
|
8 | 8 | public $db; |
9 | 9 | |
10 | 10 | public function __construct($dbc = null) { |
@@ -19,33 +19,33 @@ discard block |
||
19 | 19 | * @return Array the SQL part |
20 | 20 | */ |
21 | 21 | |
22 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
22 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
23 | 23 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
24 | 24 | $filters = array(); |
25 | 25 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
26 | 26 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
27 | 27 | $filters = $globalStatsFilters[$globalFilterName]; |
28 | 28 | } else { |
29 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
29 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | if (isset($filter[0]['source'])) { |
33 | - $filters = array_merge($filters,$filter); |
|
33 | + $filters = array_merge($filters, $filter); |
|
34 | 34 | } |
35 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
35 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
36 | 36 | $filter_query_join = ''; |
37 | 37 | $filter_query_where = ''; |
38 | - foreach($filters as $flt) { |
|
38 | + foreach ($filters as $flt) { |
|
39 | 39 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
40 | 40 | if (isset($flt['source'])) { |
41 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
42 | 42 | } else { |
43 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
43 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
47 | 47 | if (isset($filter['source']) && !empty($filter['source'])) { |
48 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
48 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
49 | 49 | } |
50 | 50 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
51 | 51 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
75 | 75 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
76 | 76 | if ($filter_query_where != '') { |
77 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
77 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
78 | 78 | } |
79 | 79 | $filter_query = $filter_query_join.$filter_query_where; |
80 | 80 | return $filter_query; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return Array the tracker information |
90 | 90 | * |
91 | 91 | */ |
92 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
92 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
93 | 93 | { |
94 | 94 | date_default_timezone_set('UTC'); |
95 | 95 | if (!is_string($query)) |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | $sth = $this->db->prepare($query.$limitQuery); |
110 | 110 | $sth->execute($params); |
111 | 111 | } catch (PDOException $e) { |
112 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
112 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
113 | 113 | exit(); |
114 | 114 | } |
115 | 115 | |
116 | 116 | $num_rows = 0; |
117 | 117 | $tracker_array = array(); |
118 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
118 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
119 | 119 | { |
120 | 120 | $num_rows++; |
121 | 121 | $temp_array = array(); |
@@ -171,17 +171,17 @@ discard block |
||
171 | 171 | { |
172 | 172 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
173 | 173 | } else { |
174 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
174 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
175 | 175 | } |
176 | 176 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
177 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
178 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
177 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
178 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
179 | 179 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
180 | 180 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
181 | 181 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
182 | 182 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
183 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
184 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
183 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
184 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
185 | 185 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
186 | 186 | } |
187 | 187 | } |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | { |
219 | 219 | $limit_array = explode(",", $limit); |
220 | 220 | |
221 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
222 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
221 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
222 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
223 | 223 | |
224 | 224 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
225 | 225 | { |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | $orderby_query = " ORDER BY tracker_output.date DESC"; |
237 | 237 | } |
238 | 238 | |
239 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
239 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
240 | 240 | |
241 | - $tracker_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
241 | + $tracker_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
242 | 242 | |
243 | 243 | return $tracker_array; |
244 | 244 | } |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | if ($id == '') return array(); |
258 | 258 | $additional_query = "tracker_output.famtrackid = :id"; |
259 | 259 | $query_values = array(':id' => $id); |
260 | - $query = $global_query." WHERE ".$additional_query." "; |
|
261 | - $tracker_array = $this->getDataFromDB($query,$query_values); |
|
260 | + $query = $global_query." WHERE ".$additional_query." "; |
|
261 | + $tracker_array = $this->getDataFromDB($query, $query_values); |
|
262 | 262 | return $tracker_array; |
263 | 263 | } |
264 | 264 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $query_values = array(); |
278 | 278 | $limit_query = ''; |
279 | 279 | $additional_query = ''; |
280 | - $filter_query = $this->getFilter($filter,true,true); |
|
280 | + $filter_query = $this->getFilter($filter, true, true); |
|
281 | 281 | if ($ident != "") |
282 | 282 | { |
283 | 283 | if (!is_string($ident)) |
@@ -293,8 +293,8 @@ discard block |
||
293 | 293 | { |
294 | 294 | $limit_array = explode(",", $limit); |
295 | 295 | |
296 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
297 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
296 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
297 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
298 | 298 | |
299 | 299 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
300 | 300 | { |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | return $tracker_array; |
319 | 319 | } |
320 | 320 | |
321 | - public function getTrackerDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
321 | + public function getTrackerDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
322 | 322 | { |
323 | 323 | global $global_query, $globalTimezone, $globalDBdriver; |
324 | 324 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $limit_query = ''; |
327 | 327 | $additional_query = ''; |
328 | 328 | |
329 | - $filter_query = $this->getFilter($filter,true,true); |
|
329 | + $filter_query = $this->getFilter($filter, true, true); |
|
330 | 330 | |
331 | 331 | if ($date != "") |
332 | 332 | { |
@@ -352,8 +352,8 @@ discard block |
||
352 | 352 | { |
353 | 353 | $limit_array = explode(",", $limit); |
354 | 354 | |
355 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
356 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
355 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
356 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
357 | 357 | |
358 | 358 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
359 | 359 | { |
@@ -384,11 +384,11 @@ discard block |
||
384 | 384 | * @return Array list of source name |
385 | 385 | * |
386 | 386 | */ |
387 | - public function getAllSourceName($type = '',$filters = array()) |
|
387 | + public function getAllSourceName($type = '', $filters = array()) |
|
388 | 388 | { |
389 | - $filter_query = $this->getFilter($filters,true,true); |
|
389 | + $filter_query = $this->getFilter($filters, true, true); |
|
390 | 390 | $query_values = array(); |
391 | - $query = "SELECT DISTINCT tracker_output.source_name |
|
391 | + $query = "SELECT DISTINCT tracker_output.source_name |
|
392 | 392 | FROM tracker_output".$filter_query." tracker_output.source_name <> ''"; |
393 | 393 | if ($type != '') { |
394 | 394 | $query_values = array(':type' => $type); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $source_array = array(); |
404 | 404 | $temp_array = array(); |
405 | 405 | |
406 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
406 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
407 | 407 | { |
408 | 408 | $temp_array['source_name'] = $row['source_name']; |
409 | 409 | $source_array[] = $temp_array; |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function getAllIdents($filters = array()) |
422 | 422 | { |
423 | - $filter_query = $this->getFilter($filters,true,true); |
|
424 | - $query = "SELECT DISTINCT tracker_output.ident |
|
423 | + $filter_query = $this->getFilter($filters, true, true); |
|
424 | + $query = "SELECT DISTINCT tracker_output.ident |
|
425 | 425 | FROM tracker_output".$filter_query." tracker_output.ident <> '' |
426 | 426 | ORDER BY tracker_output.date ASC LIMIT 700 OFFSET 0"; |
427 | 427 | |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | $ident_array = array(); |
432 | 432 | $temp_array = array(); |
433 | 433 | |
434 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
434 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
435 | 435 | { |
436 | 436 | $temp_array['ident'] = $row['ident']; |
437 | 437 | $ident_array[] = $temp_array; |
@@ -456,12 +456,12 @@ discard block |
||
456 | 456 | } else $offset = '+00:00'; |
457 | 457 | |
458 | 458 | if ($globalDBdriver == 'mysql') { |
459 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
|
459 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
|
460 | 460 | FROM tracker_output |
461 | 461 | WHERE tracker_output.date <> '' |
462 | 462 | ORDER BY tracker_output.date ASC LIMIT 0,100"; |
463 | 463 | } else { |
464 | - $query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
464 | + $query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
465 | 465 | FROM tracker_output |
466 | 466 | WHERE tracker_output.date <> '' |
467 | 467 | ORDER BY tracker_output.date ASC LIMIT 0,100"; |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | $date_array = array(); |
474 | 474 | $temp_array = array(); |
475 | 475 | |
476 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
476 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
477 | 477 | { |
478 | 478 | $temp_array['date'] = $row['date']; |
479 | 479 | |
@@ -492,11 +492,11 @@ discard block |
||
492 | 492 | * @return String success or false |
493 | 493 | * |
494 | 494 | */ |
495 | - public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL) |
|
495 | + public function updateIdentTrackerData($famtrackid = '', $ident = '', $fromsource = NULL) |
|
496 | 496 | { |
497 | 497 | |
498 | 498 | $query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid'; |
499 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident); |
|
499 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident); |
|
500 | 500 | |
501 | 501 | try { |
502 | 502 | $sth = $this->db->prepare($query); |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '') |
521 | 521 | { |
522 | 522 | $query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid'; |
523 | - $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
523 | + $query_values = array(':famtrackid' => $famtrackid, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident); |
|
524 | 524 | |
525 | 525 | try { |
526 | 526 | $sth = $this->db->prepare($query); |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | * @param String $verticalrate vertival rate of flight |
561 | 561 | * @return String success or false |
562 | 562 | */ |
563 | - public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '') |
|
563 | + public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '', $format_source = '', $source_name = '') |
|
564 | 564 | { |
565 | 565 | global $globalURL; |
566 | 566 | |
@@ -628,21 +628,21 @@ discard block |
||
628 | 628 | } |
629 | 629 | |
630 | 630 | |
631 | - if ($date == "" || strtotime($date) < time()-20*60) |
|
631 | + if ($date == "" || strtotime($date) < time() - 20*60) |
|
632 | 632 | { |
633 | 633 | $date = date("Y-m-d H:i:s", time()); |
634 | 634 | } |
635 | 635 | |
636 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
637 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
638 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
639 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
640 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
641 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
642 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
643 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
644 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
|
645 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
636 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
637 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
638 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
639 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
640 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
641 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
642 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
643 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
644 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); |
|
645 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
646 | 646 | |
647 | 647 | if ($latitude == '' && $longitude == '') { |
648 | 648 | $latitude = 0; |
@@ -650,10 +650,10 @@ discard block |
||
650 | 650 | } |
651 | 651 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
652 | 652 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
653 | - $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
653 | + $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
654 | 654 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
655 | 655 | |
656 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type); |
|
656 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':comment' => $comment, ':type' => $type); |
|
657 | 657 | |
658 | 658 | try { |
659 | 659 | |
@@ -679,13 +679,13 @@ discard block |
||
679 | 679 | { |
680 | 680 | global $globalDBdriver, $globalTimezone; |
681 | 681 | if ($globalDBdriver == 'mysql') { |
682 | - $query = "SELECT tracker_output.ident FROM tracker_output |
|
682 | + $query = "SELECT tracker_output.ident FROM tracker_output |
|
683 | 683 | WHERE tracker_output.ident = :ident |
684 | 684 | AND tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
685 | 685 | AND tracker_output.date < UTC_TIMESTAMP()"; |
686 | 686 | $query_data = array(':ident' => $ident); |
687 | 687 | } else { |
688 | - $query = "SELECT tracker_output.ident FROM tracker_output |
|
688 | + $query = "SELECT tracker_output.ident FROM tracker_output |
|
689 | 689 | WHERE tracker_output.ident = :ident |
690 | 690 | AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
691 | 691 | AND tracker_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -694,8 +694,8 @@ discard block |
||
694 | 694 | |
695 | 695 | $sth = $this->db->prepare($query); |
696 | 696 | $sth->execute($query_data); |
697 | - $ident_result=''; |
|
698 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
697 | + $ident_result = ''; |
|
698 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
699 | 699 | { |
700 | 700 | $ident_result = $row['ident']; |
701 | 701 | } |
@@ -721,8 +721,8 @@ discard block |
||
721 | 721 | return false; |
722 | 722 | } else { |
723 | 723 | $q_array = explode(" ", $q); |
724 | - foreach ($q_array as $q_item){ |
|
725 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
724 | + foreach ($q_array as $q_item) { |
|
725 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
726 | 726 | $additional_query .= " AND ("; |
727 | 727 | $additional_query .= "(tracker_output.ident like '%".$q_item."%')"; |
728 | 728 | $additional_query .= ")"; |
@@ -730,11 +730,11 @@ discard block |
||
730 | 730 | } |
731 | 731 | } |
732 | 732 | if ($globalDBdriver == 'mysql') { |
733 | - $query = "SELECT tracker_output.* FROM tracker_output |
|
733 | + $query = "SELECT tracker_output.* FROM tracker_output |
|
734 | 734 | WHERE tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
735 | 735 | AND tracker_output.date < UTC_TIMESTAMP()"; |
736 | 736 | } else { |
737 | - $query = "SELECT tracker_output.* FROM tracker_output |
|
737 | + $query = "SELECT tracker_output.* FROM tracker_output |
|
738 | 738 | WHERE tracker_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
739 | 739 | AND tracker_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
740 | 740 | } |
@@ -748,16 +748,16 @@ discard block |
||
748 | 748 | * @return Array the airline country list |
749 | 749 | * |
750 | 750 | */ |
751 | - public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
751 | + public function countAllTrackerOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
752 | 752 | { |
753 | 753 | global $globalDBdriver, $globalArchive; |
754 | 754 | //$filter_query = $this->getFilter($filters,true,true); |
755 | - $Connection= new Connection($this->db); |
|
755 | + $Connection = new Connection($this->db); |
|
756 | 756 | if (!$Connection->tableExists('countries')) return array(); |
757 | 757 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
758 | 758 | require_once('class.TrackerLive.php'); |
759 | 759 | $TrackerLive = new TrackerLive($this->db); |
760 | - $filter_query = $TrackerLive->getFilter($filters,true,true); |
|
760 | + $filter_query = $TrackerLive->getFilter($filters, true, true); |
|
761 | 761 | $filter_query .= " over_country IS NOT NULL AND over_country <> ''"; |
762 | 762 | if ($olderthanmonths > 0) { |
763 | 763 | if ($globalDBdriver == 'mysql') { |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | } else { |
778 | 778 | require_once('class.TrackerArchive.php'); |
779 | 779 | $TrackerArchive = new TrackerArchive($this->db); |
780 | - $filter_query = $TrackerArchive->getFilter($filters,true,true); |
|
780 | + $filter_query = $TrackerArchive->getFilter($filters, true, true); |
|
781 | 781 | $filter_query .= " over_country IS NOT NULL AND over_country <> ''"; |
782 | 782 | if ($olderthanmonths > 0) { |
783 | 783 | if ($globalDBdriver == 'mysql') { |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | $flight_array = array(); |
806 | 806 | $temp_array = array(); |
807 | 807 | |
808 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
808 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
809 | 809 | { |
810 | 810 | $temp_array['tracker_count'] = $row['nb']; |
811 | 811 | $temp_array['tracker_country'] = $row['name']; |
@@ -822,11 +822,11 @@ discard block |
||
822 | 822 | * @return Array the callsign list |
823 | 823 | * |
824 | 824 | */ |
825 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
825 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
826 | 826 | { |
827 | 827 | global $globalDBdriver; |
828 | - $filter_query = $this->getFilter($filters,true,true); |
|
829 | - $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
|
828 | + $filter_query = $this->getFilter($filters, true, true); |
|
829 | + $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
|
830 | 830 | FROM tracker_output".$filter_query." tracker_output.ident <> ''"; |
831 | 831 | if ($olderthanmonths > 0) { |
832 | 832 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -840,28 +840,28 @@ discard block |
||
840 | 840 | if ($year != '') { |
841 | 841 | if ($globalDBdriver == 'mysql') { |
842 | 842 | $query .= " AND YEAR(tracker_output.date) = :year"; |
843 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
843 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
844 | 844 | } else { |
845 | 845 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
846 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
846 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
847 | 847 | } |
848 | 848 | } |
849 | 849 | if ($month != '') { |
850 | 850 | if ($globalDBdriver == 'mysql') { |
851 | 851 | $query .= " AND MONTH(tracker_output.date) = :month"; |
852 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
852 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
853 | 853 | } else { |
854 | 854 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
855 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
855 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
856 | 856 | } |
857 | 857 | } |
858 | 858 | if ($day != '') { |
859 | 859 | if ($globalDBdriver == 'mysql') { |
860 | 860 | $query .= " AND DAY(tracker_output.date) = :day"; |
861 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
861 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
862 | 862 | } else { |
863 | 863 | $query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day"; |
864 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
864 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
865 | 865 | } |
866 | 866 | } |
867 | 867 | $query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC"; |
@@ -873,7 +873,7 @@ discard block |
||
873 | 873 | $callsign_array = array(); |
874 | 874 | $temp_array = array(); |
875 | 875 | |
876 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
876 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
877 | 877 | { |
878 | 878 | $temp_array['callsign_icao'] = $row['ident']; |
879 | 879 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | $date_array = array(); |
926 | 926 | $temp_array = array(); |
927 | 927 | |
928 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
928 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
929 | 929 | { |
930 | 930 | $temp_array['date_name'] = $row['date_name']; |
931 | 931 | $temp_array['date_count'] = $row['date_count']; |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | $datetime = new DateTime(); |
952 | 952 | $offset = $datetime->format('P'); |
953 | 953 | } else $offset = '+00:00'; |
954 | - $filter_query = $this->getFilter($filters,true,true); |
|
954 | + $filter_query = $this->getFilter($filters, true, true); |
|
955 | 955 | if ($globalDBdriver == 'mysql') { |
956 | 956 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
957 | 957 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | $date_array = array(); |
973 | 973 | $temp_array = array(); |
974 | 974 | |
975 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
975 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
976 | 976 | { |
977 | 977 | $temp_array['date_name'] = $row['date_name']; |
978 | 978 | $temp_array['date_count'] = $row['date_count']; |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | $datetime = new DateTime(); |
998 | 998 | $offset = $datetime->format('P'); |
999 | 999 | } else $offset = '+00:00'; |
1000 | - $filter_query = $this->getFilter($filters,true,true); |
|
1000 | + $filter_query = $this->getFilter($filters, true, true); |
|
1001 | 1001 | if ($globalDBdriver == 'mysql') { |
1002 | 1002 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1003 | 1003 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | $date_array = array(); |
1019 | 1019 | $temp_array = array(); |
1020 | 1020 | |
1021 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1021 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1022 | 1022 | { |
1023 | 1023 | $temp_array['date_name'] = $row['date_name']; |
1024 | 1024 | $temp_array['date_count'] = $row['date_count']; |
@@ -1065,7 +1065,7 @@ discard block |
||
1065 | 1065 | $date_array = array(); |
1066 | 1066 | $temp_array = array(); |
1067 | 1067 | |
1068 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1068 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1069 | 1069 | { |
1070 | 1070 | $temp_array['month_name'] = $row['month_name']; |
1071 | 1071 | $temp_array['year_name'] = $row['year_name']; |
@@ -1094,7 +1094,7 @@ discard block |
||
1094 | 1094 | $datetime = new DateTime(); |
1095 | 1095 | $offset = $datetime->format('P'); |
1096 | 1096 | } else $offset = '+00:00'; |
1097 | - $filter_query = $this->getFilter($filters,true,true); |
|
1097 | + $filter_query = $this->getFilter($filters, true, true); |
|
1098 | 1098 | if ($globalDBdriver == 'mysql') { |
1099 | 1099 | $query = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
1100 | 1100 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -1115,7 +1115,7 @@ discard block |
||
1115 | 1115 | $date_array = array(); |
1116 | 1116 | $temp_array = array(); |
1117 | 1117 | |
1118 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1118 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1119 | 1119 | { |
1120 | 1120 | $temp_array['year_name'] = $row['year_name']; |
1121 | 1121 | $temp_array['month_name'] = $row['month_name']; |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | * @return Array the hour list |
1136 | 1136 | * |
1137 | 1137 | */ |
1138 | - public function countAllHours($orderby,$filters = array()) |
|
1138 | + public function countAllHours($orderby, $filters = array()) |
|
1139 | 1139 | { |
1140 | 1140 | global $globalTimezone, $globalDBdriver; |
1141 | 1141 | if ($globalTimezone != '') { |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | $hour_array = array(); |
1184 | 1184 | $temp_array = array(); |
1185 | 1185 | |
1186 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1186 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1187 | 1187 | { |
1188 | 1188 | $temp_array['hour_name'] = $row['hour_name']; |
1189 | 1189 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1205,8 +1205,8 @@ discard block |
||
1205 | 1205 | public function countAllHoursByDate($date, $filters = array()) |
1206 | 1206 | { |
1207 | 1207 | global $globalTimezone, $globalDBdriver; |
1208 | - $filter_query = $this->getFilter($filters,true,true); |
|
1209 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
1208 | + $filter_query = $this->getFilter($filters, true, true); |
|
1209 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
1210 | 1210 | if ($globalTimezone != '') { |
1211 | 1211 | date_default_timezone_set($globalTimezone); |
1212 | 1212 | $datetime = new DateTime($date); |
@@ -1214,12 +1214,12 @@ discard block |
||
1214 | 1214 | } else $offset = '+00:00'; |
1215 | 1215 | |
1216 | 1216 | if ($globalDBdriver == 'mysql') { |
1217 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1217 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1218 | 1218 | FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = :date |
1219 | 1219 | GROUP BY hour_name |
1220 | 1220 | ORDER BY hour_name ASC"; |
1221 | 1221 | } else { |
1222 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1222 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1223 | 1223 | FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
1224 | 1224 | GROUP BY hour_name |
1225 | 1225 | ORDER BY hour_name ASC"; |
@@ -1231,7 +1231,7 @@ discard block |
||
1231 | 1231 | $hour_array = array(); |
1232 | 1232 | $temp_array = array(); |
1233 | 1233 | |
1234 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1234 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1235 | 1235 | { |
1236 | 1236 | $temp_array['hour_name'] = $row['hour_name']; |
1237 | 1237 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1253,8 +1253,8 @@ discard block |
||
1253 | 1253 | public function countAllHoursByIdent($ident, $filters = array()) |
1254 | 1254 | { |
1255 | 1255 | global $globalTimezone, $globalDBdriver; |
1256 | - $filter_query = $this->getFilter($filters,true,true); |
|
1257 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1256 | + $filter_query = $this->getFilter($filters, true, true); |
|
1257 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1258 | 1258 | if ($globalTimezone != '') { |
1259 | 1259 | date_default_timezone_set($globalTimezone); |
1260 | 1260 | $datetime = new DateTime(); |
@@ -1262,12 +1262,12 @@ discard block |
||
1262 | 1262 | } else $offset = '+00:00'; |
1263 | 1263 | |
1264 | 1264 | if ($globalDBdriver == 'mysql') { |
1265 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1265 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1266 | 1266 | FROM tracker_output".$filter_query." tracker_output.ident = :ident |
1267 | 1267 | GROUP BY hour_name |
1268 | 1268 | ORDER BY hour_name ASC"; |
1269 | 1269 | } else { |
1270 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1270 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1271 | 1271 | FROM tracker_output".$filter_query." tracker_output.ident = :ident |
1272 | 1272 | GROUP BY hour_name |
1273 | 1273 | ORDER BY hour_name ASC"; |
@@ -1275,12 +1275,12 @@ discard block |
||
1275 | 1275 | |
1276 | 1276 | |
1277 | 1277 | $sth = $this->db->prepare($query); |
1278 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
1278 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
1279 | 1279 | |
1280 | 1280 | $hour_array = array(); |
1281 | 1281 | $temp_array = array(); |
1282 | 1282 | |
1283 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1283 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1284 | 1284 | { |
1285 | 1285 | $temp_array['hour_name'] = $row['hour_name']; |
1286 | 1286 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1299,33 +1299,33 @@ discard block |
||
1299 | 1299 | * @return Integer the number of trackers |
1300 | 1300 | * |
1301 | 1301 | */ |
1302 | - public function countOverallTracker($filters = array(),$year = '',$month = '') |
|
1302 | + public function countOverallTracker($filters = array(), $year = '', $month = '') |
|
1303 | 1303 | { |
1304 | 1304 | global $globalDBdriver; |
1305 | 1305 | //$queryi = "SELECT COUNT(tracker_output.tracker_id) AS flight_count FROM tracker_output"; |
1306 | - $queryi = "SELECT COUNT(DISTINCT tracker_output.ident) AS tracker_count FROM tracker_output"; |
|
1306 | + $queryi = "SELECT COUNT(DISTINCT tracker_output.ident) AS tracker_count FROM tracker_output"; |
|
1307 | 1307 | $query_values = array(); |
1308 | 1308 | $query = ''; |
1309 | 1309 | if ($year != '') { |
1310 | 1310 | if ($globalDBdriver == 'mysql') { |
1311 | 1311 | $query .= " AND YEAR(tracker_output.date) = :year"; |
1312 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1312 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1313 | 1313 | } else { |
1314 | 1314 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
1315 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1315 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1316 | 1316 | } |
1317 | 1317 | } |
1318 | 1318 | if ($month != '') { |
1319 | 1319 | if ($globalDBdriver == 'mysql') { |
1320 | 1320 | $query .= " AND MONTH(tracker_output.date) = :month"; |
1321 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1321 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1322 | 1322 | } else { |
1323 | 1323 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
1324 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1324 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1325 | 1325 | } |
1326 | 1326 | } |
1327 | 1327 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1328 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1328 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1329 | 1329 | |
1330 | 1330 | $sth = $this->db->prepare($queryi); |
1331 | 1331 | $sth->execute($query_values); |
@@ -1338,32 +1338,32 @@ discard block |
||
1338 | 1338 | * @return Integer the number of flights |
1339 | 1339 | * |
1340 | 1340 | */ |
1341 | - public function countOverallTrackerTypes($filters = array(),$year = '',$month = '') |
|
1341 | + public function countOverallTrackerTypes($filters = array(), $year = '', $month = '') |
|
1342 | 1342 | { |
1343 | 1343 | global $globalDBdriver; |
1344 | - $queryi = "SELECT COUNT(DISTINCT tracker_output.type) AS tracker_count FROM tracker_output"; |
|
1344 | + $queryi = "SELECT COUNT(DISTINCT tracker_output.type) AS tracker_count FROM tracker_output"; |
|
1345 | 1345 | $query_values = array(); |
1346 | 1346 | $query = ''; |
1347 | 1347 | if ($year != '') { |
1348 | 1348 | if ($globalDBdriver == 'mysql') { |
1349 | 1349 | $query .= " AND YEAR(tracker_output.date) = :year"; |
1350 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1350 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1351 | 1351 | } else { |
1352 | 1352 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
1353 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1353 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1354 | 1354 | } |
1355 | 1355 | } |
1356 | 1356 | if ($month != '') { |
1357 | 1357 | if ($globalDBdriver == 'mysql') { |
1358 | 1358 | $query .= " AND MONTH(tracker_output.date) = :month"; |
1359 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1359 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1360 | 1360 | } else { |
1361 | 1361 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
1362 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1362 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1363 | 1363 | } |
1364 | 1364 | } |
1365 | 1365 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1366 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1366 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1367 | 1367 | |
1368 | 1368 | $sth = $this->db->prepare($queryi); |
1369 | 1369 | $sth->execute($query_values); |
@@ -1380,7 +1380,7 @@ discard block |
||
1380 | 1380 | public function countAllHoursFromToday($filters = array()) |
1381 | 1381 | { |
1382 | 1382 | global $globalTimezone, $globalDBdriver; |
1383 | - $filter_query = $this->getFilter($filters,true,true); |
|
1383 | + $filter_query = $this->getFilter($filters, true, true); |
|
1384 | 1384 | if ($globalTimezone != '') { |
1385 | 1385 | date_default_timezone_set($globalTimezone); |
1386 | 1386 | $datetime = new DateTime(); |
@@ -1388,12 +1388,12 @@ discard block |
||
1388 | 1388 | } else $offset = '+00:00'; |
1389 | 1389 | |
1390 | 1390 | if ($globalDBdriver == 'mysql') { |
1391 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1391 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1392 | 1392 | FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = CURDATE() |
1393 | 1393 | GROUP BY hour_name |
1394 | 1394 | ORDER BY hour_name ASC"; |
1395 | 1395 | } else { |
1396 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1396 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1397 | 1397 | FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
1398 | 1398 | GROUP BY hour_name |
1399 | 1399 | ORDER BY hour_name ASC"; |
@@ -1405,7 +1405,7 @@ discard block |
||
1405 | 1405 | $hour_array = array(); |
1406 | 1406 | $temp_array = array(); |
1407 | 1407 | |
1408 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1408 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1409 | 1409 | { |
1410 | 1410 | $temp_array['hour_name'] = $row['hour_name']; |
1411 | 1411 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1424,9 +1424,9 @@ discard block |
||
1424 | 1424 | */ |
1425 | 1425 | public function getTrackerIDBasedOnFamTrackID($famtrackid) |
1426 | 1426 | { |
1427 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
1427 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
1428 | 1428 | |
1429 | - $query = "SELECT tracker_output.tracker_id |
|
1429 | + $query = "SELECT tracker_output.tracker_id |
|
1430 | 1430 | FROM tracker_output |
1431 | 1431 | WHERE tracker_output.famtrackid = '".$famtrackid."'"; |
1432 | 1432 | |
@@ -1434,7 +1434,7 @@ discard block |
||
1434 | 1434 | $sth = $this->db->prepare($query); |
1435 | 1435 | $sth->execute(); |
1436 | 1436 | |
1437 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1437 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1438 | 1438 | { |
1439 | 1439 | return $row['tracker_id']; |
1440 | 1440 | } |
@@ -1459,23 +1459,23 @@ discard block |
||
1459 | 1459 | } |
1460 | 1460 | |
1461 | 1461 | $current_date = date("Y-m-d H:i:s"); |
1462 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
1462 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
1463 | 1463 | |
1464 | 1464 | $diff = abs(strtotime($current_date) - strtotime($date)); |
1465 | 1465 | |
1466 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
1466 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
1467 | 1467 | $years = $time_array['years']; |
1468 | 1468 | |
1469 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
1469 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
1470 | 1470 | $months = $time_array['months']; |
1471 | 1471 | |
1472 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
1472 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
1473 | 1473 | $days = $time_array['days']; |
1474 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
1474 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
1475 | 1475 | $hours = $time_array['hours']; |
1476 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
1476 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
1477 | 1477 | $minutes = $time_array['minutes']; |
1478 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1478 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1479 | 1479 | |
1480 | 1480 | return $time_array; |
1481 | 1481 | } |
@@ -1498,63 +1498,63 @@ discard block |
||
1498 | 1498 | $temp_array['direction_degree'] = $direction; |
1499 | 1499 | $temp_array['direction_shortname'] = "N"; |
1500 | 1500 | $temp_array['direction_fullname'] = "North"; |
1501 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
1501 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
1502 | 1502 | $temp_array['direction_degree'] = $direction; |
1503 | 1503 | $temp_array['direction_shortname'] = "NNE"; |
1504 | 1504 | $temp_array['direction_fullname'] = "North-Northeast"; |
1505 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
1505 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
1506 | 1506 | $temp_array['direction_degree'] = $direction; |
1507 | 1507 | $temp_array['direction_shortname'] = "NE"; |
1508 | 1508 | $temp_array['direction_fullname'] = "Northeast"; |
1509 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
1509 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
1510 | 1510 | $temp_array['direction_degree'] = $direction; |
1511 | 1511 | $temp_array['direction_shortname'] = "ENE"; |
1512 | 1512 | $temp_array['direction_fullname'] = "East-Northeast"; |
1513 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
1513 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
1514 | 1514 | $temp_array['direction_degree'] = $direction; |
1515 | 1515 | $temp_array['direction_shortname'] = "E"; |
1516 | 1516 | $temp_array['direction_fullname'] = "East"; |
1517 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
1517 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
1518 | 1518 | $temp_array['direction_degree'] = $direction; |
1519 | 1519 | $temp_array['direction_shortname'] = "ESE"; |
1520 | 1520 | $temp_array['direction_fullname'] = "East-Southeast"; |
1521 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
1521 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
1522 | 1522 | $temp_array['direction_degree'] = $direction; |
1523 | 1523 | $temp_array['direction_shortname'] = "SE"; |
1524 | 1524 | $temp_array['direction_fullname'] = "Southeast"; |
1525 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
1525 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
1526 | 1526 | $temp_array['direction_degree'] = $direction; |
1527 | 1527 | $temp_array['direction_shortname'] = "SSE"; |
1528 | 1528 | $temp_array['direction_fullname'] = "South-Southeast"; |
1529 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
1529 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
1530 | 1530 | $temp_array['direction_degree'] = $direction; |
1531 | 1531 | $temp_array['direction_shortname'] = "S"; |
1532 | 1532 | $temp_array['direction_fullname'] = "South"; |
1533 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
1533 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
1534 | 1534 | $temp_array['direction_degree'] = $direction; |
1535 | 1535 | $temp_array['direction_shortname'] = "SSW"; |
1536 | 1536 | $temp_array['direction_fullname'] = "South-Southwest"; |
1537 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
1537 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
1538 | 1538 | $temp_array['direction_degree'] = $direction; |
1539 | 1539 | $temp_array['direction_shortname'] = "SW"; |
1540 | 1540 | $temp_array['direction_fullname'] = "Southwest"; |
1541 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
1541 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
1542 | 1542 | $temp_array['direction_degree'] = $direction; |
1543 | 1543 | $temp_array['direction_shortname'] = "WSW"; |
1544 | 1544 | $temp_array['direction_fullname'] = "West-Southwest"; |
1545 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
1545 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
1546 | 1546 | $temp_array['direction_degree'] = $direction; |
1547 | 1547 | $temp_array['direction_shortname'] = "W"; |
1548 | 1548 | $temp_array['direction_fullname'] = "West"; |
1549 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
1549 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
1550 | 1550 | $temp_array['direction_degree'] = $direction; |
1551 | 1551 | $temp_array['direction_shortname'] = "WNW"; |
1552 | 1552 | $temp_array['direction_fullname'] = "West-Northwest"; |
1553 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
1553 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
1554 | 1554 | $temp_array['direction_degree'] = $direction; |
1555 | 1555 | $temp_array['direction_shortname'] = "NW"; |
1556 | 1556 | $temp_array['direction_fullname'] = "Northwest"; |
1557 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
1557 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
1558 | 1558 | $temp_array['direction_degree'] = $direction; |
1559 | 1559 | $temp_array['direction_shortname'] = "NNW"; |
1560 | 1560 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -1571,11 +1571,11 @@ discard block |
||
1571 | 1571 | * @param Float $longitude longitute of the flight |
1572 | 1572 | * @return String the countrie |
1573 | 1573 | */ |
1574 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
1574 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
1575 | 1575 | { |
1576 | 1576 | global $globalDBdriver, $globalDebug; |
1577 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1578 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1577 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1578 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1579 | 1579 | |
1580 | 1580 | $Connection = new Connection($this->db); |
1581 | 1581 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1615,7 +1615,7 @@ discard block |
||
1615 | 1615 | public function getCountryFromISO2($iso2) |
1616 | 1616 | { |
1617 | 1617 | global $globalDBdriver, $globalDebug; |
1618 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
1618 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
1619 | 1619 | |
1620 | 1620 | $Connection = new Connection($this->db); |
1621 | 1621 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1644,11 +1644,11 @@ discard block |
||
1644 | 1644 | * @return Array the vessel type list |
1645 | 1645 | * |
1646 | 1646 | */ |
1647 | - public function countAllTrackerTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
1647 | + public function countAllTrackerTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
1648 | 1648 | { |
1649 | 1649 | global $globalDBdriver; |
1650 | - $filter_query = $this->getFilter($filters,true,true); |
|
1651 | - $query = "SELECT tracker_output.type AS tracker_type, COUNT(tracker_output.type) AS tracker_type_count |
|
1650 | + $filter_query = $this->getFilter($filters, true, true); |
|
1651 | + $query = "SELECT tracker_output.type AS tracker_type, COUNT(tracker_output.type) AS tracker_type_count |
|
1652 | 1652 | FROM tracker_output ".$filter_query." tracker_output.type <> ''"; |
1653 | 1653 | if ($olderthanmonths > 0) { |
1654 | 1654 | if ($globalDBdriver == 'mysql') { |
@@ -1668,28 +1668,28 @@ discard block |
||
1668 | 1668 | if ($year != '') { |
1669 | 1669 | if ($globalDBdriver == 'mysql') { |
1670 | 1670 | $query .= " AND YEAR(tracker_output.date) = :year"; |
1671 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1671 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1672 | 1672 | } else { |
1673 | 1673 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
1674 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1674 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1675 | 1675 | } |
1676 | 1676 | } |
1677 | 1677 | if ($month != '') { |
1678 | 1678 | if ($globalDBdriver == 'mysql') { |
1679 | 1679 | $query .= " AND MONTH(tracker_output.date) = :month"; |
1680 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1680 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1681 | 1681 | } else { |
1682 | 1682 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
1683 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1683 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1684 | 1684 | } |
1685 | 1685 | } |
1686 | 1686 | if ($day != '') { |
1687 | 1687 | if ($globalDBdriver == 'mysql') { |
1688 | 1688 | $query .= " AND DAY(tracker_output.date) = :day"; |
1689 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1689 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1690 | 1690 | } else { |
1691 | 1691 | $query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day"; |
1692 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1692 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1693 | 1693 | } |
1694 | 1694 | } |
1695 | 1695 | $query .= " GROUP BY tracker_output.type ORDER BY tracker_type_count DESC"; |
@@ -1698,7 +1698,7 @@ discard block |
||
1698 | 1698 | $sth->execute($query_values); |
1699 | 1699 | $tracker_array = array(); |
1700 | 1700 | $temp_array = array(); |
1701 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1701 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1702 | 1702 | { |
1703 | 1703 | $temp_array['tracker_type'] = $row['tracker_type']; |
1704 | 1704 | $temp_array['tracker_type_count'] = $row['tracker_type_count']; |
@@ -1713,13 +1713,13 @@ discard block |
||
1713 | 1713 | * @return Array the tracker information |
1714 | 1714 | * |
1715 | 1715 | */ |
1716 | - public function searchTrackerData($q = '', $callsign = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
|
1716 | + public function searchTrackerData($q = '', $callsign = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
1717 | 1717 | { |
1718 | 1718 | global $globalTimezone, $globalDBdriver; |
1719 | 1719 | date_default_timezone_set('UTC'); |
1720 | 1720 | $query_values = array(); |
1721 | 1721 | $additional_query = ''; |
1722 | - $filter_query = $this->getFilter($filters,true,true); |
|
1722 | + $filter_query = $this->getFilter($filters, true, true); |
|
1723 | 1723 | if ($q != "") |
1724 | 1724 | { |
1725 | 1725 | if (!is_string($q)) |
@@ -1727,8 +1727,8 @@ discard block |
||
1727 | 1727 | return false; |
1728 | 1728 | } else { |
1729 | 1729 | $q_array = explode(" ", $q); |
1730 | - foreach ($q_array as $q_item){ |
|
1731 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
1730 | + foreach ($q_array as $q_item) { |
|
1731 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
1732 | 1732 | $additional_query .= " AND ("; |
1733 | 1733 | if (is_int($q_item)) $additional_query .= "(tracker_output.tracker_id = '".$q_item."') OR "; |
1734 | 1734 | $additional_query .= "(tracker_output.ident like '%".$q_item."%') OR "; |
@@ -1738,20 +1738,20 @@ discard block |
||
1738 | 1738 | } |
1739 | 1739 | if ($callsign != "") |
1740 | 1740 | { |
1741 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
1741 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
1742 | 1742 | if (!is_string($callsign)) |
1743 | 1743 | { |
1744 | 1744 | return false; |
1745 | 1745 | } else { |
1746 | 1746 | $additional_query .= " AND tracker_output.ident = :callsign"; |
1747 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
1747 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
1748 | 1748 | } |
1749 | 1749 | } |
1750 | 1750 | if ($date_posted != "") |
1751 | 1751 | { |
1752 | 1752 | $date_array = explode(",", $date_posted); |
1753 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
1754 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
1753 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
1754 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
1755 | 1755 | if ($globalTimezone != '') { |
1756 | 1756 | date_default_timezone_set($globalTimezone); |
1757 | 1757 | $datetime = new DateTime(); |
@@ -1778,8 +1778,8 @@ discard block |
||
1778 | 1778 | if ($limit != "") |
1779 | 1779 | { |
1780 | 1780 | $limit_array = explode(",", $limit); |
1781 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1782 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1781 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1782 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1783 | 1783 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1784 | 1784 | { |
1785 | 1785 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
@@ -1797,22 +1797,22 @@ discard block |
||
1797 | 1797 | } |
1798 | 1798 | } |
1799 | 1799 | if ($origLat != "" && $origLon != "" && $dist != "") { |
1800 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
1800 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
1801 | 1801 | if ($globalDBdriver == 'mysql') { |
1802 | - $query="SELECT tracker_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - tracker_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(tracker_archive.latitude*pi()/180)*POWER(SIN(($origLon-tracker_archive.longitude)*pi()/180/2),2))) as distance |
|
1802 | + $query = "SELECT tracker_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - tracker_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(tracker_archive.latitude*pi()/180)*POWER(SIN(($origLon-tracker_archive.longitude)*pi()/180/2),2))) as distance |
|
1803 | 1803 | FROM tracker_archive,tracker_output".$filter_query." tracker_output.famtrackid = tracker_archive.famtrackid AND tracker_output.ident <> '' ".$additional_query."AND tracker_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and tracker_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
1804 | 1804 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - tracker_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(tracker_archive.latitude*pi()/180)*POWER(SIN(($origLon-tracker_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query; |
1805 | 1805 | } else { |
1806 | - $query="SELECT tracker_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(tracker_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(tracker_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
1806 | + $query = "SELECT tracker_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(tracker_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(tracker_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
1807 | 1807 | FROM tracker_archive,tracker_output".$filter_query." tracker_output.famtrackid = tracker_archive.famtrackid AND tracker_output.ident <> '' ".$additional_query."AND CAST(tracker_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(tracker_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
1808 | 1808 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(tracker_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(tracker_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query; |
1809 | 1809 | } |
1810 | 1810 | } else { |
1811 | - $query = "SELECT tracker_output.* FROM tracker_output".$filter_query." tracker_output.ident <> '' |
|
1811 | + $query = "SELECT tracker_output.* FROM tracker_output".$filter_query." tracker_output.ident <> '' |
|
1812 | 1812 | ".$additional_query." |
1813 | 1813 | ".$orderby_query; |
1814 | 1814 | } |
1815 | - $tracker_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
1815 | + $tracker_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
1816 | 1816 | return $tracker_array; |
1817 | 1817 | } |
1818 | 1818 | |
@@ -1837,7 +1837,7 @@ discard block |
||
1837 | 1837 | curl_close($ch); |
1838 | 1838 | $bitly_data = json_decode($bitly_data); |
1839 | 1839 | $bitly_url = ''; |
1840 | - if ($bitly_data->status_txt = "OK"){ |
|
1840 | + if ($bitly_data->status_txt = "OK") { |
|
1841 | 1841 | $bitly_url = $bitly_data->data->url; |
1842 | 1842 | } |
1843 | 1843 | return $bitly_url; |
@@ -1845,7 +1845,7 @@ discard block |
||
1845 | 1845 | |
1846 | 1846 | public function getOrderBy() |
1847 | 1847 | { |
1848 | - $orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY tracker_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY tracker_output.type DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_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")); |
|
1848 | + $orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY tracker_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY tracker_output.type DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_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")); |
|
1849 | 1849 | |
1850 | 1850 | return $orderby; |
1851 | 1851 |
@@ -91,28 +91,28 @@ |
||
91 | 91 | $limit_previous_2 = $limit_end - $absolute_difference; |
92 | 92 | |
93 | 93 | if ( |
94 | - (isset($_GET['q']) && $_GET['q'] != '') || |
|
95 | - (isset($_GET['registration']) && $_GET['registration'] != '') || |
|
96 | - (isset($_GET['aircraft']) && $_GET['aircraft'] != '') || |
|
97 | - (isset($_GET['manufacturer']) && $_GET['manufacturer'] != '') || |
|
98 | - (isset($_GET['highlights']) && $_GET['highlights'] != '') || |
|
99 | - (isset($_GET['airline']) && $_GET['airline'] != '') || |
|
100 | - (isset($_GET['airline_country']) && $_GET['airline_country'] != '') || |
|
101 | - (isset($_GET['airline_type']) && $_GET['airline_type'] != '') || |
|
102 | - (isset($_GET['airport']) && $_GET['airport'] != '') || |
|
103 | - (isset($_GET['airport_country']) && $_GET['airport_country'] != '') || |
|
104 | - (isset($_GET['callsign']) && $_GET['callsign'] != '') || |
|
105 | - (isset($_GET['owner']) && $_GET['owner'] != '') || |
|
106 | - (isset($_GET['pilot_name']) && $_GET['pilot_name'] != '') || |
|
107 | - (isset($_GET['pilot_id']) && $_GET['pilot_id'] != '') || |
|
108 | - (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != '') || |
|
109 | - (isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != '') || |
|
110 | - (isset($_GET['mmsi']) && $_GET['mmsi'] != '') || |
|
111 | - (isset($_GET['imo']) && $_GET['imo'] != '') || |
|
112 | - ((isset($_GET['origlat']) && $_GET['origlat'] != '') && |
|
113 | - (isset($_GET['origlon']) && $_GET['origlon'] != '') && |
|
114 | - (isset($_GET['dist']) && $_GET['dist'] != '')) |
|
115 | - ){ |
|
94 | + (isset($_GET['q']) && $_GET['q'] != '') || |
|
95 | + (isset($_GET['registration']) && $_GET['registration'] != '') || |
|
96 | + (isset($_GET['aircraft']) && $_GET['aircraft'] != '') || |
|
97 | + (isset($_GET['manufacturer']) && $_GET['manufacturer'] != '') || |
|
98 | + (isset($_GET['highlights']) && $_GET['highlights'] != '') || |
|
99 | + (isset($_GET['airline']) && $_GET['airline'] != '') || |
|
100 | + (isset($_GET['airline_country']) && $_GET['airline_country'] != '') || |
|
101 | + (isset($_GET['airline_type']) && $_GET['airline_type'] != '') || |
|
102 | + (isset($_GET['airport']) && $_GET['airport'] != '') || |
|
103 | + (isset($_GET['airport_country']) && $_GET['airport_country'] != '') || |
|
104 | + (isset($_GET['callsign']) && $_GET['callsign'] != '') || |
|
105 | + (isset($_GET['owner']) && $_GET['owner'] != '') || |
|
106 | + (isset($_GET['pilot_name']) && $_GET['pilot_name'] != '') || |
|
107 | + (isset($_GET['pilot_id']) && $_GET['pilot_id'] != '') || |
|
108 | + (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != '') || |
|
109 | + (isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != '') || |
|
110 | + (isset($_GET['mmsi']) && $_GET['mmsi'] != '') || |
|
111 | + (isset($_GET['imo']) && $_GET['imo'] != '') || |
|
112 | + ((isset($_GET['origlat']) && $_GET['origlat'] != '') && |
|
113 | + (isset($_GET['origlon']) && $_GET['origlon'] != '') && |
|
114 | + (isset($_GET['dist']) && $_GET['dist'] != '')) |
|
115 | + ){ |
|
116 | 116 | $q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING); |
117 | 117 | $registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING); |
118 | 118 | $aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING); |
@@ -26,24 +26,24 @@ discard block |
||
26 | 26 | $sql_date = ''; |
27 | 27 | if (isset($_GET['start_date'])) { |
28 | 28 | //for the date manipulation into the query |
29 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
29 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
30 | 30 | if (strtotime($_GET['start_date']) !== false && strtotime($_GET['end_date']) !== false) { |
31 | 31 | //$start_date = $_GET['start_date']." 00:00:00"; |
32 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
32 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
33 | 33 | //$end_date = $_GET['end_date']." 00:00:00"; |
34 | - $end_date = date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
34 | + $end_date = date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
35 | 35 | $sql_date = $start_date.",".$end_date; |
36 | 36 | } |
37 | - } else if($_GET['start_date'] != ""){ |
|
37 | + } else if ($_GET['start_date'] != "") { |
|
38 | 38 | if (strtotime($_GET['start_date']) !== false) { |
39 | 39 | //$start_date = $_GET['start_date']." 00:00:00"; |
40 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
40 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
41 | 41 | $sql_date = $start_date; |
42 | 42 | } |
43 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
43 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
44 | 44 | if (strtotime($_GET['end_date']) !== false) { |
45 | 45 | //$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date']." 00:00:00"; |
46 | - $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
46 | + $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
47 | 47 | $sql_date = $end_date; |
48 | 48 | } |
49 | 49 | } else $sql_date = ''; |
@@ -51,21 +51,21 @@ discard block |
||
51 | 51 | |
52 | 52 | if (isset($_GET['highest_altitude'])) { |
53 | 53 | //for altitude manipulation |
54 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
55 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
56 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
54 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
55 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
56 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
57 | 57 | $sql_altitude = $start_altitude.",".$end_altitude; |
58 | - } else if($_GET['highest_altitude'] != ""){ |
|
59 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
58 | + } else if ($_GET['highest_altitude'] != "") { |
|
59 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
60 | 60 | $sql_altitude = $end_altitude; |
61 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
62 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
61 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
62 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
63 | 63 | $sql_altitude = $start_altitude; |
64 | 64 | } else $sql_altitude = ''; |
65 | 65 | } else $sql_altitude = ''; |
66 | 66 | |
67 | 67 | //calculuation for the pagination |
68 | -if(!isset($_GET['limit'])) |
|
68 | +if (!isset($_GET['limit'])) |
|
69 | 69 | { |
70 | 70 | if (!isset($_GET['number_results'])) |
71 | 71 | { |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | $limit_end = 25; |
74 | 74 | $absolute_difference = 25; |
75 | 75 | } else { |
76 | - if ($_GET['number_results'] > 1000){ |
|
76 | + if ($_GET['number_results'] > 1000) { |
|
77 | 77 | $_GET['number_results'] = 1000; |
78 | 78 | } |
79 | 79 | $limit_start = 0; |
80 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
81 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
80 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
81 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
82 | 82 | } |
83 | -} else { |
|
83 | +} else { |
|
84 | 84 | $limit_explode = explode(",", $_GET['limit']); |
85 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
86 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
85 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
86 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
87 | 87 | } |
88 | 88 | $absolute_difference = abs($limit_start - $limit_end); |
89 | 89 | $limit_next = $limit_end + $absolute_difference; |
@@ -112,31 +112,31 @@ discard block |
||
112 | 112 | ((isset($_GET['origlat']) && $_GET['origlat'] != '') && |
113 | 113 | (isset($_GET['origlon']) && $_GET['origlon'] != '') && |
114 | 114 | (isset($_GET['dist']) && $_GET['dist'] != '')) |
115 | - ){ |
|
116 | - $q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING); |
|
117 | - $registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING); |
|
118 | - $aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING); |
|
119 | - $manufacturer = filter_input(INPUT_GET, 'manufacturer',FILTER_SANITIZE_STRING); |
|
120 | - $highlights = filter_input(INPUT_GET, 'highlights',FILTER_SANITIZE_STRING); |
|
121 | - $airline = filter_input(INPUT_GET, 'airline',FILTER_SANITIZE_STRING); |
|
122 | - $airline_country = filter_input(INPUT_GET, 'airline_country',FILTER_SANITIZE_STRING); |
|
123 | - $airline_type = filter_input(INPUT_GET, 'airline_type',FILTER_SANITIZE_STRING); |
|
124 | - $airport = filter_input(INPUT_GET, 'airport',FILTER_SANITIZE_STRING); |
|
125 | - $airport_country = filter_input(INPUT_GET, 'airport_country',FILTER_SANITIZE_STRING); |
|
126 | - $callsign = filter_input(INPUT_GET, 'callsign',FILTER_SANITIZE_STRING); |
|
127 | - $owner = filter_input(INPUT_GET, 'owner',FILTER_SANITIZE_STRING); |
|
128 | - $pilot_name = filter_input(INPUT_GET, 'pilot_name',FILTER_SANITIZE_STRING); |
|
129 | - $pilot_id = filter_input(INPUT_GET, 'pilot_id',FILTER_SANITIZE_STRING); |
|
130 | - $mmsi = filter_input(INPUT_GET, 'mmsi',FILTER_SANITIZE_NUMBER_INT); |
|
131 | - $imo = filter_input(INPUT_GET, 'imo',FILTER_SANITIZE_NUMBER_INT); |
|
132 | - $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route',FILTER_SANITIZE_STRING); |
|
133 | - $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
134 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
135 | - $archive = filter_input(INPUT_GET,'archive',FILTER_SANITIZE_NUMBER_INT); |
|
136 | - $origlat = filter_input(INPUT_GET,'origlat',FILTER_SANITIZE_NUMBER_FLOAT); |
|
137 | - $origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_NUMBER_FLOAT); |
|
138 | - $dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT); |
|
139 | - $number_results = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
115 | + ) { |
|
116 | + $q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
117 | + $registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING); |
|
118 | + $aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
119 | + $manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
120 | + $highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
121 | + $airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
122 | + $airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
123 | + $airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
124 | + $airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
125 | + $airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
126 | + $callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
127 | + $owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
128 | + $pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
129 | + $pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
130 | + $mmsi = filter_input(INPUT_GET, 'mmsi', FILTER_SANITIZE_NUMBER_INT); |
|
131 | + $imo = filter_input(INPUT_GET, 'imo', FILTER_SANITIZE_NUMBER_INT); |
|
132 | + $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
133 | + $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
134 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
135 | + $archive = filter_input(INPUT_GET, 'archive', FILTER_SANITIZE_NUMBER_INT); |
|
136 | + $origlat = filter_input(INPUT_GET, 'origlat', FILTER_SANITIZE_NUMBER_FLOAT); |
|
137 | + $origlon = filter_input(INPUT_GET, 'origlon', FILTER_SANITIZE_NUMBER_FLOAT); |
|
138 | + $dist = filter_input(INPUT_GET, 'dist', FILTER_SANITIZE_NUMBER_INT); |
|
139 | + $number_results = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
140 | 140 | if ($dist != '') { |
141 | 141 | if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934; |
142 | 142 | elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852; |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | if ($archive == 1) { |
146 | 146 | if ($type == 'aircraft') { |
147 | 147 | $SpotterArchive = new SpotterArchive(); |
148 | - $spotter_array = $SpotterArchive->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,'',$origlat,$origlon,$dist); |
|
148 | + $spotter_array = $SpotterArchive->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, '', $origlat, $origlon, $dist); |
|
149 | 149 | } |
150 | 150 | } else { |
151 | 151 | if ($type == 'aircraft') { |
152 | - $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,'',$origlat,$origlon,$dist); |
|
152 | + $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, '', $origlat, $origlon, $dist); |
|
153 | 153 | } elseif ($type == 'tracker') { |
154 | - $spotter_array = $Tracker->searchTrackerData($q,$callsign,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
154 | + $spotter_array = $Tracker->searchTrackerData($q, $callsign, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
155 | 155 | } elseif ($type == 'marine') { |
156 | - $spotter_array = $Marine->searchMarineData($q,$callsign,$mmsi,$imo,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
156 | + $spotter_array = $Marine->searchMarineData($q, $callsign, $mmsi, $imo, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | //remove 3D=true parameter |
190 | 190 | $no3D = str_replace("&3D=true", "", $_SERVER['QUERY_STRING']); |
191 | 191 | $kmlURL = str_replace("http://", "kml://", $globalURL); |
192 | - if (!isset($_GET['3D'])){ |
|
192 | + if (!isset($_GET['3D'])) { |
|
193 | 193 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'" class="active"><i class="fa fa-table"></i> '._("Table").'</a></li>'; |
194 | 194 | } else { |
195 | 195 | print '<li><span class="notablet"><a href="'.$globalURL.'/search?'.$no3D.'"><i class="fa fa-table"></i> '._("Table").'</a></span></li>'; |
196 | 196 | } |
197 | - if (isset($_GET['3D'])){ |
|
197 | + if (isset($_GET['3D'])) { |
|
198 | 198 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="active"><i class="fa fa-globe"></i> '._("3D Map").'</a></li>'; |
199 | 199 | } else { |
200 | 200 | print '<li ><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="notablet nomobile"><i class="fa fa-globe"></i> '._("3D Map").'</a><a href="'.$kmlURL.'/search/kml?'.htmlentities($_SERVER['QUERY_STRING']).'" class="tablet mobile"><i class="fa fa-globe"></i> 3D Map</a></li>'; |
@@ -215,32 +215,32 @@ discard block |
||
215 | 215 | print '<div class="column">'; |
216 | 216 | print '<div class="info">'; |
217 | 217 | print '<h1>'._("Search Results for").' '; |
218 | - if (isset($_GET['q']) && $_GET['q'] != ""){ print _("Keyword:").' <span>'.$q.'</span> '; } |
|
219 | - if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
|
220 | - if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
|
221 | - if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; } |
|
222 | - if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
223 | - if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; } |
|
224 | - if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
|
225 | - if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
|
226 | - if (isset($_GET['airport']) && $_GET['airport'] != ""){ print _("Airport:").' <span>'.$airport.'</span> '; } |
|
227 | - if (isset($_GET['airport_country']) && $_GET['airport_country'] != ""){ print _("Airport country:").' <span>'.$airport_country.'</span> '; } |
|
228 | - if (isset($_GET['callsign']) && $_GET['callsign'] != ""){ print _("Callsign:").' <span>'.$callsign.'</span> '; } |
|
229 | - if (isset($_GET['owner']) && $_GET['owner'] != ""){ print _("Owner:").' <span>'.$owner.'</span> '; } |
|
230 | - if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != ""){ print _("Pilot id:").' <span>'.$pilot_id.'</span> '; } |
|
231 | - if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != ""){ print _("Pilot name:").' <span>'.$pilot_name.'</span> '; } |
|
232 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")){ print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; } |
|
233 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; } |
|
234 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
235 | - if (isset($_GET['mmsi']) && $_GET['mmsi'] != ""){ print _("MMSI:").' <span>'.$mmsi.'</span> '; } |
|
236 | - if (isset($_GET['imo']) && $_GET['imo'] != ""){ print _("IMO:").' <span>'.$imo.'</span> '; } |
|
237 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == ""){ print _("Date starting at:").' <span>'.$start_date.'</span> '; } |
|
238 | - if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date ending at:").' <span>'.$end_date.'</span> '; } |
|
239 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; } |
|
240 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == ""){ print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; } |
|
241 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
242 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
243 | - if (isset($_GET['number_results']) && $_GET['number_results'] != ""){ print _("limit per page:").' <span>'.$number_results.'</span> '; } |
|
218 | + if (isset($_GET['q']) && $_GET['q'] != "") { print _("Keyword:").' <span>'.$q.'</span> '; } |
|
219 | + if (isset($_GET['aircraft']) && $_GET['aircraft'] != "") { print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
|
220 | + if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != "") { print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
|
221 | + if (isset($_GET['registration']) && $_GET['registration'] != "") { print _("Registration:").' <span>'.$registration.'</span> '; } |
|
222 | + if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
223 | + if (isset($_GET['airline']) && $_GET['airline'] != "") { print _("Airline:").' <span>'.$airline.'</span> '; } |
|
224 | + if (isset($_GET['airline_country']) && $_GET['airline_country'] != "") { print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
|
225 | + if (isset($_GET['airline_type']) && $_GET['airline_type'] != "") { print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
|
226 | + if (isset($_GET['airport']) && $_GET['airport'] != "") { print _("Airport:").' <span>'.$airport.'</span> '; } |
|
227 | + if (isset($_GET['airport_country']) && $_GET['airport_country'] != "") { print _("Airport country:").' <span>'.$airport_country.'</span> '; } |
|
228 | + if (isset($_GET['callsign']) && $_GET['callsign'] != "") { print _("Callsign:").' <span>'.$callsign.'</span> '; } |
|
229 | + if (isset($_GET['owner']) && $_GET['owner'] != "") { print _("Owner:").' <span>'.$owner.'</span> '; } |
|
230 | + if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != "") { print _("Pilot id:").' <span>'.$pilot_id.'</span> '; } |
|
231 | + if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != "") { print _("Pilot name:").' <span>'.$pilot_name.'</span> '; } |
|
232 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")) { print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; } |
|
233 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; } |
|
234 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
235 | + if (isset($_GET['mmsi']) && $_GET['mmsi'] != "") { print _("MMSI:").' <span>'.$mmsi.'</span> '; } |
|
236 | + if (isset($_GET['imo']) && $_GET['imo'] != "") { print _("IMO:").' <span>'.$imo.'</span> '; } |
|
237 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == "") { print _("Date starting at:").' <span>'.$start_date.'</span> '; } |
|
238 | + if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date ending at:").' <span>'.$end_date.'</span> '; } |
|
239 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; } |
|
240 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == "") { print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; } |
|
241 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
242 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
243 | + if (isset($_GET['number_results']) && $_GET['number_results'] != "") { print _("limit per page:").' <span>'.$number_results.'</span> '; } |
|
244 | 244 | print '</h1>'; |
245 | 245 | print '</div>'; |
246 | 246 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | </select> |
375 | 375 | </div> |
376 | 376 | </div> |
377 | - <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
377 | + <script type="text/javascript">getSelect('manufacturer','<?php if (isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
378 | 378 | <div class="form-group"> |
379 | 379 | <label class="control-label col-sm-2"><?php echo _("Type"); ?></label> |
380 | 380 | <div class="col-sm-10"> |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | </select> |
384 | 384 | </div> |
385 | 385 | </div> |
386 | - <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
386 | + <script type="text/javascript">getSelect('aircrafttypes','<?php if (isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
387 | 387 | <div class="form-group"> |
388 | 388 | <label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> |
389 | 389 | <div class="col-sm-10"> |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | </div> |
407 | 407 | </div> |
408 | 408 | <?php |
409 | - }else { |
|
409 | + } else { |
|
410 | 410 | ?> |
411 | 411 | <div class="form-group"> |
412 | 412 | <label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | ?> |
420 | 420 | <div class="form-group"> |
421 | 421 | <div class="col-sm-offset-2 col-sm-10"> |
422 | - <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
423 | - <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
422 | + <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
423 | + <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
424 | 424 | </div> |
425 | 425 | </div> |
426 | 426 | </fieldset> |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | </select> |
435 | 435 | </div> |
436 | 436 | </div> |
437 | - <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script> |
|
437 | + <script type="text/javascript">getSelect('airlinenames','<?php if (isset($_GET['airline'])) print $airline; ?>');</script> |
|
438 | 438 | <div class="form-group"> |
439 | 439 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
440 | 440 | <div class="col-sm-10"> |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | </select> |
444 | 444 | </div> |
445 | 445 | </div> |
446 | - <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
446 | + <script type="text/javascript">getSelect('airlinecountries','<?php if (isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
447 | 447 | <div class="form-group"> |
448 | 448 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
449 | 449 | <div class="col-sm-10"> |
@@ -452,10 +452,10 @@ discard block |
||
452 | 452 | </div> |
453 | 453 | <div class="form-group"> |
454 | 454 | <div class="col-sm-offset-2 col-sm-10"> |
455 | - <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
|
456 | - <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
457 | - <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
458 | - <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
455 | + <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all") { print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
|
456 | + <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger") { print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
457 | + <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "cargo") { print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
458 | + <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "military") { print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
459 | 459 | </div> |
460 | 460 | </div> |
461 | 461 | </fieldset> |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | </select> |
470 | 470 | </div> |
471 | 471 | </div> |
472 | - <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
472 | + <script type="text/javascript">getSelect('airportnames','<?php if (isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
473 | 473 | <div class="form-group"> |
474 | 474 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
475 | 475 | <div class="col-sm-10"> |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | </select> |
479 | 479 | </div> |
480 | 480 | </div> |
481 | - <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
481 | + <script type="text/javascript">getSelect('airportcountries','<?php if (isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
482 | 482 | </fieldset> |
483 | 483 | <fieldset> |
484 | 484 | <legend><?php echo _("Route"); ?></legend> |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | </select> |
491 | 491 | </div> |
492 | 492 | </div> |
493 | - <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
493 | + <script type="text/javascript">getSelect('departureairportnames','<?php if (isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
494 | 494 | <div class="form-group"> |
495 | 495 | <label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> |
496 | 496 | <div class="col-sm-10"> |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | </select> |
500 | 500 | </div> |
501 | 501 | </div> |
502 | - <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
502 | + <script type="text/javascript">getSelect('arrivalairportnames','<?php if (isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
503 | 503 | </fieldset> |
504 | 504 | <fieldset> |
505 | 505 | <legend>Altitude</legend> |
@@ -510,9 +510,9 @@ discard block |
||
510 | 510 | <option></option> |
511 | 511 | <?php |
512 | 512 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
513 | -foreach($altitude_array as $altitude) |
|
513 | +foreach ($altitude_array as $altitude) |
|
514 | 514 | { |
515 | - if(isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
515 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
516 | 516 | { |
517 | 517 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
518 | 518 | } else { |
@@ -530,9 +530,9 @@ discard block |
||
530 | 530 | <option></option> |
531 | 531 | <?php |
532 | 532 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
533 | - foreach($altitude_array as $altitude) |
|
533 | + foreach ($altitude_array as $altitude) |
|
534 | 534 | { |
535 | - if(isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
535 | + if (isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
536 | 536 | { |
537 | 537 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
538 | 538 | } else { |
@@ -655,10 +655,10 @@ discard block |
||
655 | 655 | <div class="col-sm-10"> |
656 | 656 | <select class="form-control" name="number_results"> |
657 | 657 | <?php |
658 | -$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
659 | -foreach($number_results_array as $number) |
|
658 | +$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
659 | +foreach ($number_results_array as $number) |
|
660 | 660 | { |
661 | - if(isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
661 | + if (isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
662 | 662 | { |
663 | 663 | print '<option value="'.$number.'" selected="selected">'.$number.'</option>'; |
664 | 664 | } else { |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | <fieldset> |
678 | 678 | <div class="form-group"> |
679 | 679 | <div class="col-sm-offset-2 col-sm-10"> |
680 | - <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" disabled /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label> |
|
680 | + <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" disabled /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label> |
|
681 | 681 | <p class="help-block">Disabled in demo</p> |
682 | 682 | </div> |
683 | 683 | </div> |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | <fieldset> |
689 | 689 | <div class="form-group"> |
690 | 690 | <div class="col-sm-offset-2 col-sm-10"> |
691 | - <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label> |
|
691 | + <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label> |
|
692 | 692 | </div> |
693 | 693 | </div> |
694 | 694 | </fieldset> |
@@ -46,8 +46,10 @@ discard block |
||
46 | 46 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
47 | 47 | $sql_date = $end_date; |
48 | 48 | } |
49 | - } else $sql_date = ''; |
|
50 | -} |
|
49 | + } else { |
|
50 | + $sql_date = ''; |
|
51 | + } |
|
52 | + } |
|
51 | 53 | |
52 | 54 | if (isset($_GET['highest_altitude'])) { |
53 | 55 | //for altitude manipulation |
@@ -61,8 +63,12 @@ discard block |
||
61 | 63 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
62 | 64 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
63 | 65 | $sql_altitude = $start_altitude; |
64 | - } else $sql_altitude = ''; |
|
65 | -} else $sql_altitude = ''; |
|
66 | + } else { |
|
67 | + $sql_altitude = ''; |
|
68 | + } |
|
69 | + } else { |
|
70 | + $sql_altitude = ''; |
|
71 | +} |
|
66 | 72 | |
67 | 73 | //calculuation for the pagination |
68 | 74 | if(!isset($_GET['limit'])) |
@@ -80,7 +86,7 @@ discard block |
||
80 | 86 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
81 | 87 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
82 | 88 | } |
83 | -} else { |
|
89 | +} else { |
|
84 | 90 | $limit_explode = explode(",", $_GET['limit']); |
85 | 91 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
86 | 92 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -138,10 +144,15 @@ discard block |
||
138 | 144 | $dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT); |
139 | 145 | $number_results = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
140 | 146 | if ($dist != '') { |
141 | - if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934; |
|
142 | - elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852; |
|
147 | + if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') { |
|
148 | + $dist = $dist*1.60934; |
|
149 | + } elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') { |
|
150 | + $dist = $dist*1.852; |
|
151 | + } |
|
152 | + } |
|
153 | + if (!isset($sql_date)) { |
|
154 | + $sql_date = ''; |
|
143 | 155 | } |
144 | - if (!isset($sql_date)) $sql_date = ''; |
|
145 | 156 | if ($archive == 1) { |
146 | 157 | if ($type == 'aircraft') { |
147 | 158 | $SpotterArchive = new SpotterArchive(); |
@@ -219,7 +230,10 @@ discard block |
||
219 | 230 | if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
220 | 231 | if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
221 | 232 | if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; } |
222 | - if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
233 | + if (isset($_GET['highlights'])) { |
|
234 | + if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; |
|
235 | + } |
|
236 | + } |
|
223 | 237 | if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; } |
224 | 238 | if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
225 | 239 | if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
@@ -355,7 +369,10 @@ discard block |
||
355 | 369 | <div class="form-group"> |
356 | 370 | <label class="control-label col-sm-2"><?php echo _("Keywords"); ?></label> |
357 | 371 | <div class="col-sm-10"> |
358 | - <input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) print $q; ?>" size="10" placeholder="<?php echo _("Keywords"); ?>" /> |
|
372 | + <input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) { |
|
373 | + print $q; |
|
374 | +} |
|
375 | +?>" size="10" placeholder="<?php echo _("Keywords"); ?>" /> |
|
359 | 376 | </div> |
360 | 377 | </div> |
361 | 378 | </fieldset> |
@@ -374,7 +391,10 @@ discard block |
||
374 | 391 | </select> |
375 | 392 | </div> |
376 | 393 | </div> |
377 | - <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
394 | + <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) { |
|
395 | + print $manufacturer; |
|
396 | +} |
|
397 | +?>')</script> |
|
378 | 398 | <div class="form-group"> |
379 | 399 | <label class="control-label col-sm-2"><?php echo _("Type"); ?></label> |
380 | 400 | <div class="col-sm-10"> |
@@ -383,11 +403,17 @@ discard block |
||
383 | 403 | </select> |
384 | 404 | </div> |
385 | 405 | </div> |
386 | - <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
406 | + <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) { |
|
407 | + print $aircraft_icao; |
|
408 | +} |
|
409 | +?>');</script> |
|
387 | 410 | <div class="form-group"> |
388 | 411 | <label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> |
389 | 412 | <div class="col-sm-10"> |
390 | - <input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) print $registration; ?>" size="8" placeholder="<?php echo _("Registration"); ?>" /> |
|
413 | + <input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) { |
|
414 | + print $registration; |
|
415 | +} |
|
416 | +?>" size="8" placeholder="<?php echo _("Registration"); ?>" /> |
|
391 | 417 | </div> |
392 | 418 | </div> |
393 | 419 | <?php |
@@ -396,22 +422,31 @@ discard block |
||
396 | 422 | <div class="form-group"> |
397 | 423 | <label class="control-label col-sm-2"><?php echo _("Pilot id"); ?></label> |
398 | 424 | <div class="col-sm-10"> |
399 | - <input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) print $pilot_id; ?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" /> |
|
425 | + <input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) { |
|
426 | + print $pilot_id; |
|
427 | +} |
|
428 | +?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" /> |
|
400 | 429 | </div> |
401 | 430 | </div> |
402 | 431 | <div class="form-group"> |
403 | 432 | <label class="control-label col-sm-2"><?php echo _("Pilot name"); ?></label> |
404 | 433 | <div class="col-sm-10"> |
405 | - <input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) print $pilot_name; ?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" /> |
|
434 | + <input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) { |
|
435 | + print $pilot_name; |
|
436 | +} |
|
437 | +?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" /> |
|
406 | 438 | </div> |
407 | 439 | </div> |
408 | 440 | <?php |
409 | - }else { |
|
441 | + } else { |
|
410 | 442 | ?> |
411 | 443 | <div class="form-group"> |
412 | 444 | <label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> |
413 | 445 | <div class="col-sm-10"> |
414 | - <input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) print $owner; ?>" size="15" placeholder="<?php echo _("Owner name"); ?>" /> |
|
446 | + <input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) { |
|
447 | + print $owner; |
|
448 | +} |
|
449 | +?>" size="15" placeholder="<?php echo _("Owner name"); ?>" /> |
|
415 | 450 | </div> |
416 | 451 | </div> |
417 | 452 | <?php |
@@ -419,8 +454,14 @@ discard block |
||
419 | 454 | ?> |
420 | 455 | <div class="form-group"> |
421 | 456 | <div class="col-sm-offset-2 col-sm-10"> |
422 | - <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
423 | - <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
457 | + <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) { |
|
458 | + if ($_GET['highlights'] == "true"){ print 'checked="checked"'; |
|
459 | +} |
|
460 | +} ?>> <label for="highlights"><?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
461 | + <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) { |
|
462 | + if ($_GET['highlights'] == "true"){ print 'checked="checked"'; |
|
463 | +} |
|
464 | +} ?>> <?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
424 | 465 | </div> |
425 | 466 | </div> |
426 | 467 | </fieldset> |
@@ -434,7 +475,10 @@ discard block |
||
434 | 475 | </select> |
435 | 476 | </div> |
436 | 477 | </div> |
437 | - <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script> |
|
478 | + <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) { |
|
479 | + print $airline; |
|
480 | +} |
|
481 | +?>');</script> |
|
438 | 482 | <div class="form-group"> |
439 | 483 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
440 | 484 | <div class="col-sm-10"> |
@@ -443,19 +487,34 @@ discard block |
||
443 | 487 | </select> |
444 | 488 | </div> |
445 | 489 | </div> |
446 | - <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
490 | + <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) { |
|
491 | + print $airline_country; |
|
492 | +} |
|
493 | +?>');</script> |
|
447 | 494 | <div class="form-group"> |
448 | 495 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
449 | 496 | <div class="col-sm-10"> |
450 | - <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
497 | + <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) { |
|
498 | + print $callsign; |
|
499 | +} |
|
500 | +?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
451 | 501 | </div> |
452 | 502 | </div> |
453 | 503 | <div class="form-group"> |
454 | 504 | <div class="col-sm-offset-2 col-sm-10"> |
455 | 505 | <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
456 | - <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
457 | - <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
458 | - <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
506 | + <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) { |
|
507 | + if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; |
|
508 | +} |
|
509 | +} ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
510 | + <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) { |
|
511 | + if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; |
|
512 | +} |
|
513 | +} ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
514 | + <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) { |
|
515 | + if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; |
|
516 | +} |
|
517 | +} ?>> <?php echo _("Only Military airlines"); ?></label> |
|
459 | 518 | </div> |
460 | 519 | </div> |
461 | 520 | </fieldset> |
@@ -469,7 +528,10 @@ discard block |
||
469 | 528 | </select> |
470 | 529 | </div> |
471 | 530 | </div> |
472 | - <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
531 | + <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) { |
|
532 | + print $airport_icao; |
|
533 | +} |
|
534 | +?>');</script> |
|
473 | 535 | <div class="form-group"> |
474 | 536 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
475 | 537 | <div class="col-sm-10"> |
@@ -478,7 +540,10 @@ discard block |
||
478 | 540 | </select> |
479 | 541 | </div> |
480 | 542 | </div> |
481 | - <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
543 | + <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) { |
|
544 | + print $airport_country; |
|
545 | +} |
|
546 | +?>');</script> |
|
482 | 547 | </fieldset> |
483 | 548 | <fieldset> |
484 | 549 | <legend><?php echo _("Route"); ?></legend> |
@@ -490,7 +555,10 @@ discard block |
||
490 | 555 | </select> |
491 | 556 | </div> |
492 | 557 | </div> |
493 | - <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
558 | + <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) { |
|
559 | + print $departure_airport_route; |
|
560 | +} |
|
561 | +?>');</script> |
|
494 | 562 | <div class="form-group"> |
495 | 563 | <label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> |
496 | 564 | <div class="col-sm-10"> |
@@ -499,7 +567,10 @@ discard block |
||
499 | 567 | </select> |
500 | 568 | </div> |
501 | 569 | </div> |
502 | - <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
570 | + <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) { |
|
571 | + print $arrival_airport_route; |
|
572 | +} |
|
573 | +?>');</script> |
|
503 | 574 | </fieldset> |
504 | 575 | <fieldset> |
505 | 576 | <legend>Altitude</legend> |
@@ -549,19 +620,33 @@ discard block |
||
549 | 620 | <div class="form-group"> |
550 | 621 | <label class="control-label col-sm-2"><?php echo _("Latitude"); ?></label> |
551 | 622 | <div class="col-sm-10"> |
552 | - <input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) print $origlat; ?>" /> |
|
623 | + <input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) { |
|
624 | + print $origlat; |
|
625 | +} |
|
626 | +?>" /> |
|
553 | 627 | </div> |
554 | 628 | </div> |
555 | 629 | <div class="form-group"> |
556 | 630 | <label class="control-label col-sm-2"><?php echo _("Longitude"); ?></label> |
557 | 631 | <div class="col-sm-10"> |
558 | - <input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) print $origlon; ?>" /> |
|
632 | + <input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) { |
|
633 | + print $origlon; |
|
634 | +} |
|
635 | +?>" /> |
|
559 | 636 | </div> |
560 | 637 | </div> |
561 | 638 | <div class="form-group"> |
562 | - <label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) print $globalDistanceUnit; else print 'km'; print ')'; ?></label> |
|
639 | + <label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) { |
|
640 | + print $globalDistanceUnit; |
|
641 | +} else { |
|
642 | + print 'km'; |
|
643 | +} |
|
644 | +print ')'; ?></label> |
|
563 | 645 | <div class="col-sm-10"> |
564 | - <input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) print $distance; ?>" /> |
|
646 | + <input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) { |
|
647 | + print $distance; |
|
648 | +} |
|
649 | +?>" /> |
|
565 | 650 | </div> |
566 | 651 | </div> |
567 | 652 | </fieldset> |
@@ -572,7 +657,10 @@ discard block |
||
572 | 657 | <div class="form-group"> |
573 | 658 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
574 | 659 | <div class="col-sm-10"> |
575 | - <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
660 | + <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) { |
|
661 | + print $callsign; |
|
662 | +} |
|
663 | +?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
576 | 664 | </div> |
577 | 665 | </div> |
578 | 666 | </fieldset> |
@@ -583,7 +671,10 @@ discard block |
||
583 | 671 | <div class="form-group"> |
584 | 672 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
585 | 673 | <div class="col-sm-10"> |
586 | - <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
674 | + <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) { |
|
675 | + print $callsign; |
|
676 | +} |
|
677 | +?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
587 | 678 | </div> |
588 | 679 | </div> |
589 | 680 | </fieldset> |
@@ -591,7 +682,10 @@ discard block |
||
591 | 682 | <div class="form-group"> |
592 | 683 | <label class="control-label col-sm-2"><?php echo _("MMSI"); ?></label> |
593 | 684 | <div class="col-sm-10"> |
594 | - <input type="text" name="mmsi" class="form-control" value="<?php if (isset($_GET['mmsi'])) print $mmsi; ?>" size="8" placeholder="<?php echo _("MMSI"); ?>" /> |
|
685 | + <input type="text" name="mmsi" class="form-control" value="<?php if (isset($_GET['mmsi'])) { |
|
686 | + print $mmsi; |
|
687 | +} |
|
688 | +?>" size="8" placeholder="<?php echo _("MMSI"); ?>" /> |
|
595 | 689 | </div> |
596 | 690 | </div> |
597 | 691 | </fieldset> |
@@ -599,7 +693,10 @@ discard block |
||
599 | 693 | <div class="form-group"> |
600 | 694 | <label class="control-label col-sm-2"><?php echo _("IMO"); ?></label> |
601 | 695 | <div class="col-sm-10"> |
602 | - <input type="text" name="imo" class="form-control" value="<?php if (isset($_GET['imo'])) print $imo; ?>" size="8" placeholder="<?php echo _("IMO"); ?>" /> |
|
696 | + <input type="text" name="imo" class="form-control" value="<?php if (isset($_GET['imo'])) { |
|
697 | + print $imo; |
|
698 | +} |
|
699 | +?>" size="8" placeholder="<?php echo _("IMO"); ?>" /> |
|
603 | 700 | </div> |
604 | 701 | </div> |
605 | 702 | </fieldset> |
@@ -612,7 +709,10 @@ discard block |
||
612 | 709 | <label class="control-label col-sm-2"><?php echo _("Start Date"); ?></label> |
613 | 710 | <div class="col-sm-10"> |
614 | 711 | <div class='input-group date' id='datetimepicker1'> |
615 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date']) && $_GET['start_date'] != '') print $start_date; ?>" placeholder="<?php echo _("Start Date/Time"); ?>" /> |
|
712 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date']) && $_GET['start_date'] != '') { |
|
713 | + print $start_date; |
|
714 | +} |
|
715 | +?>" placeholder="<?php echo _("Start Date/Time"); ?>" /> |
|
616 | 716 | <span class="input-group-addon"> |
617 | 717 | <span class="glyphicon glyphicon-calendar"></span> |
618 | 718 | </span> |
@@ -623,7 +723,10 @@ discard block |
||
623 | 723 | <label class="control-label col-sm-2"><?php echo _("End Date"); ?></label> |
624 | 724 | <div class="col-sm-10"> |
625 | 725 | <div class='input-group date' id='datetimepicker2'> |
626 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date']) && $_GET['end_date'] != '') print $end_date; ?>" placeholder="<?php echo _("End Date/Time"); ?>" /> |
|
726 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date']) && $_GET['end_date'] != '') { |
|
727 | + print $end_date; |
|
728 | +} |
|
729 | +?>" placeholder="<?php echo _("End Date/Time"); ?>" /> |
|
627 | 730 | <span class="input-group-addon"> |
628 | 731 | <span class="glyphicon glyphicon-calendar"></span> |
629 | 732 | </span> |
@@ -22,7 +22,9 @@ |
||
22 | 22 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
23 | 23 | $Stats = new Stats(); |
24 | 24 | $all_manufacturers = $Stats->getAllManufacturers(); |
25 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
25 | + if (empty($all_manufacturers)) { |
|
26 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
27 | + } |
|
26 | 28 | foreach($all_manufacturers as $all_manufacturer) |
27 | 29 | { |
28 | 30 | if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer'])) |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | die(); |
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | -$manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)))); |
|
12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
13 | -$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort); |
|
11 | +$manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING)))); |
|
12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
13 | +$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort); |
|
14 | 14 | |
15 | 15 | if (!empty($spotter_array)) |
16 | 16 | { |
17 | - $title = sprintf(_("Most Common Airlines by Country from %s"),$manufacturer); |
|
17 | + $title = sprintf(_("Most Common Airlines by Country from %s"), $manufacturer); |
|
18 | 18 | |
19 | 19 | require_once('header.php'); |
20 | 20 | print '<div class="select-item">'; |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | $Stats = new Stats(); |
24 | 24 | $all_manufacturers = $Stats->getAllManufacturers(); |
25 | 25 | if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
26 | - foreach($all_manufacturers as $all_manufacturer) |
|
26 | + foreach ($all_manufacturers as $all_manufacturer) |
|
27 | 27 | { |
28 | - if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer'])) |
|
28 | + if ($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer'])) |
|
29 | 29 | { |
30 | 30 | print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>'; |
31 | 31 | } else { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | include('manufacturer-sub-menu.php'); |
45 | 45 | print '<div class="column">'; |
46 | 46 | print '<h2>'._("Most Common Airlines by Country").'</h2>'; |
47 | - print '<p>'.sprintf(_("The statistic below shows the most common airlines by Country of origin of flights from <strong>%s</strong>."),$manufacturer).'</p>'; |
|
47 | + print '<p>'.sprintf(_("The statistic below shows the most common airlines by Country of origin of flights from <strong>%s</strong>."), $manufacturer).'</p>'; |
|
48 | 48 | $airline_array = $Spotter->countAllAirlineCountriesByManufacturer($manufacturer); |
49 | 49 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
50 | 50 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
53 | 53 | print 'var series = ['; |
54 | 54 | $country_data = ''; |
55 | - foreach($airline_array as $airline_item) |
|
55 | + foreach ($airline_array as $airline_item) |
|
56 | 56 | { |
57 | 57 | $country_data .= '[ "'.$airline_item['airline_country_iso3'].'",'.$airline_item['airline_country_count'].'],'; |
58 | 58 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | print '</thead>'; |
100 | 100 | print '<tbody>'; |
101 | 101 | $i = 1; |
102 | - foreach($airline_array as $airline_item) |
|
102 | + foreach ($airline_array as $airline_item) |
|
103 | 103 | { |
104 | 104 | print '<tr>'; |
105 | 105 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -4,8 +4,8 @@ |
||
4 | 4 | require_once('require/class.Stats.php'); |
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | if (!isset($_GET['aircraft_manufacturer'])) { |
7 | - header('Location: '.$globalURL.'/manufacturer'); |
|
8 | - die(); |
|
7 | + header('Location: '.$globalURL.'/manufacturer'); |
|
8 | + die(); |
|
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | 11 | $manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)))); |
@@ -3,8 +3,8 @@ |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | if (!isset($_GET['country'])) { |
6 | - header('Location: '.$globalURL.'/country'); |
|
7 | - die(); |
|
6 | + header('Location: '.$globalURL.'/country'); |
|
7 | + die(); |
|
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | $country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING)))); |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING)))); |
|
11 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
10 | +$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING)))); |
|
11 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
12 | 12 | if (isset($_GET['sort'])) { |
13 | 13 | $spotter_array = $Spotter->getSpotterDataByCountry($country, "0,1", $sort); |
14 | 14 | } else { |
@@ -17,16 +17,16 @@ discard block |
||
17 | 17 | |
18 | 18 | if (!empty($spotter_array)) |
19 | 19 | { |
20 | - $title = sprintf(_("Most Common Aircraft by registration from %s"),$country); |
|
20 | + $title = sprintf(_("Most Common Aircraft by registration from %s"), $country); |
|
21 | 21 | require_once('header.php'); |
22 | 22 | print '<div class="select-item">'; |
23 | 23 | print '<form action="'.$globalURL.'/country" method="post">'; |
24 | 24 | print '<select name="country" class="selectpicker" data-live-search="true">'; |
25 | 25 | print '<option></option>'; |
26 | 26 | $all_countries = $Spotter->getAllCountries(); |
27 | - foreach($all_countries as $all_country) |
|
27 | + foreach ($all_countries as $all_country) |
|
28 | 28 | { |
29 | - if($country == $all_country['country']) |
|
29 | + if ($country == $all_country['country']) |
|
30 | 30 | { |
31 | 31 | print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>'; |
32 | 32 | } else { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | if ($_GET['country'] != "NA") |
42 | 42 | { |
43 | 43 | print '<div class="info column">'; |
44 | - print '<h1>'.sprintf(_("Airports & Airlines from %s"),$country).'</h1>'; |
|
44 | + print '<h1>'.sprintf(_("Airports & Airlines from %s"), $country).'</h1>'; |
|
45 | 45 | print '</div>'; |
46 | 46 | } else { |
47 | 47 | 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>'; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | include('country-sub-menu.php'); |
51 | 51 | print '<div class="column">'; |
52 | 52 | print '<h2>'._("Most Common Aircraft by Registration").'</h2>'; |
53 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of airlines or departure/arrival airports from <strong>%s</strong>."),$country).'</p>'; |
|
53 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of airlines or departure/arrival airports from <strong>%s</strong>."), $country).'</p>'; |
|
54 | 54 | $aircraft_array = $Spotter->countAllAircraftRegistrationByCountry($country); |
55 | 55 | if (!empty($aircraft_array)) |
56 | 56 | { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | print '</thead>'; |
66 | 66 | print '<tbody>'; |
67 | 67 | $i = 1; |
68 | - foreach($aircraft_array as $aircraft_item) |
|
68 | + foreach ($aircraft_array as $aircraft_item) |
|
69 | 69 | { |
70 | 70 | print '<tr>'; |
71 | 71 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | </span> |
16 | 16 | <div class="sub-menu sub-menu-container"> |
17 | 17 | <ul class="nav nav-pills"> |
18 | - <li><a href="<?php print $globalURL; ?>/registration/<?php print $_GET['registration']; ?>" <?php if (strtolower($current_page) == "registration-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
18 | + <li><a href="<?php print $globalURL; ?>/registration/<?php print $_GET['registration']; ?>" <?php if (strtolower($current_page) == "registration-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
19 | 19 | <li class="dropdown"> |
20 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "registration-statistics-departure-airport" || strtolower($current_page) == "registration-statistics-departure-airport-country" || strtolower($current_page) == "registration-statistics-arrival-airport" || strtolower($current_page) == "registration-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
20 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "registration-statistics-departure-airport" || strtolower($current_page) == "registration-statistics-departure-airport-country" || strtolower($current_page) == "registration-statistics-arrival-airport" || strtolower($current_page) == "registration-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
21 | 21 | <?php _("Airport"); ?> <span class="caret"></span> |
22 | 22 | </a> |
23 | 23 | <ul class="dropdown-menu" role="menu"> |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | <li><a href="<?php print $globalURL; ?>/registration/statistics/arrival-airport-country/<?php print $registration; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
28 | 28 | </ul> |
29 | 29 | </li> |
30 | - <li><a href="<?php print $globalURL; ?>/registration/statistics/route/<?php print $registration; ?>" <?php if (strtolower($current_page) == "registration-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
31 | - <li><a href="<?php print $globalURL; ?>/registration/statistics/time/<?php print $registration; ?>" <?php if (strtolower($current_page) == "registration-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
30 | + <li><a href="<?php print $globalURL; ?>/registration/statistics/route/<?php print $registration; ?>" <?php if (strtolower($current_page) == "registration-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
31 | + <li><a href="<?php print $globalURL; ?>/registration/statistics/time/<?php print $registration; ?>" <?php if (strtolower($current_page) == "registration-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
32 | 32 | </ul> |
33 | 33 | </div> |
34 | 34 | \ No newline at end of file |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING)))); |
|
11 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
10 | +$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING)))); |
|
11 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
12 | 12 | |
13 | 13 | if (isset($_GET['sort'])) { |
14 | 14 | $spotter_array = $Spotter->getSpotterDataByCountry($country, "0,1", $sort); |
@@ -18,16 +18,16 @@ discard block |
||
18 | 18 | |
19 | 19 | if (!empty($spotter_array)) |
20 | 20 | { |
21 | - $title = sprintf(_("Most Common Departure Airports from %s"),$country); |
|
21 | + $title = sprintf(_("Most Common Departure Airports from %s"), $country); |
|
22 | 22 | require_once('header.php'); |
23 | 23 | print '<div class="select-item">'; |
24 | 24 | print '<form action="'.$globalURL.'/country" method="post">'; |
25 | 25 | print '<select name="country" class="selectpicker" data-live-search="true">'; |
26 | 26 | print '<option></option>'; |
27 | 27 | $all_countries = $Spotter->getAllCountries(); |
28 | - foreach($all_countries as $all_country) |
|
28 | + foreach ($all_countries as $all_country) |
|
29 | 29 | { |
30 | - if($country == $all_country['country']) |
|
30 | + if ($country == $all_country['country']) |
|
31 | 31 | { |
32 | 32 | print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>'; |
33 | 33 | } else { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | if ($_GET['country'] != "NA") |
42 | 42 | { |
43 | 43 | print '<div class="info column">'; |
44 | - print '<h1>'.sprintf(_("Airports & Airlines from %s"),$country).'</h1>'; |
|
44 | + print '<h1>'.sprintf(_("Airports & Airlines from %s"), $country).'</h1>'; |
|
45 | 45 | print '</div>'; |
46 | 46 | } else { |
47 | 47 | 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>'; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | include('country-sub-menu.php'); |
51 | 51 | print '<div class="column">'; |
52 | 52 | print '<h2>'._("Most Common Departure Airports").'</h2>'; |
53 | - print '<p>'.sprintf(_("The statistic below shows all departure airports of flights of airports & airlines from <strong>%s</strong>."),$country).'</p>'; |
|
53 | + print '<p>'.sprintf(_("The statistic below shows all departure airports of flights of airports & airlines from <strong>%s</strong>."), $country).'</p>'; |
|
54 | 54 | |
55 | 55 | $airport_airport_array = $Spotter->countAllDepartureAirportsByCountry($country); |
56 | 56 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | print '<script>'; |
61 | 61 | print 'var series = ['; |
62 | 62 | $airport_data = ''; |
63 | - foreach($airport_airport_array as $airport_item) |
|
63 | + foreach ($airport_airport_array as $airport_item) |
|
64 | 64 | { |
65 | 65 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
66 | 66 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | print '</thead>'; |
115 | 115 | print '<tbody>'; |
116 | 116 | $i = 1; |
117 | - foreach($airport_airport_array as $airport_item) |
|
117 | + foreach ($airport_airport_array as $airport_item) |
|
118 | 118 | { |
119 | 119 | print '<tr>'; |
120 | 120 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -22,7 +22,9 @@ |
||
22 | 22 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
23 | 23 | $Stats = new Stats(); |
24 | 24 | $all_manufacturers = $Stats->getAllManufacturers(); |
25 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
25 | + if (empty($all_manufacturers)) { |
|
26 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
27 | + } |
|
26 | 28 | foreach($all_manufacturers as $all_manufacturer) |
27 | 29 | { |
28 | 30 | if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer'])) |
@@ -4,8 +4,8 @@ |
||
4 | 4 | require_once('require/class.Stats.php'); |
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | if (!isset($_GET['aircraft_manufacturer'])) { |
7 | - header('Location: '.$globalURL.'/manufacturer'); |
|
8 | - die(); |
|
7 | + header('Location: '.$globalURL.'/manufacturer'); |
|
8 | + die(); |
|
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | 11 | $manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)))); |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | die(); |
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | -$manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)))); |
|
12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
13 | -$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort); |
|
11 | +$manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING)))); |
|
12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
13 | +$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort); |
|
14 | 14 | |
15 | 15 | if (!empty($spotter_array)) |
16 | 16 | { |
17 | - $title = sprintf(_("Most Common Aircraft from %s"),$manufacturer); |
|
17 | + $title = sprintf(_("Most Common Aircraft from %s"), $manufacturer); |
|
18 | 18 | |
19 | 19 | require_once('header.php'); |
20 | 20 | print '<div class="select-item">'; |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | $Stats = new Stats(); |
24 | 24 | $all_manufacturers = $Stats->getAllManufacturers(); |
25 | 25 | if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
26 | - foreach($all_manufacturers as $all_manufacturer) |
|
26 | + foreach ($all_manufacturers as $all_manufacturer) |
|
27 | 27 | { |
28 | - if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer'])) |
|
28 | + if ($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer'])) |
|
29 | 29 | { |
30 | 30 | print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>'; |
31 | 31 | } else { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | include('manufacturer-sub-menu.php'); |
45 | 45 | print '<div class="column">'; |
46 | 46 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
47 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights from <strong>%s</strong>."),$manufacturer).'</p>'; |
|
47 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights from <strong>%s</strong>."), $manufacturer).'</p>'; |
|
48 | 48 | |
49 | 49 | $aircraft_array = $Spotter->countAllAircraftTypesByManufacturer($manufacturer); |
50 | 50 | if (!empty($aircraft_array)) |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | print '</thead>'; |
60 | 60 | print '<tbody>'; |
61 | 61 | $i = 1; |
62 | - foreach($aircraft_array as $aircraft_item) |
|
62 | + foreach ($aircraft_array as $aircraft_item) |
|
63 | 63 | { |
64 | 64 | print '<tr>'; |
65 | 65 | print '<td><strong>'.$i.'</strong></td>'; |