@@ -69,7 +69,9 @@ discard block |
||
69 | 69 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
70 | 70 | } |
71 | 71 | } |
72 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
72 | + if (is_array($globalFilter)) { |
|
73 | + $filter = array_merge($filter,$globalFilter); |
|
74 | + } |
|
73 | 75 | $filter_query_join = ''; |
74 | 76 | $filter_query_where = ''; |
75 | 77 | foreach($filters as $flt) { |
@@ -122,8 +124,11 @@ discard block |
||
122 | 124 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
123 | 125 | } |
124 | 126 | } |
125 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
126 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
127 | + if ($filter_query_where == '' && $where) { |
|
128 | + $filter_query_where = ' WHERE'; |
|
129 | + } elseif ($filter_query_where != '' && $and) { |
|
130 | + $filter_query_where .= ' AND'; |
|
131 | + } |
|
127 | 132 | $filter_query = $filter_query_join.$filter_query_where; |
128 | 133 | return $filter_query; |
129 | 134 | } |
@@ -143,10 +148,18 @@ discard block |
||
143 | 148 | $Image = new Image($this->db); |
144 | 149 | $Schedule = new Schedule($this->db); |
145 | 150 | $ACARS = new ACARS($this->db); |
146 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
147 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
148 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
149 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
151 | + if (!isset($globalIVAO)) { |
|
152 | + $globalIVAO = FALSE; |
|
153 | + } |
|
154 | + if (!isset($globalVATSIM)) { |
|
155 | + $globalVATSIM = FALSE; |
|
156 | + } |
|
157 | + if (!isset($globalphpVMS)) { |
|
158 | + $globalphpVMS = FALSE; |
|
159 | + } |
|
160 | + if (!isset($globalVAM)) { |
|
161 | + $globalVAM = FALSE; |
|
162 | + } |
|
150 | 163 | date_default_timezone_set('UTC'); |
151 | 164 | |
152 | 165 | if (!is_string($query)) |
@@ -193,21 +206,35 @@ discard block |
||
193 | 206 | } else { |
194 | 207 | $temp_array['spotter_id'] = ''; |
195 | 208 | } |
196 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
197 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
209 | + if (isset($row['flightaware_id'])) { |
|
210 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
211 | + } |
|
212 | + if (isset($row['modes'])) { |
|
213 | + $temp_array['modes'] = $row['modes']; |
|
214 | + } |
|
198 | 215 | $temp_array['ident'] = $row['ident']; |
199 | 216 | if (isset($row['registration']) && $row['registration'] != '') { |
200 | 217 | $temp_array['registration'] = $row['registration']; |
201 | 218 | } elseif (isset($temp_array['modes'])) { |
202 | 219 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
203 | - } else $temp_array['registration'] = ''; |
|
204 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
220 | + } else { |
|
221 | + $temp_array['registration'] = ''; |
|
222 | + } |
|
223 | + if (isset($row['aircraft_icao'])) { |
|
224 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
225 | + } |
|
205 | 226 | |
206 | 227 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
207 | 228 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
208 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
209 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
210 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
229 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
230 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
231 | + } |
|
232 | + if (isset($row['latitude'])) { |
|
233 | + $temp_array['latitude'] = $row['latitude']; |
|
234 | + } |
|
235 | + if (isset($row['longitude'])) { |
|
236 | + $temp_array['longitude'] = $row['longitude']; |
|
237 | + } |
|
211 | 238 | /* |
212 | 239 | if (Connection->tableExists('countries')) { |
213 | 240 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -217,8 +244,12 @@ discard block |
||
217 | 244 | } |
218 | 245 | } |
219 | 246 | */ |
220 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
221 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
247 | + if (isset($row['waypoints'])) { |
|
248 | + $temp_array['waypoints'] = $row['waypoints']; |
|
249 | + } |
|
250 | + if (isset($row['format_source'])) { |
|
251 | + $temp_array['format_source'] = $row['format_source']; |
|
252 | + } |
|
222 | 253 | if (isset($row['route_stop'])) { |
223 | 254 | $temp_array['route_stop'] = $row['route_stop']; |
224 | 255 | if ($row['route_stop'] != '') { |
@@ -237,13 +268,19 @@ discard block |
||
237 | 268 | } |
238 | 269 | } |
239 | 270 | } |
240 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
271 | + if (isset($row['altitude'])) { |
|
272 | + $temp_array['altitude'] = $row['altitude']; |
|
273 | + } |
|
241 | 274 | if (isset($row['heading'])) { |
242 | 275 | $temp_array['heading'] = $row['heading']; |
243 | 276 | $heading_direction = $this->parseDirection($row['heading']); |
244 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
277 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
278 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
279 | + } |
|
280 | + } |
|
281 | + if (isset($row['ground_speed'])) { |
|
282 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
245 | 283 | } |
246 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
247 | 284 | $temp_array['image'] = ""; |
248 | 285 | $temp_array['image_thumbnail'] = ""; |
249 | 286 | $temp_array['image_source'] = ""; |
@@ -251,7 +288,9 @@ discard block |
||
251 | 288 | |
252 | 289 | if (isset($row['highlight'])) { |
253 | 290 | $temp_array['highlight'] = $row['highlight']; |
254 | - } else $temp_array['highlight'] = ''; |
|
291 | + } else { |
|
292 | + $temp_array['highlight'] = ''; |
|
293 | + } |
|
255 | 294 | |
256 | 295 | if (isset($row['date'])) { |
257 | 296 | $dateArray = $this->parseDateString($row['date']); |
@@ -299,7 +338,9 @@ discard block |
||
299 | 338 | |
300 | 339 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
301 | 340 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
302 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
341 | + } else { |
|
342 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
343 | + } |
|
303 | 344 | } else { |
304 | 345 | $temp_array['aircraft_shadow'] = 'default.png'; |
305 | 346 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -307,11 +348,17 @@ discard block |
||
307 | 348 | } |
308 | 349 | } |
309 | 350 | $fromsource = NULL; |
310 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
311 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
312 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
313 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
314 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
351 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
352 | + $fromsource = $globalAirlinesSource; |
|
353 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
354 | + $fromsource = 'vatsim'; |
|
355 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
356 | + $fromsource = 'ivao'; |
|
357 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
358 | + $fromsource = 'vatsim'; |
|
359 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
360 | + $fromsource = 'ivao'; |
|
361 | + } |
|
315 | 362 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
316 | 363 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
317 | 364 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -334,12 +381,18 @@ discard block |
||
334 | 381 | } |
335 | 382 | } else { |
336 | 383 | $temp_array['airline_icao'] = $row['airline_icao']; |
337 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
338 | - else $temp_array['airline_iata'] = 'N/A'; |
|
384 | + if (isset($row['airline_iata'])) { |
|
385 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
386 | + } else { |
|
387 | + $temp_array['airline_iata'] = 'N/A'; |
|
388 | + } |
|
339 | 389 | $temp_array['airline_name'] = $row['airline_name']; |
340 | 390 | $temp_array['airline_country'] = $row['airline_country']; |
341 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
342 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
391 | + if (isset($row['airline_callsign'])) { |
|
392 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
393 | + } else { |
|
394 | + $temp_array['airline_callsign'] = 'N/A'; |
|
395 | + } |
|
343 | 396 | $temp_array['airline_type'] = $row['airline_type']; |
344 | 397 | if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') { |
345 | 398 | $airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']); |
@@ -366,7 +419,9 @@ discard block |
||
366 | 419 | } |
367 | 420 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
368 | 421 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
369 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
422 | + if ($owner_info['owner'] != '') { |
|
423 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
424 | + } |
|
370 | 425 | $temp_array['aircraft_base'] = $owner_info['base']; |
371 | 426 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
372 | 427 | } |
@@ -374,9 +429,14 @@ discard block |
||
374 | 429 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
375 | 430 | { |
376 | 431 | if ($globalIVAO) { |
377 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
378 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
379 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
432 | + if (isset($temp_array['airline_icao'])) { |
|
433 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
434 | + } else { |
|
435 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
436 | + } |
|
437 | + } else { |
|
438 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
439 | + } |
|
380 | 440 | if (count($image_array) > 0) { |
381 | 441 | $temp_array['image'] = $image_array[0]['image']; |
382 | 442 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -428,7 +488,9 @@ discard block |
||
428 | 488 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
429 | 489 | if ($row['departure_airport_icao'] != '') { |
430 | 490 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
431 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
491 | + if (!isset($departure_airport_array[0]['name'])) { |
|
492 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
493 | + } |
|
432 | 494 | /* |
433 | 495 | } elseif ($row['departure_airport_name'] != '') { |
434 | 496 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -436,7 +498,9 @@ discard block |
||
436 | 498 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
437 | 499 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
438 | 500 | */ |
439 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
501 | + } else { |
|
502 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
503 | + } |
|
440 | 504 | if (isset($departure_airport_array[0]['name'])) { |
441 | 505 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
442 | 506 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -456,8 +520,12 @@ discard block |
||
456 | 520 | |
457 | 521 | if ($row['arrival_airport_icao'] != '') { |
458 | 522 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
459 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
460 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
523 | + if (count($arrival_airport_array) == 0) { |
|
524 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
525 | + } |
|
526 | + } else { |
|
527 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
528 | + } |
|
461 | 529 | if (isset($arrival_airport_array[0]['name'])) { |
462 | 530 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
463 | 531 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -473,27 +541,45 @@ discard block |
||
473 | 541 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
474 | 542 | } |
475 | 543 | */ |
476 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
477 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
478 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
479 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
480 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
544 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
545 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
546 | + } |
|
547 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
548 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
549 | + } |
|
550 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
551 | + $temp_array['source_name'] = $row['source_name']; |
|
552 | + } |
|
553 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
554 | + $temp_array['over_country'] = $row['over_country']; |
|
555 | + } |
|
556 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
557 | + $temp_array['distance'] = $row['distance']; |
|
558 | + } |
|
481 | 559 | if (isset($row['squawk'])) { |
482 | 560 | $temp_array['squawk'] = $row['squawk']; |
483 | 561 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
484 | 562 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
485 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
563 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
564 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
565 | + } |
|
486 | 566 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
487 | 567 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
488 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
489 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
568 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
569 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
570 | + } |
|
571 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
572 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
573 | + } |
|
490 | 574 | } |
491 | 575 | |
492 | 576 | $temp_array['query_number_rows'] = $num_rows; |
493 | 577 | |
494 | 578 | $spotter_array[] = $temp_array; |
495 | 579 | } |
496 | - if ($num_rows == 0) return array(); |
|
580 | + if ($num_rows == 0) { |
|
581 | + return array(); |
|
582 | + } |
|
497 | 583 | $spotter_array[0]['query_number_rows'] = $num_rows; |
498 | 584 | return $spotter_array; |
499 | 585 | } |
@@ -526,7 +612,9 @@ discard block |
||
526 | 612 | foreach ($q_array as $q_item){ |
527 | 613 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
528 | 614 | $additional_query .= " AND ("; |
529 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
615 | + if (is_int($q_item)) { |
|
616 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
617 | + } |
|
530 | 618 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
531 | 619 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
532 | 620 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -547,7 +635,9 @@ discard block |
||
547 | 635 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
548 | 636 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
549 | 637 | $translate = $Translation->ident2icao($q_item); |
550 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
638 | + if ($translate != $q_item) { |
|
639 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
640 | + } |
|
551 | 641 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
552 | 642 | $additional_query .= ")"; |
553 | 643 | } |
@@ -774,7 +864,9 @@ discard block |
||
774 | 864 | date_default_timezone_set($globalTimezone); |
775 | 865 | $datetime = new DateTime(); |
776 | 866 | $offset = $datetime->format('P'); |
777 | - } else $offset = '+00:00'; |
|
867 | + } else { |
|
868 | + $offset = '+00:00'; |
|
869 | + } |
|
778 | 870 | |
779 | 871 | if ($date_array[1] != "") |
780 | 872 | { |
@@ -806,8 +898,12 @@ discard block |
||
806 | 898 | { |
807 | 899 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
808 | 900 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
809 | - } else $limit_query = ""; |
|
810 | - } else $limit_query = ""; |
|
901 | + } else { |
|
902 | + $limit_query = ""; |
|
903 | + } |
|
904 | + } else { |
|
905 | + $limit_query = ""; |
|
906 | + } |
|
811 | 907 | |
812 | 908 | |
813 | 909 | if ($sort != "") |
@@ -875,8 +971,12 @@ discard block |
||
875 | 971 | { |
876 | 972 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
877 | 973 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
878 | - } else $limit_query = ""; |
|
879 | - } else $limit_query = ""; |
|
974 | + } else { |
|
975 | + $limit_query = ""; |
|
976 | + } |
|
977 | + } else { |
|
978 | + $limit_query = ""; |
|
979 | + } |
|
880 | 980 | |
881 | 981 | if ($sort != "") |
882 | 982 | { |
@@ -1200,7 +1300,9 @@ discard block |
||
1200 | 1300 | global $global_query; |
1201 | 1301 | |
1202 | 1302 | date_default_timezone_set('UTC'); |
1203 | - if ($id == '') return array(); |
|
1303 | + if ($id == '') { |
|
1304 | + return array(); |
|
1305 | + } |
|
1204 | 1306 | $additional_query = "spotter_output.spotter_id = :id"; |
1205 | 1307 | $query_values = array(':id' => $id); |
1206 | 1308 | |
@@ -1937,7 +2039,9 @@ discard block |
||
1937 | 2039 | { |
1938 | 2040 | $highlight = $row['highlight']; |
1939 | 2041 | } |
1940 | - if (isset($highlight)) return $highlight; |
|
2042 | + if (isset($highlight)) { |
|
2043 | + return $highlight; |
|
2044 | + } |
|
1941 | 2045 | } |
1942 | 2046 | |
1943 | 2047 | |
@@ -1965,7 +2069,9 @@ discard block |
||
1965 | 2069 | $sth->closeCursor(); |
1966 | 2070 | if (count($row) > 0) { |
1967 | 2071 | return $row['usage']; |
1968 | - } else return ''; |
|
2072 | + } else { |
|
2073 | + return ''; |
|
2074 | + } |
|
1969 | 2075 | } |
1970 | 2076 | |
1971 | 2077 | /** |
@@ -1990,7 +2096,9 @@ discard block |
||
1990 | 2096 | $sth->closeCursor(); |
1991 | 2097 | if (count($row) > 0) { |
1992 | 2098 | return $row['icao']; |
1993 | - } else return ''; |
|
2099 | + } else { |
|
2100 | + return ''; |
|
2101 | + } |
|
1994 | 2102 | } |
1995 | 2103 | |
1996 | 2104 | /** |
@@ -2018,7 +2126,9 @@ discard block |
||
2018 | 2126 | $airport_longitude = $row['longitude']; |
2019 | 2127 | $Common = new Common(); |
2020 | 2128 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
2021 | - } else return ''; |
|
2129 | + } else { |
|
2130 | + return ''; |
|
2131 | + } |
|
2022 | 2132 | } |
2023 | 2133 | |
2024 | 2134 | /** |
@@ -2130,7 +2240,9 @@ discard block |
||
2130 | 2240 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2131 | 2241 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2132 | 2242 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2133 | - } else return array(); |
|
2243 | + } else { |
|
2244 | + return array(); |
|
2245 | + } |
|
2134 | 2246 | if ($globalDBdriver == 'mysql') { |
2135 | 2247 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
2136 | 2248 | } else { |
@@ -2165,7 +2277,9 @@ discard block |
||
2165 | 2277 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2166 | 2278 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2167 | 2279 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2168 | - } else return array(); |
|
2280 | + } else { |
|
2281 | + return array(); |
|
2282 | + } |
|
2169 | 2283 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
2170 | 2284 | $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.")"; |
2171 | 2285 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2200,7 +2314,9 @@ discard block |
||
2200 | 2314 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
2201 | 2315 | { |
2202 | 2316 | global $globalUseRealAirlines; |
2203 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
2317 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
2318 | + $fromsource = NULL; |
|
2319 | + } |
|
2204 | 2320 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
2205 | 2321 | if ($airline_icao == 'NA') { |
2206 | 2322 | $airline_array = array(); |
@@ -2269,7 +2385,9 @@ discard block |
||
2269 | 2385 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
2270 | 2386 | { |
2271 | 2387 | global $globalUseRealAirlines; |
2272 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
2388 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
2389 | + $fromsource = NULL; |
|
2390 | + } |
|
2273 | 2391 | $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
2274 | 2392 | $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
2275 | 2393 | $sth = $this->db->prepare($query); |
@@ -2285,7 +2403,9 @@ discard block |
||
2285 | 2403 | $sth->execute(array(':fromsource' => $fromsource)); |
2286 | 2404 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2287 | 2405 | $sth->closeCursor(); |
2288 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name); |
|
2406 | + if ($row['nb'] == 0) { |
|
2407 | + $result = $this->getAllAirlineInfoByName($airline_name); |
|
2408 | + } |
|
2289 | 2409 | } |
2290 | 2410 | return $result; |
2291 | 2411 | } |
@@ -2348,15 +2468,20 @@ discard block |
||
2348 | 2468 | 'A320-211' => 'A320', |
2349 | 2469 | '747-8i' => 'B748', |
2350 | 2470 | 'A380' => 'A388'); |
2351 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
2471 | + if (isset($all_aircraft[$aircraft_type])) { |
|
2472 | + return $all_aircraft[$aircraft_type]; |
|
2473 | + } |
|
2352 | 2474 | |
2353 | 2475 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
2354 | 2476 | $aircraft_type = strtoupper($aircraft_type); |
2355 | 2477 | $sth = $this->db->prepare($query); |
2356 | 2478 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
2357 | 2479 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
2358 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
2359 | - else return ''; |
|
2480 | + if (isset($result[0]['icao'])) { |
|
2481 | + return $result[0]['icao']; |
|
2482 | + } else { |
|
2483 | + return ''; |
|
2484 | + } |
|
2360 | 2485 | } |
2361 | 2486 | |
2362 | 2487 | /** |
@@ -2379,9 +2504,13 @@ discard block |
||
2379 | 2504 | $sth->closeCursor(); |
2380 | 2505 | if (isset($row['icaotypecode'])) { |
2381 | 2506 | $icao = $row['icaotypecode']; |
2382 | - if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao]; |
|
2507 | + if (isset($this->aircraft_correct_icaotype[$icao])) { |
|
2508 | + $icao = $this->aircraft_correct_icaotype[$icao]; |
|
2509 | + } |
|
2383 | 2510 | return $icao; |
2384 | - } else return ''; |
|
2511 | + } else { |
|
2512 | + return ''; |
|
2513 | + } |
|
2385 | 2514 | } |
2386 | 2515 | |
2387 | 2516 | /** |
@@ -2404,7 +2533,9 @@ discard block |
||
2404 | 2533 | $sth->closeCursor(); |
2405 | 2534 | if (isset($row['icaotypecode'])) { |
2406 | 2535 | return $row['icaotypecode']; |
2407 | - } else return ''; |
|
2536 | + } else { |
|
2537 | + return ''; |
|
2538 | + } |
|
2408 | 2539 | } |
2409 | 2540 | |
2410 | 2541 | /** |
@@ -2450,7 +2581,9 @@ discard block |
||
2450 | 2581 | $sth->closeCursor(); |
2451 | 2582 | if (isset($row['operator_correct'])) { |
2452 | 2583 | return $row['operator_correct']; |
2453 | - } else return $operator; |
|
2584 | + } else { |
|
2585 | + return $operator; |
|
2586 | + } |
|
2454 | 2587 | } |
2455 | 2588 | |
2456 | 2589 | /** |
@@ -2463,7 +2596,9 @@ discard block |
||
2463 | 2596 | public function getRouteInfo($callsign) |
2464 | 2597 | { |
2465 | 2598 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
2466 | - if ($callsign == '') return array(); |
|
2599 | + if ($callsign == '') { |
|
2600 | + return array(); |
|
2601 | + } |
|
2467 | 2602 | $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"; |
2468 | 2603 | |
2469 | 2604 | $sth = $this->db->prepare($query); |
@@ -2473,7 +2608,9 @@ discard block |
||
2473 | 2608 | $sth->closeCursor(); |
2474 | 2609 | if (count($row) > 0) { |
2475 | 2610 | return $row; |
2476 | - } else return array(); |
|
2611 | + } else { |
|
2612 | + return array(); |
|
2613 | + } |
|
2477 | 2614 | } |
2478 | 2615 | |
2479 | 2616 | /** |
@@ -2526,7 +2663,9 @@ discard block |
||
2526 | 2663 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
2527 | 2664 | $sth->closeCursor(); |
2528 | 2665 | return $result; |
2529 | - } else return array(); |
|
2666 | + } else { |
|
2667 | + return array(); |
|
2668 | + } |
|
2530 | 2669 | } |
2531 | 2670 | |
2532 | 2671 | |
@@ -2685,8 +2824,11 @@ discard block |
||
2685 | 2824 | $query .= " ORDER BY spotter_output.source_name ASC"; |
2686 | 2825 | |
2687 | 2826 | $sth = $this->db->prepare($query); |
2688 | - if (!empty($query_values)) $sth->execute($query_values); |
|
2689 | - else $sth->execute(); |
|
2827 | + if (!empty($query_values)) { |
|
2828 | + $sth->execute($query_values); |
|
2829 | + } else { |
|
2830 | + $sth->execute(); |
|
2831 | + } |
|
2690 | 2832 | |
2691 | 2833 | $source_array = array(); |
2692 | 2834 | $temp_array = array(); |
@@ -2719,9 +2861,13 @@ discard block |
||
2719 | 2861 | WHERE spotter_output.airline_icao <> '' |
2720 | 2862 | ORDER BY spotter_output.airline_name ASC"; |
2721 | 2863 | */ |
2722 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
2723 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
2724 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
2864 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
2865 | + $forsource = $globalAirlinesSource; |
|
2866 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
2867 | + $forsource = 'vatsim'; |
|
2868 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
2869 | + $forsource = 'ivao'; |
|
2870 | + } |
|
2725 | 2871 | if ($forsource === NULL) { |
2726 | 2872 | $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"; |
2727 | 2873 | $query_data = array(); |
@@ -2764,9 +2910,13 @@ discard block |
||
2764 | 2910 | { |
2765 | 2911 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
2766 | 2912 | $filter_query = $this->getFilter($filters,true,true); |
2767 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
2768 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
2769 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
2913 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
2914 | + $forsource = $globalAirlinesSource; |
|
2915 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
2916 | + $forsource = 'vatsim'; |
|
2917 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
2918 | + $forsource = 'ivao'; |
|
2919 | + } |
|
2770 | 2920 | if ($forsource === NULL) { |
2771 | 2921 | $query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC"; |
2772 | 2922 | $query_data = array(); |
@@ -3041,7 +3191,9 @@ discard block |
||
3041 | 3191 | date_default_timezone_set($globalTimezone); |
3042 | 3192 | $datetime = new DateTime(); |
3043 | 3193 | $offset = $datetime->format('P'); |
3044 | - } else $offset = '+00:00'; |
|
3194 | + } else { |
|
3195 | + $offset = '+00:00'; |
|
3196 | + } |
|
3045 | 3197 | if ($airport_icao == '') { |
3046 | 3198 | if ($globalDBdriver == 'mysql') { |
3047 | 3199 | $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' AND departure_airport_icao <> '' 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"; |
@@ -3073,7 +3225,9 @@ discard block |
||
3073 | 3225 | date_default_timezone_set($globalTimezone); |
3074 | 3226 | $datetime = new DateTime(); |
3075 | 3227 | $offset = $datetime->format('P'); |
3076 | - } else $offset = '+00:00'; |
|
3228 | + } else { |
|
3229 | + $offset = '+00:00'; |
|
3230 | + } |
|
3077 | 3231 | if ($airport_icao == '') { |
3078 | 3232 | if ($globalDBdriver == 'mysql') { |
3079 | 3233 | $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 departure_airport_icao <> '' 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"; |
@@ -3106,7 +3260,9 @@ discard block |
||
3106 | 3260 | date_default_timezone_set($globalTimezone); |
3107 | 3261 | $datetime = new DateTime(); |
3108 | 3262 | $offset = $datetime->format('P'); |
3109 | - } else $offset = '+00:00'; |
|
3263 | + } else { |
|
3264 | + $offset = '+00:00'; |
|
3265 | + } |
|
3110 | 3266 | if ($airport_icao == '') { |
3111 | 3267 | if ($globalDBdriver == 'mysql') { |
3112 | 3268 | $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 |
@@ -3145,7 +3301,9 @@ discard block |
||
3145 | 3301 | date_default_timezone_set($globalTimezone); |
3146 | 3302 | $datetime = new DateTime(); |
3147 | 3303 | $offset = $datetime->format('P'); |
3148 | - } else $offset = '+00:00'; |
|
3304 | + } else { |
|
3305 | + $offset = '+00:00'; |
|
3306 | + } |
|
3149 | 3307 | if ($airport_icao == '') { |
3150 | 3308 | if ($globalDBdriver == 'mysql') { |
3151 | 3309 | $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 |
@@ -3190,7 +3348,9 @@ discard block |
||
3190 | 3348 | date_default_timezone_set($globalTimezone); |
3191 | 3349 | $datetime = new DateTime(); |
3192 | 3350 | $offset = $datetime->format('P'); |
3193 | - } else $offset = '+00:00'; |
|
3351 | + } else { |
|
3352 | + $offset = '+00:00'; |
|
3353 | + } |
|
3194 | 3354 | if ($airport_icao == '') { |
3195 | 3355 | if ($globalDBdriver == 'mysql') { |
3196 | 3356 | $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' AND arrival_airport_icao <> '' 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"; |
@@ -3225,7 +3385,9 @@ discard block |
||
3225 | 3385 | date_default_timezone_set($globalTimezone); |
3226 | 3386 | $datetime = new DateTime(); |
3227 | 3387 | $offset = $datetime->format('P'); |
3228 | - } else $offset = '+00:00'; |
|
3388 | + } else { |
|
3389 | + $offset = '+00:00'; |
|
3390 | + } |
|
3229 | 3391 | if ($airport_icao == '') { |
3230 | 3392 | if ($globalDBdriver == 'mysql') { |
3231 | 3393 | $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 |
@@ -3267,7 +3429,9 @@ discard block |
||
3267 | 3429 | date_default_timezone_set($globalTimezone); |
3268 | 3430 | $datetime = new DateTime(); |
3269 | 3431 | $offset = $datetime->format('P'); |
3270 | - } else $offset = '+00:00'; |
|
3432 | + } else { |
|
3433 | + $offset = '+00:00'; |
|
3434 | + } |
|
3271 | 3435 | if ($airport_icao == '') { |
3272 | 3436 | if ($globalDBdriver == 'mysql') { |
3273 | 3437 | $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 arrival_airport_icao <> '' 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"; |
@@ -3301,7 +3465,9 @@ discard block |
||
3301 | 3465 | date_default_timezone_set($globalTimezone); |
3302 | 3466 | $datetime = new DateTime(); |
3303 | 3467 | $offset = $datetime->format('P'); |
3304 | - } else $offset = '+00:00'; |
|
3468 | + } else { |
|
3469 | + $offset = '+00:00'; |
|
3470 | + } |
|
3305 | 3471 | if ($airport_icao == '') { |
3306 | 3472 | if ($globalDBdriver == 'mysql') { |
3307 | 3473 | $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 |
@@ -3349,7 +3515,9 @@ discard block |
||
3349 | 3515 | date_default_timezone_set($globalTimezone); |
3350 | 3516 | $datetime = new DateTime(); |
3351 | 3517 | $offset = $datetime->format('P'); |
3352 | - } else $offset = '+00:00'; |
|
3518 | + } else { |
|
3519 | + $offset = '+00:00'; |
|
3520 | + } |
|
3353 | 3521 | |
3354 | 3522 | if ($globalDBdriver == 'mysql') { |
3355 | 3523 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3469,7 +3637,9 @@ discard block |
||
3469 | 3637 | */ |
3470 | 3638 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
3471 | 3639 | { |
3472 | - if ($groundspeed == '') $groundspeed = NULL; |
|
3640 | + if ($groundspeed == '') { |
|
3641 | + $groundspeed = NULL; |
|
3642 | + } |
|
3473 | 3643 | $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'; |
3474 | 3644 | $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); |
3475 | 3645 | |
@@ -3519,10 +3689,18 @@ discard block |
||
3519 | 3689 | $Image = new Image($this->db); |
3520 | 3690 | $Common = new Common(); |
3521 | 3691 | |
3522 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
3523 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
3524 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
3525 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
3692 | + if (!isset($globalIVAO)) { |
|
3693 | + $globalIVAO = FALSE; |
|
3694 | + } |
|
3695 | + if (!isset($globalVATSIM)) { |
|
3696 | + $globalVATSIM = FALSE; |
|
3697 | + } |
|
3698 | + if (!isset($globalphpVMS)) { |
|
3699 | + $globalphpVMS = FALSE; |
|
3700 | + } |
|
3701 | + if (!isset($globalVAM)) { |
|
3702 | + $globalVAM = FALSE; |
|
3703 | + } |
|
3526 | 3704 | date_default_timezone_set('UTC'); |
3527 | 3705 | |
3528 | 3706 | //getting the registration |
@@ -3535,23 +3713,33 @@ discard block |
||
3535 | 3713 | if ($ModeS != '') { |
3536 | 3714 | $timeelapsed = microtime(true); |
3537 | 3715 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
3538 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3716 | + if ($globalDebugTimeElapsed) { |
|
3717 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3718 | + } |
|
3539 | 3719 | } else { |
3540 | 3720 | $myhex = explode('-',$flightaware_id); |
3541 | 3721 | if (count($myhex) > 0) { |
3542 | 3722 | $timeelapsed = microtime(true); |
3543 | 3723 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
3544 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3724 | + if ($globalDebugTimeElapsed) { |
|
3725 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3726 | + } |
|
3545 | 3727 | } |
3546 | 3728 | } |
3547 | 3729 | } |
3548 | 3730 | } |
3549 | 3731 | $fromsource = NULL; |
3550 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
3551 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
3552 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
3553 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
3554 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
3732 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
3733 | + $fromsource = $globalAirlinesSource; |
|
3734 | + } elseif ($format_source == 'vatsimtxt') { |
|
3735 | + $fromsource = 'vatsim'; |
|
3736 | + } elseif ($format_source == 'whazzup') { |
|
3737 | + $fromsource = 'ivao'; |
|
3738 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
3739 | + $fromsource = 'vatsim'; |
|
3740 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
3741 | + $fromsource = 'ivao'; |
|
3742 | + } |
|
3555 | 3743 | //getting the airline information |
3556 | 3744 | if ($ident != "") |
3557 | 3745 | { |
@@ -3575,15 +3763,21 @@ discard block |
||
3575 | 3763 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
3576 | 3764 | $airline_array = $this->getAllAirlineInfo("NA"); |
3577 | 3765 | } |
3578 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3766 | + if ($globalDebugTimeElapsed) { |
|
3767 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3768 | + } |
|
3579 | 3769 | |
3580 | 3770 | } else { |
3581 | 3771 | $timeelapsed = microtime(true); |
3582 | 3772 | $airline_array = $this->getAllAirlineInfo("NA"); |
3583 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3773 | + if ($globalDebugTimeElapsed) { |
|
3774 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3775 | + } |
|
3584 | 3776 | } |
3585 | 3777 | } |
3586 | - } else $airline_array = array(); |
|
3778 | + } else { |
|
3779 | + $airline_array = array(); |
|
3780 | + } |
|
3587 | 3781 | |
3588 | 3782 | //getting the aircraft information |
3589 | 3783 | $aircraft_array = array(); |
@@ -3597,27 +3791,37 @@ discard block |
||
3597 | 3791 | { |
3598 | 3792 | $timeelapsed = microtime(true); |
3599 | 3793 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3600 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3794 | + if ($globalDebugTimeElapsed) { |
|
3795 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3796 | + } |
|
3601 | 3797 | } else { |
3602 | 3798 | $timeelapsed = microtime(true); |
3603 | 3799 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3604 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3800 | + if ($globalDebugTimeElapsed) { |
|
3801 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3802 | + } |
|
3605 | 3803 | } |
3606 | 3804 | } |
3607 | 3805 | } else { |
3608 | 3806 | if ($ModeS != '') { |
3609 | 3807 | $timeelapsed = microtime(true); |
3610 | 3808 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
3611 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3809 | + if ($globalDebugTimeElapsed) { |
|
3810 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3811 | + } |
|
3612 | 3812 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
3613 | 3813 | { |
3614 | 3814 | $timeelapsed = microtime(true); |
3615 | 3815 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3616 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3816 | + if ($globalDebugTimeElapsed) { |
|
3817 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3818 | + } |
|
3617 | 3819 | } else { |
3618 | 3820 | $timeelapsed = microtime(true); |
3619 | 3821 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3620 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3822 | + if ($globalDebugTimeElapsed) { |
|
3823 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3824 | + } |
|
3621 | 3825 | } |
3622 | 3826 | } |
3623 | 3827 | } |
@@ -3633,7 +3837,9 @@ discard block |
||
3633 | 3837 | } else { |
3634 | 3838 | $timeelapsed = microtime(true); |
3635 | 3839 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
3636 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3840 | + if ($globalDebugTimeElapsed) { |
|
3841 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3842 | + } |
|
3637 | 3843 | } |
3638 | 3844 | } |
3639 | 3845 | |
@@ -3648,7 +3854,9 @@ discard block |
||
3648 | 3854 | } else { |
3649 | 3855 | $timeelapsed = microtime(true); |
3650 | 3856 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
3651 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3857 | + if ($globalDebugTimeElapsed) { |
|
3858 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3859 | + } |
|
3652 | 3860 | } |
3653 | 3861 | } |
3654 | 3862 | |
@@ -3682,7 +3890,9 @@ discard block |
||
3682 | 3890 | { |
3683 | 3891 | return false; |
3684 | 3892 | } |
3685 | - } else $altitude = 0; |
|
3893 | + } else { |
|
3894 | + $altitude = 0; |
|
3895 | + } |
|
3686 | 3896 | |
3687 | 3897 | if ($heading != "") |
3688 | 3898 | { |
@@ -3711,7 +3921,9 @@ discard block |
||
3711 | 3921 | { |
3712 | 3922 | $timeelapsed = microtime(true); |
3713 | 3923 | $image_array = $Image->getSpotterImage($registration); |
3714 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3924 | + if ($globalDebugTimeElapsed) { |
|
3925 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3926 | + } |
|
3715 | 3927 | if (!isset($image_array[0]['registration'])) |
3716 | 3928 | { |
3717 | 3929 | //echo "Add image !!!! \n"; |
@@ -3719,14 +3931,21 @@ discard block |
||
3719 | 3931 | } |
3720 | 3932 | $timeelapsed = microtime(true); |
3721 | 3933 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
3722 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3723 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
3934 | + if ($globalDebugTimeElapsed) { |
|
3935 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3936 | + } |
|
3937 | + if ($owner_info['owner'] != '') { |
|
3938 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
3939 | + } |
|
3724 | 3940 | } |
3725 | 3941 | |
3726 | 3942 | if ($globalIVAO && $aircraft_icao != '') |
3727 | 3943 | { |
3728 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
3729 | - else $airline_icao = ''; |
|
3944 | + if (isset($airline_array[0]['icao'])) { |
|
3945 | + $airline_icao = $airline_array[0]['icao']; |
|
3946 | + } else { |
|
3947 | + $airline_icao = ''; |
|
3948 | + } |
|
3730 | 3949 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
3731 | 3950 | if (!isset($image_array[0]['registration'])) |
3732 | 3951 | { |
@@ -3771,16 +3990,28 @@ discard block |
||
3771 | 3990 | { |
3772 | 3991 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
3773 | 3992 | } |
3774 | - if ($registration == '') $registration = 'NA'; |
|
3993 | + if ($registration == '') { |
|
3994 | + $registration = 'NA'; |
|
3995 | + } |
|
3775 | 3996 | if ($latitude == '' && $longitude == '') { |
3776 | 3997 | $latitude = 0; |
3777 | 3998 | $longitude = 0; |
3778 | 3999 | } |
3779 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
3780 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
3781 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
3782 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
3783 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
4000 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
4001 | + $squawk = NULL; |
|
4002 | + } |
|
4003 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
4004 | + $verticalrate = NULL; |
|
4005 | + } |
|
4006 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
4007 | + $heading = 0; |
|
4008 | + } |
|
4009 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
4010 | + $groundspeed = 0; |
|
4011 | + } |
|
4012 | + if (!isset($aircraft_owner)) { |
|
4013 | + $aircraft_owner = NULL; |
|
4014 | + } |
|
3784 | 4015 | $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) |
3785 | 4016 | 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)"; |
3786 | 4017 | |
@@ -3791,9 +4022,13 @@ discard block |
||
3791 | 4022 | if ($airline_type == '') { |
3792 | 4023 | $timeelapsed = microtime(true); |
3793 | 4024 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
3794 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
4025 | + if ($globalDebugTimeElapsed) { |
|
4026 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
4027 | + } |
|
4028 | + } |
|
4029 | + if ($airline_type == null) { |
|
4030 | + $airline_type = ''; |
|
3795 | 4031 | } |
3796 | - if ($airline_type == null) $airline_type = ''; |
|
3797 | 4032 | $aircraft_type = $aircraft_array[0]['type']; |
3798 | 4033 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
3799 | 4034 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -3957,7 +4192,9 @@ discard block |
||
3957 | 4192 | } |
3958 | 4193 | } |
3959 | 4194 | $query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
3960 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4195 | + if ($limit) { |
|
4196 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4197 | + } |
|
3961 | 4198 | |
3962 | 4199 | $sth = $this->db->prepare($query); |
3963 | 4200 | $sth->execute($query_values); |
@@ -4030,7 +4267,9 @@ discard block |
||
4030 | 4267 | } |
4031 | 4268 | |
4032 | 4269 | $query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
4033 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4270 | + if ($limit) { |
|
4271 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4272 | + } |
|
4034 | 4273 | |
4035 | 4274 | |
4036 | 4275 | $sth = $this->db->prepare($query); |
@@ -4074,7 +4313,9 @@ discard block |
||
4074 | 4313 | } |
4075 | 4314 | } |
4076 | 4315 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
4077 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4316 | + if ($limit) { |
|
4317 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4318 | + } |
|
4078 | 4319 | |
4079 | 4320 | |
4080 | 4321 | $sth = $this->db->prepare($query); |
@@ -4150,7 +4391,9 @@ discard block |
||
4150 | 4391 | } |
4151 | 4392 | } |
4152 | 4393 | $query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
4153 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4394 | + if ($limit) { |
|
4395 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4396 | + } |
|
4154 | 4397 | |
4155 | 4398 | $sth = $this->db->prepare($query); |
4156 | 4399 | $sth->execute($query_values); |
@@ -4192,7 +4435,9 @@ discard block |
||
4192 | 4435 | } |
4193 | 4436 | } |
4194 | 4437 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
4195 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4438 | + if ($limit) { |
|
4439 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4440 | + } |
|
4196 | 4441 | |
4197 | 4442 | |
4198 | 4443 | $sth = $this->db->prepare($query); |
@@ -4435,7 +4680,9 @@ discard block |
||
4435 | 4680 | date_default_timezone_set($globalTimezone); |
4436 | 4681 | $datetime = new DateTime($date); |
4437 | 4682 | $offset = $datetime->format('P'); |
4438 | - } else $offset = '+00:00'; |
|
4683 | + } else { |
|
4684 | + $offset = '+00:00'; |
|
4685 | + } |
|
4439 | 4686 | |
4440 | 4687 | if ($globalDBdriver == 'mysql') { |
4441 | 4688 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4483,7 +4730,9 @@ discard block |
||
4483 | 4730 | date_default_timezone_set($globalTimezone); |
4484 | 4731 | $datetime = new DateTime($date); |
4485 | 4732 | $offset = $datetime->format('P'); |
4486 | - } else $offset = '+00:00'; |
|
4733 | + } else { |
|
4734 | + $offset = '+00:00'; |
|
4735 | + } |
|
4487 | 4736 | |
4488 | 4737 | if ($globalDBdriver == 'mysql') { |
4489 | 4738 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4730,7 +4979,9 @@ discard block |
||
4730 | 4979 | } |
4731 | 4980 | $query .= " GROUP BY spotter_output.airline_country |
4732 | 4981 | ORDER BY airline_country_count DESC"; |
4733 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4982 | + if ($limit) { |
|
4983 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4984 | + } |
|
4734 | 4985 | |
4735 | 4986 | $sth = $this->db->prepare($query); |
4736 | 4987 | $sth->execute($query_values); |
@@ -4758,7 +5009,9 @@ discard block |
||
4758 | 5009 | global $globalDBdriver; |
4759 | 5010 | //$filter_query = $this->getFilter($filters,true,true); |
4760 | 5011 | $Connection= new Connection($this->db); |
4761 | - if (!$Connection->tableExists('countries')) return array(); |
|
5012 | + if (!$Connection->tableExists('countries')) { |
|
5013 | + return array(); |
|
5014 | + } |
|
4762 | 5015 | /* |
4763 | 5016 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
4764 | 5017 | FROM countries c, spotter_output s |
@@ -4790,7 +5043,9 @@ discard block |
||
4790 | 5043 | } |
4791 | 5044 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country "; |
4792 | 5045 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
4793 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5046 | + if ($limit) { |
|
5047 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5048 | + } |
|
4794 | 5049 | |
4795 | 5050 | |
4796 | 5051 | $sth = $this->db->prepare($query); |
@@ -4867,7 +5122,9 @@ discard block |
||
4867 | 5122 | } |
4868 | 5123 | |
4869 | 5124 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
4870 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5125 | + if ($limit) { |
|
5126 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5127 | + } |
|
4871 | 5128 | |
4872 | 5129 | $sth = $this->db->prepare($query); |
4873 | 5130 | $sth->execute($query_values); |
@@ -4941,7 +5198,9 @@ discard block |
||
4941 | 5198 | } |
4942 | 5199 | |
4943 | 5200 | $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"; |
4944 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5201 | + if ($limit) { |
|
5202 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5203 | + } |
|
4945 | 5204 | |
4946 | 5205 | $sth = $this->db->prepare($query); |
4947 | 5206 | $sth->execute($query_values); |
@@ -4988,7 +5247,9 @@ discard block |
||
4988 | 5247 | } |
4989 | 5248 | |
4990 | 5249 | $query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
4991 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5250 | + if ($limit) { |
|
5251 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5252 | + } |
|
4992 | 5253 | |
4993 | 5254 | $sth = $this->db->prepare($query); |
4994 | 5255 | $sth->execute(); |
@@ -5041,7 +5302,9 @@ discard block |
||
5041 | 5302 | if($row['registration'] != "") |
5042 | 5303 | { |
5043 | 5304 | $image_array = $Image->getSpotterImage($row['registration']); |
5044 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5305 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5306 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5307 | + } |
|
5045 | 5308 | } |
5046 | 5309 | $temp_array['registration_count'] = $row['registration_count']; |
5047 | 5310 | |
@@ -5116,7 +5379,9 @@ discard block |
||
5116 | 5379 | if($row['registration'] != "") |
5117 | 5380 | { |
5118 | 5381 | $image_array = $Image->getSpotterImage($row['registration']); |
5119 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5382 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5383 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5384 | + } |
|
5120 | 5385 | } |
5121 | 5386 | $temp_array['registration_count'] = $row['registration_count']; |
5122 | 5387 | |
@@ -5223,7 +5488,9 @@ discard block |
||
5223 | 5488 | if($row['registration'] != "") |
5224 | 5489 | { |
5225 | 5490 | $image_array = $Image->getSpotterImage($row['registration']); |
5226 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5491 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5492 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5493 | + } |
|
5227 | 5494 | } |
5228 | 5495 | $temp_array['registration_count'] = $row['registration_count']; |
5229 | 5496 | $aircraft_array[] = $temp_array; |
@@ -5348,7 +5615,9 @@ discard block |
||
5348 | 5615 | date_default_timezone_set($globalTimezone); |
5349 | 5616 | $datetime = new DateTime($date); |
5350 | 5617 | $offset = $datetime->format('P'); |
5351 | - } else $offset = '+00:00'; |
|
5618 | + } else { |
|
5619 | + $offset = '+00:00'; |
|
5620 | + } |
|
5352 | 5621 | |
5353 | 5622 | if ($globalDBdriver == 'mysql') { |
5354 | 5623 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -5395,7 +5664,9 @@ discard block |
||
5395 | 5664 | date_default_timezone_set($globalTimezone); |
5396 | 5665 | $datetime = new DateTime($date); |
5397 | 5666 | $offset = $datetime->format('P'); |
5398 | - } else $offset = '+00:00'; |
|
5667 | + } else { |
|
5668 | + $offset = '+00:00'; |
|
5669 | + } |
|
5399 | 5670 | |
5400 | 5671 | if ($globalDBdriver == 'mysql') { |
5401 | 5672 | $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 |
@@ -5424,7 +5695,9 @@ discard block |
||
5424 | 5695 | if($row['registration'] != "") |
5425 | 5696 | { |
5426 | 5697 | $image_array = $Image->getSpotterImage($row['registration']); |
5427 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5698 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5699 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5700 | + } |
|
5428 | 5701 | } |
5429 | 5702 | $temp_array['registration_count'] = $row['registration_count']; |
5430 | 5703 | |
@@ -5449,7 +5722,9 @@ discard block |
||
5449 | 5722 | date_default_timezone_set($globalTimezone); |
5450 | 5723 | $datetime = new DateTime($date); |
5451 | 5724 | $offset = $datetime->format('P'); |
5452 | - } else $offset = '+00:00'; |
|
5725 | + } else { |
|
5726 | + $offset = '+00:00'; |
|
5727 | + } |
|
5453 | 5728 | |
5454 | 5729 | if ($globalDBdriver == 'mysql') { |
5455 | 5730 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5547,8 +5822,11 @@ discard block |
||
5547 | 5822 | if($row['registration'] != "") |
5548 | 5823 | { |
5549 | 5824 | $image_array = $Image->getSpotterImage($row['registration']); |
5550 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5551 | - else $temp_array['image_thumbnail'] = ''; |
|
5825 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5826 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5827 | + } else { |
|
5828 | + $temp_array['image_thumbnail'] = ''; |
|
5829 | + } |
|
5552 | 5830 | } |
5553 | 5831 | $temp_array['registration_count'] = $row['registration_count']; |
5554 | 5832 | $aircraft_array[] = $temp_array; |
@@ -5655,7 +5933,9 @@ discard block |
||
5655 | 5933 | if($row['registration'] != "") |
5656 | 5934 | { |
5657 | 5935 | $image_array = $Image->getSpotterImage($row['registration']); |
5658 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5936 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5937 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5938 | + } |
|
5659 | 5939 | } |
5660 | 5940 | $temp_array['registration_count'] = $row['registration_count']; |
5661 | 5941 | |
@@ -5772,7 +6052,9 @@ discard block |
||
5772 | 6052 | if($row['registration'] != "") |
5773 | 6053 | { |
5774 | 6054 | $image_array = $Image->getSpotterImage($row['registration']); |
5775 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6055 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
6056 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6057 | + } |
|
5776 | 6058 | } |
5777 | 6059 | $temp_array['registration_count'] = $row['registration_count']; |
5778 | 6060 | |
@@ -5938,7 +6220,9 @@ discard block |
||
5938 | 6220 | } |
5939 | 6221 | } |
5940 | 6222 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
5941 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6223 | + if ($limit) { |
|
6224 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6225 | + } |
|
5942 | 6226 | |
5943 | 6227 | $sth = $this->db->prepare($query); |
5944 | 6228 | $sth->execute($query_values); |
@@ -5957,7 +6241,9 @@ discard block |
||
5957 | 6241 | if($row['registration'] != "") |
5958 | 6242 | { |
5959 | 6243 | $image_array = $Image->getSpotterImage($row['registration']); |
5960 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6244 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
6245 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6246 | + } |
|
5961 | 6247 | } |
5962 | 6248 | |
5963 | 6249 | $aircraft_array[] = $temp_array; |
@@ -5998,7 +6284,9 @@ discard block |
||
5998 | 6284 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
5999 | 6285 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6000 | 6286 | $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"; |
6001 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6287 | + if ($limit) { |
|
6288 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6289 | + } |
|
6002 | 6290 | |
6003 | 6291 | $sth = $this->db->prepare($query); |
6004 | 6292 | $sth->execute(); |
@@ -6018,7 +6306,9 @@ discard block |
||
6018 | 6306 | if($row['registration'] != "") |
6019 | 6307 | { |
6020 | 6308 | $image_array = $Image->getSpotterImage($row['registration']); |
6021 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6309 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
6310 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6311 | + } |
|
6022 | 6312 | } |
6023 | 6313 | |
6024 | 6314 | $aircraft_array[] = $temp_array; |
@@ -6084,7 +6374,9 @@ discard block |
||
6084 | 6374 | } |
6085 | 6375 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
6086 | 6376 | ORDER BY airport_departure_icao_count DESC"; |
6087 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6377 | + if ($limit) { |
|
6378 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6379 | + } |
|
6088 | 6380 | |
6089 | 6381 | $sth = $this->db->prepare($query); |
6090 | 6382 | $sth->execute($query_values); |
@@ -6135,7 +6427,9 @@ discard block |
||
6135 | 6427 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6136 | 6428 | $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 |
6137 | 6429 | ORDER BY airport_departure_icao_count DESC"; |
6138 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6430 | + if ($limit) { |
|
6431 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6432 | + } |
|
6139 | 6433 | |
6140 | 6434 | $sth = $this->db->prepare($query); |
6141 | 6435 | $sth->execute(); |
@@ -6213,7 +6507,9 @@ discard block |
||
6213 | 6507 | } |
6214 | 6508 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
6215 | 6509 | ORDER BY airport_departure_icao_count DESC"; |
6216 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6510 | + if ($limit) { |
|
6511 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6512 | + } |
|
6217 | 6513 | //echo $query; |
6218 | 6514 | $sth = $this->db->prepare($query); |
6219 | 6515 | $sth->execute($query_values); |
@@ -6265,7 +6561,9 @@ discard block |
||
6265 | 6561 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6266 | 6562 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
6267 | 6563 | ORDER BY airport_departure_icao_count DESC"; |
6268 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6564 | + if ($limit) { |
|
6565 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6566 | + } |
|
6269 | 6567 | |
6270 | 6568 | $sth = $this->db->prepare($query); |
6271 | 6569 | $sth->execute(); |
@@ -6660,7 +6958,9 @@ discard block |
||
6660 | 6958 | date_default_timezone_set($globalTimezone); |
6661 | 6959 | $datetime = new DateTime($date); |
6662 | 6960 | $offset = $datetime->format('P'); |
6663 | - } else $offset = '+00:00'; |
|
6961 | + } else { |
|
6962 | + $offset = '+00:00'; |
|
6963 | + } |
|
6664 | 6964 | |
6665 | 6965 | if ($globalDBdriver == 'mysql') { |
6666 | 6966 | $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 |
@@ -6710,7 +7010,9 @@ discard block |
||
6710 | 7010 | date_default_timezone_set($globalTimezone); |
6711 | 7011 | $datetime = new DateTime($date); |
6712 | 7012 | $offset = $datetime->format('P'); |
6713 | - } else $offset = '+00:00'; |
|
7013 | + } else { |
|
7014 | + $offset = '+00:00'; |
|
7015 | + } |
|
6714 | 7016 | |
6715 | 7017 | if ($globalDBdriver == 'mysql') { |
6716 | 7018 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -6948,7 +7250,9 @@ discard block |
||
6948 | 7250 | } |
6949 | 7251 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6950 | 7252 | ORDER BY airport_arrival_icao_count DESC"; |
6951 | - if ($limit) $query .= " LIMIT 10"; |
|
7253 | + if ($limit) { |
|
7254 | + $query .= " LIMIT 10"; |
|
7255 | + } |
|
6952 | 7256 | |
6953 | 7257 | |
6954 | 7258 | $sth = $this->db->prepare($query); |
@@ -6968,7 +7272,9 @@ discard block |
||
6968 | 7272 | if ($icaoaskey) { |
6969 | 7273 | $icao = $row['arrival_airport_icao']; |
6970 | 7274 | $airport_array[$icao] = $temp_array; |
6971 | - } else $airport_array[] = $temp_array; |
|
7275 | + } else { |
|
7276 | + $airport_array[] = $temp_array; |
|
7277 | + } |
|
6972 | 7278 | } |
6973 | 7279 | |
6974 | 7280 | return $airport_array; |
@@ -7005,7 +7311,9 @@ discard block |
||
7005 | 7311 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
7006 | 7312 | $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 |
7007 | 7313 | ORDER BY airport_arrival_icao_count DESC"; |
7008 | - if ($limit) $query .= " LIMIT 10"; |
|
7314 | + if ($limit) { |
|
7315 | + $query .= " LIMIT 10"; |
|
7316 | + } |
|
7009 | 7317 | |
7010 | 7318 | |
7011 | 7319 | $sth = $this->db->prepare($query); |
@@ -7026,7 +7334,9 @@ discard block |
||
7026 | 7334 | if ($icaoaskey) { |
7027 | 7335 | $icao = $row['arrival_airport_icao']; |
7028 | 7336 | $airport_array[$icao] = $temp_array; |
7029 | - } else $airport_array[] = $temp_array; |
|
7337 | + } else { |
|
7338 | + $airport_array[] = $temp_array; |
|
7339 | + } |
|
7030 | 7340 | } |
7031 | 7341 | |
7032 | 7342 | return $airport_array; |
@@ -7089,7 +7399,9 @@ discard block |
||
7089 | 7399 | } |
7090 | 7400 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
7091 | 7401 | ORDER BY airport_arrival_icao_count DESC"; |
7092 | - if ($limit) $query .= " LIMIT 10"; |
|
7402 | + if ($limit) { |
|
7403 | + $query .= " LIMIT 10"; |
|
7404 | + } |
|
7093 | 7405 | |
7094 | 7406 | |
7095 | 7407 | $sth = $this->db->prepare($query); |
@@ -7108,7 +7420,9 @@ discard block |
||
7108 | 7420 | if ($icaoaskey) { |
7109 | 7421 | $icao = $row['arrival_airport_icao']; |
7110 | 7422 | $airport_array[$icao] = $temp_array; |
7111 | - } else $airport_array[] = $temp_array; |
|
7423 | + } else { |
|
7424 | + $airport_array[] = $temp_array; |
|
7425 | + } |
|
7112 | 7426 | } |
7113 | 7427 | |
7114 | 7428 | return $airport_array; |
@@ -7145,7 +7459,9 @@ discard block |
||
7145 | 7459 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
7146 | 7460 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
7147 | 7461 | ORDER BY airport_arrival_icao_count DESC"; |
7148 | - if ($limit) $query .= " LIMIT 10"; |
|
7462 | + if ($limit) { |
|
7463 | + $query .= " LIMIT 10"; |
|
7464 | + } |
|
7149 | 7465 | |
7150 | 7466 | |
7151 | 7467 | $sth = $this->db->prepare($query); |
@@ -7166,7 +7482,9 @@ discard block |
||
7166 | 7482 | if ($icaoaskey) { |
7167 | 7483 | $icao = $row['arrival_airport_icao']; |
7168 | 7484 | $airport_array[$icao] = $temp_array; |
7169 | - } else $airport_array[] = $temp_array; |
|
7485 | + } else { |
|
7486 | + $airport_array[] = $temp_array; |
|
7487 | + } |
|
7170 | 7488 | } |
7171 | 7489 | |
7172 | 7490 | return $airport_array; |
@@ -7547,7 +7865,9 @@ discard block |
||
7547 | 7865 | date_default_timezone_set($globalTimezone); |
7548 | 7866 | $datetime = new DateTime($date); |
7549 | 7867 | $offset = $datetime->format('P'); |
7550 | - } else $offset = '+00:00'; |
|
7868 | + } else { |
|
7869 | + $offset = '+00:00'; |
|
7870 | + } |
|
7551 | 7871 | |
7552 | 7872 | if ($globalDBdriver == 'mysql') { |
7553 | 7873 | $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 |
@@ -7597,7 +7917,9 @@ discard block |
||
7597 | 7917 | date_default_timezone_set($globalTimezone); |
7598 | 7918 | $datetime = new DateTime($date); |
7599 | 7919 | $offset = $datetime->format('P'); |
7600 | - } else $offset = '+00:00'; |
|
7920 | + } else { |
|
7921 | + $offset = '+00:00'; |
|
7922 | + } |
|
7601 | 7923 | |
7602 | 7924 | if ($globalDBdriver == 'mysql') { |
7603 | 7925 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -7879,7 +8201,9 @@ discard block |
||
7879 | 8201 | } |
7880 | 8202 | $query .= " GROUP BY spotter_output.arrival_airport_country |
7881 | 8203 | ORDER BY airport_arrival_country_count DESC"; |
7882 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
8204 | + if ($limit) { |
|
8205 | + $query .= " LIMIT 10 OFFSET 0"; |
|
8206 | + } |
|
7883 | 8207 | |
7884 | 8208 | |
7885 | 8209 | $sth = $this->db->prepare($query); |
@@ -8166,7 +8490,9 @@ discard block |
||
8166 | 8490 | date_default_timezone_set($globalTimezone); |
8167 | 8491 | $datetime = new DateTime($date); |
8168 | 8492 | $offset = $datetime->format('P'); |
8169 | - } else $offset = '+00:00'; |
|
8493 | + } else { |
|
8494 | + $offset = '+00:00'; |
|
8495 | + } |
|
8170 | 8496 | |
8171 | 8497 | if ($globalDBdriver == 'mysql') { |
8172 | 8498 | $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 |
@@ -8342,12 +8668,18 @@ discard block |
||
8342 | 8668 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
8343 | 8669 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
8344 | 8670 | if ($olderthanmonths > 0) { |
8345 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
8346 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
8671 | + if ($globalDBdriver == 'mysql') { |
|
8672 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
8673 | + } else { |
|
8674 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
8675 | + } |
|
8347 | 8676 | } |
8348 | 8677 | if ($sincedate != '') { |
8349 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
8350 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
8678 | + if ($globalDBdriver == 'mysql') { |
|
8679 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
8680 | + } else { |
|
8681 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
8682 | + } |
|
8351 | 8683 | } |
8352 | 8684 | $query_values = array(); |
8353 | 8685 | if ($year != '') { |
@@ -8378,7 +8710,9 @@ discard block |
||
8378 | 8710 | } |
8379 | 8711 | } |
8380 | 8712 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
8381 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
8713 | + if ($limit) { |
|
8714 | + $query .= " LIMIT 10 OFFSET 0"; |
|
8715 | + } |
|
8382 | 8716 | |
8383 | 8717 | $sth = $this->db->prepare($query); |
8384 | 8718 | $sth->execute($query_values); |
@@ -8412,15 +8746,23 @@ discard block |
||
8412 | 8746 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
8413 | 8747 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
8414 | 8748 | if ($olderthanmonths > 0) { |
8415 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
8416 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
8749 | + if ($globalDBdriver == 'mysql') { |
|
8750 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
8751 | + } else { |
|
8752 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
8753 | + } |
|
8417 | 8754 | } |
8418 | 8755 | if ($sincedate != '') { |
8419 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
8420 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
8756 | + if ($globalDBdriver == 'mysql') { |
|
8757 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
8758 | + } else { |
|
8759 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
8760 | + } |
|
8421 | 8761 | } |
8422 | 8762 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
8423 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
8763 | + if ($limit) { |
|
8764 | + $query .= " LIMIT 10 OFFSET 0"; |
|
8765 | + } |
|
8424 | 8766 | |
8425 | 8767 | $sth = $this->db->prepare($query); |
8426 | 8768 | $sth->execute(); |
@@ -8457,7 +8799,9 @@ discard block |
||
8457 | 8799 | date_default_timezone_set($globalTimezone); |
8458 | 8800 | $datetime = new DateTime(); |
8459 | 8801 | $offset = $datetime->format('P'); |
8460 | - } else $offset = '+00:00'; |
|
8802 | + } else { |
|
8803 | + $offset = '+00:00'; |
|
8804 | + } |
|
8461 | 8805 | |
8462 | 8806 | if ($globalDBdriver == 'mysql') { |
8463 | 8807 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8506,7 +8850,9 @@ discard block |
||
8506 | 8850 | date_default_timezone_set($globalTimezone); |
8507 | 8851 | $datetime = new DateTime(); |
8508 | 8852 | $offset = $datetime->format('P'); |
8509 | - } else $offset = '+00:00'; |
|
8853 | + } else { |
|
8854 | + $offset = '+00:00'; |
|
8855 | + } |
|
8510 | 8856 | $filter_query = $this->getFilter($filters,true,true); |
8511 | 8857 | if ($globalDBdriver == 'mysql') { |
8512 | 8858 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8555,7 +8901,9 @@ discard block |
||
8555 | 8901 | date_default_timezone_set($globalTimezone); |
8556 | 8902 | $datetime = new DateTime(); |
8557 | 8903 | $offset = $datetime->format('P'); |
8558 | - } else $offset = '+00:00'; |
|
8904 | + } else { |
|
8905 | + $offset = '+00:00'; |
|
8906 | + } |
|
8559 | 8907 | $filter_query = $this->getFilter($filters,true,true); |
8560 | 8908 | if ($globalDBdriver == 'mysql') { |
8561 | 8909 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8601,7 +8949,9 @@ discard block |
||
8601 | 8949 | date_default_timezone_set($globalTimezone); |
8602 | 8950 | $datetime = new DateTime(); |
8603 | 8951 | $offset = $datetime->format('P'); |
8604 | - } else $offset = '+00:00'; |
|
8952 | + } else { |
|
8953 | + $offset = '+00:00'; |
|
8954 | + } |
|
8605 | 8955 | $filter_query = $this->getFilter($filters,true,true); |
8606 | 8956 | if ($globalDBdriver == 'mysql') { |
8607 | 8957 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8649,7 +8999,9 @@ discard block |
||
8649 | 8999 | date_default_timezone_set($globalTimezone); |
8650 | 9000 | $datetime = new DateTime(); |
8651 | 9001 | $offset = $datetime->format('P'); |
8652 | - } else $offset = '+00:00'; |
|
9002 | + } else { |
|
9003 | + $offset = '+00:00'; |
|
9004 | + } |
|
8653 | 9005 | |
8654 | 9006 | if ($globalDBdriver == 'mysql') { |
8655 | 9007 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8697,7 +9049,9 @@ discard block |
||
8697 | 9049 | date_default_timezone_set($globalTimezone); |
8698 | 9050 | $datetime = new DateTime(); |
8699 | 9051 | $offset = $datetime->format('P'); |
8700 | - } else $offset = '+00:00'; |
|
9052 | + } else { |
|
9053 | + $offset = '+00:00'; |
|
9054 | + } |
|
8701 | 9055 | |
8702 | 9056 | if ($globalDBdriver == 'mysql') { |
8703 | 9057 | $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 |
@@ -8744,7 +9098,9 @@ discard block |
||
8744 | 9098 | date_default_timezone_set($globalTimezone); |
8745 | 9099 | $datetime = new DateTime(); |
8746 | 9100 | $offset = $datetime->format('P'); |
8747 | - } else $offset = '+00:00'; |
|
9101 | + } else { |
|
9102 | + $offset = '+00:00'; |
|
9103 | + } |
|
8748 | 9104 | |
8749 | 9105 | if ($globalDBdriver == 'mysql') { |
8750 | 9106 | $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 |
@@ -8792,7 +9148,9 @@ discard block |
||
8792 | 9148 | date_default_timezone_set($globalTimezone); |
8793 | 9149 | $datetime = new DateTime(); |
8794 | 9150 | $offset = $datetime->format('P'); |
8795 | - } else $offset = '+00:00'; |
|
9151 | + } else { |
|
9152 | + $offset = '+00:00'; |
|
9153 | + } |
|
8796 | 9154 | $filter_query = $this->getFilter($filters,true,true); |
8797 | 9155 | if ($globalDBdriver == 'mysql') { |
8798 | 9156 | $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 |
@@ -8837,7 +9195,9 @@ discard block |
||
8837 | 9195 | date_default_timezone_set($globalTimezone); |
8838 | 9196 | $datetime = new DateTime(); |
8839 | 9197 | $offset = $datetime->format('P'); |
8840 | - } else $offset = '+00:00'; |
|
9198 | + } else { |
|
9199 | + $offset = '+00:00'; |
|
9200 | + } |
|
8841 | 9201 | $filter_query = $this->getFilter($filters,true,true); |
8842 | 9202 | |
8843 | 9203 | if ($globalDBdriver == 'mysql') { |
@@ -8884,7 +9244,9 @@ discard block |
||
8884 | 9244 | date_default_timezone_set($globalTimezone); |
8885 | 9245 | $datetime = new DateTime(); |
8886 | 9246 | $offset = $datetime->format('P'); |
8887 | - } else $offset = '+00:00'; |
|
9247 | + } else { |
|
9248 | + $offset = '+00:00'; |
|
9249 | + } |
|
8888 | 9250 | |
8889 | 9251 | if ($globalDBdriver == 'mysql') { |
8890 | 9252 | $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 |
@@ -8930,7 +9292,9 @@ discard block |
||
8930 | 9292 | date_default_timezone_set($globalTimezone); |
8931 | 9293 | $datetime = new DateTime(); |
8932 | 9294 | $offset = $datetime->format('P'); |
8933 | - } else $offset = '+00:00'; |
|
9295 | + } else { |
|
9296 | + $offset = '+00:00'; |
|
9297 | + } |
|
8934 | 9298 | $filter_query = $this->getFilter($filters,true,true); |
8935 | 9299 | |
8936 | 9300 | if ($globalDBdriver == 'mysql') { |
@@ -8977,7 +9341,9 @@ discard block |
||
8977 | 9341 | date_default_timezone_set($globalTimezone); |
8978 | 9342 | $datetime = new DateTime(); |
8979 | 9343 | $offset = $datetime->format('P'); |
8980 | - } else $offset = '+00:00'; |
|
9344 | + } else { |
|
9345 | + $offset = '+00:00'; |
|
9346 | + } |
|
8981 | 9347 | |
8982 | 9348 | if ($globalDBdriver == 'mysql') { |
8983 | 9349 | $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 |
@@ -9024,7 +9390,9 @@ discard block |
||
9024 | 9390 | date_default_timezone_set($globalTimezone); |
9025 | 9391 | $datetime = new DateTime(); |
9026 | 9392 | $offset = $datetime->format('P'); |
9027 | - } else $offset = '+00:00'; |
|
9393 | + } else { |
|
9394 | + $offset = '+00:00'; |
|
9395 | + } |
|
9028 | 9396 | |
9029 | 9397 | if ($globalDBdriver == 'mysql') { |
9030 | 9398 | $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 |
@@ -9069,7 +9437,9 @@ discard block |
||
9069 | 9437 | date_default_timezone_set($globalTimezone); |
9070 | 9438 | $datetime = new DateTime(); |
9071 | 9439 | $offset = $datetime->format('P'); |
9072 | - } else $offset = '+00:00'; |
|
9440 | + } else { |
|
9441 | + $offset = '+00:00'; |
|
9442 | + } |
|
9073 | 9443 | $filter_query = $this->getFilter($filters,true,true); |
9074 | 9444 | |
9075 | 9445 | if ($globalDBdriver == 'mysql') { |
@@ -9117,7 +9487,9 @@ discard block |
||
9117 | 9487 | date_default_timezone_set($globalTimezone); |
9118 | 9488 | $datetime = new DateTime(); |
9119 | 9489 | $offset = $datetime->format('P'); |
9120 | - } else $offset = '+00:00'; |
|
9490 | + } else { |
|
9491 | + $offset = '+00:00'; |
|
9492 | + } |
|
9121 | 9493 | |
9122 | 9494 | if ($globalDBdriver == 'mysql') { |
9123 | 9495 | $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 |
@@ -9163,7 +9535,9 @@ discard block |
||
9163 | 9535 | date_default_timezone_set($globalTimezone); |
9164 | 9536 | $datetime = new DateTime(); |
9165 | 9537 | $offset = $datetime->format('P'); |
9166 | - } else $offset = '+00:00'; |
|
9538 | + } else { |
|
9539 | + $offset = '+00:00'; |
|
9540 | + } |
|
9167 | 9541 | $filter_query = $this->getFilter($filters,true,true); |
9168 | 9542 | |
9169 | 9543 | if ($globalDBdriver == 'mysql') { |
@@ -9211,7 +9585,9 @@ discard block |
||
9211 | 9585 | date_default_timezone_set($globalTimezone); |
9212 | 9586 | $datetime = new DateTime(); |
9213 | 9587 | $offset = $datetime->format('P'); |
9214 | - } else $offset = '+00:00'; |
|
9588 | + } else { |
|
9589 | + $offset = '+00:00'; |
|
9590 | + } |
|
9215 | 9591 | |
9216 | 9592 | if ($globalDBdriver == 'mysql') { |
9217 | 9593 | $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 |
@@ -9258,7 +9634,9 @@ discard block |
||
9258 | 9634 | date_default_timezone_set($globalTimezone); |
9259 | 9635 | $datetime = new DateTime(); |
9260 | 9636 | $offset = $datetime->format('P'); |
9261 | - } else $offset = '+00:00'; |
|
9637 | + } else { |
|
9638 | + $offset = '+00:00'; |
|
9639 | + } |
|
9262 | 9640 | $filter_query = $this->getFilter($filters,true,true); |
9263 | 9641 | if ($globalDBdriver == 'mysql') { |
9264 | 9642 | $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 |
@@ -9307,7 +9685,9 @@ discard block |
||
9307 | 9685 | date_default_timezone_set($globalTimezone); |
9308 | 9686 | $datetime = new DateTime(); |
9309 | 9687 | $offset = $datetime->format('P'); |
9310 | - } else $offset = '+00:00'; |
|
9688 | + } else { |
|
9689 | + $offset = '+00:00'; |
|
9690 | + } |
|
9311 | 9691 | |
9312 | 9692 | $orderby_sql = ''; |
9313 | 9693 | if ($orderby == "hour") |
@@ -9373,7 +9753,9 @@ discard block |
||
9373 | 9753 | date_default_timezone_set($globalTimezone); |
9374 | 9754 | $datetime = new DateTime(); |
9375 | 9755 | $offset = $datetime->format('P'); |
9376 | - } else $offset = '+00:00'; |
|
9756 | + } else { |
|
9757 | + $offset = '+00:00'; |
|
9758 | + } |
|
9377 | 9759 | |
9378 | 9760 | $orderby_sql = ''; |
9379 | 9761 | if ($orderby == "hour") |
@@ -9440,7 +9822,9 @@ discard block |
||
9440 | 9822 | date_default_timezone_set($globalTimezone); |
9441 | 9823 | $datetime = new DateTime(); |
9442 | 9824 | $offset = $datetime->format('P'); |
9443 | - } else $offset = '+00:00'; |
|
9825 | + } else { |
|
9826 | + $offset = '+00:00'; |
|
9827 | + } |
|
9444 | 9828 | |
9445 | 9829 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
9446 | 9830 | |
@@ -9491,7 +9875,9 @@ discard block |
||
9491 | 9875 | date_default_timezone_set($globalTimezone); |
9492 | 9876 | $datetime = new DateTime(); |
9493 | 9877 | $offset = $datetime->format('P'); |
9494 | - } else $offset = '+00:00'; |
|
9878 | + } else { |
|
9879 | + $offset = '+00:00'; |
|
9880 | + } |
|
9495 | 9881 | |
9496 | 9882 | if ($globalDBdriver == 'mysql') { |
9497 | 9883 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9538,7 +9924,9 @@ discard block |
||
9538 | 9924 | date_default_timezone_set($globalTimezone); |
9539 | 9925 | $datetime = new DateTime(); |
9540 | 9926 | $offset = $datetime->format('P'); |
9541 | - } else $offset = '+00:00'; |
|
9927 | + } else { |
|
9928 | + $offset = '+00:00'; |
|
9929 | + } |
|
9542 | 9930 | |
9543 | 9931 | if ($globalDBdriver == 'mysql') { |
9544 | 9932 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9585,7 +9973,9 @@ discard block |
||
9585 | 9973 | date_default_timezone_set($globalTimezone); |
9586 | 9974 | $datetime = new DateTime(); |
9587 | 9975 | $offset = $datetime->format('P'); |
9588 | - } else $offset = '+00:00'; |
|
9976 | + } else { |
|
9977 | + $offset = '+00:00'; |
|
9978 | + } |
|
9589 | 9979 | |
9590 | 9980 | if ($globalDBdriver == 'mysql') { |
9591 | 9981 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9633,7 +10023,9 @@ discard block |
||
9633 | 10023 | date_default_timezone_set($globalTimezone); |
9634 | 10024 | $datetime = new DateTime(); |
9635 | 10025 | $offset = $datetime->format('P'); |
9636 | - } else $offset = '+00:00'; |
|
10026 | + } else { |
|
10027 | + $offset = '+00:00'; |
|
10028 | + } |
|
9637 | 10029 | |
9638 | 10030 | if ($globalDBdriver == 'mysql') { |
9639 | 10031 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9681,7 +10073,9 @@ discard block |
||
9681 | 10073 | date_default_timezone_set($globalTimezone); |
9682 | 10074 | $datetime = new DateTime($date); |
9683 | 10075 | $offset = $datetime->format('P'); |
9684 | - } else $offset = '+00:00'; |
|
10076 | + } else { |
|
10077 | + $offset = '+00:00'; |
|
10078 | + } |
|
9685 | 10079 | |
9686 | 10080 | if ($globalDBdriver == 'mysql') { |
9687 | 10081 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9729,7 +10123,9 @@ discard block |
||
9729 | 10123 | date_default_timezone_set($globalTimezone); |
9730 | 10124 | $datetime = new DateTime(); |
9731 | 10125 | $offset = $datetime->format('P'); |
9732 | - } else $offset = '+00:00'; |
|
10126 | + } else { |
|
10127 | + $offset = '+00:00'; |
|
10128 | + } |
|
9733 | 10129 | |
9734 | 10130 | if ($globalDBdriver == 'mysql') { |
9735 | 10131 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9779,7 +10175,9 @@ discard block |
||
9779 | 10175 | date_default_timezone_set($globalTimezone); |
9780 | 10176 | $datetime = new DateTime(); |
9781 | 10177 | $offset = $datetime->format('P'); |
9782 | - } else $offset = '+00:00'; |
|
10178 | + } else { |
|
10179 | + $offset = '+00:00'; |
|
10180 | + } |
|
9783 | 10181 | |
9784 | 10182 | if ($globalDBdriver == 'mysql') { |
9785 | 10183 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9826,7 +10224,9 @@ discard block |
||
9826 | 10224 | date_default_timezone_set($globalTimezone); |
9827 | 10225 | $datetime = new DateTime(); |
9828 | 10226 | $offset = $datetime->format('P'); |
9829 | - } else $offset = '+00:00'; |
|
10227 | + } else { |
|
10228 | + $offset = '+00:00'; |
|
10229 | + } |
|
9830 | 10230 | |
9831 | 10231 | if ($globalDBdriver == 'mysql') { |
9832 | 10232 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10037,8 +10437,11 @@ discard block |
||
10037 | 10437 | $query_values = array_merge($query_values,array(':month' => $month)); |
10038 | 10438 | } |
10039 | 10439 | } |
10040 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
10041 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
10440 | + if (empty($query_values)) { |
|
10441 | + $queryi .= $this->getFilter($filters); |
|
10442 | + } else { |
|
10443 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
10444 | + } |
|
10042 | 10445 | |
10043 | 10446 | //echo $query; |
10044 | 10447 | $sth = $this->db->prepare($queryi); |
@@ -10117,8 +10520,11 @@ discard block |
||
10117 | 10520 | $query_values = array_merge($query_values,array(':month' => $month)); |
10118 | 10521 | } |
10119 | 10522 | } |
10120 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
10121 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
10523 | + if ($query == '') { |
|
10524 | + $queryi .= $this->getFilter($filters); |
|
10525 | + } else { |
|
10526 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
10527 | + } |
|
10122 | 10528 | |
10123 | 10529 | |
10124 | 10530 | $sth = $this->db->prepare($queryi); |
@@ -10141,7 +10547,9 @@ discard block |
||
10141 | 10547 | date_default_timezone_set($globalTimezone); |
10142 | 10548 | $datetime = new DateTime(); |
10143 | 10549 | $offset = $datetime->format('P'); |
10144 | - } else $offset = '+00:00'; |
|
10550 | + } else { |
|
10551 | + $offset = '+00:00'; |
|
10552 | + } |
|
10145 | 10553 | |
10146 | 10554 | if ($globalDBdriver == 'mysql') { |
10147 | 10555 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10327,7 +10735,9 @@ discard block |
||
10327 | 10735 | */ |
10328 | 10736 | public function parseDirection($direction = 0) |
10329 | 10737 | { |
10330 | - if ($direction == '') $direction = 0; |
|
10738 | + if ($direction == '') { |
|
10739 | + $direction = 0; |
|
10740 | + } |
|
10331 | 10741 | $direction_array = array(); |
10332 | 10742 | $temp_array = array(); |
10333 | 10743 | |
@@ -10428,7 +10838,9 @@ discard block |
||
10428 | 10838 | if (isset($result->AirlineFlightInfoResult)) |
10429 | 10839 | { |
10430 | 10840 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
10431 | - } else return ''; |
|
10841 | + } else { |
|
10842 | + return ''; |
|
10843 | + } |
|
10432 | 10844 | |
10433 | 10845 | $registration = $this->convertAircraftRegistration($registration); |
10434 | 10846 | |
@@ -10457,7 +10869,9 @@ discard block |
||
10457 | 10869 | if (count($row) > 0) { |
10458 | 10870 | //return $row['Registration']; |
10459 | 10871 | return $row['registration']; |
10460 | - } else return ''; |
|
10872 | + } else { |
|
10873 | + return ''; |
|
10874 | + } |
|
10461 | 10875 | |
10462 | 10876 | } |
10463 | 10877 | |
@@ -10480,9 +10894,14 @@ discard block |
||
10480 | 10894 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
10481 | 10895 | $sth->closeCursor(); |
10482 | 10896 | if (count($row) > 0) { |
10483 | - if ($row['type_flight'] == null) return ''; |
|
10484 | - else return $row['type_flight']; |
|
10485 | - } else return ''; |
|
10897 | + if ($row['type_flight'] == null) { |
|
10898 | + return ''; |
|
10899 | + } else { |
|
10900 | + return $row['type_flight']; |
|
10901 | + } |
|
10902 | + } else { |
|
10903 | + return ''; |
|
10904 | + } |
|
10486 | 10905 | |
10487 | 10906 | } |
10488 | 10907 | |
@@ -10500,7 +10919,9 @@ discard block |
||
10500 | 10919 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
10501 | 10920 | |
10502 | 10921 | $Connection = new Connection($this->db); |
10503 | - if (!$Connection->tableExists('countries')) return ''; |
|
10922 | + if (!$Connection->tableExists('countries')) { |
|
10923 | + return ''; |
|
10924 | + } |
|
10504 | 10925 | |
10505 | 10926 | try { |
10506 | 10927 | /* |
@@ -10520,9 +10941,13 @@ discard block |
||
10520 | 10941 | $sth->closeCursor(); |
10521 | 10942 | if (count($row) > 0) { |
10522 | 10943 | return $row; |
10523 | - } else return ''; |
|
10944 | + } else { |
|
10945 | + return ''; |
|
10946 | + } |
|
10524 | 10947 | } catch (PDOException $e) { |
10525 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
10948 | + if (isset($globalDebug) && $globalDebug) { |
|
10949 | + echo 'Error : '.$e->getMessage()."\n"; |
|
10950 | + } |
|
10526 | 10951 | return ''; |
10527 | 10952 | } |
10528 | 10953 | |
@@ -10540,7 +10965,9 @@ discard block |
||
10540 | 10965 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
10541 | 10966 | |
10542 | 10967 | $Connection = new Connection($this->db); |
10543 | - if (!$Connection->tableExists('countries')) return ''; |
|
10968 | + if (!$Connection->tableExists('countries')) { |
|
10969 | + return ''; |
|
10970 | + } |
|
10544 | 10971 | |
10545 | 10972 | try { |
10546 | 10973 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -10552,9 +10979,13 @@ discard block |
||
10552 | 10979 | $sth->closeCursor(); |
10553 | 10980 | if (count($row) > 0) { |
10554 | 10981 | return $row; |
10555 | - } else return ''; |
|
10982 | + } else { |
|
10983 | + return ''; |
|
10984 | + } |
|
10556 | 10985 | } catch (PDOException $e) { |
10557 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
10986 | + if (isset($globalDebug) && $globalDebug) { |
|
10987 | + echo 'Error : '.$e->getMessage()."\n"; |
|
10988 | + } |
|
10558 | 10989 | return ''; |
10559 | 10990 | } |
10560 | 10991 | |
@@ -10804,7 +11235,9 @@ discard block |
||
10804 | 11235 | { |
10805 | 11236 | global $globalBitlyAccessToken; |
10806 | 11237 | |
10807 | - if ($globalBitlyAccessToken == '') return $url; |
|
11238 | + if ($globalBitlyAccessToken == '') { |
|
11239 | + return $url; |
|
11240 | + } |
|
10808 | 11241 | |
10809 | 11242 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
10810 | 11243 | |
@@ -10953,7 +11386,9 @@ discard block |
||
10953 | 11386 | |
10954 | 11387 | |
10955 | 11388 | // routes |
10956 | - if ($globalDebug) print "Routes...\n"; |
|
11389 | + if ($globalDebug) { |
|
11390 | + print "Routes...\n"; |
|
11391 | + } |
|
10957 | 11392 | if ($globalDBdriver == 'mysql') { |
10958 | 11393 | $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)"; |
10959 | 11394 | } else { |
@@ -10972,7 +11407,9 @@ discard block |
||
10972 | 11407 | } |
10973 | 11408 | } |
10974 | 11409 | |
10975 | - if ($globalDebug) print "Airlines...\n"; |
|
11410 | + if ($globalDebug) { |
|
11411 | + print "Airlines...\n"; |
|
11412 | + } |
|
10976 | 11413 | //airlines |
10977 | 11414 | if ($globalDBdriver == 'mysql') { |
10978 | 11415 | $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)"; |
@@ -10986,10 +11423,15 @@ discard block |
||
10986 | 11423 | if (is_numeric(substr($row['ident'], -1, 1))) |
10987 | 11424 | { |
10988 | 11425 | $fromsource = NULL; |
10989 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
10990 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
10991 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
10992 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
11426 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
11427 | + $fromsource = 'vatsim'; |
|
11428 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
11429 | + $fromsource = 'ivao'; |
|
11430 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
11431 | + $fromsource = 'vatsim'; |
|
11432 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
11433 | + $fromsource = 'ivao'; |
|
11434 | + } |
|
10993 | 11435 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
10994 | 11436 | if (isset($airline_array[0]['name'])) { |
10995 | 11437 | $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"; |
@@ -10999,13 +11441,17 @@ discard block |
||
10999 | 11441 | } |
11000 | 11442 | } |
11001 | 11443 | |
11002 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
11444 | + if ($globalDebug) { |
|
11445 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
11446 | + } |
|
11003 | 11447 | //duplicate modes |
11004 | 11448 | $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"; |
11005 | 11449 | $sth = $this->db->prepare($query); |
11006 | 11450 | $sth->execute(); |
11007 | 11451 | |
11008 | - if ($globalDebug) print "Aircraft...\n"; |
|
11452 | + if ($globalDebug) { |
|
11453 | + print "Aircraft...\n"; |
|
11454 | + } |
|
11009 | 11455 | //aircraft |
11010 | 11456 | if ($globalDBdriver == 'mysql') { |
11011 | 11457 | $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)"; |
@@ -11048,26 +11494,38 @@ discard block |
||
11048 | 11494 | if (isset($closestAirports[0])) { |
11049 | 11495 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
11050 | 11496 | $airport_icao = $closestAirports[0]['icao']; |
11051 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
11497 | + if ($globalDebug) { |
|
11498 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
11499 | + } |
|
11052 | 11500 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
11053 | 11501 | foreach ($closestAirports as $airport) { |
11054 | 11502 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
11055 | 11503 | $airport_icao = $airport['icao']; |
11056 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
11504 | + if ($globalDebug) { |
|
11505 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
11506 | + } |
|
11057 | 11507 | break; |
11058 | 11508 | } |
11059 | 11509 | } |
11060 | 11510 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
11061 | 11511 | $airport_icao = $closestAirports[0]['icao']; |
11062 | - 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"; |
|
11512 | + if ($globalDebug) { |
|
11513 | + 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"; |
|
11514 | + } |
|
11063 | 11515 | } else { |
11064 | - 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"; |
|
11516 | + if ($globalDebug) { |
|
11517 | + 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"; |
|
11518 | + } |
|
11065 | 11519 | } |
11066 | 11520 | } else { |
11067 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
11521 | + if ($globalDebug) { |
|
11522 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
11523 | + } |
|
11068 | 11524 | } |
11069 | 11525 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
11070 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
11526 | + if ($globalDebug) { |
|
11527 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
11528 | + } |
|
11071 | 11529 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
11072 | 11530 | $sthu = $this->db->prepare($update_query); |
11073 | 11531 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |