@@ -19,8 +19,12 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
22 | - if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter); |
|
23 | - if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter); |
|
22 | + if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
|
23 | + $filter = array_merge($globalStatsFilters[$globalFilterName],$filter); |
|
24 | + } |
|
25 | + if (is_array($globalFilter)) { |
|
26 | + $filter = array_merge($globalFilter,$filter); |
|
27 | + } |
|
24 | 28 | $filter_query_join = ''; |
25 | 29 | $filter_query_where = ''; |
26 | 30 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
@@ -48,8 +52,11 @@ discard block |
||
48 | 52 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
49 | 53 | } |
50 | 54 | } |
51 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
52 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
55 | + if ($filter_query_where == '' && $where) { |
|
56 | + $filter_query_where = ' WHERE'; |
|
57 | + } elseif ($filter_query_where != '' && $and) { |
|
58 | + $filter_query_where .= ' AND'; |
|
59 | + } |
|
53 | 60 | $filter_query = $filter_query_join.$filter_query_where; |
54 | 61 | return $filter_query; |
55 | 62 | } |
@@ -69,10 +76,18 @@ discard block |
||
69 | 76 | $Image = new Image($this->db); |
70 | 77 | $Schedule = new Schedule($this->db); |
71 | 78 | $ACARS = new ACARS($this->db); |
72 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
73 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
74 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
75 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
79 | + if (!isset($globalIVAO)) { |
|
80 | + $globalIVAO = FALSE; |
|
81 | + } |
|
82 | + if (!isset($globalVATSIM)) { |
|
83 | + $globalVATSIM = FALSE; |
|
84 | + } |
|
85 | + if (!isset($globalphpVMS)) { |
|
86 | + $globalphpVMS = FALSE; |
|
87 | + } |
|
88 | + if (!isset($globalVAM)) { |
|
89 | + $globalVAM = FALSE; |
|
90 | + } |
|
76 | 91 | date_default_timezone_set('UTC'); |
77 | 92 | |
78 | 93 | if (!is_string($query)) |
@@ -119,21 +134,35 @@ discard block |
||
119 | 134 | } else { |
120 | 135 | $temp_array['spotter_id'] = ''; |
121 | 136 | } |
122 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
123 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
137 | + if (isset($row['flightaware_id'])) { |
|
138 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
139 | + } |
|
140 | + if (isset($row['modes'])) { |
|
141 | + $temp_array['modes'] = $row['modes']; |
|
142 | + } |
|
124 | 143 | $temp_array['ident'] = $row['ident']; |
125 | 144 | if (isset($row['registration']) && $row['registration'] != '') { |
126 | 145 | $temp_array['registration'] = $row['registration']; |
127 | 146 | } elseif (isset($temp_array['modes'])) { |
128 | 147 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
129 | - } else $temp_array['registration'] = ''; |
|
130 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
148 | + } else { |
|
149 | + $temp_array['registration'] = ''; |
|
150 | + } |
|
151 | + if (isset($row['aircraft_icao'])) { |
|
152 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
153 | + } |
|
131 | 154 | |
132 | 155 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
133 | 156 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
134 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
135 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
136 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
157 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
158 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
159 | + } |
|
160 | + if (isset($row['latitude'])) { |
|
161 | + $temp_array['latitude'] = $row['latitude']; |
|
162 | + } |
|
163 | + if (isset($row['longitude'])) { |
|
164 | + $temp_array['longitude'] = $row['longitude']; |
|
165 | + } |
|
137 | 166 | /* |
138 | 167 | if (Connection->tableExists('countries')) { |
139 | 168 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -143,8 +172,12 @@ discard block |
||
143 | 172 | } |
144 | 173 | } |
145 | 174 | */ |
146 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
147 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
175 | + if (isset($row['waypoints'])) { |
|
176 | + $temp_array['waypoints'] = $row['waypoints']; |
|
177 | + } |
|
178 | + if (isset($row['format_source'])) { |
|
179 | + $temp_array['format_source'] = $row['format_source']; |
|
180 | + } |
|
148 | 181 | if (isset($row['route_stop'])) { |
149 | 182 | $temp_array['route_stop'] = $row['route_stop']; |
150 | 183 | if ($row['route_stop'] != '') { |
@@ -163,13 +196,19 @@ discard block |
||
163 | 196 | } |
164 | 197 | } |
165 | 198 | } |
166 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
199 | + if (isset($row['altitude'])) { |
|
200 | + $temp_array['altitude'] = $row['altitude']; |
|
201 | + } |
|
167 | 202 | if (isset($row['heading'])) { |
168 | 203 | $temp_array['heading'] = $row['heading']; |
169 | 204 | $heading_direction = $this->parseDirection($row['heading']); |
170 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
205 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
206 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
207 | + } |
|
208 | + } |
|
209 | + if (isset($row['ground_speed'])) { |
|
210 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
171 | 211 | } |
172 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
173 | 212 | $temp_array['image'] = ""; |
174 | 213 | $temp_array['image_thumbnail'] = ""; |
175 | 214 | $temp_array['image_source'] = ""; |
@@ -177,7 +216,9 @@ discard block |
||
177 | 216 | |
178 | 217 | if (isset($row['highlight'])) { |
179 | 218 | $temp_array['highlight'] = $row['highlight']; |
180 | - } else $temp_array['highlight'] = ''; |
|
219 | + } else { |
|
220 | + $temp_array['highlight'] = ''; |
|
221 | + } |
|
181 | 222 | |
182 | 223 | if (isset($row['date'])) { |
183 | 224 | $dateArray = $this->parseDateString($row['date']); |
@@ -225,7 +266,9 @@ discard block |
||
225 | 266 | |
226 | 267 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
227 | 268 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
228 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
269 | + } else { |
|
270 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
271 | + } |
|
229 | 272 | } else { |
230 | 273 | $temp_array['aircraft_shadow'] = 'default.png'; |
231 | 274 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -233,11 +276,17 @@ discard block |
||
233 | 276 | } |
234 | 277 | } |
235 | 278 | $fromsource = NULL; |
236 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
237 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
238 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
239 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
240 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
279 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
280 | + $fromsource = $globalAirlinesSource; |
|
281 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
282 | + $fromsource = 'vatsim'; |
|
283 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
284 | + $fromsource = 'ivao'; |
|
285 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
286 | + $fromsource = 'vatsim'; |
|
287 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
288 | + $fromsource = 'ivao'; |
|
289 | + } |
|
241 | 290 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
242 | 291 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
243 | 292 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -260,12 +309,18 @@ discard block |
||
260 | 309 | } |
261 | 310 | } else { |
262 | 311 | $temp_array['airline_icao'] = $row['airline_icao']; |
263 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
264 | - else $temp_array['airline_iata'] = ''; |
|
312 | + if (isset($row['airline_iata'])) { |
|
313 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
314 | + } else { |
|
315 | + $temp_array['airline_iata'] = ''; |
|
316 | + } |
|
265 | 317 | $temp_array['airline_name'] = $row['airline_name']; |
266 | 318 | $temp_array['airline_country'] = $row['airline_country']; |
267 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
268 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
319 | + if (isset($row['airline_callsign'])) { |
|
320 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
321 | + } else { |
|
322 | + $temp_array['airline_callsign'] = 'N/A'; |
|
323 | + } |
|
269 | 324 | $temp_array['airline_type'] = $row['airline_type']; |
270 | 325 | } |
271 | 326 | if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') { |
@@ -281,7 +336,9 @@ discard block |
||
281 | 336 | } |
282 | 337 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
283 | 338 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
284 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
339 | + if ($owner_info['owner'] != '') { |
|
340 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
341 | + } |
|
285 | 342 | $temp_array['aircraft_base'] = $owner_info['base']; |
286 | 343 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
287 | 344 | } |
@@ -289,9 +346,14 @@ discard block |
||
289 | 346 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
290 | 347 | { |
291 | 348 | if ($globalIVAO) { |
292 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
293 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
294 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
349 | + if (isset($temp_array['airline_icao'])) { |
|
350 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
351 | + } else { |
|
352 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
353 | + } |
|
354 | + } else { |
|
355 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
356 | + } |
|
295 | 357 | if (count($image_array) > 0) { |
296 | 358 | $temp_array['image'] = $image_array[0]['image']; |
297 | 359 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -341,7 +403,9 @@ discard block |
||
341 | 403 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
342 | 404 | if ($row['departure_airport_icao'] != '') { |
343 | 405 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
344 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
406 | + if (!isset($departure_airport_array[0]['name'])) { |
|
407 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
408 | + } |
|
345 | 409 | /* |
346 | 410 | } elseif ($row['departure_airport_name'] != '') { |
347 | 411 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -349,7 +413,9 @@ discard block |
||
349 | 413 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
350 | 414 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
351 | 415 | */ |
352 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
416 | + } else { |
|
417 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
418 | + } |
|
353 | 419 | if (isset($departure_airport_array[0]['name'])) { |
354 | 420 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
355 | 421 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -369,8 +435,12 @@ discard block |
||
369 | 435 | |
370 | 436 | if ($row['arrival_airport_icao'] != '') { |
371 | 437 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
372 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
373 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
438 | + if (count($arrival_airport_array) == 0) { |
|
439 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
440 | + } |
|
441 | + } else { |
|
442 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
443 | + } |
|
374 | 444 | if (isset($arrival_airport_array[0]['name'])) { |
375 | 445 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
376 | 446 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -386,27 +456,45 @@ discard block |
||
386 | 456 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
387 | 457 | } |
388 | 458 | */ |
389 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
390 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
391 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
392 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
393 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
459 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
460 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
461 | + } |
|
462 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
463 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
464 | + } |
|
465 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
466 | + $temp_array['source_name'] = $row['source_name']; |
|
467 | + } |
|
468 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
469 | + $temp_array['over_country'] = $row['over_country']; |
|
470 | + } |
|
471 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
472 | + $temp_array['distance'] = $row['distance']; |
|
473 | + } |
|
394 | 474 | if (isset($row['squawk'])) { |
395 | 475 | $temp_array['squawk'] = $row['squawk']; |
396 | 476 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
397 | 477 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
398 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
478 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
479 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
480 | + } |
|
399 | 481 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
400 | 482 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
401 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
402 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
483 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
484 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
485 | + } |
|
486 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
487 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
488 | + } |
|
403 | 489 | } |
404 | 490 | |
405 | 491 | $temp_array['query_number_rows'] = $num_rows; |
406 | 492 | |
407 | 493 | $spotter_array[] = $temp_array; |
408 | 494 | } |
409 | - if ($num_rows == 0) return array(); |
|
495 | + if ($num_rows == 0) { |
|
496 | + return array(); |
|
497 | + } |
|
410 | 498 | $spotter_array[0]['query_number_rows'] = $num_rows; |
411 | 499 | return $spotter_array; |
412 | 500 | } |
@@ -439,7 +527,9 @@ discard block |
||
439 | 527 | foreach ($q_array as $q_item){ |
440 | 528 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
441 | 529 | $additional_query .= " AND ("; |
442 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
530 | + if (is_int($q_item)) { |
|
531 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
532 | + } |
|
443 | 533 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
444 | 534 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
445 | 535 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -460,7 +550,9 @@ discard block |
||
460 | 550 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
461 | 551 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
462 | 552 | $translate = $Translation->ident2icao($q_item); |
463 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
553 | + if ($translate != $q_item) { |
|
554 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
555 | + } |
|
464 | 556 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
465 | 557 | $additional_query .= ")"; |
466 | 558 | } |
@@ -687,7 +779,9 @@ discard block |
||
687 | 779 | date_default_timezone_set($globalTimezone); |
688 | 780 | $datetime = new DateTime(); |
689 | 781 | $offset = $datetime->format('P'); |
690 | - } else $offset = '+00:00'; |
|
782 | + } else { |
|
783 | + $offset = '+00:00'; |
|
784 | + } |
|
691 | 785 | |
692 | 786 | if ($date_array[1] != "") |
693 | 787 | { |
@@ -719,8 +813,12 @@ discard block |
||
719 | 813 | { |
720 | 814 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
721 | 815 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
722 | - } else $limit_query = ""; |
|
723 | - } else $limit_query = ""; |
|
816 | + } else { |
|
817 | + $limit_query = ""; |
|
818 | + } |
|
819 | + } else { |
|
820 | + $limit_query = ""; |
|
821 | + } |
|
724 | 822 | |
725 | 823 | |
726 | 824 | if ($sort != "") |
@@ -788,8 +886,12 @@ discard block |
||
788 | 886 | { |
789 | 887 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
790 | 888 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
791 | - } else $limit_query = ""; |
|
792 | - } else $limit_query = ""; |
|
889 | + } else { |
|
890 | + $limit_query = ""; |
|
891 | + } |
|
892 | + } else { |
|
893 | + $limit_query = ""; |
|
894 | + } |
|
793 | 895 | |
794 | 896 | if ($sort != "") |
795 | 897 | { |
@@ -1113,7 +1215,9 @@ discard block |
||
1113 | 1215 | global $global_query; |
1114 | 1216 | |
1115 | 1217 | date_default_timezone_set('UTC'); |
1116 | - if ($id == '') return array(); |
|
1218 | + if ($id == '') { |
|
1219 | + return array(); |
|
1220 | + } |
|
1117 | 1221 | $additional_query = "spotter_output.spotter_id = :id"; |
1118 | 1222 | $query_values = array(':id' => $id); |
1119 | 1223 | |
@@ -1739,7 +1843,9 @@ discard block |
||
1739 | 1843 | { |
1740 | 1844 | $highlight = $row['highlight']; |
1741 | 1845 | } |
1742 | - if (isset($highlight)) return $highlight; |
|
1846 | + if (isset($highlight)) { |
|
1847 | + return $highlight; |
|
1848 | + } |
|
1743 | 1849 | } |
1744 | 1850 | |
1745 | 1851 | |
@@ -1767,7 +1873,9 @@ discard block |
||
1767 | 1873 | $sth->closeCursor(); |
1768 | 1874 | if (count($row) > 0) { |
1769 | 1875 | return $row['usage']; |
1770 | - } else return ''; |
|
1876 | + } else { |
|
1877 | + return ''; |
|
1878 | + } |
|
1771 | 1879 | } |
1772 | 1880 | |
1773 | 1881 | /** |
@@ -1792,7 +1900,9 @@ discard block |
||
1792 | 1900 | $sth->closeCursor(); |
1793 | 1901 | if (count($row) > 0) { |
1794 | 1902 | return $row['icao']; |
1795 | - } else return ''; |
|
1903 | + } else { |
|
1904 | + return ''; |
|
1905 | + } |
|
1796 | 1906 | } |
1797 | 1907 | |
1798 | 1908 | /** |
@@ -1820,7 +1930,9 @@ discard block |
||
1820 | 1930 | $airport_longitude = $row['longitude']; |
1821 | 1931 | $Common = new Common(); |
1822 | 1932 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
1823 | - } else return ''; |
|
1933 | + } else { |
|
1934 | + return ''; |
|
1935 | + } |
|
1824 | 1936 | } |
1825 | 1937 | |
1826 | 1938 | /** |
@@ -1932,7 +2044,9 @@ discard block |
||
1932 | 2044 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1933 | 2045 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1934 | 2046 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1935 | - } else return array(); |
|
2047 | + } else { |
|
2048 | + return array(); |
|
2049 | + } |
|
1936 | 2050 | if ($globalDBdriver == 'mysql') { |
1937 | 2051 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
1938 | 2052 | } else { |
@@ -1967,7 +2081,9 @@ discard block |
||
1967 | 2081 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1968 | 2082 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1969 | 2083 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1970 | - } else return array(); |
|
2084 | + } else { |
|
2085 | + return array(); |
|
2086 | + } |
|
1971 | 2087 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
1972 | 2088 | $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
1973 | 2089 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2002,7 +2118,9 @@ discard block |
||
2002 | 2118 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
2003 | 2119 | { |
2004 | 2120 | global $globalUseRealAirlines; |
2005 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
2121 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
2122 | + $fromsource = NULL; |
|
2123 | + } |
|
2006 | 2124 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
2007 | 2125 | if ($airline_icao == 'NA') { |
2008 | 2126 | $airline_array = array(); |
@@ -2052,7 +2170,9 @@ discard block |
||
2052 | 2170 | $sth->execute(array(':fromsource' => $fromsource)); |
2053 | 2171 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2054 | 2172 | $sth->closeCursor(); |
2055 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao); |
|
2173 | + if ($row['nb'] == 0) { |
|
2174 | + $result = $this->getAllAirlineInfo($airline_icao); |
|
2175 | + } |
|
2056 | 2176 | } |
2057 | 2177 | return $result; |
2058 | 2178 | } |
@@ -2116,15 +2236,20 @@ discard block |
||
2116 | 2236 | 'A320-211' => 'A320', |
2117 | 2237 | '747-8i' => 'B748', |
2118 | 2238 | 'A380' => 'A388'); |
2119 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
2239 | + if (isset($all_aircraft[$aircraft_type])) { |
|
2240 | + return $all_aircraft[$aircraft_type]; |
|
2241 | + } |
|
2120 | 2242 | |
2121 | 2243 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
2122 | 2244 | $aircraft_type = strtoupper($aircraft_type); |
2123 | 2245 | $sth = $this->db->prepare($query); |
2124 | 2246 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
2125 | 2247 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
2126 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
2127 | - else return ''; |
|
2248 | + if (isset($result[0]['icao'])) { |
|
2249 | + return $result[0]['icao']; |
|
2250 | + } else { |
|
2251 | + return ''; |
|
2252 | + } |
|
2128 | 2253 | } |
2129 | 2254 | |
2130 | 2255 | /** |
@@ -2147,7 +2272,9 @@ discard block |
||
2147 | 2272 | $sth->closeCursor(); |
2148 | 2273 | if (isset($row['icaotypecode'])) { |
2149 | 2274 | return $row['icaotypecode']; |
2150 | - } else return ''; |
|
2275 | + } else { |
|
2276 | + return ''; |
|
2277 | + } |
|
2151 | 2278 | } |
2152 | 2279 | |
2153 | 2280 | /** |
@@ -2169,7 +2296,9 @@ discard block |
||
2169 | 2296 | $sth->closeCursor(); |
2170 | 2297 | if (isset($row['operator_correct'])) { |
2171 | 2298 | return $row['operator_correct']; |
2172 | - } else return $operator; |
|
2299 | + } else { |
|
2300 | + return $operator; |
|
2301 | + } |
|
2173 | 2302 | } |
2174 | 2303 | |
2175 | 2304 | /** |
@@ -2182,7 +2311,9 @@ discard block |
||
2182 | 2311 | public function getRouteInfo($callsign) |
2183 | 2312 | { |
2184 | 2313 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
2185 | - if ($callsign == '') return array(); |
|
2314 | + if ($callsign == '') { |
|
2315 | + return array(); |
|
2316 | + } |
|
2186 | 2317 | $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
2187 | 2318 | |
2188 | 2319 | $sth = $this->db->prepare($query); |
@@ -2192,7 +2323,9 @@ discard block |
||
2192 | 2323 | $sth->closeCursor(); |
2193 | 2324 | if (count($row) > 0) { |
2194 | 2325 | return $row; |
2195 | - } else return array(); |
|
2326 | + } else { |
|
2327 | + return array(); |
|
2328 | + } |
|
2196 | 2329 | } |
2197 | 2330 | |
2198 | 2331 | /** |
@@ -2245,7 +2378,9 @@ discard block |
||
2245 | 2378 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
2246 | 2379 | $sth->closeCursor(); |
2247 | 2380 | return $result; |
2248 | - } else return array(); |
|
2381 | + } else { |
|
2382 | + return array(); |
|
2383 | + } |
|
2249 | 2384 | } |
2250 | 2385 | |
2251 | 2386 | |
@@ -2402,8 +2537,11 @@ discard block |
||
2402 | 2537 | $query .= " ORDER BY spotter_output.source_name ASC"; |
2403 | 2538 | |
2404 | 2539 | $sth = $this->db->prepare($query); |
2405 | - if (!empty($query_values)) $sth->execute($query_values); |
|
2406 | - else $sth->execute(); |
|
2540 | + if (!empty($query_values)) { |
|
2541 | + $sth->execute($query_values); |
|
2542 | + } else { |
|
2543 | + $sth->execute(); |
|
2544 | + } |
|
2407 | 2545 | |
2408 | 2546 | $source_array = array(); |
2409 | 2547 | $temp_array = array(); |
@@ -2436,9 +2574,13 @@ discard block |
||
2436 | 2574 | WHERE spotter_output.airline_icao <> '' |
2437 | 2575 | ORDER BY spotter_output.airline_name ASC"; |
2438 | 2576 | */ |
2439 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
2440 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
2441 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
2577 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
2578 | + $forsource = $globalAirlinesSource; |
|
2579 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
2580 | + $forsource = 'vatsim'; |
|
2581 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
2582 | + $forsource = 'ivao'; |
|
2583 | + } |
|
2442 | 2584 | if ($forsource === NULL) { |
2443 | 2585 | $query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC"; |
2444 | 2586 | $query_data = array(); |
@@ -2730,7 +2872,9 @@ discard block |
||
2730 | 2872 | date_default_timezone_set($globalTimezone); |
2731 | 2873 | $datetime = new DateTime(); |
2732 | 2874 | $offset = $datetime->format('P'); |
2733 | - } else $offset = '+00:00'; |
|
2875 | + } else { |
|
2876 | + $offset = '+00:00'; |
|
2877 | + } |
|
2734 | 2878 | if ($airport_icao == '') { |
2735 | 2879 | if ($globalDBdriver == 'mysql') { |
2736 | 2880 | $query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -2762,7 +2906,9 @@ discard block |
||
2762 | 2906 | date_default_timezone_set($globalTimezone); |
2763 | 2907 | $datetime = new DateTime(); |
2764 | 2908 | $offset = $datetime->format('P'); |
2765 | - } else $offset = '+00:00'; |
|
2909 | + } else { |
|
2910 | + $offset = '+00:00'; |
|
2911 | + } |
|
2766 | 2912 | if ($airport_icao == '') { |
2767 | 2913 | if ($globalDBdriver == 'mysql') { |
2768 | 2914 | $query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -2795,7 +2941,9 @@ discard block |
||
2795 | 2941 | date_default_timezone_set($globalTimezone); |
2796 | 2942 | $datetime = new DateTime(); |
2797 | 2943 | $offset = $datetime->format('P'); |
2798 | - } else $offset = '+00:00'; |
|
2944 | + } else { |
|
2945 | + $offset = '+00:00'; |
|
2946 | + } |
|
2799 | 2947 | if ($airport_icao == '') { |
2800 | 2948 | if ($globalDBdriver == 'mysql') { |
2801 | 2949 | $query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -2834,7 +2982,9 @@ discard block |
||
2834 | 2982 | date_default_timezone_set($globalTimezone); |
2835 | 2983 | $datetime = new DateTime(); |
2836 | 2984 | $offset = $datetime->format('P'); |
2837 | - } else $offset = '+00:00'; |
|
2985 | + } else { |
|
2986 | + $offset = '+00:00'; |
|
2987 | + } |
|
2838 | 2988 | if ($airport_icao == '') { |
2839 | 2989 | if ($globalDBdriver == 'mysql') { |
2840 | 2990 | $query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -2879,7 +3029,9 @@ discard block |
||
2879 | 3029 | date_default_timezone_set($globalTimezone); |
2880 | 3030 | $datetime = new DateTime(); |
2881 | 3031 | $offset = $datetime->format('P'); |
2882 | - } else $offset = '+00:00'; |
|
3032 | + } else { |
|
3033 | + $offset = '+00:00'; |
|
3034 | + } |
|
2883 | 3035 | if ($airport_icao == '') { |
2884 | 3036 | if ($globalDBdriver == 'mysql') { |
2885 | 3037 | $query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -2914,7 +3066,9 @@ discard block |
||
2914 | 3066 | date_default_timezone_set($globalTimezone); |
2915 | 3067 | $datetime = new DateTime(); |
2916 | 3068 | $offset = $datetime->format('P'); |
2917 | - } else $offset = '+00:00'; |
|
3069 | + } else { |
|
3070 | + $offset = '+00:00'; |
|
3071 | + } |
|
2918 | 3072 | if ($airport_icao == '') { |
2919 | 3073 | if ($globalDBdriver == 'mysql') { |
2920 | 3074 | $query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -2956,7 +3110,9 @@ discard block |
||
2956 | 3110 | date_default_timezone_set($globalTimezone); |
2957 | 3111 | $datetime = new DateTime(); |
2958 | 3112 | $offset = $datetime->format('P'); |
2959 | - } else $offset = '+00:00'; |
|
3113 | + } else { |
|
3114 | + $offset = '+00:00'; |
|
3115 | + } |
|
2960 | 3116 | if ($airport_icao == '') { |
2961 | 3117 | if ($globalDBdriver == 'mysql') { |
2962 | 3118 | $query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -2990,7 +3146,9 @@ discard block |
||
2990 | 3146 | date_default_timezone_set($globalTimezone); |
2991 | 3147 | $datetime = new DateTime(); |
2992 | 3148 | $offset = $datetime->format('P'); |
2993 | - } else $offset = '+00:00'; |
|
3149 | + } else { |
|
3150 | + $offset = '+00:00'; |
|
3151 | + } |
|
2994 | 3152 | if ($airport_icao == '') { |
2995 | 3153 | if ($globalDBdriver == 'mysql') { |
2996 | 3154 | $query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3038,7 +3196,9 @@ discard block |
||
3038 | 3196 | date_default_timezone_set($globalTimezone); |
3039 | 3197 | $datetime = new DateTime(); |
3040 | 3198 | $offset = $datetime->format('P'); |
3041 | - } else $offset = '+00:00'; |
|
3199 | + } else { |
|
3200 | + $offset = '+00:00'; |
|
3201 | + } |
|
3042 | 3202 | |
3043 | 3203 | if ($globalDBdriver == 'mysql') { |
3044 | 3204 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3158,7 +3318,9 @@ discard block |
||
3158 | 3318 | */ |
3159 | 3319 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
3160 | 3320 | { |
3161 | - if ($groundspeed == '') $groundspeed = NULL; |
|
3321 | + if ($groundspeed == '') { |
|
3322 | + $groundspeed = NULL; |
|
3323 | + } |
|
3162 | 3324 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
3163 | 3325 | $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
3164 | 3326 | |
@@ -3208,10 +3370,18 @@ discard block |
||
3208 | 3370 | $Image = new Image($this->db); |
3209 | 3371 | $Common = new Common(); |
3210 | 3372 | |
3211 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
3212 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
3213 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
3214 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
3373 | + if (!isset($globalIVAO)) { |
|
3374 | + $globalIVAO = FALSE; |
|
3375 | + } |
|
3376 | + if (!isset($globalVATSIM)) { |
|
3377 | + $globalVATSIM = FALSE; |
|
3378 | + } |
|
3379 | + if (!isset($globalphpVMS)) { |
|
3380 | + $globalphpVMS = FALSE; |
|
3381 | + } |
|
3382 | + if (!isset($globalVAM)) { |
|
3383 | + $globalVAM = FALSE; |
|
3384 | + } |
|
3215 | 3385 | date_default_timezone_set('UTC'); |
3216 | 3386 | |
3217 | 3387 | //getting the registration |
@@ -3224,23 +3394,33 @@ discard block |
||
3224 | 3394 | if ($ModeS != '') { |
3225 | 3395 | $timeelapsed = microtime(true); |
3226 | 3396 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
3227 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3397 | + if ($globalDebugTimeElapsed) { |
|
3398 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3399 | + } |
|
3228 | 3400 | } else { |
3229 | 3401 | $myhex = explode('-',$flightaware_id); |
3230 | 3402 | if (count($myhex) > 0) { |
3231 | 3403 | $timeelapsed = microtime(true); |
3232 | 3404 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
3233 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3405 | + if ($globalDebugTimeElapsed) { |
|
3406 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3407 | + } |
|
3234 | 3408 | } |
3235 | 3409 | } |
3236 | 3410 | } |
3237 | 3411 | } |
3238 | 3412 | $fromsource = NULL; |
3239 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
3240 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
3241 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
3242 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
3243 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
3413 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
3414 | + $fromsource = $globalAirlinesSource; |
|
3415 | + } elseif ($format_source == 'vatsimtxt') { |
|
3416 | + $fromsource = 'vatsim'; |
|
3417 | + } elseif ($format_source == 'whazzup') { |
|
3418 | + $fromsource = 'ivao'; |
|
3419 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
3420 | + $fromsource = 'vatsim'; |
|
3421 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
3422 | + $fromsource = 'ivao'; |
|
3423 | + } |
|
3244 | 3424 | //getting the airline information |
3245 | 3425 | if ($ident != "") |
3246 | 3426 | { |
@@ -3264,15 +3444,21 @@ discard block |
||
3264 | 3444 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
3265 | 3445 | $airline_array = $this->getAllAirlineInfo("NA"); |
3266 | 3446 | } |
3267 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3447 | + if ($globalDebugTimeElapsed) { |
|
3448 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3449 | + } |
|
3268 | 3450 | |
3269 | 3451 | } else { |
3270 | 3452 | $timeelapsed = microtime(true); |
3271 | 3453 | $airline_array = $this->getAllAirlineInfo("NA"); |
3272 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3454 | + if ($globalDebugTimeElapsed) { |
|
3455 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3456 | + } |
|
3273 | 3457 | } |
3274 | 3458 | } |
3275 | - } else $airline_array = array(); |
|
3459 | + } else { |
|
3460 | + $airline_array = array(); |
|
3461 | + } |
|
3276 | 3462 | |
3277 | 3463 | //getting the aircraft information |
3278 | 3464 | $aircraft_array = array(); |
@@ -3286,27 +3472,37 @@ discard block |
||
3286 | 3472 | { |
3287 | 3473 | $timeelapsed = microtime(true); |
3288 | 3474 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3289 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3475 | + if ($globalDebugTimeElapsed) { |
|
3476 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3477 | + } |
|
3290 | 3478 | } else { |
3291 | 3479 | $timeelapsed = microtime(true); |
3292 | 3480 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3293 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3481 | + if ($globalDebugTimeElapsed) { |
|
3482 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3483 | + } |
|
3294 | 3484 | } |
3295 | 3485 | } |
3296 | 3486 | } else { |
3297 | 3487 | if ($ModeS != '') { |
3298 | 3488 | $timeelapsed = microtime(true); |
3299 | 3489 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
3300 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3490 | + if ($globalDebugTimeElapsed) { |
|
3491 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3492 | + } |
|
3301 | 3493 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
3302 | 3494 | { |
3303 | 3495 | $timeelapsed = microtime(true); |
3304 | 3496 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3305 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3497 | + if ($globalDebugTimeElapsed) { |
|
3498 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3499 | + } |
|
3306 | 3500 | } else { |
3307 | 3501 | $timeelapsed = microtime(true); |
3308 | 3502 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3309 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3503 | + if ($globalDebugTimeElapsed) { |
|
3504 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3505 | + } |
|
3310 | 3506 | } |
3311 | 3507 | } |
3312 | 3508 | } |
@@ -3321,7 +3517,9 @@ discard block |
||
3321 | 3517 | } else { |
3322 | 3518 | $timeelapsed = microtime(true); |
3323 | 3519 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
3324 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3520 | + if ($globalDebugTimeElapsed) { |
|
3521 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3522 | + } |
|
3325 | 3523 | } |
3326 | 3524 | } |
3327 | 3525 | |
@@ -3335,7 +3533,9 @@ discard block |
||
3335 | 3533 | } else { |
3336 | 3534 | $timeelapsed = microtime(true); |
3337 | 3535 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
3338 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3536 | + if ($globalDebugTimeElapsed) { |
|
3537 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3538 | + } |
|
3339 | 3539 | } |
3340 | 3540 | } |
3341 | 3541 | |
@@ -3370,7 +3570,9 @@ discard block |
||
3370 | 3570 | { |
3371 | 3571 | return false; |
3372 | 3572 | } |
3373 | - } else $altitude = 0; |
|
3573 | + } else { |
|
3574 | + $altitude = 0; |
|
3575 | + } |
|
3374 | 3576 | |
3375 | 3577 | if ($heading != "") |
3376 | 3578 | { |
@@ -3399,7 +3601,9 @@ discard block |
||
3399 | 3601 | { |
3400 | 3602 | $timeelapsed = microtime(true); |
3401 | 3603 | $image_array = $Image->getSpotterImage($registration); |
3402 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3604 | + if ($globalDebugTimeElapsed) { |
|
3605 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3606 | + } |
|
3403 | 3607 | if (!isset($image_array[0]['registration'])) |
3404 | 3608 | { |
3405 | 3609 | //echo "Add image !!!! \n"; |
@@ -3407,14 +3611,21 @@ discard block |
||
3407 | 3611 | } |
3408 | 3612 | $timeelapsed = microtime(true); |
3409 | 3613 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
3410 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3411 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
3614 | + if ($globalDebugTimeElapsed) { |
|
3615 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3616 | + } |
|
3617 | + if ($owner_info['owner'] != '') { |
|
3618 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
3619 | + } |
|
3412 | 3620 | } |
3413 | 3621 | |
3414 | 3622 | if ($globalIVAO && $aircraft_icao != '') |
3415 | 3623 | { |
3416 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
3417 | - else $airline_icao = ''; |
|
3624 | + if (isset($airline_array[0]['icao'])) { |
|
3625 | + $airline_icao = $airline_array[0]['icao']; |
|
3626 | + } else { |
|
3627 | + $airline_icao = ''; |
|
3628 | + } |
|
3418 | 3629 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
3419 | 3630 | if (!isset($image_array[0]['registration'])) |
3420 | 3631 | { |
@@ -3459,12 +3670,24 @@ discard block |
||
3459 | 3670 | { |
3460 | 3671 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
3461 | 3672 | } |
3462 | - if ($registration == '') $registration = 'NA'; |
|
3463 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
3464 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
3465 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
3466 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
3467 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
3673 | + if ($registration == '') { |
|
3674 | + $registration = 'NA'; |
|
3675 | + } |
|
3676 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
3677 | + $squawk = NULL; |
|
3678 | + } |
|
3679 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
3680 | + $verticalrate = NULL; |
|
3681 | + } |
|
3682 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
3683 | + $heading = 0; |
|
3684 | + } |
|
3685 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
3686 | + $groundspeed = 0; |
|
3687 | + } |
|
3688 | + if (!isset($aircraft_owner)) { |
|
3689 | + $aircraft_owner = NULL; |
|
3690 | + } |
|
3468 | 3691 | $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
3469 | 3692 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
3470 | 3693 | |
@@ -3475,9 +3698,13 @@ discard block |
||
3475 | 3698 | if ($airline_type == '') { |
3476 | 3699 | $timeelapsed = microtime(true); |
3477 | 3700 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
3478 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3701 | + if ($globalDebugTimeElapsed) { |
|
3702 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3703 | + } |
|
3704 | + } |
|
3705 | + if ($airline_type == null) { |
|
3706 | + $airline_type = ''; |
|
3479 | 3707 | } |
3480 | - if ($airline_type == null) $airline_type = ''; |
|
3481 | 3708 | $aircraft_type = $aircraft_array[0]['type']; |
3482 | 3709 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
3483 | 3710 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -3612,7 +3839,9 @@ discard block |
||
3612 | 3839 | } |
3613 | 3840 | } |
3614 | 3841 | $query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
3615 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
3842 | + if ($limit) { |
|
3843 | + $query .= " LIMIT 10 OFFSET 0"; |
|
3844 | + } |
|
3616 | 3845 | |
3617 | 3846 | $sth = $this->db->prepare($query); |
3618 | 3847 | $sth->execute(); |
@@ -3657,7 +3886,9 @@ discard block |
||
3657 | 3886 | } |
3658 | 3887 | } |
3659 | 3888 | $query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC"; |
3660 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
3889 | + if ($limit) { |
|
3890 | + $query .= " LIMIT 10 OFFSET 0"; |
|
3891 | + } |
|
3661 | 3892 | |
3662 | 3893 | |
3663 | 3894 | $sth = $this->db->prepare($query); |
@@ -3702,7 +3933,9 @@ discard block |
||
3702 | 3933 | } |
3703 | 3934 | } |
3704 | 3935 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name ORDER BY pilot_count DESC"; |
3705 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
3936 | + if ($limit) { |
|
3937 | + $query .= " LIMIT 10 OFFSET 0"; |
|
3938 | + } |
|
3706 | 3939 | |
3707 | 3940 | |
3708 | 3941 | $sth = $this->db->prepare($query); |
@@ -3749,7 +3982,9 @@ discard block |
||
3749 | 3982 | } |
3750 | 3983 | } |
3751 | 3984 | $query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
3752 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
3985 | + if ($limit) { |
|
3986 | + $query .= " LIMIT 10 OFFSET 0"; |
|
3987 | + } |
|
3753 | 3988 | |
3754 | 3989 | |
3755 | 3990 | $sth = $this->db->prepare($query); |
@@ -3794,7 +4029,9 @@ discard block |
||
3794 | 4029 | } |
3795 | 4030 | } |
3796 | 4031 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
3797 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4032 | + if ($limit) { |
|
4033 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4034 | + } |
|
3798 | 4035 | |
3799 | 4036 | |
3800 | 4037 | $sth = $this->db->prepare($query); |
@@ -4037,7 +4274,9 @@ discard block |
||
4037 | 4274 | date_default_timezone_set($globalTimezone); |
4038 | 4275 | $datetime = new DateTime($date); |
4039 | 4276 | $offset = $datetime->format('P'); |
4040 | - } else $offset = '+00:00'; |
|
4277 | + } else { |
|
4278 | + $offset = '+00:00'; |
|
4279 | + } |
|
4041 | 4280 | |
4042 | 4281 | if ($globalDBdriver == 'mysql') { |
4043 | 4282 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4085,7 +4324,9 @@ discard block |
||
4085 | 4324 | date_default_timezone_set($globalTimezone); |
4086 | 4325 | $datetime = new DateTime($date); |
4087 | 4326 | $offset = $datetime->format('P'); |
4088 | - } else $offset = '+00:00'; |
|
4327 | + } else { |
|
4328 | + $offset = '+00:00'; |
|
4329 | + } |
|
4089 | 4330 | |
4090 | 4331 | if ($globalDBdriver == 'mysql') { |
4091 | 4332 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4303,7 +4544,9 @@ discard block |
||
4303 | 4544 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' |
4304 | 4545 | GROUP BY spotter_output.airline_country |
4305 | 4546 | ORDER BY airline_country_count DESC"; |
4306 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4547 | + if ($limit) { |
|
4548 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4549 | + } |
|
4307 | 4550 | |
4308 | 4551 | $sth = $this->db->prepare($query); |
4309 | 4552 | $sth->execute(); |
@@ -4331,7 +4574,9 @@ discard block |
||
4331 | 4574 | global $globalDBdriver; |
4332 | 4575 | //$filter_query = $this->getFilter($filters,true,true); |
4333 | 4576 | $Connection= new Connection($this->db); |
4334 | - if (!$Connection->tableExists('countries')) return array(); |
|
4577 | + if (!$Connection->tableExists('countries')) { |
|
4578 | + return array(); |
|
4579 | + } |
|
4335 | 4580 | /* |
4336 | 4581 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
4337 | 4582 | FROM countries c, spotter_output s |
@@ -4356,7 +4601,9 @@ discard block |
||
4356 | 4601 | } |
4357 | 4602 | |
4358 | 4603 | $query .= "GROUP BY c.name ORDER BY nb DESC"; |
4359 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4604 | + if ($limit) { |
|
4605 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4606 | + } |
|
4360 | 4607 | |
4361 | 4608 | |
4362 | 4609 | $sth = $this->db->prepare($query); |
@@ -4406,7 +4653,9 @@ discard block |
||
4406 | 4653 | } |
4407 | 4654 | |
4408 | 4655 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
4409 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4656 | + if ($limit) { |
|
4657 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4658 | + } |
|
4410 | 4659 | |
4411 | 4660 | $sth = $this->db->prepare($query); |
4412 | 4661 | $sth->execute(); |
@@ -4452,7 +4701,9 @@ discard block |
||
4452 | 4701 | } |
4453 | 4702 | |
4454 | 4703 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
4455 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4704 | + if ($limit) { |
|
4705 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4706 | + } |
|
4456 | 4707 | |
4457 | 4708 | $sth = $this->db->prepare($query); |
4458 | 4709 | $sth->execute(); |
@@ -4505,7 +4756,9 @@ discard block |
||
4505 | 4756 | if($row['registration'] != "") |
4506 | 4757 | { |
4507 | 4758 | $image_array = $Image->getSpotterImage($row['registration']); |
4508 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
4759 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
4760 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
4761 | + } |
|
4509 | 4762 | } |
4510 | 4763 | $temp_array['registration_count'] = $row['registration_count']; |
4511 | 4764 | |
@@ -4580,7 +4833,9 @@ discard block |
||
4580 | 4833 | if($row['registration'] != "") |
4581 | 4834 | { |
4582 | 4835 | $image_array = $Image->getSpotterImage($row['registration']); |
4583 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
4836 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
4837 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
4838 | + } |
|
4584 | 4839 | } |
4585 | 4840 | $temp_array['registration_count'] = $row['registration_count']; |
4586 | 4841 | |
@@ -4687,7 +4942,9 @@ discard block |
||
4687 | 4942 | if($row['registration'] != "") |
4688 | 4943 | { |
4689 | 4944 | $image_array = $Image->getSpotterImage($row['registration']); |
4690 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
4945 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
4946 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
4947 | + } |
|
4691 | 4948 | } |
4692 | 4949 | $temp_array['registration_count'] = $row['registration_count']; |
4693 | 4950 | $aircraft_array[] = $temp_array; |
@@ -4812,7 +5069,9 @@ discard block |
||
4812 | 5069 | date_default_timezone_set($globalTimezone); |
4813 | 5070 | $datetime = new DateTime($date); |
4814 | 5071 | $offset = $datetime->format('P'); |
4815 | - } else $offset = '+00:00'; |
|
5072 | + } else { |
|
5073 | + $offset = '+00:00'; |
|
5074 | + } |
|
4816 | 5075 | |
4817 | 5076 | if ($globalDBdriver == 'mysql') { |
4818 | 5077 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -4859,7 +5118,9 @@ discard block |
||
4859 | 5118 | date_default_timezone_set($globalTimezone); |
4860 | 5119 | $datetime = new DateTime($date); |
4861 | 5120 | $offset = $datetime->format('P'); |
4862 | - } else $offset = '+00:00'; |
|
5121 | + } else { |
|
5122 | + $offset = '+00:00'; |
|
5123 | + } |
|
4863 | 5124 | |
4864 | 5125 | if ($globalDBdriver == 'mysql') { |
4865 | 5126 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
@@ -4888,7 +5149,9 @@ discard block |
||
4888 | 5149 | if($row['registration'] != "") |
4889 | 5150 | { |
4890 | 5151 | $image_array = $Image->getSpotterImage($row['registration']); |
4891 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5152 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5153 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5154 | + } |
|
4892 | 5155 | } |
4893 | 5156 | $temp_array['registration_count'] = $row['registration_count']; |
4894 | 5157 | |
@@ -4913,7 +5176,9 @@ discard block |
||
4913 | 5176 | date_default_timezone_set($globalTimezone); |
4914 | 5177 | $datetime = new DateTime($date); |
4915 | 5178 | $offset = $datetime->format('P'); |
4916 | - } else $offset = '+00:00'; |
|
5179 | + } else { |
|
5180 | + $offset = '+00:00'; |
|
5181 | + } |
|
4917 | 5182 | |
4918 | 5183 | if ($globalDBdriver == 'mysql') { |
4919 | 5184 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5011,8 +5276,11 @@ discard block |
||
5011 | 5276 | if($row['registration'] != "") |
5012 | 5277 | { |
5013 | 5278 | $image_array = $Image->getSpotterImage($row['registration']); |
5014 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5015 | - else $temp_array['image_thumbnail'] = ''; |
|
5279 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5280 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5281 | + } else { |
|
5282 | + $temp_array['image_thumbnail'] = ''; |
|
5283 | + } |
|
5016 | 5284 | } |
5017 | 5285 | $temp_array['registration_count'] = $row['registration_count']; |
5018 | 5286 | $aircraft_array[] = $temp_array; |
@@ -5119,7 +5387,9 @@ discard block |
||
5119 | 5387 | if($row['registration'] != "") |
5120 | 5388 | { |
5121 | 5389 | $image_array = $Image->getSpotterImage($row['registration']); |
5122 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5390 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5391 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5392 | + } |
|
5123 | 5393 | } |
5124 | 5394 | $temp_array['registration_count'] = $row['registration_count']; |
5125 | 5395 | |
@@ -5236,7 +5506,9 @@ discard block |
||
5236 | 5506 | if($row['registration'] != "") |
5237 | 5507 | { |
5238 | 5508 | $image_array = $Image->getSpotterImage($row['registration']); |
5239 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5509 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5510 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5511 | + } |
|
5240 | 5512 | } |
5241 | 5513 | $temp_array['registration_count'] = $row['registration_count']; |
5242 | 5514 | |
@@ -5348,7 +5620,9 @@ discard block |
||
5348 | 5620 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
5349 | 5621 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5350 | 5622 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
5351 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5623 | + if ($limit) { |
|
5624 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5625 | + } |
|
5352 | 5626 | |
5353 | 5627 | $sth = $this->db->prepare($query); |
5354 | 5628 | $sth->execute(); |
@@ -5367,7 +5641,9 @@ discard block |
||
5367 | 5641 | if($row['registration'] != "") |
5368 | 5642 | { |
5369 | 5643 | $image_array = $Image->getSpotterImage($row['registration']); |
5370 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5644 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5645 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5646 | + } |
|
5371 | 5647 | } |
5372 | 5648 | |
5373 | 5649 | $aircraft_array[] = $temp_array; |
@@ -5408,7 +5684,9 @@ discard block |
||
5408 | 5684 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
5409 | 5685 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5410 | 5686 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
5411 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5687 | + if ($limit) { |
|
5688 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5689 | + } |
|
5412 | 5690 | |
5413 | 5691 | $sth = $this->db->prepare($query); |
5414 | 5692 | $sth->execute(); |
@@ -5428,7 +5706,9 @@ discard block |
||
5428 | 5706 | if($row['registration'] != "") |
5429 | 5707 | { |
5430 | 5708 | $image_array = $Image->getSpotterImage($row['registration']); |
5431 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5709 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5710 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5711 | + } |
|
5432 | 5712 | } |
5433 | 5713 | |
5434 | 5714 | $aircraft_array[] = $temp_array; |
@@ -5469,7 +5749,9 @@ discard block |
||
5469 | 5749 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5470 | 5750 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
5471 | 5751 | ORDER BY airport_departure_icao_count DESC"; |
5472 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5752 | + if ($limit) { |
|
5753 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5754 | + } |
|
5473 | 5755 | |
5474 | 5756 | $sth = $this->db->prepare($query); |
5475 | 5757 | $sth->execute(); |
@@ -5521,7 +5803,9 @@ discard block |
||
5521 | 5803 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5522 | 5804 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
5523 | 5805 | ORDER BY airport_departure_icao_count DESC"; |
5524 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5806 | + if ($limit) { |
|
5807 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5808 | + } |
|
5525 | 5809 | |
5526 | 5810 | $sth = $this->db->prepare($query); |
5527 | 5811 | $sth->execute(); |
@@ -5573,7 +5857,9 @@ discard block |
||
5573 | 5857 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5574 | 5858 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
5575 | 5859 | ORDER BY airport_departure_icao_count DESC"; |
5576 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5860 | + if ($limit) { |
|
5861 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5862 | + } |
|
5577 | 5863 | //echo $query; |
5578 | 5864 | $sth = $this->db->prepare($query); |
5579 | 5865 | $sth->execute(); |
@@ -5625,7 +5911,9 @@ discard block |
||
5625 | 5911 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5626 | 5912 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
5627 | 5913 | ORDER BY airport_departure_icao_count DESC"; |
5628 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5914 | + if ($limit) { |
|
5915 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5916 | + } |
|
5629 | 5917 | |
5630 | 5918 | $sth = $this->db->prepare($query); |
5631 | 5919 | $sth->execute(); |
@@ -6020,7 +6308,9 @@ discard block |
||
6020 | 6308 | date_default_timezone_set($globalTimezone); |
6021 | 6309 | $datetime = new DateTime($date); |
6022 | 6310 | $offset = $datetime->format('P'); |
6023 | - } else $offset = '+00:00'; |
|
6311 | + } else { |
|
6312 | + $offset = '+00:00'; |
|
6313 | + } |
|
6024 | 6314 | |
6025 | 6315 | if ($globalDBdriver == 'mysql') { |
6026 | 6316 | $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
@@ -6070,7 +6360,9 @@ discard block |
||
6070 | 6360 | date_default_timezone_set($globalTimezone); |
6071 | 6361 | $datetime = new DateTime($date); |
6072 | 6362 | $offset = $datetime->format('P'); |
6073 | - } else $offset = '+00:00'; |
|
6363 | + } else { |
|
6364 | + $offset = '+00:00'; |
|
6365 | + } |
|
6074 | 6366 | |
6075 | 6367 | if ($globalDBdriver == 'mysql') { |
6076 | 6368 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -6283,7 +6575,9 @@ discard block |
||
6283 | 6575 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6284 | 6576 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6285 | 6577 | ORDER BY airport_arrival_icao_count DESC"; |
6286 | - if ($limit) $query .= " LIMIT 10"; |
|
6578 | + if ($limit) { |
|
6579 | + $query .= " LIMIT 10"; |
|
6580 | + } |
|
6287 | 6581 | |
6288 | 6582 | |
6289 | 6583 | $sth = $this->db->prepare($query); |
@@ -6303,7 +6597,9 @@ discard block |
||
6303 | 6597 | if ($icaoaskey) { |
6304 | 6598 | $icao = $row['arrival_airport_icao']; |
6305 | 6599 | $airport_array[$icao] = $temp_array; |
6306 | - } else $airport_array[] = $temp_array; |
|
6600 | + } else { |
|
6601 | + $airport_array[] = $temp_array; |
|
6602 | + } |
|
6307 | 6603 | } |
6308 | 6604 | |
6309 | 6605 | return $airport_array; |
@@ -6345,7 +6641,9 @@ discard block |
||
6345 | 6641 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6346 | 6642 | $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6347 | 6643 | ORDER BY airport_arrival_icao_count DESC"; |
6348 | - if ($limit) $query .= " LIMIT 10"; |
|
6644 | + if ($limit) { |
|
6645 | + $query .= " LIMIT 10"; |
|
6646 | + } |
|
6349 | 6647 | |
6350 | 6648 | |
6351 | 6649 | $sth = $this->db->prepare($query); |
@@ -6366,7 +6664,9 @@ discard block |
||
6366 | 6664 | if ($icaoaskey) { |
6367 | 6665 | $icao = $row['arrival_airport_icao']; |
6368 | 6666 | $airport_array[$icao] = $temp_array; |
6369 | - } else $airport_array[] = $temp_array; |
|
6667 | + } else { |
|
6668 | + $airport_array[] = $temp_array; |
|
6669 | + } |
|
6370 | 6670 | } |
6371 | 6671 | |
6372 | 6672 | return $airport_array; |
@@ -6408,7 +6708,9 @@ discard block |
||
6408 | 6708 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6409 | 6709 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
6410 | 6710 | ORDER BY airport_arrival_icao_count DESC"; |
6411 | - if ($limit) $query .= " LIMIT 10"; |
|
6711 | + if ($limit) { |
|
6712 | + $query .= " LIMIT 10"; |
|
6713 | + } |
|
6412 | 6714 | |
6413 | 6715 | |
6414 | 6716 | $sth = $this->db->prepare($query); |
@@ -6428,7 +6730,9 @@ discard block |
||
6428 | 6730 | if ($icaoaskey) { |
6429 | 6731 | $icao = $row['arrival_airport_icao']; |
6430 | 6732 | $airport_array[$icao] = $temp_array; |
6431 | - } else $airport_array[] = $temp_array; |
|
6733 | + } else { |
|
6734 | + $airport_array[] = $temp_array; |
|
6735 | + } |
|
6432 | 6736 | } |
6433 | 6737 | |
6434 | 6738 | return $airport_array; |
@@ -6470,7 +6774,9 @@ discard block |
||
6470 | 6774 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6471 | 6775 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
6472 | 6776 | ORDER BY airport_arrival_icao_count DESC"; |
6473 | - if ($limit) $query .= " LIMIT 10"; |
|
6777 | + if ($limit) { |
|
6778 | + $query .= " LIMIT 10"; |
|
6779 | + } |
|
6474 | 6780 | |
6475 | 6781 | |
6476 | 6782 | $sth = $this->db->prepare($query); |
@@ -6491,7 +6797,9 @@ discard block |
||
6491 | 6797 | if ($icaoaskey) { |
6492 | 6798 | $icao = $row['arrival_airport_icao']; |
6493 | 6799 | $airport_array[$icao] = $temp_array; |
6494 | - } else $airport_array[] = $temp_array; |
|
6800 | + } else { |
|
6801 | + $airport_array[] = $temp_array; |
|
6802 | + } |
|
6495 | 6803 | } |
6496 | 6804 | |
6497 | 6805 | return $airport_array; |
@@ -6872,7 +7180,9 @@ discard block |
||
6872 | 7180 | date_default_timezone_set($globalTimezone); |
6873 | 7181 | $datetime = new DateTime($date); |
6874 | 7182 | $offset = $datetime->format('P'); |
6875 | - } else $offset = '+00:00'; |
|
7183 | + } else { |
|
7184 | + $offset = '+00:00'; |
|
7185 | + } |
|
6876 | 7186 | |
6877 | 7187 | if ($globalDBdriver == 'mysql') { |
6878 | 7188 | $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
@@ -6922,7 +7232,9 @@ discard block |
||
6922 | 7232 | date_default_timezone_set($globalTimezone); |
6923 | 7233 | $datetime = new DateTime($date); |
6924 | 7234 | $offset = $datetime->format('P'); |
6925 | - } else $offset = '+00:00'; |
|
7235 | + } else { |
|
7236 | + $offset = '+00:00'; |
|
7237 | + } |
|
6926 | 7238 | |
6927 | 7239 | if ($globalDBdriver == 'mysql') { |
6928 | 7240 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -7145,7 +7457,9 @@ discard block |
||
7145 | 7457 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'"; |
7146 | 7458 | $query .= " GROUP BY spotter_output.arrival_airport_country |
7147 | 7459 | ORDER BY airport_arrival_country_count DESC"; |
7148 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
7460 | + if ($limit) { |
|
7461 | + $query .= " LIMIT 10 OFFSET 0"; |
|
7462 | + } |
|
7149 | 7463 | |
7150 | 7464 | |
7151 | 7465 | $sth = $this->db->prepare($query); |
@@ -7432,7 +7746,9 @@ discard block |
||
7432 | 7746 | date_default_timezone_set($globalTimezone); |
7433 | 7747 | $datetime = new DateTime($date); |
7434 | 7748 | $offset = $datetime->format('P'); |
7435 | - } else $offset = '+00:00'; |
|
7749 | + } else { |
|
7750 | + $offset = '+00:00'; |
|
7751 | + } |
|
7436 | 7752 | |
7437 | 7753 | if ($globalDBdriver == 'mysql') { |
7438 | 7754 | $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
@@ -7608,15 +7924,23 @@ discard block |
||
7608 | 7924 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
7609 | 7925 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
7610 | 7926 | if ($olderthanmonths > 0) { |
7611 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
7612 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
7927 | + if ($globalDBdriver == 'mysql') { |
|
7928 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
7929 | + } else { |
|
7930 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
7931 | + } |
|
7613 | 7932 | } |
7614 | 7933 | if ($sincedate != '') { |
7615 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
7616 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
7934 | + if ($globalDBdriver == 'mysql') { |
|
7935 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
7936 | + } else { |
|
7937 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
7938 | + } |
|
7617 | 7939 | } |
7618 | 7940 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
7619 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
7941 | + if ($limit) { |
|
7942 | + $query .= " LIMIT 10 OFFSET 0"; |
|
7943 | + } |
|
7620 | 7944 | |
7621 | 7945 | $sth = $this->db->prepare($query); |
7622 | 7946 | $sth->execute(); |
@@ -7650,15 +7974,23 @@ discard block |
||
7650 | 7974 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
7651 | 7975 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
7652 | 7976 | if ($olderthanmonths > 0) { |
7653 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
7654 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
7977 | + if ($globalDBdriver == 'mysql') { |
|
7978 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
7979 | + } else { |
|
7980 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
7981 | + } |
|
7655 | 7982 | } |
7656 | 7983 | if ($sincedate != '') { |
7657 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
7658 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
7984 | + if ($globalDBdriver == 'mysql') { |
|
7985 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
7986 | + } else { |
|
7987 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
7988 | + } |
|
7659 | 7989 | } |
7660 | 7990 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
7661 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
7991 | + if ($limit) { |
|
7992 | + $query .= " LIMIT 10 OFFSET 0"; |
|
7993 | + } |
|
7662 | 7994 | |
7663 | 7995 | $sth = $this->db->prepare($query); |
7664 | 7996 | $sth->execute(); |
@@ -7695,7 +8027,9 @@ discard block |
||
7695 | 8027 | date_default_timezone_set($globalTimezone); |
7696 | 8028 | $datetime = new DateTime(); |
7697 | 8029 | $offset = $datetime->format('P'); |
7698 | - } else $offset = '+00:00'; |
|
8030 | + } else { |
|
8031 | + $offset = '+00:00'; |
|
8032 | + } |
|
7699 | 8033 | |
7700 | 8034 | if ($globalDBdriver == 'mysql') { |
7701 | 8035 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7744,7 +8078,9 @@ discard block |
||
7744 | 8078 | date_default_timezone_set($globalTimezone); |
7745 | 8079 | $datetime = new DateTime(); |
7746 | 8080 | $offset = $datetime->format('P'); |
7747 | - } else $offset = '+00:00'; |
|
8081 | + } else { |
|
8082 | + $offset = '+00:00'; |
|
8083 | + } |
|
7748 | 8084 | $filter_query = $this->getFilter($filters,true,true); |
7749 | 8085 | if ($globalDBdriver == 'mysql') { |
7750 | 8086 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7793,7 +8129,9 @@ discard block |
||
7793 | 8129 | date_default_timezone_set($globalTimezone); |
7794 | 8130 | $datetime = new DateTime(); |
7795 | 8131 | $offset = $datetime->format('P'); |
7796 | - } else $offset = '+00:00'; |
|
8132 | + } else { |
|
8133 | + $offset = '+00:00'; |
|
8134 | + } |
|
7797 | 8135 | $filter_query = $this->getFilter($filters,true,true); |
7798 | 8136 | if ($globalDBdriver == 'mysql') { |
7799 | 8137 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7839,7 +8177,9 @@ discard block |
||
7839 | 8177 | date_default_timezone_set($globalTimezone); |
7840 | 8178 | $datetime = new DateTime(); |
7841 | 8179 | $offset = $datetime->format('P'); |
7842 | - } else $offset = '+00:00'; |
|
8180 | + } else { |
|
8181 | + $offset = '+00:00'; |
|
8182 | + } |
|
7843 | 8183 | $filter_query = $this->getFilter($filters,true,true); |
7844 | 8184 | if ($globalDBdriver == 'mysql') { |
7845 | 8185 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7887,7 +8227,9 @@ discard block |
||
7887 | 8227 | date_default_timezone_set($globalTimezone); |
7888 | 8228 | $datetime = new DateTime(); |
7889 | 8229 | $offset = $datetime->format('P'); |
7890 | - } else $offset = '+00:00'; |
|
8230 | + } else { |
|
8231 | + $offset = '+00:00'; |
|
8232 | + } |
|
7891 | 8233 | |
7892 | 8234 | if ($globalDBdriver == 'mysql') { |
7893 | 8235 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7935,7 +8277,9 @@ discard block |
||
7935 | 8277 | date_default_timezone_set($globalTimezone); |
7936 | 8278 | $datetime = new DateTime(); |
7937 | 8279 | $offset = $datetime->format('P'); |
7938 | - } else $offset = '+00:00'; |
|
8280 | + } else { |
|
8281 | + $offset = '+00:00'; |
|
8282 | + } |
|
7939 | 8283 | |
7940 | 8284 | if ($globalDBdriver == 'mysql') { |
7941 | 8285 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -7982,7 +8326,9 @@ discard block |
||
7982 | 8326 | date_default_timezone_set($globalTimezone); |
7983 | 8327 | $datetime = new DateTime(); |
7984 | 8328 | $offset = $datetime->format('P'); |
7985 | - } else $offset = '+00:00'; |
|
8329 | + } else { |
|
8330 | + $offset = '+00:00'; |
|
8331 | + } |
|
7986 | 8332 | |
7987 | 8333 | if ($globalDBdriver == 'mysql') { |
7988 | 8334 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -8030,7 +8376,9 @@ discard block |
||
8030 | 8376 | date_default_timezone_set($globalTimezone); |
8031 | 8377 | $datetime = new DateTime(); |
8032 | 8378 | $offset = $datetime->format('P'); |
8033 | - } else $offset = '+00:00'; |
|
8379 | + } else { |
|
8380 | + $offset = '+00:00'; |
|
8381 | + } |
|
8034 | 8382 | $filter_query = $this->getFilter($filters,true,true); |
8035 | 8383 | if ($globalDBdriver == 'mysql') { |
8036 | 8384 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -8075,7 +8423,9 @@ discard block |
||
8075 | 8423 | date_default_timezone_set($globalTimezone); |
8076 | 8424 | $datetime = new DateTime(); |
8077 | 8425 | $offset = $datetime->format('P'); |
8078 | - } else $offset = '+00:00'; |
|
8426 | + } else { |
|
8427 | + $offset = '+00:00'; |
|
8428 | + } |
|
8079 | 8429 | $filter_query = $this->getFilter($filters,true,true); |
8080 | 8430 | |
8081 | 8431 | if ($globalDBdriver == 'mysql') { |
@@ -8122,7 +8472,9 @@ discard block |
||
8122 | 8472 | date_default_timezone_set($globalTimezone); |
8123 | 8473 | $datetime = new DateTime(); |
8124 | 8474 | $offset = $datetime->format('P'); |
8125 | - } else $offset = '+00:00'; |
|
8475 | + } else { |
|
8476 | + $offset = '+00:00'; |
|
8477 | + } |
|
8126 | 8478 | |
8127 | 8479 | if ($globalDBdriver == 'mysql') { |
8128 | 8480 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
@@ -8168,7 +8520,9 @@ discard block |
||
8168 | 8520 | date_default_timezone_set($globalTimezone); |
8169 | 8521 | $datetime = new DateTime(); |
8170 | 8522 | $offset = $datetime->format('P'); |
8171 | - } else $offset = '+00:00'; |
|
8523 | + } else { |
|
8524 | + $offset = '+00:00'; |
|
8525 | + } |
|
8172 | 8526 | $filter_query = $this->getFilter($filters,true,true); |
8173 | 8527 | |
8174 | 8528 | if ($globalDBdriver == 'mysql') { |
@@ -8215,7 +8569,9 @@ discard block |
||
8215 | 8569 | date_default_timezone_set($globalTimezone); |
8216 | 8570 | $datetime = new DateTime(); |
8217 | 8571 | $offset = $datetime->format('P'); |
8218 | - } else $offset = '+00:00'; |
|
8572 | + } else { |
|
8573 | + $offset = '+00:00'; |
|
8574 | + } |
|
8219 | 8575 | |
8220 | 8576 | if ($globalDBdriver == 'mysql') { |
8221 | 8577 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
@@ -8262,7 +8618,9 @@ discard block |
||
8262 | 8618 | date_default_timezone_set($globalTimezone); |
8263 | 8619 | $datetime = new DateTime(); |
8264 | 8620 | $offset = $datetime->format('P'); |
8265 | - } else $offset = '+00:00'; |
|
8621 | + } else { |
|
8622 | + $offset = '+00:00'; |
|
8623 | + } |
|
8266 | 8624 | |
8267 | 8625 | if ($globalDBdriver == 'mysql') { |
8268 | 8626 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
@@ -8307,7 +8665,9 @@ discard block |
||
8307 | 8665 | date_default_timezone_set($globalTimezone); |
8308 | 8666 | $datetime = new DateTime(); |
8309 | 8667 | $offset = $datetime->format('P'); |
8310 | - } else $offset = '+00:00'; |
|
8668 | + } else { |
|
8669 | + $offset = '+00:00'; |
|
8670 | + } |
|
8311 | 8671 | $filter_query = $this->getFilter($filters,true,true); |
8312 | 8672 | |
8313 | 8673 | if ($globalDBdriver == 'mysql') { |
@@ -8355,7 +8715,9 @@ discard block |
||
8355 | 8715 | date_default_timezone_set($globalTimezone); |
8356 | 8716 | $datetime = new DateTime(); |
8357 | 8717 | $offset = $datetime->format('P'); |
8358 | - } else $offset = '+00:00'; |
|
8718 | + } else { |
|
8719 | + $offset = '+00:00'; |
|
8720 | + } |
|
8359 | 8721 | |
8360 | 8722 | if ($globalDBdriver == 'mysql') { |
8361 | 8723 | $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
@@ -8401,7 +8763,9 @@ discard block |
||
8401 | 8763 | date_default_timezone_set($globalTimezone); |
8402 | 8764 | $datetime = new DateTime(); |
8403 | 8765 | $offset = $datetime->format('P'); |
8404 | - } else $offset = '+00:00'; |
|
8766 | + } else { |
|
8767 | + $offset = '+00:00'; |
|
8768 | + } |
|
8405 | 8769 | $filter_query = $this->getFilter($filters,true,true); |
8406 | 8770 | |
8407 | 8771 | if ($globalDBdriver == 'mysql') { |
@@ -8449,7 +8813,9 @@ discard block |
||
8449 | 8813 | date_default_timezone_set($globalTimezone); |
8450 | 8814 | $datetime = new DateTime(); |
8451 | 8815 | $offset = $datetime->format('P'); |
8452 | - } else $offset = '+00:00'; |
|
8816 | + } else { |
|
8817 | + $offset = '+00:00'; |
|
8818 | + } |
|
8453 | 8819 | |
8454 | 8820 | if ($globalDBdriver == 'mysql') { |
8455 | 8821 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
@@ -8496,7 +8862,9 @@ discard block |
||
8496 | 8862 | date_default_timezone_set($globalTimezone); |
8497 | 8863 | $datetime = new DateTime(); |
8498 | 8864 | $offset = $datetime->format('P'); |
8499 | - } else $offset = '+00:00'; |
|
8865 | + } else { |
|
8866 | + $offset = '+00:00'; |
|
8867 | + } |
|
8500 | 8868 | $filter_query = $this->getFilter($filters,true,true); |
8501 | 8869 | if ($globalDBdriver == 'mysql') { |
8502 | 8870 | $query = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -8545,7 +8913,9 @@ discard block |
||
8545 | 8913 | date_default_timezone_set($globalTimezone); |
8546 | 8914 | $datetime = new DateTime(); |
8547 | 8915 | $offset = $datetime->format('P'); |
8548 | - } else $offset = '+00:00'; |
|
8916 | + } else { |
|
8917 | + $offset = '+00:00'; |
|
8918 | + } |
|
8549 | 8919 | |
8550 | 8920 | $orderby_sql = ''; |
8551 | 8921 | if ($orderby == "hour") |
@@ -8611,7 +8981,9 @@ discard block |
||
8611 | 8981 | date_default_timezone_set($globalTimezone); |
8612 | 8982 | $datetime = new DateTime(); |
8613 | 8983 | $offset = $datetime->format('P'); |
8614 | - } else $offset = '+00:00'; |
|
8984 | + } else { |
|
8985 | + $offset = '+00:00'; |
|
8986 | + } |
|
8615 | 8987 | |
8616 | 8988 | $orderby_sql = ''; |
8617 | 8989 | if ($orderby == "hour") |
@@ -8678,7 +9050,9 @@ discard block |
||
8678 | 9050 | date_default_timezone_set($globalTimezone); |
8679 | 9051 | $datetime = new DateTime(); |
8680 | 9052 | $offset = $datetime->format('P'); |
8681 | - } else $offset = '+00:00'; |
|
9053 | + } else { |
|
9054 | + $offset = '+00:00'; |
|
9055 | + } |
|
8682 | 9056 | |
8683 | 9057 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
8684 | 9058 | |
@@ -8729,7 +9103,9 @@ discard block |
||
8729 | 9103 | date_default_timezone_set($globalTimezone); |
8730 | 9104 | $datetime = new DateTime(); |
8731 | 9105 | $offset = $datetime->format('P'); |
8732 | - } else $offset = '+00:00'; |
|
9106 | + } else { |
|
9107 | + $offset = '+00:00'; |
|
9108 | + } |
|
8733 | 9109 | |
8734 | 9110 | if ($globalDBdriver == 'mysql') { |
8735 | 9111 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -8776,7 +9152,9 @@ discard block |
||
8776 | 9152 | date_default_timezone_set($globalTimezone); |
8777 | 9153 | $datetime = new DateTime(); |
8778 | 9154 | $offset = $datetime->format('P'); |
8779 | - } else $offset = '+00:00'; |
|
9155 | + } else { |
|
9156 | + $offset = '+00:00'; |
|
9157 | + } |
|
8780 | 9158 | |
8781 | 9159 | if ($globalDBdriver == 'mysql') { |
8782 | 9160 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -8823,7 +9201,9 @@ discard block |
||
8823 | 9201 | date_default_timezone_set($globalTimezone); |
8824 | 9202 | $datetime = new DateTime(); |
8825 | 9203 | $offset = $datetime->format('P'); |
8826 | - } else $offset = '+00:00'; |
|
9204 | + } else { |
|
9205 | + $offset = '+00:00'; |
|
9206 | + } |
|
8827 | 9207 | |
8828 | 9208 | if ($globalDBdriver == 'mysql') { |
8829 | 9209 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -8871,7 +9251,9 @@ discard block |
||
8871 | 9251 | date_default_timezone_set($globalTimezone); |
8872 | 9252 | $datetime = new DateTime(); |
8873 | 9253 | $offset = $datetime->format('P'); |
8874 | - } else $offset = '+00:00'; |
|
9254 | + } else { |
|
9255 | + $offset = '+00:00'; |
|
9256 | + } |
|
8875 | 9257 | |
8876 | 9258 | if ($globalDBdriver == 'mysql') { |
8877 | 9259 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -8919,7 +9301,9 @@ discard block |
||
8919 | 9301 | date_default_timezone_set($globalTimezone); |
8920 | 9302 | $datetime = new DateTime($date); |
8921 | 9303 | $offset = $datetime->format('P'); |
8922 | - } else $offset = '+00:00'; |
|
9304 | + } else { |
|
9305 | + $offset = '+00:00'; |
|
9306 | + } |
|
8923 | 9307 | |
8924 | 9308 | if ($globalDBdriver == 'mysql') { |
8925 | 9309 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -8967,7 +9351,9 @@ discard block |
||
8967 | 9351 | date_default_timezone_set($globalTimezone); |
8968 | 9352 | $datetime = new DateTime(); |
8969 | 9353 | $offset = $datetime->format('P'); |
8970 | - } else $offset = '+00:00'; |
|
9354 | + } else { |
|
9355 | + $offset = '+00:00'; |
|
9356 | + } |
|
8971 | 9357 | |
8972 | 9358 | if ($globalDBdriver == 'mysql') { |
8973 | 9359 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9017,7 +9403,9 @@ discard block |
||
9017 | 9403 | date_default_timezone_set($globalTimezone); |
9018 | 9404 | $datetime = new DateTime(); |
9019 | 9405 | $offset = $datetime->format('P'); |
9020 | - } else $offset = '+00:00'; |
|
9406 | + } else { |
|
9407 | + $offset = '+00:00'; |
|
9408 | + } |
|
9021 | 9409 | |
9022 | 9410 | if ($globalDBdriver == 'mysql') { |
9023 | 9411 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9064,7 +9452,9 @@ discard block |
||
9064 | 9452 | date_default_timezone_set($globalTimezone); |
9065 | 9453 | $datetime = new DateTime(); |
9066 | 9454 | $offset = $datetime->format('P'); |
9067 | - } else $offset = '+00:00'; |
|
9455 | + } else { |
|
9456 | + $offset = '+00:00'; |
|
9457 | + } |
|
9068 | 9458 | |
9069 | 9459 | if ($globalDBdriver == 'mysql') { |
9070 | 9460 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9232,7 +9622,9 @@ discard block |
||
9232 | 9622 | date_default_timezone_set($globalTimezone); |
9233 | 9623 | $datetime = new DateTime(); |
9234 | 9624 | $offset = $datetime->format('P'); |
9235 | - } else $offset = '+00:00'; |
|
9625 | + } else { |
|
9626 | + $offset = '+00:00'; |
|
9627 | + } |
|
9236 | 9628 | |
9237 | 9629 | if ($globalDBdriver == 'mysql') { |
9238 | 9630 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9418,7 +9810,9 @@ discard block |
||
9418 | 9810 | */ |
9419 | 9811 | public function parseDirection($direction = 0) |
9420 | 9812 | { |
9421 | - if ($direction == '') $direction = 0; |
|
9813 | + if ($direction == '') { |
|
9814 | + $direction = 0; |
|
9815 | + } |
|
9422 | 9816 | $direction_array = array(); |
9423 | 9817 | $temp_array = array(); |
9424 | 9818 | |
@@ -9519,7 +9913,9 @@ discard block |
||
9519 | 9913 | if (isset($result->AirlineFlightInfoResult)) |
9520 | 9914 | { |
9521 | 9915 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
9522 | - } else return ''; |
|
9916 | + } else { |
|
9917 | + return ''; |
|
9918 | + } |
|
9523 | 9919 | |
9524 | 9920 | $registration = $this->convertAircraftRegistration($registration); |
9525 | 9921 | |
@@ -9548,7 +9944,9 @@ discard block |
||
9548 | 9944 | if (count($row) > 0) { |
9549 | 9945 | //return $row['Registration']; |
9550 | 9946 | return $row['registration']; |
9551 | - } else return ''; |
|
9947 | + } else { |
|
9948 | + return ''; |
|
9949 | + } |
|
9552 | 9950 | |
9553 | 9951 | } |
9554 | 9952 | |
@@ -9571,9 +9969,14 @@ discard block |
||
9571 | 9969 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
9572 | 9970 | $sth->closeCursor(); |
9573 | 9971 | if (count($row) > 0) { |
9574 | - if ($row['type_flight'] == null) return ''; |
|
9575 | - else return $row['type_flight']; |
|
9576 | - } else return ''; |
|
9972 | + if ($row['type_flight'] == null) { |
|
9973 | + return ''; |
|
9974 | + } else { |
|
9975 | + return $row['type_flight']; |
|
9976 | + } |
|
9977 | + } else { |
|
9978 | + return ''; |
|
9979 | + } |
|
9577 | 9980 | |
9578 | 9981 | } |
9579 | 9982 | |
@@ -9591,7 +9994,9 @@ discard block |
||
9591 | 9994 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
9592 | 9995 | |
9593 | 9996 | $Connection = new Connection($this->db); |
9594 | - if (!$Connection->tableExists('countries')) return ''; |
|
9997 | + if (!$Connection->tableExists('countries')) { |
|
9998 | + return ''; |
|
9999 | + } |
|
9595 | 10000 | |
9596 | 10001 | try { |
9597 | 10002 | /* |
@@ -9611,9 +10016,13 @@ discard block |
||
9611 | 10016 | $sth->closeCursor(); |
9612 | 10017 | if (count($row) > 0) { |
9613 | 10018 | return $row; |
9614 | - } else return ''; |
|
10019 | + } else { |
|
10020 | + return ''; |
|
10021 | + } |
|
9615 | 10022 | } catch (PDOException $e) { |
9616 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
10023 | + if (isset($globalDebug) && $globalDebug) { |
|
10024 | + echo 'Error : '.$e->getMessage()."\n"; |
|
10025 | + } |
|
9617 | 10026 | return ''; |
9618 | 10027 | } |
9619 | 10028 | |
@@ -9761,7 +10170,9 @@ discard block |
||
9761 | 10170 | { |
9762 | 10171 | global $globalBitlyAccessToken; |
9763 | 10172 | |
9764 | - if ($globalBitlyAccessToken == '') return $url; |
|
10173 | + if ($globalBitlyAccessToken == '') { |
|
10174 | + return $url; |
|
10175 | + } |
|
9765 | 10176 | |
9766 | 10177 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
9767 | 10178 | |
@@ -9910,7 +10321,9 @@ discard block |
||
9910 | 10321 | |
9911 | 10322 | |
9912 | 10323 | // routes |
9913 | - if ($globalDebug) print "Routes...\n"; |
|
10324 | + if ($globalDebug) { |
|
10325 | + print "Routes...\n"; |
|
10326 | + } |
|
9914 | 10327 | if ($globalDBdriver == 'mysql') { |
9915 | 10328 | $query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
9916 | 10329 | } else { |
@@ -9929,7 +10342,9 @@ discard block |
||
9929 | 10342 | } |
9930 | 10343 | } |
9931 | 10344 | |
9932 | - if ($globalDebug) print "Airlines...\n"; |
|
10345 | + if ($globalDebug) { |
|
10346 | + print "Airlines...\n"; |
|
10347 | + } |
|
9933 | 10348 | //airlines |
9934 | 10349 | if ($globalDBdriver == 'mysql') { |
9935 | 10350 | $query = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
@@ -9943,10 +10358,15 @@ discard block |
||
9943 | 10358 | if (is_numeric(substr($row['ident'], -1, 1))) |
9944 | 10359 | { |
9945 | 10360 | $fromsource = NULL; |
9946 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
9947 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
9948 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
9949 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
10361 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
10362 | + $fromsource = 'vatsim'; |
|
10363 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
10364 | + $fromsource = 'ivao'; |
|
10365 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
10366 | + $fromsource = 'vatsim'; |
|
10367 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
10368 | + $fromsource = 'ivao'; |
|
10369 | + } |
|
9950 | 10370 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
9951 | 10371 | if (isset($airline_array[0]['name'])) { |
9952 | 10372 | $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
@@ -9956,13 +10376,17 @@ discard block |
||
9956 | 10376 | } |
9957 | 10377 | } |
9958 | 10378 | |
9959 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
10379 | + if ($globalDebug) { |
|
10380 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
10381 | + } |
|
9960 | 10382 | //duplicate modes |
9961 | 10383 | $query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL"; |
9962 | 10384 | $sth = $this->db->prepare($query); |
9963 | 10385 | $sth->execute(); |
9964 | 10386 | |
9965 | - if ($globalDebug) print "Aircraft...\n"; |
|
10387 | + if ($globalDebug) { |
|
10388 | + print "Aircraft...\n"; |
|
10389 | + } |
|
9966 | 10390 | //aircraft |
9967 | 10391 | if ($globalDBdriver == 'mysql') { |
9968 | 10392 | $query = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -10005,26 +10429,38 @@ discard block |
||
10005 | 10429 | if (isset($closestAirports[0])) { |
10006 | 10430 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
10007 | 10431 | $airport_icao = $closestAirports[0]['icao']; |
10008 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
10432 | + if ($globalDebug) { |
|
10433 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
10434 | + } |
|
10009 | 10435 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
10010 | 10436 | foreach ($closestAirports as $airport) { |
10011 | 10437 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
10012 | 10438 | $airport_icao = $airport['icao']; |
10013 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
10439 | + if ($globalDebug) { |
|
10440 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
10441 | + } |
|
10014 | 10442 | break; |
10015 | 10443 | } |
10016 | 10444 | } |
10017 | 10445 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
10018 | 10446 | $airport_icao = $closestAirports[0]['icao']; |
10019 | - if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
10447 | + if ($globalDebug) { |
|
10448 | + echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
10449 | + } |
|
10020 | 10450 | } else { |
10021 | - if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
10451 | + if ($globalDebug) { |
|
10452 | + echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
10453 | + } |
|
10022 | 10454 | } |
10023 | 10455 | } else { |
10024 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
10456 | + if ($globalDebug) { |
|
10457 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
10458 | + } |
|
10025 | 10459 | } |
10026 | 10460 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
10027 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
10461 | + if ($globalDebug) { |
|
10462 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
10463 | + } |
|
10028 | 10464 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
10029 | 10465 | $sthu = $this->db->prepare($update_query); |
10030 | 10466 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |