@@ -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 | |
@@ -1832,7 +1934,9 @@ discard block |
||
1832 | 1934 | { |
1833 | 1935 | $highlight = $row['highlight']; |
1834 | 1936 | } |
1835 | - if (isset($highlight)) return $highlight; |
|
1937 | + if (isset($highlight)) { |
|
1938 | + return $highlight; |
|
1939 | + } |
|
1836 | 1940 | } |
1837 | 1941 | |
1838 | 1942 | |
@@ -1860,7 +1964,9 @@ discard block |
||
1860 | 1964 | $sth->closeCursor(); |
1861 | 1965 | if (count($row) > 0) { |
1862 | 1966 | return $row['usage']; |
1863 | - } else return ''; |
|
1967 | + } else { |
|
1968 | + return ''; |
|
1969 | + } |
|
1864 | 1970 | } |
1865 | 1971 | |
1866 | 1972 | /** |
@@ -1885,7 +1991,9 @@ discard block |
||
1885 | 1991 | $sth->closeCursor(); |
1886 | 1992 | if (count($row) > 0) { |
1887 | 1993 | return $row['icao']; |
1888 | - } else return ''; |
|
1994 | + } else { |
|
1995 | + return ''; |
|
1996 | + } |
|
1889 | 1997 | } |
1890 | 1998 | |
1891 | 1999 | /** |
@@ -1913,7 +2021,9 @@ discard block |
||
1913 | 2021 | $airport_longitude = $row['longitude']; |
1914 | 2022 | $Common = new Common(); |
1915 | 2023 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
1916 | - } else return ''; |
|
2024 | + } else { |
|
2025 | + return ''; |
|
2026 | + } |
|
1917 | 2027 | } |
1918 | 2028 | |
1919 | 2029 | /** |
@@ -2025,7 +2135,9 @@ discard block |
||
2025 | 2135 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2026 | 2136 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2027 | 2137 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2028 | - } else return array(); |
|
2138 | + } else { |
|
2139 | + return array(); |
|
2140 | + } |
|
2029 | 2141 | if ($globalDBdriver == 'mysql') { |
2030 | 2142 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
2031 | 2143 | } else { |
@@ -2060,7 +2172,9 @@ discard block |
||
2060 | 2172 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2061 | 2173 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2062 | 2174 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2063 | - } else return array(); |
|
2175 | + } else { |
|
2176 | + return array(); |
|
2177 | + } |
|
2064 | 2178 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
2065 | 2179 | $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.")"; |
2066 | 2180 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2095,7 +2209,9 @@ discard block |
||
2095 | 2209 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
2096 | 2210 | { |
2097 | 2211 | global $globalUseRealAirlines; |
2098 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
2212 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
2213 | + $fromsource = NULL; |
|
2214 | + } |
|
2099 | 2215 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
2100 | 2216 | if ($airline_icao == 'NA') { |
2101 | 2217 | $airline_array = array(); |
@@ -2145,7 +2261,9 @@ discard block |
||
2145 | 2261 | $sth->execute(array(':fromsource' => $fromsource)); |
2146 | 2262 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2147 | 2263 | $sth->closeCursor(); |
2148 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao); |
|
2264 | + if ($row['nb'] == 0) { |
|
2265 | + $result = $this->getAllAirlineInfo($airline_icao); |
|
2266 | + } |
|
2149 | 2267 | } |
2150 | 2268 | return $result; |
2151 | 2269 | } |
@@ -2161,7 +2279,9 @@ discard block |
||
2161 | 2279 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
2162 | 2280 | { |
2163 | 2281 | global $globalUseRealAirlines; |
2164 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
2282 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
2283 | + $fromsource = NULL; |
|
2284 | + } |
|
2165 | 2285 | $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
2166 | 2286 | $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"; |
2167 | 2287 | $sth = $this->db->prepare($query); |
@@ -2177,7 +2297,9 @@ discard block |
||
2177 | 2297 | $sth->execute(array(':fromsource' => $fromsource)); |
2178 | 2298 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2179 | 2299 | $sth->closeCursor(); |
2180 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name); |
|
2300 | + if ($row['nb'] == 0) { |
|
2301 | + $result = $this->getAllAirlineInfoByName($airline_name); |
|
2302 | + } |
|
2181 | 2303 | } |
2182 | 2304 | return $result; |
2183 | 2305 | } |
@@ -2240,15 +2362,20 @@ discard block |
||
2240 | 2362 | 'A320-211' => 'A320', |
2241 | 2363 | '747-8i' => 'B748', |
2242 | 2364 | 'A380' => 'A388'); |
2243 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
2365 | + if (isset($all_aircraft[$aircraft_type])) { |
|
2366 | + return $all_aircraft[$aircraft_type]; |
|
2367 | + } |
|
2244 | 2368 | |
2245 | 2369 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
2246 | 2370 | $aircraft_type = strtoupper($aircraft_type); |
2247 | 2371 | $sth = $this->db->prepare($query); |
2248 | 2372 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
2249 | 2373 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
2250 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
2251 | - else return ''; |
|
2374 | + if (isset($result[0]['icao'])) { |
|
2375 | + return $result[0]['icao']; |
|
2376 | + } else { |
|
2377 | + return ''; |
|
2378 | + } |
|
2252 | 2379 | } |
2253 | 2380 | |
2254 | 2381 | /** |
@@ -2271,9 +2398,13 @@ discard block |
||
2271 | 2398 | $sth->closeCursor(); |
2272 | 2399 | if (isset($row['icaotypecode'])) { |
2273 | 2400 | $icao = $row['icaotypecode']; |
2274 | - if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao]; |
|
2401 | + if (isset($this->aircraft_correct_icaotype[$icao])) { |
|
2402 | + $icao = $this->aircraft_correct_icaotype[$icao]; |
|
2403 | + } |
|
2275 | 2404 | return $icao; |
2276 | - } else return ''; |
|
2405 | + } else { |
|
2406 | + return ''; |
|
2407 | + } |
|
2277 | 2408 | } |
2278 | 2409 | |
2279 | 2410 | /** |
@@ -2296,7 +2427,9 @@ discard block |
||
2296 | 2427 | $sth->closeCursor(); |
2297 | 2428 | if (isset($row['icaotypecode'])) { |
2298 | 2429 | return $row['icaotypecode']; |
2299 | - } else return ''; |
|
2430 | + } else { |
|
2431 | + return ''; |
|
2432 | + } |
|
2300 | 2433 | } |
2301 | 2434 | |
2302 | 2435 | /** |
@@ -2318,7 +2451,9 @@ discard block |
||
2318 | 2451 | $sth->closeCursor(); |
2319 | 2452 | if (isset($row['operator_correct'])) { |
2320 | 2453 | return $row['operator_correct']; |
2321 | - } else return $operator; |
|
2454 | + } else { |
|
2455 | + return $operator; |
|
2456 | + } |
|
2322 | 2457 | } |
2323 | 2458 | |
2324 | 2459 | /** |
@@ -2331,7 +2466,9 @@ discard block |
||
2331 | 2466 | public function getRouteInfo($callsign) |
2332 | 2467 | { |
2333 | 2468 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
2334 | - if ($callsign == '') return array(); |
|
2469 | + if ($callsign == '') { |
|
2470 | + return array(); |
|
2471 | + } |
|
2335 | 2472 | $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"; |
2336 | 2473 | |
2337 | 2474 | $sth = $this->db->prepare($query); |
@@ -2341,7 +2478,9 @@ discard block |
||
2341 | 2478 | $sth->closeCursor(); |
2342 | 2479 | if (count($row) > 0) { |
2343 | 2480 | return $row; |
2344 | - } else return array(); |
|
2481 | + } else { |
|
2482 | + return array(); |
|
2483 | + } |
|
2345 | 2484 | } |
2346 | 2485 | |
2347 | 2486 | /** |
@@ -2394,7 +2533,9 @@ discard block |
||
2394 | 2533 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
2395 | 2534 | $sth->closeCursor(); |
2396 | 2535 | return $result; |
2397 | - } else return array(); |
|
2536 | + } else { |
|
2537 | + return array(); |
|
2538 | + } |
|
2398 | 2539 | } |
2399 | 2540 | |
2400 | 2541 | |
@@ -2553,8 +2694,11 @@ discard block |
||
2553 | 2694 | $query .= " ORDER BY spotter_output.source_name ASC"; |
2554 | 2695 | |
2555 | 2696 | $sth = $this->db->prepare($query); |
2556 | - if (!empty($query_values)) $sth->execute($query_values); |
|
2557 | - else $sth->execute(); |
|
2697 | + if (!empty($query_values)) { |
|
2698 | + $sth->execute($query_values); |
|
2699 | + } else { |
|
2700 | + $sth->execute(); |
|
2701 | + } |
|
2558 | 2702 | |
2559 | 2703 | $source_array = array(); |
2560 | 2704 | $temp_array = array(); |
@@ -2587,9 +2731,13 @@ discard block |
||
2587 | 2731 | WHERE spotter_output.airline_icao <> '' |
2588 | 2732 | ORDER BY spotter_output.airline_name ASC"; |
2589 | 2733 | */ |
2590 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
2591 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
2592 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
2734 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
2735 | + $forsource = $globalAirlinesSource; |
|
2736 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
2737 | + $forsource = 'vatsim'; |
|
2738 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
2739 | + $forsource = 'ivao'; |
|
2740 | + } |
|
2593 | 2741 | if ($forsource === NULL) { |
2594 | 2742 | $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"; |
2595 | 2743 | $query_data = array(); |
@@ -2632,9 +2780,13 @@ discard block |
||
2632 | 2780 | { |
2633 | 2781 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
2634 | 2782 | $filter_query = $this->getFilter($filters,true,true); |
2635 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
2636 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
2637 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
2783 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
2784 | + $forsource = $globalAirlinesSource; |
|
2785 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
2786 | + $forsource = 'vatsim'; |
|
2787 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
2788 | + $forsource = 'ivao'; |
|
2789 | + } |
|
2638 | 2790 | if ($forsource === NULL) { |
2639 | 2791 | $query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC"; |
2640 | 2792 | $query_data = array(); |
@@ -2909,7 +3061,9 @@ discard block |
||
2909 | 3061 | date_default_timezone_set($globalTimezone); |
2910 | 3062 | $datetime = new DateTime(); |
2911 | 3063 | $offset = $datetime->format('P'); |
2912 | - } else $offset = '+00:00'; |
|
3064 | + } else { |
|
3065 | + $offset = '+00:00'; |
|
3066 | + } |
|
2913 | 3067 | if ($airport_icao == '') { |
2914 | 3068 | if ($globalDBdriver == 'mysql') { |
2915 | 3069 | $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"; |
@@ -2941,7 +3095,9 @@ discard block |
||
2941 | 3095 | date_default_timezone_set($globalTimezone); |
2942 | 3096 | $datetime = new DateTime(); |
2943 | 3097 | $offset = $datetime->format('P'); |
2944 | - } else $offset = '+00:00'; |
|
3098 | + } else { |
|
3099 | + $offset = '+00:00'; |
|
3100 | + } |
|
2945 | 3101 | if ($airport_icao == '') { |
2946 | 3102 | if ($globalDBdriver == 'mysql') { |
2947 | 3103 | $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"; |
@@ -2974,7 +3130,9 @@ discard block |
||
2974 | 3130 | date_default_timezone_set($globalTimezone); |
2975 | 3131 | $datetime = new DateTime(); |
2976 | 3132 | $offset = $datetime->format('P'); |
2977 | - } else $offset = '+00:00'; |
|
3133 | + } else { |
|
3134 | + $offset = '+00:00'; |
|
3135 | + } |
|
2978 | 3136 | if ($airport_icao == '') { |
2979 | 3137 | if ($globalDBdriver == 'mysql') { |
2980 | 3138 | $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 |
@@ -3013,7 +3171,9 @@ discard block |
||
3013 | 3171 | date_default_timezone_set($globalTimezone); |
3014 | 3172 | $datetime = new DateTime(); |
3015 | 3173 | $offset = $datetime->format('P'); |
3016 | - } else $offset = '+00:00'; |
|
3174 | + } else { |
|
3175 | + $offset = '+00:00'; |
|
3176 | + } |
|
3017 | 3177 | if ($airport_icao == '') { |
3018 | 3178 | if ($globalDBdriver == 'mysql') { |
3019 | 3179 | $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 |
@@ -3058,7 +3218,9 @@ discard block |
||
3058 | 3218 | date_default_timezone_set($globalTimezone); |
3059 | 3219 | $datetime = new DateTime(); |
3060 | 3220 | $offset = $datetime->format('P'); |
3061 | - } else $offset = '+00:00'; |
|
3221 | + } else { |
|
3222 | + $offset = '+00:00'; |
|
3223 | + } |
|
3062 | 3224 | if ($airport_icao == '') { |
3063 | 3225 | if ($globalDBdriver == 'mysql') { |
3064 | 3226 | $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"; |
@@ -3093,7 +3255,9 @@ discard block |
||
3093 | 3255 | date_default_timezone_set($globalTimezone); |
3094 | 3256 | $datetime = new DateTime(); |
3095 | 3257 | $offset = $datetime->format('P'); |
3096 | - } else $offset = '+00:00'; |
|
3258 | + } else { |
|
3259 | + $offset = '+00:00'; |
|
3260 | + } |
|
3097 | 3261 | if ($airport_icao == '') { |
3098 | 3262 | if ($globalDBdriver == 'mysql') { |
3099 | 3263 | $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 |
@@ -3135,7 +3299,9 @@ discard block |
||
3135 | 3299 | date_default_timezone_set($globalTimezone); |
3136 | 3300 | $datetime = new DateTime(); |
3137 | 3301 | $offset = $datetime->format('P'); |
3138 | - } else $offset = '+00:00'; |
|
3302 | + } else { |
|
3303 | + $offset = '+00:00'; |
|
3304 | + } |
|
3139 | 3305 | if ($airport_icao == '') { |
3140 | 3306 | if ($globalDBdriver == 'mysql') { |
3141 | 3307 | $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"; |
@@ -3169,7 +3335,9 @@ discard block |
||
3169 | 3335 | date_default_timezone_set($globalTimezone); |
3170 | 3336 | $datetime = new DateTime(); |
3171 | 3337 | $offset = $datetime->format('P'); |
3172 | - } else $offset = '+00:00'; |
|
3338 | + } else { |
|
3339 | + $offset = '+00:00'; |
|
3340 | + } |
|
3173 | 3341 | if ($airport_icao == '') { |
3174 | 3342 | if ($globalDBdriver == 'mysql') { |
3175 | 3343 | $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 |
@@ -3217,7 +3385,9 @@ discard block |
||
3217 | 3385 | date_default_timezone_set($globalTimezone); |
3218 | 3386 | $datetime = new DateTime(); |
3219 | 3387 | $offset = $datetime->format('P'); |
3220 | - } else $offset = '+00:00'; |
|
3388 | + } else { |
|
3389 | + $offset = '+00:00'; |
|
3390 | + } |
|
3221 | 3391 | |
3222 | 3392 | if ($globalDBdriver == 'mysql') { |
3223 | 3393 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3337,7 +3507,9 @@ discard block |
||
3337 | 3507 | */ |
3338 | 3508 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
3339 | 3509 | { |
3340 | - if ($groundspeed == '') $groundspeed = NULL; |
|
3510 | + if ($groundspeed == '') { |
|
3511 | + $groundspeed = NULL; |
|
3512 | + } |
|
3341 | 3513 | $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'; |
3342 | 3514 | $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); |
3343 | 3515 | |
@@ -3387,10 +3559,18 @@ discard block |
||
3387 | 3559 | $Image = new Image($this->db); |
3388 | 3560 | $Common = new Common(); |
3389 | 3561 | |
3390 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
3391 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
3392 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
3393 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
3562 | + if (!isset($globalIVAO)) { |
|
3563 | + $globalIVAO = FALSE; |
|
3564 | + } |
|
3565 | + if (!isset($globalVATSIM)) { |
|
3566 | + $globalVATSIM = FALSE; |
|
3567 | + } |
|
3568 | + if (!isset($globalphpVMS)) { |
|
3569 | + $globalphpVMS = FALSE; |
|
3570 | + } |
|
3571 | + if (!isset($globalVAM)) { |
|
3572 | + $globalVAM = FALSE; |
|
3573 | + } |
|
3394 | 3574 | date_default_timezone_set('UTC'); |
3395 | 3575 | |
3396 | 3576 | //getting the registration |
@@ -3403,23 +3583,33 @@ discard block |
||
3403 | 3583 | if ($ModeS != '') { |
3404 | 3584 | $timeelapsed = microtime(true); |
3405 | 3585 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
3406 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3586 | + if ($globalDebugTimeElapsed) { |
|
3587 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3588 | + } |
|
3407 | 3589 | } else { |
3408 | 3590 | $myhex = explode('-',$flightaware_id); |
3409 | 3591 | if (count($myhex) > 0) { |
3410 | 3592 | $timeelapsed = microtime(true); |
3411 | 3593 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
3412 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3594 | + if ($globalDebugTimeElapsed) { |
|
3595 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3596 | + } |
|
3413 | 3597 | } |
3414 | 3598 | } |
3415 | 3599 | } |
3416 | 3600 | } |
3417 | 3601 | $fromsource = NULL; |
3418 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
3419 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
3420 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
3421 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
3422 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
3602 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
3603 | + $fromsource = $globalAirlinesSource; |
|
3604 | + } elseif ($format_source == 'vatsimtxt') { |
|
3605 | + $fromsource = 'vatsim'; |
|
3606 | + } elseif ($format_source == 'whazzup') { |
|
3607 | + $fromsource = 'ivao'; |
|
3608 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
3609 | + $fromsource = 'vatsim'; |
|
3610 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
3611 | + $fromsource = 'ivao'; |
|
3612 | + } |
|
3423 | 3613 | //getting the airline information |
3424 | 3614 | if ($ident != "") |
3425 | 3615 | { |
@@ -3443,15 +3633,21 @@ discard block |
||
3443 | 3633 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
3444 | 3634 | $airline_array = $this->getAllAirlineInfo("NA"); |
3445 | 3635 | } |
3446 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3636 | + if ($globalDebugTimeElapsed) { |
|
3637 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3638 | + } |
|
3447 | 3639 | |
3448 | 3640 | } else { |
3449 | 3641 | $timeelapsed = microtime(true); |
3450 | 3642 | $airline_array = $this->getAllAirlineInfo("NA"); |
3451 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3643 | + if ($globalDebugTimeElapsed) { |
|
3644 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3645 | + } |
|
3452 | 3646 | } |
3453 | 3647 | } |
3454 | - } else $airline_array = array(); |
|
3648 | + } else { |
|
3649 | + $airline_array = array(); |
|
3650 | + } |
|
3455 | 3651 | |
3456 | 3652 | //getting the aircraft information |
3457 | 3653 | $aircraft_array = array(); |
@@ -3465,27 +3661,37 @@ discard block |
||
3465 | 3661 | { |
3466 | 3662 | $timeelapsed = microtime(true); |
3467 | 3663 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3468 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3664 | + if ($globalDebugTimeElapsed) { |
|
3665 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3666 | + } |
|
3469 | 3667 | } else { |
3470 | 3668 | $timeelapsed = microtime(true); |
3471 | 3669 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3472 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3670 | + if ($globalDebugTimeElapsed) { |
|
3671 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3672 | + } |
|
3473 | 3673 | } |
3474 | 3674 | } |
3475 | 3675 | } else { |
3476 | 3676 | if ($ModeS != '') { |
3477 | 3677 | $timeelapsed = microtime(true); |
3478 | 3678 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
3479 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3679 | + if ($globalDebugTimeElapsed) { |
|
3680 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3681 | + } |
|
3480 | 3682 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
3481 | 3683 | { |
3482 | 3684 | $timeelapsed = microtime(true); |
3483 | 3685 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3484 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3686 | + if ($globalDebugTimeElapsed) { |
|
3687 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3688 | + } |
|
3485 | 3689 | } else { |
3486 | 3690 | $timeelapsed = microtime(true); |
3487 | 3691 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3488 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3692 | + if ($globalDebugTimeElapsed) { |
|
3693 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3694 | + } |
|
3489 | 3695 | } |
3490 | 3696 | } |
3491 | 3697 | } |
@@ -3501,7 +3707,9 @@ discard block |
||
3501 | 3707 | } else { |
3502 | 3708 | $timeelapsed = microtime(true); |
3503 | 3709 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
3504 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3710 | + if ($globalDebugTimeElapsed) { |
|
3711 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3712 | + } |
|
3505 | 3713 | } |
3506 | 3714 | } |
3507 | 3715 | |
@@ -3516,7 +3724,9 @@ discard block |
||
3516 | 3724 | } else { |
3517 | 3725 | $timeelapsed = microtime(true); |
3518 | 3726 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
3519 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3727 | + if ($globalDebugTimeElapsed) { |
|
3728 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3729 | + } |
|
3520 | 3730 | } |
3521 | 3731 | } |
3522 | 3732 | |
@@ -3550,7 +3760,9 @@ discard block |
||
3550 | 3760 | { |
3551 | 3761 | return false; |
3552 | 3762 | } |
3553 | - } else $altitude = 0; |
|
3763 | + } else { |
|
3764 | + $altitude = 0; |
|
3765 | + } |
|
3554 | 3766 | |
3555 | 3767 | if ($heading != "") |
3556 | 3768 | { |
@@ -3579,7 +3791,9 @@ discard block |
||
3579 | 3791 | { |
3580 | 3792 | $timeelapsed = microtime(true); |
3581 | 3793 | $image_array = $Image->getSpotterImage($registration); |
3582 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3794 | + if ($globalDebugTimeElapsed) { |
|
3795 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3796 | + } |
|
3583 | 3797 | if (!isset($image_array[0]['registration'])) |
3584 | 3798 | { |
3585 | 3799 | //echo "Add image !!!! \n"; |
@@ -3587,14 +3801,21 @@ discard block |
||
3587 | 3801 | } |
3588 | 3802 | $timeelapsed = microtime(true); |
3589 | 3803 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
3590 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3591 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
3804 | + if ($globalDebugTimeElapsed) { |
|
3805 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3806 | + } |
|
3807 | + if ($owner_info['owner'] != '') { |
|
3808 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
3809 | + } |
|
3592 | 3810 | } |
3593 | 3811 | |
3594 | 3812 | if ($globalIVAO && $aircraft_icao != '') |
3595 | 3813 | { |
3596 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
3597 | - else $airline_icao = ''; |
|
3814 | + if (isset($airline_array[0]['icao'])) { |
|
3815 | + $airline_icao = $airline_array[0]['icao']; |
|
3816 | + } else { |
|
3817 | + $airline_icao = ''; |
|
3818 | + } |
|
3598 | 3819 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
3599 | 3820 | if (!isset($image_array[0]['registration'])) |
3600 | 3821 | { |
@@ -3639,16 +3860,28 @@ discard block |
||
3639 | 3860 | { |
3640 | 3861 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
3641 | 3862 | } |
3642 | - if ($registration == '') $registration = 'NA'; |
|
3863 | + if ($registration == '') { |
|
3864 | + $registration = 'NA'; |
|
3865 | + } |
|
3643 | 3866 | if ($latitude == '' && $longitude == '') { |
3644 | 3867 | $latitude = 0; |
3645 | 3868 | $longitude = 0; |
3646 | 3869 | } |
3647 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
3648 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
3649 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
3650 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
3651 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
3870 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
3871 | + $squawk = NULL; |
|
3872 | + } |
|
3873 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
3874 | + $verticalrate = NULL; |
|
3875 | + } |
|
3876 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
3877 | + $heading = 0; |
|
3878 | + } |
|
3879 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
3880 | + $groundspeed = 0; |
|
3881 | + } |
|
3882 | + if (!isset($aircraft_owner)) { |
|
3883 | + $aircraft_owner = NULL; |
|
3884 | + } |
|
3652 | 3885 | $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) |
3653 | 3886 | 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)"; |
3654 | 3887 | |
@@ -3659,9 +3892,13 @@ discard block |
||
3659 | 3892 | if ($airline_type == '') { |
3660 | 3893 | $timeelapsed = microtime(true); |
3661 | 3894 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
3662 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3895 | + if ($globalDebugTimeElapsed) { |
|
3896 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3897 | + } |
|
3898 | + } |
|
3899 | + if ($airline_type == null) { |
|
3900 | + $airline_type = ''; |
|
3663 | 3901 | } |
3664 | - if ($airline_type == null) $airline_type = ''; |
|
3665 | 3902 | $aircraft_type = $aircraft_array[0]['type']; |
3666 | 3903 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
3667 | 3904 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -3797,7 +4034,9 @@ discard block |
||
3797 | 4034 | } |
3798 | 4035 | } |
3799 | 4036 | $query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
3800 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4037 | + if ($limit) { |
|
4038 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4039 | + } |
|
3801 | 4040 | |
3802 | 4041 | $sth = $this->db->prepare($query); |
3803 | 4042 | $sth->execute(); |
@@ -3842,7 +4081,9 @@ discard block |
||
3842 | 4081 | } |
3843 | 4082 | } |
3844 | 4083 | $query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
3845 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4084 | + if ($limit) { |
|
4085 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4086 | + } |
|
3846 | 4087 | |
3847 | 4088 | |
3848 | 4089 | $sth = $this->db->prepare($query); |
@@ -3888,7 +4129,9 @@ discard block |
||
3888 | 4129 | } |
3889 | 4130 | } |
3890 | 4131 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
3891 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4132 | + if ($limit) { |
|
4133 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4134 | + } |
|
3892 | 4135 | |
3893 | 4136 | |
3894 | 4137 | $sth = $this->db->prepare($query); |
@@ -3936,7 +4179,9 @@ discard block |
||
3936 | 4179 | } |
3937 | 4180 | } |
3938 | 4181 | $query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
3939 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4182 | + if ($limit) { |
|
4183 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4184 | + } |
|
3940 | 4185 | |
3941 | 4186 | |
3942 | 4187 | $sth = $this->db->prepare($query); |
@@ -3981,7 +4226,9 @@ discard block |
||
3981 | 4226 | } |
3982 | 4227 | } |
3983 | 4228 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
3984 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4229 | + if ($limit) { |
|
4230 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4231 | + } |
|
3985 | 4232 | |
3986 | 4233 | |
3987 | 4234 | $sth = $this->db->prepare($query); |
@@ -4224,7 +4471,9 @@ discard block |
||
4224 | 4471 | date_default_timezone_set($globalTimezone); |
4225 | 4472 | $datetime = new DateTime($date); |
4226 | 4473 | $offset = $datetime->format('P'); |
4227 | - } else $offset = '+00:00'; |
|
4474 | + } else { |
|
4475 | + $offset = '+00:00'; |
|
4476 | + } |
|
4228 | 4477 | |
4229 | 4478 | if ($globalDBdriver == 'mysql') { |
4230 | 4479 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4272,7 +4521,9 @@ discard block |
||
4272 | 4521 | date_default_timezone_set($globalTimezone); |
4273 | 4522 | $datetime = new DateTime($date); |
4274 | 4523 | $offset = $datetime->format('P'); |
4275 | - } else $offset = '+00:00'; |
|
4524 | + } else { |
|
4525 | + $offset = '+00:00'; |
|
4526 | + } |
|
4276 | 4527 | |
4277 | 4528 | if ($globalDBdriver == 'mysql') { |
4278 | 4529 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4490,7 +4741,9 @@ discard block |
||
4490 | 4741 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' |
4491 | 4742 | GROUP BY spotter_output.airline_country |
4492 | 4743 | ORDER BY airline_country_count DESC"; |
4493 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4744 | + if ($limit) { |
|
4745 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4746 | + } |
|
4494 | 4747 | |
4495 | 4748 | $sth = $this->db->prepare($query); |
4496 | 4749 | $sth->execute(); |
@@ -4518,7 +4771,9 @@ discard block |
||
4518 | 4771 | global $globalDBdriver; |
4519 | 4772 | //$filter_query = $this->getFilter($filters,true,true); |
4520 | 4773 | $Connection= new Connection($this->db); |
4521 | - if (!$Connection->tableExists('countries')) return array(); |
|
4774 | + if (!$Connection->tableExists('countries')) { |
|
4775 | + return array(); |
|
4776 | + } |
|
4522 | 4777 | /* |
4523 | 4778 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
4524 | 4779 | FROM countries c, spotter_output s |
@@ -4550,7 +4805,9 @@ discard block |
||
4550 | 4805 | } |
4551 | 4806 | $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 "; |
4552 | 4807 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
4553 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4808 | + if ($limit) { |
|
4809 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4810 | + } |
|
4554 | 4811 | |
4555 | 4812 | |
4556 | 4813 | $sth = $this->db->prepare($query); |
@@ -4600,7 +4857,9 @@ discard block |
||
4600 | 4857 | } |
4601 | 4858 | |
4602 | 4859 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
4603 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4860 | + if ($limit) { |
|
4861 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4862 | + } |
|
4604 | 4863 | |
4605 | 4864 | $sth = $this->db->prepare($query); |
4606 | 4865 | $sth->execute(); |
@@ -4646,7 +4905,9 @@ discard block |
||
4646 | 4905 | } |
4647 | 4906 | |
4648 | 4907 | $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"; |
4649 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4908 | + if ($limit) { |
|
4909 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4910 | + } |
|
4650 | 4911 | |
4651 | 4912 | $sth = $this->db->prepare($query); |
4652 | 4913 | $sth->execute(); |
@@ -4693,7 +4954,9 @@ discard block |
||
4693 | 4954 | } |
4694 | 4955 | |
4695 | 4956 | $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"; |
4696 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4957 | + if ($limit) { |
|
4958 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4959 | + } |
|
4697 | 4960 | |
4698 | 4961 | $sth = $this->db->prepare($query); |
4699 | 4962 | $sth->execute(); |
@@ -4746,7 +5009,9 @@ discard block |
||
4746 | 5009 | if($row['registration'] != "") |
4747 | 5010 | { |
4748 | 5011 | $image_array = $Image->getSpotterImage($row['registration']); |
4749 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5012 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5013 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5014 | + } |
|
4750 | 5015 | } |
4751 | 5016 | $temp_array['registration_count'] = $row['registration_count']; |
4752 | 5017 | |
@@ -4821,7 +5086,9 @@ discard block |
||
4821 | 5086 | if($row['registration'] != "") |
4822 | 5087 | { |
4823 | 5088 | $image_array = $Image->getSpotterImage($row['registration']); |
4824 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5089 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5090 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5091 | + } |
|
4825 | 5092 | } |
4826 | 5093 | $temp_array['registration_count'] = $row['registration_count']; |
4827 | 5094 | |
@@ -4928,7 +5195,9 @@ discard block |
||
4928 | 5195 | if($row['registration'] != "") |
4929 | 5196 | { |
4930 | 5197 | $image_array = $Image->getSpotterImage($row['registration']); |
4931 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5198 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5199 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5200 | + } |
|
4932 | 5201 | } |
4933 | 5202 | $temp_array['registration_count'] = $row['registration_count']; |
4934 | 5203 | $aircraft_array[] = $temp_array; |
@@ -5053,7 +5322,9 @@ discard block |
||
5053 | 5322 | date_default_timezone_set($globalTimezone); |
5054 | 5323 | $datetime = new DateTime($date); |
5055 | 5324 | $offset = $datetime->format('P'); |
5056 | - } else $offset = '+00:00'; |
|
5325 | + } else { |
|
5326 | + $offset = '+00:00'; |
|
5327 | + } |
|
5057 | 5328 | |
5058 | 5329 | if ($globalDBdriver == 'mysql') { |
5059 | 5330 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -5100,7 +5371,9 @@ discard block |
||
5100 | 5371 | date_default_timezone_set($globalTimezone); |
5101 | 5372 | $datetime = new DateTime($date); |
5102 | 5373 | $offset = $datetime->format('P'); |
5103 | - } else $offset = '+00:00'; |
|
5374 | + } else { |
|
5375 | + $offset = '+00:00'; |
|
5376 | + } |
|
5104 | 5377 | |
5105 | 5378 | if ($globalDBdriver == 'mysql') { |
5106 | 5379 | $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 |
@@ -5129,7 +5402,9 @@ discard block |
||
5129 | 5402 | if($row['registration'] != "") |
5130 | 5403 | { |
5131 | 5404 | $image_array = $Image->getSpotterImage($row['registration']); |
5132 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5405 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5406 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5407 | + } |
|
5133 | 5408 | } |
5134 | 5409 | $temp_array['registration_count'] = $row['registration_count']; |
5135 | 5410 | |
@@ -5154,7 +5429,9 @@ discard block |
||
5154 | 5429 | date_default_timezone_set($globalTimezone); |
5155 | 5430 | $datetime = new DateTime($date); |
5156 | 5431 | $offset = $datetime->format('P'); |
5157 | - } else $offset = '+00:00'; |
|
5432 | + } else { |
|
5433 | + $offset = '+00:00'; |
|
5434 | + } |
|
5158 | 5435 | |
5159 | 5436 | if ($globalDBdriver == 'mysql') { |
5160 | 5437 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5252,8 +5529,11 @@ discard block |
||
5252 | 5529 | if($row['registration'] != "") |
5253 | 5530 | { |
5254 | 5531 | $image_array = $Image->getSpotterImage($row['registration']); |
5255 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5256 | - else $temp_array['image_thumbnail'] = ''; |
|
5532 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5533 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5534 | + } else { |
|
5535 | + $temp_array['image_thumbnail'] = ''; |
|
5536 | + } |
|
5257 | 5537 | } |
5258 | 5538 | $temp_array['registration_count'] = $row['registration_count']; |
5259 | 5539 | $aircraft_array[] = $temp_array; |
@@ -5360,7 +5640,9 @@ discard block |
||
5360 | 5640 | if($row['registration'] != "") |
5361 | 5641 | { |
5362 | 5642 | $image_array = $Image->getSpotterImage($row['registration']); |
5363 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5643 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5644 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5645 | + } |
|
5364 | 5646 | } |
5365 | 5647 | $temp_array['registration_count'] = $row['registration_count']; |
5366 | 5648 | |
@@ -5477,7 +5759,9 @@ discard block |
||
5477 | 5759 | if($row['registration'] != "") |
5478 | 5760 | { |
5479 | 5761 | $image_array = $Image->getSpotterImage($row['registration']); |
5480 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5762 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5763 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5764 | + } |
|
5481 | 5765 | } |
5482 | 5766 | $temp_array['registration_count'] = $row['registration_count']; |
5483 | 5767 | |
@@ -5589,7 +5873,9 @@ discard block |
||
5589 | 5873 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
5590 | 5874 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5591 | 5875 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
5592 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5876 | + if ($limit) { |
|
5877 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5878 | + } |
|
5593 | 5879 | |
5594 | 5880 | $sth = $this->db->prepare($query); |
5595 | 5881 | $sth->execute(); |
@@ -5608,7 +5894,9 @@ discard block |
||
5608 | 5894 | if($row['registration'] != "") |
5609 | 5895 | { |
5610 | 5896 | $image_array = $Image->getSpotterImage($row['registration']); |
5611 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5897 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5898 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5899 | + } |
|
5612 | 5900 | } |
5613 | 5901 | |
5614 | 5902 | $aircraft_array[] = $temp_array; |
@@ -5649,7 +5937,9 @@ discard block |
||
5649 | 5937 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
5650 | 5938 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5651 | 5939 | $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"; |
5652 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5940 | + if ($limit) { |
|
5941 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5942 | + } |
|
5653 | 5943 | |
5654 | 5944 | $sth = $this->db->prepare($query); |
5655 | 5945 | $sth->execute(); |
@@ -5669,7 +5959,9 @@ discard block |
||
5669 | 5959 | if($row['registration'] != "") |
5670 | 5960 | { |
5671 | 5961 | $image_array = $Image->getSpotterImage($row['registration']); |
5672 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5962 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5963 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5964 | + } |
|
5673 | 5965 | } |
5674 | 5966 | |
5675 | 5967 | $aircraft_array[] = $temp_array; |
@@ -5710,7 +6002,9 @@ discard block |
||
5710 | 6002 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5711 | 6003 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
5712 | 6004 | ORDER BY airport_departure_icao_count DESC"; |
5713 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6005 | + if ($limit) { |
|
6006 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6007 | + } |
|
5714 | 6008 | |
5715 | 6009 | $sth = $this->db->prepare($query); |
5716 | 6010 | $sth->execute(); |
@@ -5762,7 +6056,9 @@ discard block |
||
5762 | 6056 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5763 | 6057 | $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 |
5764 | 6058 | ORDER BY airport_departure_icao_count DESC"; |
5765 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6059 | + if ($limit) { |
|
6060 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6061 | + } |
|
5766 | 6062 | |
5767 | 6063 | $sth = $this->db->prepare($query); |
5768 | 6064 | $sth->execute(); |
@@ -5814,7 +6110,9 @@ discard block |
||
5814 | 6110 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5815 | 6111 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
5816 | 6112 | ORDER BY airport_departure_icao_count DESC"; |
5817 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6113 | + if ($limit) { |
|
6114 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6115 | + } |
|
5818 | 6116 | //echo $query; |
5819 | 6117 | $sth = $this->db->prepare($query); |
5820 | 6118 | $sth->execute(); |
@@ -5866,7 +6164,9 @@ discard block |
||
5866 | 6164 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5867 | 6165 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
5868 | 6166 | ORDER BY airport_departure_icao_count DESC"; |
5869 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6167 | + if ($limit) { |
|
6168 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6169 | + } |
|
5870 | 6170 | |
5871 | 6171 | $sth = $this->db->prepare($query); |
5872 | 6172 | $sth->execute(); |
@@ -6261,7 +6561,9 @@ discard block |
||
6261 | 6561 | date_default_timezone_set($globalTimezone); |
6262 | 6562 | $datetime = new DateTime($date); |
6263 | 6563 | $offset = $datetime->format('P'); |
6264 | - } else $offset = '+00:00'; |
|
6564 | + } else { |
|
6565 | + $offset = '+00:00'; |
|
6566 | + } |
|
6265 | 6567 | |
6266 | 6568 | if ($globalDBdriver == 'mysql') { |
6267 | 6569 | $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 |
@@ -6311,7 +6613,9 @@ discard block |
||
6311 | 6613 | date_default_timezone_set($globalTimezone); |
6312 | 6614 | $datetime = new DateTime($date); |
6313 | 6615 | $offset = $datetime->format('P'); |
6314 | - } else $offset = '+00:00'; |
|
6616 | + } else { |
|
6617 | + $offset = '+00:00'; |
|
6618 | + } |
|
6315 | 6619 | |
6316 | 6620 | if ($globalDBdriver == 'mysql') { |
6317 | 6621 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -6524,7 +6828,9 @@ discard block |
||
6524 | 6828 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6525 | 6829 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6526 | 6830 | ORDER BY airport_arrival_icao_count DESC"; |
6527 | - if ($limit) $query .= " LIMIT 10"; |
|
6831 | + if ($limit) { |
|
6832 | + $query .= " LIMIT 10"; |
|
6833 | + } |
|
6528 | 6834 | |
6529 | 6835 | |
6530 | 6836 | $sth = $this->db->prepare($query); |
@@ -6544,7 +6850,9 @@ discard block |
||
6544 | 6850 | if ($icaoaskey) { |
6545 | 6851 | $icao = $row['arrival_airport_icao']; |
6546 | 6852 | $airport_array[$icao] = $temp_array; |
6547 | - } else $airport_array[] = $temp_array; |
|
6853 | + } else { |
|
6854 | + $airport_array[] = $temp_array; |
|
6855 | + } |
|
6548 | 6856 | } |
6549 | 6857 | |
6550 | 6858 | return $airport_array; |
@@ -6581,7 +6889,9 @@ discard block |
||
6581 | 6889 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6582 | 6890 | $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 |
6583 | 6891 | ORDER BY airport_arrival_icao_count DESC"; |
6584 | - if ($limit) $query .= " LIMIT 10"; |
|
6892 | + if ($limit) { |
|
6893 | + $query .= " LIMIT 10"; |
|
6894 | + } |
|
6585 | 6895 | |
6586 | 6896 | |
6587 | 6897 | $sth = $this->db->prepare($query); |
@@ -6602,7 +6912,9 @@ discard block |
||
6602 | 6912 | if ($icaoaskey) { |
6603 | 6913 | $icao = $row['arrival_airport_icao']; |
6604 | 6914 | $airport_array[$icao] = $temp_array; |
6605 | - } else $airport_array[] = $temp_array; |
|
6915 | + } else { |
|
6916 | + $airport_array[] = $temp_array; |
|
6917 | + } |
|
6606 | 6918 | } |
6607 | 6919 | |
6608 | 6920 | return $airport_array; |
@@ -6639,7 +6951,9 @@ discard block |
||
6639 | 6951 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6640 | 6952 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
6641 | 6953 | ORDER BY airport_arrival_icao_count DESC"; |
6642 | - if ($limit) $query .= " LIMIT 10"; |
|
6954 | + if ($limit) { |
|
6955 | + $query .= " LIMIT 10"; |
|
6956 | + } |
|
6643 | 6957 | |
6644 | 6958 | |
6645 | 6959 | $sth = $this->db->prepare($query); |
@@ -6659,7 +6973,9 @@ discard block |
||
6659 | 6973 | if ($icaoaskey) { |
6660 | 6974 | $icao = $row['arrival_airport_icao']; |
6661 | 6975 | $airport_array[$icao] = $temp_array; |
6662 | - } else $airport_array[] = $temp_array; |
|
6976 | + } else { |
|
6977 | + $airport_array[] = $temp_array; |
|
6978 | + } |
|
6663 | 6979 | } |
6664 | 6980 | |
6665 | 6981 | return $airport_array; |
@@ -6696,7 +7012,9 @@ discard block |
||
6696 | 7012 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6697 | 7013 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
6698 | 7014 | ORDER BY airport_arrival_icao_count DESC"; |
6699 | - if ($limit) $query .= " LIMIT 10"; |
|
7015 | + if ($limit) { |
|
7016 | + $query .= " LIMIT 10"; |
|
7017 | + } |
|
6700 | 7018 | |
6701 | 7019 | |
6702 | 7020 | $sth = $this->db->prepare($query); |
@@ -6717,7 +7035,9 @@ discard block |
||
6717 | 7035 | if ($icaoaskey) { |
6718 | 7036 | $icao = $row['arrival_airport_icao']; |
6719 | 7037 | $airport_array[$icao] = $temp_array; |
6720 | - } else $airport_array[] = $temp_array; |
|
7038 | + } else { |
|
7039 | + $airport_array[] = $temp_array; |
|
7040 | + } |
|
6721 | 7041 | } |
6722 | 7042 | |
6723 | 7043 | return $airport_array; |
@@ -7098,7 +7418,9 @@ discard block |
||
7098 | 7418 | date_default_timezone_set($globalTimezone); |
7099 | 7419 | $datetime = new DateTime($date); |
7100 | 7420 | $offset = $datetime->format('P'); |
7101 | - } else $offset = '+00:00'; |
|
7421 | + } else { |
|
7422 | + $offset = '+00:00'; |
|
7423 | + } |
|
7102 | 7424 | |
7103 | 7425 | if ($globalDBdriver == 'mysql') { |
7104 | 7426 | $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 |
@@ -7148,7 +7470,9 @@ discard block |
||
7148 | 7470 | date_default_timezone_set($globalTimezone); |
7149 | 7471 | $datetime = new DateTime($date); |
7150 | 7472 | $offset = $datetime->format('P'); |
7151 | - } else $offset = '+00:00'; |
|
7473 | + } else { |
|
7474 | + $offset = '+00:00'; |
|
7475 | + } |
|
7152 | 7476 | |
7153 | 7477 | if ($globalDBdriver == 'mysql') { |
7154 | 7478 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -7371,7 +7695,9 @@ discard block |
||
7371 | 7695 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
7372 | 7696 | $query .= " GROUP BY spotter_output.arrival_airport_country |
7373 | 7697 | ORDER BY airport_arrival_country_count DESC"; |
7374 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
7698 | + if ($limit) { |
|
7699 | + $query .= " LIMIT 10 OFFSET 0"; |
|
7700 | + } |
|
7375 | 7701 | |
7376 | 7702 | |
7377 | 7703 | $sth = $this->db->prepare($query); |
@@ -7658,7 +7984,9 @@ discard block |
||
7658 | 7984 | date_default_timezone_set($globalTimezone); |
7659 | 7985 | $datetime = new DateTime($date); |
7660 | 7986 | $offset = $datetime->format('P'); |
7661 | - } else $offset = '+00:00'; |
|
7987 | + } else { |
|
7988 | + $offset = '+00:00'; |
|
7989 | + } |
|
7662 | 7990 | |
7663 | 7991 | if ($globalDBdriver == 'mysql') { |
7664 | 7992 | $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 |
@@ -7834,15 +8162,23 @@ discard block |
||
7834 | 8162 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
7835 | 8163 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
7836 | 8164 | if ($olderthanmonths > 0) { |
7837 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
7838 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
8165 | + if ($globalDBdriver == 'mysql') { |
|
8166 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
8167 | + } else { |
|
8168 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
8169 | + } |
|
7839 | 8170 | } |
7840 | 8171 | if ($sincedate != '') { |
7841 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
7842 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
8172 | + if ($globalDBdriver == 'mysql') { |
|
8173 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
8174 | + } else { |
|
8175 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
8176 | + } |
|
7843 | 8177 | } |
7844 | 8178 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
7845 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
8179 | + if ($limit) { |
|
8180 | + $query .= " LIMIT 10 OFFSET 0"; |
|
8181 | + } |
|
7846 | 8182 | |
7847 | 8183 | $sth = $this->db->prepare($query); |
7848 | 8184 | $sth->execute(); |
@@ -7876,15 +8212,23 @@ discard block |
||
7876 | 8212 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
7877 | 8213 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
7878 | 8214 | if ($olderthanmonths > 0) { |
7879 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
7880 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
8215 | + if ($globalDBdriver == 'mysql') { |
|
8216 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
8217 | + } else { |
|
8218 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
8219 | + } |
|
7881 | 8220 | } |
7882 | 8221 | if ($sincedate != '') { |
7883 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
7884 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
8222 | + if ($globalDBdriver == 'mysql') { |
|
8223 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
8224 | + } else { |
|
8225 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
8226 | + } |
|
7885 | 8227 | } |
7886 | 8228 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
7887 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
8229 | + if ($limit) { |
|
8230 | + $query .= " LIMIT 10 OFFSET 0"; |
|
8231 | + } |
|
7888 | 8232 | |
7889 | 8233 | $sth = $this->db->prepare($query); |
7890 | 8234 | $sth->execute(); |
@@ -7921,7 +8265,9 @@ discard block |
||
7921 | 8265 | date_default_timezone_set($globalTimezone); |
7922 | 8266 | $datetime = new DateTime(); |
7923 | 8267 | $offset = $datetime->format('P'); |
7924 | - } else $offset = '+00:00'; |
|
8268 | + } else { |
|
8269 | + $offset = '+00:00'; |
|
8270 | + } |
|
7925 | 8271 | |
7926 | 8272 | if ($globalDBdriver == 'mysql') { |
7927 | 8273 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7970,7 +8316,9 @@ discard block |
||
7970 | 8316 | date_default_timezone_set($globalTimezone); |
7971 | 8317 | $datetime = new DateTime(); |
7972 | 8318 | $offset = $datetime->format('P'); |
7973 | - } else $offset = '+00:00'; |
|
8319 | + } else { |
|
8320 | + $offset = '+00:00'; |
|
8321 | + } |
|
7974 | 8322 | $filter_query = $this->getFilter($filters,true,true); |
7975 | 8323 | if ($globalDBdriver == 'mysql') { |
7976 | 8324 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8019,7 +8367,9 @@ discard block |
||
8019 | 8367 | date_default_timezone_set($globalTimezone); |
8020 | 8368 | $datetime = new DateTime(); |
8021 | 8369 | $offset = $datetime->format('P'); |
8022 | - } else $offset = '+00:00'; |
|
8370 | + } else { |
|
8371 | + $offset = '+00:00'; |
|
8372 | + } |
|
8023 | 8373 | $filter_query = $this->getFilter($filters,true,true); |
8024 | 8374 | if ($globalDBdriver == 'mysql') { |
8025 | 8375 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8065,7 +8415,9 @@ discard block |
||
8065 | 8415 | date_default_timezone_set($globalTimezone); |
8066 | 8416 | $datetime = new DateTime(); |
8067 | 8417 | $offset = $datetime->format('P'); |
8068 | - } else $offset = '+00:00'; |
|
8418 | + } else { |
|
8419 | + $offset = '+00:00'; |
|
8420 | + } |
|
8069 | 8421 | $filter_query = $this->getFilter($filters,true,true); |
8070 | 8422 | if ($globalDBdriver == 'mysql') { |
8071 | 8423 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8113,7 +8465,9 @@ discard block |
||
8113 | 8465 | date_default_timezone_set($globalTimezone); |
8114 | 8466 | $datetime = new DateTime(); |
8115 | 8467 | $offset = $datetime->format('P'); |
8116 | - } else $offset = '+00:00'; |
|
8468 | + } else { |
|
8469 | + $offset = '+00:00'; |
|
8470 | + } |
|
8117 | 8471 | |
8118 | 8472 | if ($globalDBdriver == 'mysql') { |
8119 | 8473 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8161,7 +8515,9 @@ discard block |
||
8161 | 8515 | date_default_timezone_set($globalTimezone); |
8162 | 8516 | $datetime = new DateTime(); |
8163 | 8517 | $offset = $datetime->format('P'); |
8164 | - } else $offset = '+00:00'; |
|
8518 | + } else { |
|
8519 | + $offset = '+00:00'; |
|
8520 | + } |
|
8165 | 8521 | |
8166 | 8522 | if ($globalDBdriver == 'mysql') { |
8167 | 8523 | $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 |
@@ -8208,7 +8564,9 @@ discard block |
||
8208 | 8564 | date_default_timezone_set($globalTimezone); |
8209 | 8565 | $datetime = new DateTime(); |
8210 | 8566 | $offset = $datetime->format('P'); |
8211 | - } else $offset = '+00:00'; |
|
8567 | + } else { |
|
8568 | + $offset = '+00:00'; |
|
8569 | + } |
|
8212 | 8570 | |
8213 | 8571 | if ($globalDBdriver == 'mysql') { |
8214 | 8572 | $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 |
@@ -8256,7 +8614,9 @@ discard block |
||
8256 | 8614 | date_default_timezone_set($globalTimezone); |
8257 | 8615 | $datetime = new DateTime(); |
8258 | 8616 | $offset = $datetime->format('P'); |
8259 | - } else $offset = '+00:00'; |
|
8617 | + } else { |
|
8618 | + $offset = '+00:00'; |
|
8619 | + } |
|
8260 | 8620 | $filter_query = $this->getFilter($filters,true,true); |
8261 | 8621 | if ($globalDBdriver == 'mysql') { |
8262 | 8622 | $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 |
@@ -8301,7 +8661,9 @@ discard block |
||
8301 | 8661 | date_default_timezone_set($globalTimezone); |
8302 | 8662 | $datetime = new DateTime(); |
8303 | 8663 | $offset = $datetime->format('P'); |
8304 | - } else $offset = '+00:00'; |
|
8664 | + } else { |
|
8665 | + $offset = '+00:00'; |
|
8666 | + } |
|
8305 | 8667 | $filter_query = $this->getFilter($filters,true,true); |
8306 | 8668 | |
8307 | 8669 | if ($globalDBdriver == 'mysql') { |
@@ -8348,7 +8710,9 @@ discard block |
||
8348 | 8710 | date_default_timezone_set($globalTimezone); |
8349 | 8711 | $datetime = new DateTime(); |
8350 | 8712 | $offset = $datetime->format('P'); |
8351 | - } else $offset = '+00:00'; |
|
8713 | + } else { |
|
8714 | + $offset = '+00:00'; |
|
8715 | + } |
|
8352 | 8716 | |
8353 | 8717 | if ($globalDBdriver == 'mysql') { |
8354 | 8718 | $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 |
@@ -8394,7 +8758,9 @@ discard block |
||
8394 | 8758 | date_default_timezone_set($globalTimezone); |
8395 | 8759 | $datetime = new DateTime(); |
8396 | 8760 | $offset = $datetime->format('P'); |
8397 | - } else $offset = '+00:00'; |
|
8761 | + } else { |
|
8762 | + $offset = '+00:00'; |
|
8763 | + } |
|
8398 | 8764 | $filter_query = $this->getFilter($filters,true,true); |
8399 | 8765 | |
8400 | 8766 | if ($globalDBdriver == 'mysql') { |
@@ -8441,7 +8807,9 @@ discard block |
||
8441 | 8807 | date_default_timezone_set($globalTimezone); |
8442 | 8808 | $datetime = new DateTime(); |
8443 | 8809 | $offset = $datetime->format('P'); |
8444 | - } else $offset = '+00:00'; |
|
8810 | + } else { |
|
8811 | + $offset = '+00:00'; |
|
8812 | + } |
|
8445 | 8813 | |
8446 | 8814 | if ($globalDBdriver == 'mysql') { |
8447 | 8815 | $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 |
@@ -8488,7 +8856,9 @@ discard block |
||
8488 | 8856 | date_default_timezone_set($globalTimezone); |
8489 | 8857 | $datetime = new DateTime(); |
8490 | 8858 | $offset = $datetime->format('P'); |
8491 | - } else $offset = '+00:00'; |
|
8859 | + } else { |
|
8860 | + $offset = '+00:00'; |
|
8861 | + } |
|
8492 | 8862 | |
8493 | 8863 | if ($globalDBdriver == 'mysql') { |
8494 | 8864 | $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 |
@@ -8533,7 +8903,9 @@ discard block |
||
8533 | 8903 | date_default_timezone_set($globalTimezone); |
8534 | 8904 | $datetime = new DateTime(); |
8535 | 8905 | $offset = $datetime->format('P'); |
8536 | - } else $offset = '+00:00'; |
|
8906 | + } else { |
|
8907 | + $offset = '+00:00'; |
|
8908 | + } |
|
8537 | 8909 | $filter_query = $this->getFilter($filters,true,true); |
8538 | 8910 | |
8539 | 8911 | if ($globalDBdriver == 'mysql') { |
@@ -8581,7 +8953,9 @@ discard block |
||
8581 | 8953 | date_default_timezone_set($globalTimezone); |
8582 | 8954 | $datetime = new DateTime(); |
8583 | 8955 | $offset = $datetime->format('P'); |
8584 | - } else $offset = '+00:00'; |
|
8956 | + } else { |
|
8957 | + $offset = '+00:00'; |
|
8958 | + } |
|
8585 | 8959 | |
8586 | 8960 | if ($globalDBdriver == 'mysql') { |
8587 | 8961 | $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 |
@@ -8627,7 +9001,9 @@ discard block |
||
8627 | 9001 | date_default_timezone_set($globalTimezone); |
8628 | 9002 | $datetime = new DateTime(); |
8629 | 9003 | $offset = $datetime->format('P'); |
8630 | - } else $offset = '+00:00'; |
|
9004 | + } else { |
|
9005 | + $offset = '+00:00'; |
|
9006 | + } |
|
8631 | 9007 | $filter_query = $this->getFilter($filters,true,true); |
8632 | 9008 | |
8633 | 9009 | if ($globalDBdriver == 'mysql') { |
@@ -8675,7 +9051,9 @@ discard block |
||
8675 | 9051 | date_default_timezone_set($globalTimezone); |
8676 | 9052 | $datetime = new DateTime(); |
8677 | 9053 | $offset = $datetime->format('P'); |
8678 | - } else $offset = '+00:00'; |
|
9054 | + } else { |
|
9055 | + $offset = '+00:00'; |
|
9056 | + } |
|
8679 | 9057 | |
8680 | 9058 | if ($globalDBdriver == 'mysql') { |
8681 | 9059 | $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 |
@@ -8722,7 +9100,9 @@ discard block |
||
8722 | 9100 | date_default_timezone_set($globalTimezone); |
8723 | 9101 | $datetime = new DateTime(); |
8724 | 9102 | $offset = $datetime->format('P'); |
8725 | - } else $offset = '+00:00'; |
|
9103 | + } else { |
|
9104 | + $offset = '+00:00'; |
|
9105 | + } |
|
8726 | 9106 | $filter_query = $this->getFilter($filters,true,true); |
8727 | 9107 | if ($globalDBdriver == 'mysql') { |
8728 | 9108 | $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 |
@@ -8771,7 +9151,9 @@ discard block |
||
8771 | 9151 | date_default_timezone_set($globalTimezone); |
8772 | 9152 | $datetime = new DateTime(); |
8773 | 9153 | $offset = $datetime->format('P'); |
8774 | - } else $offset = '+00:00'; |
|
9154 | + } else { |
|
9155 | + $offset = '+00:00'; |
|
9156 | + } |
|
8775 | 9157 | |
8776 | 9158 | $orderby_sql = ''; |
8777 | 9159 | if ($orderby == "hour") |
@@ -8837,7 +9219,9 @@ discard block |
||
8837 | 9219 | date_default_timezone_set($globalTimezone); |
8838 | 9220 | $datetime = new DateTime(); |
8839 | 9221 | $offset = $datetime->format('P'); |
8840 | - } else $offset = '+00:00'; |
|
9222 | + } else { |
|
9223 | + $offset = '+00:00'; |
|
9224 | + } |
|
8841 | 9225 | |
8842 | 9226 | $orderby_sql = ''; |
8843 | 9227 | if ($orderby == "hour") |
@@ -8904,7 +9288,9 @@ discard block |
||
8904 | 9288 | date_default_timezone_set($globalTimezone); |
8905 | 9289 | $datetime = new DateTime(); |
8906 | 9290 | $offset = $datetime->format('P'); |
8907 | - } else $offset = '+00:00'; |
|
9291 | + } else { |
|
9292 | + $offset = '+00:00'; |
|
9293 | + } |
|
8908 | 9294 | |
8909 | 9295 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
8910 | 9296 | |
@@ -8955,7 +9341,9 @@ discard block |
||
8955 | 9341 | date_default_timezone_set($globalTimezone); |
8956 | 9342 | $datetime = new DateTime(); |
8957 | 9343 | $offset = $datetime->format('P'); |
8958 | - } else $offset = '+00:00'; |
|
9344 | + } else { |
|
9345 | + $offset = '+00:00'; |
|
9346 | + } |
|
8959 | 9347 | |
8960 | 9348 | if ($globalDBdriver == 'mysql') { |
8961 | 9349 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9002,7 +9390,9 @@ discard block |
||
9002 | 9390 | date_default_timezone_set($globalTimezone); |
9003 | 9391 | $datetime = new DateTime(); |
9004 | 9392 | $offset = $datetime->format('P'); |
9005 | - } else $offset = '+00:00'; |
|
9393 | + } else { |
|
9394 | + $offset = '+00:00'; |
|
9395 | + } |
|
9006 | 9396 | |
9007 | 9397 | if ($globalDBdriver == 'mysql') { |
9008 | 9398 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9049,7 +9439,9 @@ discard block |
||
9049 | 9439 | date_default_timezone_set($globalTimezone); |
9050 | 9440 | $datetime = new DateTime(); |
9051 | 9441 | $offset = $datetime->format('P'); |
9052 | - } else $offset = '+00:00'; |
|
9442 | + } else { |
|
9443 | + $offset = '+00:00'; |
|
9444 | + } |
|
9053 | 9445 | |
9054 | 9446 | if ($globalDBdriver == 'mysql') { |
9055 | 9447 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9097,7 +9489,9 @@ discard block |
||
9097 | 9489 | date_default_timezone_set($globalTimezone); |
9098 | 9490 | $datetime = new DateTime(); |
9099 | 9491 | $offset = $datetime->format('P'); |
9100 | - } else $offset = '+00:00'; |
|
9492 | + } else { |
|
9493 | + $offset = '+00:00'; |
|
9494 | + } |
|
9101 | 9495 | |
9102 | 9496 | if ($globalDBdriver == 'mysql') { |
9103 | 9497 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9145,7 +9539,9 @@ discard block |
||
9145 | 9539 | date_default_timezone_set($globalTimezone); |
9146 | 9540 | $datetime = new DateTime($date); |
9147 | 9541 | $offset = $datetime->format('P'); |
9148 | - } else $offset = '+00:00'; |
|
9542 | + } else { |
|
9543 | + $offset = '+00:00'; |
|
9544 | + } |
|
9149 | 9545 | |
9150 | 9546 | if ($globalDBdriver == 'mysql') { |
9151 | 9547 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9193,7 +9589,9 @@ discard block |
||
9193 | 9589 | date_default_timezone_set($globalTimezone); |
9194 | 9590 | $datetime = new DateTime(); |
9195 | 9591 | $offset = $datetime->format('P'); |
9196 | - } else $offset = '+00:00'; |
|
9592 | + } else { |
|
9593 | + $offset = '+00:00'; |
|
9594 | + } |
|
9197 | 9595 | |
9198 | 9596 | if ($globalDBdriver == 'mysql') { |
9199 | 9597 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9243,7 +9641,9 @@ discard block |
||
9243 | 9641 | date_default_timezone_set($globalTimezone); |
9244 | 9642 | $datetime = new DateTime(); |
9245 | 9643 | $offset = $datetime->format('P'); |
9246 | - } else $offset = '+00:00'; |
|
9644 | + } else { |
|
9645 | + $offset = '+00:00'; |
|
9646 | + } |
|
9247 | 9647 | |
9248 | 9648 | if ($globalDBdriver == 'mysql') { |
9249 | 9649 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9290,7 +9690,9 @@ discard block |
||
9290 | 9690 | date_default_timezone_set($globalTimezone); |
9291 | 9691 | $datetime = new DateTime(); |
9292 | 9692 | $offset = $datetime->format('P'); |
9293 | - } else $offset = '+00:00'; |
|
9693 | + } else { |
|
9694 | + $offset = '+00:00'; |
|
9695 | + } |
|
9294 | 9696 | |
9295 | 9697 | if ($globalDBdriver == 'mysql') { |
9296 | 9698 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9458,7 +9860,9 @@ discard block |
||
9458 | 9860 | date_default_timezone_set($globalTimezone); |
9459 | 9861 | $datetime = new DateTime(); |
9460 | 9862 | $offset = $datetime->format('P'); |
9461 | - } else $offset = '+00:00'; |
|
9863 | + } else { |
|
9864 | + $offset = '+00:00'; |
|
9865 | + } |
|
9462 | 9866 | |
9463 | 9867 | if ($globalDBdriver == 'mysql') { |
9464 | 9868 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9644,7 +10048,9 @@ discard block |
||
9644 | 10048 | */ |
9645 | 10049 | public function parseDirection($direction = 0) |
9646 | 10050 | { |
9647 | - if ($direction == '') $direction = 0; |
|
10051 | + if ($direction == '') { |
|
10052 | + $direction = 0; |
|
10053 | + } |
|
9648 | 10054 | $direction_array = array(); |
9649 | 10055 | $temp_array = array(); |
9650 | 10056 | |
@@ -9745,7 +10151,9 @@ discard block |
||
9745 | 10151 | if (isset($result->AirlineFlightInfoResult)) |
9746 | 10152 | { |
9747 | 10153 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
9748 | - } else return ''; |
|
10154 | + } else { |
|
10155 | + return ''; |
|
10156 | + } |
|
9749 | 10157 | |
9750 | 10158 | $registration = $this->convertAircraftRegistration($registration); |
9751 | 10159 | |
@@ -9774,7 +10182,9 @@ discard block |
||
9774 | 10182 | if (count($row) > 0) { |
9775 | 10183 | //return $row['Registration']; |
9776 | 10184 | return $row['registration']; |
9777 | - } else return ''; |
|
10185 | + } else { |
|
10186 | + return ''; |
|
10187 | + } |
|
9778 | 10188 | |
9779 | 10189 | } |
9780 | 10190 | |
@@ -9797,9 +10207,14 @@ discard block |
||
9797 | 10207 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
9798 | 10208 | $sth->closeCursor(); |
9799 | 10209 | if (count($row) > 0) { |
9800 | - if ($row['type_flight'] == null) return ''; |
|
9801 | - else return $row['type_flight']; |
|
9802 | - } else return ''; |
|
10210 | + if ($row['type_flight'] == null) { |
|
10211 | + return ''; |
|
10212 | + } else { |
|
10213 | + return $row['type_flight']; |
|
10214 | + } |
|
10215 | + } else { |
|
10216 | + return ''; |
|
10217 | + } |
|
9803 | 10218 | |
9804 | 10219 | } |
9805 | 10220 | |
@@ -9817,7 +10232,9 @@ discard block |
||
9817 | 10232 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
9818 | 10233 | |
9819 | 10234 | $Connection = new Connection($this->db); |
9820 | - if (!$Connection->tableExists('countries')) return ''; |
|
10235 | + if (!$Connection->tableExists('countries')) { |
|
10236 | + return ''; |
|
10237 | + } |
|
9821 | 10238 | |
9822 | 10239 | try { |
9823 | 10240 | /* |
@@ -9837,9 +10254,13 @@ discard block |
||
9837 | 10254 | $sth->closeCursor(); |
9838 | 10255 | if (count($row) > 0) { |
9839 | 10256 | return $row; |
9840 | - } else return ''; |
|
10257 | + } else { |
|
10258 | + return ''; |
|
10259 | + } |
|
9841 | 10260 | } catch (PDOException $e) { |
9842 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
10261 | + if (isset($globalDebug) && $globalDebug) { |
|
10262 | + echo 'Error : '.$e->getMessage()."\n"; |
|
10263 | + } |
|
9843 | 10264 | return ''; |
9844 | 10265 | } |
9845 | 10266 | |
@@ -9857,7 +10278,9 @@ discard block |
||
9857 | 10278 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
9858 | 10279 | |
9859 | 10280 | $Connection = new Connection($this->db); |
9860 | - if (!$Connection->tableExists('countries')) return ''; |
|
10281 | + if (!$Connection->tableExists('countries')) { |
|
10282 | + return ''; |
|
10283 | + } |
|
9861 | 10284 | |
9862 | 10285 | try { |
9863 | 10286 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -9869,9 +10292,13 @@ discard block |
||
9869 | 10292 | $sth->closeCursor(); |
9870 | 10293 | if (count($row) > 0) { |
9871 | 10294 | return $row; |
9872 | - } else return ''; |
|
10295 | + } else { |
|
10296 | + return ''; |
|
10297 | + } |
|
9873 | 10298 | } catch (PDOException $e) { |
9874 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
10299 | + if (isset($globalDebug) && $globalDebug) { |
|
10300 | + echo 'Error : '.$e->getMessage()."\n"; |
|
10301 | + } |
|
9875 | 10302 | return ''; |
9876 | 10303 | } |
9877 | 10304 | |
@@ -10121,7 +10548,9 @@ discard block |
||
10121 | 10548 | { |
10122 | 10549 | global $globalBitlyAccessToken; |
10123 | 10550 | |
10124 | - if ($globalBitlyAccessToken == '') return $url; |
|
10551 | + if ($globalBitlyAccessToken == '') { |
|
10552 | + return $url; |
|
10553 | + } |
|
10125 | 10554 | |
10126 | 10555 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
10127 | 10556 | |
@@ -10270,7 +10699,9 @@ discard block |
||
10270 | 10699 | |
10271 | 10700 | |
10272 | 10701 | // routes |
10273 | - if ($globalDebug) print "Routes...\n"; |
|
10702 | + if ($globalDebug) { |
|
10703 | + print "Routes...\n"; |
|
10704 | + } |
|
10274 | 10705 | if ($globalDBdriver == 'mysql') { |
10275 | 10706 | $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)"; |
10276 | 10707 | } else { |
@@ -10289,7 +10720,9 @@ discard block |
||
10289 | 10720 | } |
10290 | 10721 | } |
10291 | 10722 | |
10292 | - if ($globalDebug) print "Airlines...\n"; |
|
10723 | + if ($globalDebug) { |
|
10724 | + print "Airlines...\n"; |
|
10725 | + } |
|
10293 | 10726 | //airlines |
10294 | 10727 | if ($globalDBdriver == 'mysql') { |
10295 | 10728 | $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)"; |
@@ -10303,10 +10736,15 @@ discard block |
||
10303 | 10736 | if (is_numeric(substr($row['ident'], -1, 1))) |
10304 | 10737 | { |
10305 | 10738 | $fromsource = NULL; |
10306 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
10307 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
10308 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
10309 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
10739 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
10740 | + $fromsource = 'vatsim'; |
|
10741 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
10742 | + $fromsource = 'ivao'; |
|
10743 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
10744 | + $fromsource = 'vatsim'; |
|
10745 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
10746 | + $fromsource = 'ivao'; |
|
10747 | + } |
|
10310 | 10748 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
10311 | 10749 | if (isset($airline_array[0]['name'])) { |
10312 | 10750 | $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"; |
@@ -10316,13 +10754,17 @@ discard block |
||
10316 | 10754 | } |
10317 | 10755 | } |
10318 | 10756 | |
10319 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
10757 | + if ($globalDebug) { |
|
10758 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
10759 | + } |
|
10320 | 10760 | //duplicate modes |
10321 | 10761 | $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"; |
10322 | 10762 | $sth = $this->db->prepare($query); |
10323 | 10763 | $sth->execute(); |
10324 | 10764 | |
10325 | - if ($globalDebug) print "Aircraft...\n"; |
|
10765 | + if ($globalDebug) { |
|
10766 | + print "Aircraft...\n"; |
|
10767 | + } |
|
10326 | 10768 | //aircraft |
10327 | 10769 | if ($globalDBdriver == 'mysql') { |
10328 | 10770 | $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)"; |
@@ -10365,26 +10807,38 @@ discard block |
||
10365 | 10807 | if (isset($closestAirports[0])) { |
10366 | 10808 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
10367 | 10809 | $airport_icao = $closestAirports[0]['icao']; |
10368 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
10810 | + if ($globalDebug) { |
|
10811 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
10812 | + } |
|
10369 | 10813 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
10370 | 10814 | foreach ($closestAirports as $airport) { |
10371 | 10815 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
10372 | 10816 | $airport_icao = $airport['icao']; |
10373 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
10817 | + if ($globalDebug) { |
|
10818 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
10819 | + } |
|
10374 | 10820 | break; |
10375 | 10821 | } |
10376 | 10822 | } |
10377 | 10823 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
10378 | 10824 | $airport_icao = $closestAirports[0]['icao']; |
10379 | - 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"; |
|
10825 | + if ($globalDebug) { |
|
10826 | + 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"; |
|
10827 | + } |
|
10380 | 10828 | } else { |
10381 | - 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"; |
|
10829 | + if ($globalDebug) { |
|
10830 | + 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"; |
|
10831 | + } |
|
10382 | 10832 | } |
10383 | 10833 | } else { |
10384 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
10834 | + if ($globalDebug) { |
|
10835 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
10836 | + } |
|
10385 | 10837 | } |
10386 | 10838 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
10387 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
10839 | + if ($globalDebug) { |
|
10840 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
10841 | + } |
|
10388 | 10842 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
10389 | 10843 | $sthu = $this->db->prepare($update_query); |
10390 | 10844 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | print '<h1>'._("Aircrafts Types").'</h1>'; |
17 | 17 | |
18 | 18 | $aircraft_types = $Stats->getAllAircraftTypes(); |
19 | - if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
19 | + if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') { |
|
20 | + $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
21 | + } |
|
20 | 22 | $previous = null; |
21 | 23 | print '<div class="alphabet-legend">'; |
22 | 24 | foreach($aircraft_types as $value) { |
@@ -24,7 +26,9 @@ discard block |
||
24 | 26 | $firstLetter = substr($value['aircraft_manufacturer'], 0, 1); |
25 | 27 | if($previous !== $firstLetter) |
26 | 28 | { |
27 | - if ($previous !== null) print ' | '; |
|
29 | + if ($previous !== null) { |
|
30 | + print ' | '; |
|
31 | + } |
|
28 | 32 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
29 | 33 | } |
30 | 34 | $previous = $firstLetter; |
@@ -38,10 +42,14 @@ discard block |
||
38 | 42 | { |
39 | 43 | if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')') |
40 | 44 | { |
41 | - if ($previous !== null) print '</div>'; |
|
45 | + if ($previous !== null) { |
|
46 | + print '</div>'; |
|
47 | + } |
|
42 | 48 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
43 | 49 | } |
44 | - if ($firstLetter != '(' && $firstLetter != ')') $previous = $firstLetter; |
|
50 | + if ($firstLetter != '(' && $firstLetter != ')') { |
|
51 | + $previous = $firstLetter; |
|
52 | + } |
|
45 | 53 | print '<div class="alphabet-item">'; |
46 | 54 | print '<a href="'.$globalURL.'/aircraft/'.$value['aircraft_icao'].'">'; |
47 | 55 | if ($value['aircraft_name'] == '') { |