@@ -69,7 +69,9 @@ discard block |
||
69 | 69 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
70 | 70 | } |
71 | 71 | } |
72 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
72 | + if (is_array($globalFilter)) { |
|
73 | + $filter = array_merge($filter,$globalFilter); |
|
74 | + } |
|
73 | 75 | $filter_query_join = ''; |
74 | 76 | $filter_query_where = ''; |
75 | 77 | foreach($filters as $flt) { |
@@ -122,8 +124,11 @@ discard block |
||
122 | 124 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
123 | 125 | } |
124 | 126 | } |
125 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
126 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
127 | + if ($filter_query_where == '' && $where) { |
|
128 | + $filter_query_where = ' WHERE'; |
|
129 | + } elseif ($filter_query_where != '' && $and) { |
|
130 | + $filter_query_where .= ' AND'; |
|
131 | + } |
|
127 | 132 | $filter_query = $filter_query_join.$filter_query_where; |
128 | 133 | return $filter_query; |
129 | 134 | } |
@@ -143,10 +148,18 @@ discard block |
||
143 | 148 | $Image = new Image($this->db); |
144 | 149 | $Schedule = new Schedule($this->db); |
145 | 150 | $ACARS = new ACARS($this->db); |
146 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
147 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
148 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
149 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
151 | + if (!isset($globalIVAO)) { |
|
152 | + $globalIVAO = FALSE; |
|
153 | + } |
|
154 | + if (!isset($globalVATSIM)) { |
|
155 | + $globalVATSIM = FALSE; |
|
156 | + } |
|
157 | + if (!isset($globalphpVMS)) { |
|
158 | + $globalphpVMS = FALSE; |
|
159 | + } |
|
160 | + if (!isset($globalVAM)) { |
|
161 | + $globalVAM = FALSE; |
|
162 | + } |
|
150 | 163 | date_default_timezone_set('UTC'); |
151 | 164 | |
152 | 165 | if (!is_string($query)) |
@@ -193,21 +206,35 @@ discard block |
||
193 | 206 | } else { |
194 | 207 | $temp_array['spotter_id'] = ''; |
195 | 208 | } |
196 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
197 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
209 | + if (isset($row['flightaware_id'])) { |
|
210 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
211 | + } |
|
212 | + if (isset($row['modes'])) { |
|
213 | + $temp_array['modes'] = $row['modes']; |
|
214 | + } |
|
198 | 215 | $temp_array['ident'] = $row['ident']; |
199 | 216 | if (isset($row['registration']) && $row['registration'] != '') { |
200 | 217 | $temp_array['registration'] = $row['registration']; |
201 | 218 | } elseif (isset($temp_array['modes'])) { |
202 | 219 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
203 | - } else $temp_array['registration'] = ''; |
|
204 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
220 | + } else { |
|
221 | + $temp_array['registration'] = ''; |
|
222 | + } |
|
223 | + if (isset($row['aircraft_icao'])) { |
|
224 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
225 | + } |
|
205 | 226 | |
206 | 227 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
207 | 228 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
208 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
209 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
210 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
229 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
230 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
231 | + } |
|
232 | + if (isset($row['latitude'])) { |
|
233 | + $temp_array['latitude'] = $row['latitude']; |
|
234 | + } |
|
235 | + if (isset($row['longitude'])) { |
|
236 | + $temp_array['longitude'] = $row['longitude']; |
|
237 | + } |
|
211 | 238 | /* |
212 | 239 | if (Connection->tableExists('countries')) { |
213 | 240 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -217,8 +244,12 @@ discard block |
||
217 | 244 | } |
218 | 245 | } |
219 | 246 | */ |
220 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
221 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
247 | + if (isset($row['waypoints'])) { |
|
248 | + $temp_array['waypoints'] = $row['waypoints']; |
|
249 | + } |
|
250 | + if (isset($row['format_source'])) { |
|
251 | + $temp_array['format_source'] = $row['format_source']; |
|
252 | + } |
|
222 | 253 | if (isset($row['route_stop'])) { |
223 | 254 | $temp_array['route_stop'] = $row['route_stop']; |
224 | 255 | if ($row['route_stop'] != '') { |
@@ -237,13 +268,19 @@ discard block |
||
237 | 268 | } |
238 | 269 | } |
239 | 270 | } |
240 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
271 | + if (isset($row['altitude'])) { |
|
272 | + $temp_array['altitude'] = $row['altitude']; |
|
273 | + } |
|
241 | 274 | if (isset($row['heading'])) { |
242 | 275 | $temp_array['heading'] = $row['heading']; |
243 | 276 | $heading_direction = $this->parseDirection($row['heading']); |
244 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
277 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
278 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
279 | + } |
|
280 | + } |
|
281 | + if (isset($row['ground_speed'])) { |
|
282 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
245 | 283 | } |
246 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
247 | 284 | $temp_array['image'] = ""; |
248 | 285 | $temp_array['image_thumbnail'] = ""; |
249 | 286 | $temp_array['image_source'] = ""; |
@@ -251,7 +288,9 @@ discard block |
||
251 | 288 | |
252 | 289 | if (isset($row['highlight'])) { |
253 | 290 | $temp_array['highlight'] = $row['highlight']; |
254 | - } else $temp_array['highlight'] = ''; |
|
291 | + } else { |
|
292 | + $temp_array['highlight'] = ''; |
|
293 | + } |
|
255 | 294 | |
256 | 295 | if (isset($row['date'])) { |
257 | 296 | $dateArray = $this->parseDateString($row['date']); |
@@ -299,7 +338,9 @@ discard block |
||
299 | 338 | |
300 | 339 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
301 | 340 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
302 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
341 | + } else { |
|
342 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
343 | + } |
|
303 | 344 | } else { |
304 | 345 | $temp_array['aircraft_shadow'] = 'default.png'; |
305 | 346 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -307,11 +348,17 @@ discard block |
||
307 | 348 | } |
308 | 349 | } |
309 | 350 | $fromsource = NULL; |
310 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
311 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
312 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
313 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
314 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
351 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
352 | + $fromsource = $globalAirlinesSource; |
|
353 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
354 | + $fromsource = 'vatsim'; |
|
355 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
356 | + $fromsource = 'ivao'; |
|
357 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
358 | + $fromsource = 'vatsim'; |
|
359 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
360 | + $fromsource = 'ivao'; |
|
361 | + } |
|
315 | 362 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
316 | 363 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
317 | 364 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -334,12 +381,18 @@ discard block |
||
334 | 381 | } |
335 | 382 | } else { |
336 | 383 | $temp_array['airline_icao'] = $row['airline_icao']; |
337 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
338 | - else $temp_array['airline_iata'] = 'N/A'; |
|
384 | + if (isset($row['airline_iata'])) { |
|
385 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
386 | + } else { |
|
387 | + $temp_array['airline_iata'] = 'N/A'; |
|
388 | + } |
|
339 | 389 | $temp_array['airline_name'] = $row['airline_name']; |
340 | 390 | $temp_array['airline_country'] = $row['airline_country']; |
341 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
342 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
391 | + if (isset($row['airline_callsign'])) { |
|
392 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
393 | + } else { |
|
394 | + $temp_array['airline_callsign'] = 'N/A'; |
|
395 | + } |
|
343 | 396 | $temp_array['airline_type'] = $row['airline_type']; |
344 | 397 | if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') { |
345 | 398 | $airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']); |
@@ -366,7 +419,9 @@ discard block |
||
366 | 419 | } |
367 | 420 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
368 | 421 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
369 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
422 | + if ($owner_info['owner'] != '') { |
|
423 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
424 | + } |
|
370 | 425 | $temp_array['aircraft_base'] = $owner_info['base']; |
371 | 426 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
372 | 427 | } |
@@ -374,9 +429,14 @@ discard block |
||
374 | 429 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
375 | 430 | { |
376 | 431 | if ($globalIVAO) { |
377 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
378 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
379 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
432 | + if (isset($temp_array['airline_icao'])) { |
|
433 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
434 | + } else { |
|
435 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
436 | + } |
|
437 | + } else { |
|
438 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
439 | + } |
|
380 | 440 | if (count($image_array) > 0) { |
381 | 441 | $temp_array['image'] = $image_array[0]['image']; |
382 | 442 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -428,7 +488,9 @@ discard block |
||
428 | 488 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
429 | 489 | if ($row['departure_airport_icao'] != '') { |
430 | 490 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
431 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
491 | + if (!isset($departure_airport_array[0]['name'])) { |
|
492 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
493 | + } |
|
432 | 494 | /* |
433 | 495 | } elseif ($row['departure_airport_name'] != '') { |
434 | 496 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -436,7 +498,9 @@ discard block |
||
436 | 498 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
437 | 499 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
438 | 500 | */ |
439 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
501 | + } else { |
|
502 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
503 | + } |
|
440 | 504 | if (isset($departure_airport_array[0]['name'])) { |
441 | 505 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
442 | 506 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -456,8 +520,12 @@ discard block |
||
456 | 520 | |
457 | 521 | if ($row['arrival_airport_icao'] != '') { |
458 | 522 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
459 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
460 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
523 | + if (count($arrival_airport_array) == 0) { |
|
524 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
525 | + } |
|
526 | + } else { |
|
527 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
528 | + } |
|
461 | 529 | if (isset($arrival_airport_array[0]['name'])) { |
462 | 530 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
463 | 531 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -473,27 +541,45 @@ discard block |
||
473 | 541 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
474 | 542 | } |
475 | 543 | */ |
476 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
477 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
478 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
479 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
480 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
544 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
545 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
546 | + } |
|
547 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
548 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
549 | + } |
|
550 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
551 | + $temp_array['source_name'] = $row['source_name']; |
|
552 | + } |
|
553 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
554 | + $temp_array['over_country'] = $row['over_country']; |
|
555 | + } |
|
556 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
557 | + $temp_array['distance'] = $row['distance']; |
|
558 | + } |
|
481 | 559 | if (isset($row['squawk'])) { |
482 | 560 | $temp_array['squawk'] = $row['squawk']; |
483 | 561 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
484 | 562 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
485 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
563 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
564 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
565 | + } |
|
486 | 566 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
487 | 567 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
488 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
489 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
568 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
569 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
570 | + } |
|
571 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
572 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
573 | + } |
|
490 | 574 | } |
491 | 575 | |
492 | 576 | $temp_array['query_number_rows'] = $num_rows; |
493 | 577 | |
494 | 578 | $spotter_array[] = $temp_array; |
495 | 579 | } |
496 | - if ($num_rows == 0) return array(); |
|
580 | + if ($num_rows == 0) { |
|
581 | + return array(); |
|
582 | + } |
|
497 | 583 | $spotter_array[0]['query_number_rows'] = $num_rows; |
498 | 584 | return $spotter_array; |
499 | 585 | } |
@@ -526,7 +612,9 @@ discard block |
||
526 | 612 | foreach ($q_array as $q_item){ |
527 | 613 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
528 | 614 | $additional_query .= " AND ("; |
529 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
615 | + if (is_int($q_item)) { |
|
616 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
617 | + } |
|
530 | 618 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
531 | 619 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
532 | 620 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -547,7 +635,9 @@ discard block |
||
547 | 635 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
548 | 636 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
549 | 637 | $translate = $Translation->ident2icao($q_item); |
550 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
638 | + if ($translate != $q_item) { |
|
639 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
640 | + } |
|
551 | 641 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
552 | 642 | $additional_query .= ")"; |
553 | 643 | } |
@@ -774,7 +864,9 @@ discard block |
||
774 | 864 | date_default_timezone_set($globalTimezone); |
775 | 865 | $datetime = new DateTime(); |
776 | 866 | $offset = $datetime->format('P'); |
777 | - } else $offset = '+00:00'; |
|
867 | + } else { |
|
868 | + $offset = '+00:00'; |
|
869 | + } |
|
778 | 870 | |
779 | 871 | if ($date_array[1] != "") |
780 | 872 | { |
@@ -806,8 +898,12 @@ discard block |
||
806 | 898 | { |
807 | 899 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
808 | 900 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
809 | - } else $limit_query = ""; |
|
810 | - } else $limit_query = ""; |
|
901 | + } else { |
|
902 | + $limit_query = ""; |
|
903 | + } |
|
904 | + } else { |
|
905 | + $limit_query = ""; |
|
906 | + } |
|
811 | 907 | |
812 | 908 | |
813 | 909 | if ($sort != "") |
@@ -875,8 +971,12 @@ discard block |
||
875 | 971 | { |
876 | 972 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
877 | 973 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
878 | - } else $limit_query = ""; |
|
879 | - } else $limit_query = ""; |
|
974 | + } else { |
|
975 | + $limit_query = ""; |
|
976 | + } |
|
977 | + } else { |
|
978 | + $limit_query = ""; |
|
979 | + } |
|
880 | 980 | |
881 | 981 | if ($sort != "") |
882 | 982 | { |
@@ -1200,7 +1300,9 @@ discard block |
||
1200 | 1300 | global $global_query; |
1201 | 1301 | |
1202 | 1302 | date_default_timezone_set('UTC'); |
1203 | - if ($id == '') return array(); |
|
1303 | + if ($id == '') { |
|
1304 | + return array(); |
|
1305 | + } |
|
1204 | 1306 | $additional_query = "spotter_output.spotter_id = :id"; |
1205 | 1307 | $query_values = array(':id' => $id); |
1206 | 1308 | |
@@ -1937,7 +2039,9 @@ discard block |
||
1937 | 2039 | { |
1938 | 2040 | $highlight = $row['highlight']; |
1939 | 2041 | } |
1940 | - if (isset($highlight)) return $highlight; |
|
2042 | + if (isset($highlight)) { |
|
2043 | + return $highlight; |
|
2044 | + } |
|
1941 | 2045 | } |
1942 | 2046 | |
1943 | 2047 | |
@@ -1965,7 +2069,9 @@ discard block |
||
1965 | 2069 | $sth->closeCursor(); |
1966 | 2070 | if (count($row) > 0) { |
1967 | 2071 | return $row['usage']; |
1968 | - } else return ''; |
|
2072 | + } else { |
|
2073 | + return ''; |
|
2074 | + } |
|
1969 | 2075 | } |
1970 | 2076 | |
1971 | 2077 | /** |
@@ -1990,7 +2096,9 @@ discard block |
||
1990 | 2096 | $sth->closeCursor(); |
1991 | 2097 | if (count($row) > 0) { |
1992 | 2098 | return $row['icao']; |
1993 | - } else return ''; |
|
2099 | + } else { |
|
2100 | + return ''; |
|
2101 | + } |
|
1994 | 2102 | } |
1995 | 2103 | |
1996 | 2104 | /** |
@@ -2018,7 +2126,9 @@ discard block |
||
2018 | 2126 | $airport_longitude = $row['longitude']; |
2019 | 2127 | $Common = new Common(); |
2020 | 2128 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
2021 | - } else return ''; |
|
2129 | + } else { |
|
2130 | + return ''; |
|
2131 | + } |
|
2022 | 2132 | } |
2023 | 2133 | |
2024 | 2134 | /** |
@@ -2130,7 +2240,9 @@ discard block |
||
2130 | 2240 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2131 | 2241 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2132 | 2242 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2133 | - } else return array(); |
|
2243 | + } else { |
|
2244 | + return array(); |
|
2245 | + } |
|
2134 | 2246 | if ($globalDBdriver == 'mysql') { |
2135 | 2247 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
2136 | 2248 | } else { |
@@ -2165,7 +2277,9 @@ discard block |
||
2165 | 2277 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2166 | 2278 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2167 | 2279 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2168 | - } else return array(); |
|
2280 | + } else { |
|
2281 | + return array(); |
|
2282 | + } |
|
2169 | 2283 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
2170 | 2284 | $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
2171 | 2285 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2200,7 +2314,9 @@ discard block |
||
2200 | 2314 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
2201 | 2315 | { |
2202 | 2316 | global $globalUseRealAirlines; |
2203 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
2317 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
2318 | + $fromsource = NULL; |
|
2319 | + } |
|
2204 | 2320 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
2205 | 2321 | if ($airline_icao == 'NA') { |
2206 | 2322 | $airline_array = array(); |
@@ -2269,7 +2385,9 @@ discard block |
||
2269 | 2385 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
2270 | 2386 | { |
2271 | 2387 | global $globalUseRealAirlines; |
2272 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
2388 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
2389 | + $fromsource = NULL; |
|
2390 | + } |
|
2273 | 2391 | $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
2274 | 2392 | $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
2275 | 2393 | $sth = $this->db->prepare($query); |
@@ -2285,7 +2403,9 @@ discard block |
||
2285 | 2403 | $sth->execute(array(':fromsource' => $fromsource)); |
2286 | 2404 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2287 | 2405 | $sth->closeCursor(); |
2288 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name); |
|
2406 | + if ($row['nb'] == 0) { |
|
2407 | + $result = $this->getAllAirlineInfoByName($airline_name); |
|
2408 | + } |
|
2289 | 2409 | } |
2290 | 2410 | return $result; |
2291 | 2411 | } |
@@ -2348,15 +2468,20 @@ discard block |
||
2348 | 2468 | 'A320-211' => 'A320', |
2349 | 2469 | '747-8i' => 'B748', |
2350 | 2470 | 'A380' => 'A388'); |
2351 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
2471 | + if (isset($all_aircraft[$aircraft_type])) { |
|
2472 | + return $all_aircraft[$aircraft_type]; |
|
2473 | + } |
|
2352 | 2474 | |
2353 | 2475 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
2354 | 2476 | $aircraft_type = strtoupper($aircraft_type); |
2355 | 2477 | $sth = $this->db->prepare($query); |
2356 | 2478 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
2357 | 2479 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
2358 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
2359 | - else return ''; |
|
2480 | + if (isset($result[0]['icao'])) { |
|
2481 | + return $result[0]['icao']; |
|
2482 | + } else { |
|
2483 | + return ''; |
|
2484 | + } |
|
2360 | 2485 | } |
2361 | 2486 | |
2362 | 2487 | /** |
@@ -2379,9 +2504,13 @@ discard block |
||
2379 | 2504 | $sth->closeCursor(); |
2380 | 2505 | if (isset($row['icaotypecode'])) { |
2381 | 2506 | $icao = $row['icaotypecode']; |
2382 | - if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao]; |
|
2507 | + if (isset($this->aircraft_correct_icaotype[$icao])) { |
|
2508 | + $icao = $this->aircraft_correct_icaotype[$icao]; |
|
2509 | + } |
|
2383 | 2510 | return $icao; |
2384 | - } else return ''; |
|
2511 | + } else { |
|
2512 | + return ''; |
|
2513 | + } |
|
2385 | 2514 | } |
2386 | 2515 | |
2387 | 2516 | /** |
@@ -2404,7 +2533,9 @@ discard block |
||
2404 | 2533 | $sth->closeCursor(); |
2405 | 2534 | if (isset($row['icaotypecode'])) { |
2406 | 2535 | return $row['icaotypecode']; |
2407 | - } else return ''; |
|
2536 | + } else { |
|
2537 | + return ''; |
|
2538 | + } |
|
2408 | 2539 | } |
2409 | 2540 | |
2410 | 2541 | /** |
@@ -2450,7 +2581,9 @@ discard block |
||
2450 | 2581 | $sth->closeCursor(); |
2451 | 2582 | if (isset($row['operator_correct'])) { |
2452 | 2583 | return $row['operator_correct']; |
2453 | - } else return $operator; |
|
2584 | + } else { |
|
2585 | + return $operator; |
|
2586 | + } |
|
2454 | 2587 | } |
2455 | 2588 | |
2456 | 2589 | /** |
@@ -2463,7 +2596,9 @@ discard block |
||
2463 | 2596 | public function getRouteInfo($callsign) |
2464 | 2597 | { |
2465 | 2598 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
2466 | - if ($callsign == '') return array(); |
|
2599 | + if ($callsign == '') { |
|
2600 | + return array(); |
|
2601 | + } |
|
2467 | 2602 | $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
2468 | 2603 | |
2469 | 2604 | $sth = $this->db->prepare($query); |
@@ -2473,7 +2608,9 @@ discard block |
||
2473 | 2608 | $sth->closeCursor(); |
2474 | 2609 | if (count($row) > 0) { |
2475 | 2610 | return $row; |
2476 | - } else return array(); |
|
2611 | + } else { |
|
2612 | + return array(); |
|
2613 | + } |
|
2477 | 2614 | } |
2478 | 2615 | |
2479 | 2616 | /** |
@@ -2526,7 +2663,9 @@ discard block |
||
2526 | 2663 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
2527 | 2664 | $sth->closeCursor(); |
2528 | 2665 | return $result; |
2529 | - } else return array(); |
|
2666 | + } else { |
|
2667 | + return array(); |
|
2668 | + } |
|
2530 | 2669 | } |
2531 | 2670 | |
2532 | 2671 | |
@@ -2685,8 +2824,11 @@ discard block |
||
2685 | 2824 | $query .= " ORDER BY spotter_output.source_name ASC"; |
2686 | 2825 | |
2687 | 2826 | $sth = $this->db->prepare($query); |
2688 | - if (!empty($query_values)) $sth->execute($query_values); |
|
2689 | - else $sth->execute(); |
|
2827 | + if (!empty($query_values)) { |
|
2828 | + $sth->execute($query_values); |
|
2829 | + } else { |
|
2830 | + $sth->execute(); |
|
2831 | + } |
|
2690 | 2832 | |
2691 | 2833 | $source_array = array(); |
2692 | 2834 | $temp_array = array(); |
@@ -2719,9 +2861,13 @@ discard block |
||
2719 | 2861 | WHERE spotter_output.airline_icao <> '' |
2720 | 2862 | ORDER BY spotter_output.airline_name ASC"; |
2721 | 2863 | */ |
2722 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
2723 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
2724 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
2864 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
2865 | + $forsource = $globalAirlinesSource; |
|
2866 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
2867 | + $forsource = 'vatsim'; |
|
2868 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
2869 | + $forsource = 'ivao'; |
|
2870 | + } |
|
2725 | 2871 | if ($forsource === NULL) { |
2726 | 2872 | $query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC"; |
2727 | 2873 | $query_data = array(); |
@@ -2764,9 +2910,13 @@ discard block |
||
2764 | 2910 | { |
2765 | 2911 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
2766 | 2912 | $filter_query = $this->getFilter($filters,true,true); |
2767 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
2768 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
2769 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
2913 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
2914 | + $forsource = $globalAirlinesSource; |
|
2915 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
2916 | + $forsource = 'vatsim'; |
|
2917 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
2918 | + $forsource = 'ivao'; |
|
2919 | + } |
|
2770 | 2920 | if ($forsource === NULL) { |
2771 | 2921 | $query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC"; |
2772 | 2922 | $query_data = array(); |
@@ -3077,7 +3227,9 @@ discard block |
||
3077 | 3227 | date_default_timezone_set($globalTimezone); |
3078 | 3228 | $datetime = new DateTime(); |
3079 | 3229 | $offset = $datetime->format('P'); |
3080 | - } else $offset = '+00:00'; |
|
3230 | + } else { |
|
3231 | + $offset = '+00:00'; |
|
3232 | + } |
|
3081 | 3233 | if ($airport_icao == '') { |
3082 | 3234 | if ($globalDBdriver == 'mysql') { |
3083 | 3235 | $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"; |
@@ -3109,7 +3261,9 @@ discard block |
||
3109 | 3261 | date_default_timezone_set($globalTimezone); |
3110 | 3262 | $datetime = new DateTime(); |
3111 | 3263 | $offset = $datetime->format('P'); |
3112 | - } else $offset = '+00:00'; |
|
3264 | + } else { |
|
3265 | + $offset = '+00:00'; |
|
3266 | + } |
|
3113 | 3267 | if ($airport_icao == '') { |
3114 | 3268 | if ($globalDBdriver == 'mysql') { |
3115 | 3269 | $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"; |
@@ -3142,7 +3296,9 @@ discard block |
||
3142 | 3296 | date_default_timezone_set($globalTimezone); |
3143 | 3297 | $datetime = new DateTime(); |
3144 | 3298 | $offset = $datetime->format('P'); |
3145 | - } else $offset = '+00:00'; |
|
3299 | + } else { |
|
3300 | + $offset = '+00:00'; |
|
3301 | + } |
|
3146 | 3302 | if ($airport_icao == '') { |
3147 | 3303 | if ($globalDBdriver == 'mysql') { |
3148 | 3304 | $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 |
@@ -3181,7 +3337,9 @@ discard block |
||
3181 | 3337 | date_default_timezone_set($globalTimezone); |
3182 | 3338 | $datetime = new DateTime(); |
3183 | 3339 | $offset = $datetime->format('P'); |
3184 | - } else $offset = '+00:00'; |
|
3340 | + } else { |
|
3341 | + $offset = '+00:00'; |
|
3342 | + } |
|
3185 | 3343 | if ($airport_icao == '') { |
3186 | 3344 | if ($globalDBdriver == 'mysql') { |
3187 | 3345 | $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 |
@@ -3226,7 +3384,9 @@ discard block |
||
3226 | 3384 | date_default_timezone_set($globalTimezone); |
3227 | 3385 | $datetime = new DateTime(); |
3228 | 3386 | $offset = $datetime->format('P'); |
3229 | - } else $offset = '+00:00'; |
|
3387 | + } else { |
|
3388 | + $offset = '+00:00'; |
|
3389 | + } |
|
3230 | 3390 | if ($airport_icao == '') { |
3231 | 3391 | if ($globalDBdriver == 'mysql') { |
3232 | 3392 | $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"; |
@@ -3261,7 +3421,9 @@ discard block |
||
3261 | 3421 | date_default_timezone_set($globalTimezone); |
3262 | 3422 | $datetime = new DateTime(); |
3263 | 3423 | $offset = $datetime->format('P'); |
3264 | - } else $offset = '+00:00'; |
|
3424 | + } else { |
|
3425 | + $offset = '+00:00'; |
|
3426 | + } |
|
3265 | 3427 | if ($airport_icao == '') { |
3266 | 3428 | if ($globalDBdriver == 'mysql') { |
3267 | 3429 | $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 |
@@ -3303,7 +3465,9 @@ discard block |
||
3303 | 3465 | date_default_timezone_set($globalTimezone); |
3304 | 3466 | $datetime = new DateTime(); |
3305 | 3467 | $offset = $datetime->format('P'); |
3306 | - } else $offset = '+00:00'; |
|
3468 | + } else { |
|
3469 | + $offset = '+00:00'; |
|
3470 | + } |
|
3307 | 3471 | if ($airport_icao == '') { |
3308 | 3472 | if ($globalDBdriver == 'mysql') { |
3309 | 3473 | $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"; |
@@ -3337,7 +3501,9 @@ discard block |
||
3337 | 3501 | date_default_timezone_set($globalTimezone); |
3338 | 3502 | $datetime = new DateTime(); |
3339 | 3503 | $offset = $datetime->format('P'); |
3340 | - } else $offset = '+00:00'; |
|
3504 | + } else { |
|
3505 | + $offset = '+00:00'; |
|
3506 | + } |
|
3341 | 3507 | if ($airport_icao == '') { |
3342 | 3508 | if ($globalDBdriver == 'mysql') { |
3343 | 3509 | $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 |
@@ -3385,7 +3551,9 @@ discard block |
||
3385 | 3551 | date_default_timezone_set($globalTimezone); |
3386 | 3552 | $datetime = new DateTime(); |
3387 | 3553 | $offset = $datetime->format('P'); |
3388 | - } else $offset = '+00:00'; |
|
3554 | + } else { |
|
3555 | + $offset = '+00:00'; |
|
3556 | + } |
|
3389 | 3557 | |
3390 | 3558 | if ($globalDBdriver == 'mysql') { |
3391 | 3559 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3505,7 +3673,9 @@ discard block |
||
3505 | 3673 | */ |
3506 | 3674 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
3507 | 3675 | { |
3508 | - if ($groundspeed == '') $groundspeed = NULL; |
|
3676 | + if ($groundspeed == '') { |
|
3677 | + $groundspeed = NULL; |
|
3678 | + } |
|
3509 | 3679 | $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'; |
3510 | 3680 | $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); |
3511 | 3681 | |
@@ -3555,10 +3725,18 @@ discard block |
||
3555 | 3725 | $Image = new Image($this->db); |
3556 | 3726 | $Common = new Common(); |
3557 | 3727 | |
3558 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
3559 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
3560 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
3561 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
3728 | + if (!isset($globalIVAO)) { |
|
3729 | + $globalIVAO = FALSE; |
|
3730 | + } |
|
3731 | + if (!isset($globalVATSIM)) { |
|
3732 | + $globalVATSIM = FALSE; |
|
3733 | + } |
|
3734 | + if (!isset($globalphpVMS)) { |
|
3735 | + $globalphpVMS = FALSE; |
|
3736 | + } |
|
3737 | + if (!isset($globalVAM)) { |
|
3738 | + $globalVAM = FALSE; |
|
3739 | + } |
|
3562 | 3740 | date_default_timezone_set('UTC'); |
3563 | 3741 | |
3564 | 3742 | //getting the registration |
@@ -3571,23 +3749,33 @@ discard block |
||
3571 | 3749 | if ($ModeS != '') { |
3572 | 3750 | $timeelapsed = microtime(true); |
3573 | 3751 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
3574 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3752 | + if ($globalDebugTimeElapsed) { |
|
3753 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3754 | + } |
|
3575 | 3755 | } else { |
3576 | 3756 | $myhex = explode('-',$flightaware_id); |
3577 | 3757 | if (count($myhex) > 0) { |
3578 | 3758 | $timeelapsed = microtime(true); |
3579 | 3759 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
3580 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3760 | + if ($globalDebugTimeElapsed) { |
|
3761 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3762 | + } |
|
3581 | 3763 | } |
3582 | 3764 | } |
3583 | 3765 | } |
3584 | 3766 | } |
3585 | 3767 | $fromsource = NULL; |
3586 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
3587 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
3588 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
3589 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
3590 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
3768 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
3769 | + $fromsource = $globalAirlinesSource; |
|
3770 | + } elseif ($format_source == 'vatsimtxt') { |
|
3771 | + $fromsource = 'vatsim'; |
|
3772 | + } elseif ($format_source == 'whazzup') { |
|
3773 | + $fromsource = 'ivao'; |
|
3774 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
3775 | + $fromsource = 'vatsim'; |
|
3776 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
3777 | + $fromsource = 'ivao'; |
|
3778 | + } |
|
3591 | 3779 | //getting the airline information |
3592 | 3780 | if ($ident != "") |
3593 | 3781 | { |
@@ -3611,15 +3799,21 @@ discard block |
||
3611 | 3799 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
3612 | 3800 | $airline_array = $this->getAllAirlineInfo("NA"); |
3613 | 3801 | } |
3614 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3802 | + if ($globalDebugTimeElapsed) { |
|
3803 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3804 | + } |
|
3615 | 3805 | |
3616 | 3806 | } else { |
3617 | 3807 | $timeelapsed = microtime(true); |
3618 | 3808 | $airline_array = $this->getAllAirlineInfo("NA"); |
3619 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3809 | + if ($globalDebugTimeElapsed) { |
|
3810 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3811 | + } |
|
3620 | 3812 | } |
3621 | 3813 | } |
3622 | - } else $airline_array = array(); |
|
3814 | + } else { |
|
3815 | + $airline_array = array(); |
|
3816 | + } |
|
3623 | 3817 | |
3624 | 3818 | //getting the aircraft information |
3625 | 3819 | $aircraft_array = array(); |
@@ -3633,27 +3827,37 @@ discard block |
||
3633 | 3827 | { |
3634 | 3828 | $timeelapsed = microtime(true); |
3635 | 3829 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3636 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3830 | + if ($globalDebugTimeElapsed) { |
|
3831 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3832 | + } |
|
3637 | 3833 | } else { |
3638 | 3834 | $timeelapsed = microtime(true); |
3639 | 3835 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3640 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3836 | + if ($globalDebugTimeElapsed) { |
|
3837 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3838 | + } |
|
3641 | 3839 | } |
3642 | 3840 | } |
3643 | 3841 | } else { |
3644 | 3842 | if ($ModeS != '') { |
3645 | 3843 | $timeelapsed = microtime(true); |
3646 | 3844 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
3647 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3845 | + if ($globalDebugTimeElapsed) { |
|
3846 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3847 | + } |
|
3648 | 3848 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
3649 | 3849 | { |
3650 | 3850 | $timeelapsed = microtime(true); |
3651 | 3851 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3652 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3852 | + if ($globalDebugTimeElapsed) { |
|
3853 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3854 | + } |
|
3653 | 3855 | } else { |
3654 | 3856 | $timeelapsed = microtime(true); |
3655 | 3857 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3656 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3858 | + if ($globalDebugTimeElapsed) { |
|
3859 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3860 | + } |
|
3657 | 3861 | } |
3658 | 3862 | } |
3659 | 3863 | } |
@@ -3669,7 +3873,9 @@ discard block |
||
3669 | 3873 | } else { |
3670 | 3874 | $timeelapsed = microtime(true); |
3671 | 3875 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
3672 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3876 | + if ($globalDebugTimeElapsed) { |
|
3877 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3878 | + } |
|
3673 | 3879 | } |
3674 | 3880 | } |
3675 | 3881 | |
@@ -3684,7 +3890,9 @@ discard block |
||
3684 | 3890 | } else { |
3685 | 3891 | $timeelapsed = microtime(true); |
3686 | 3892 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
3687 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3893 | + if ($globalDebugTimeElapsed) { |
|
3894 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3895 | + } |
|
3688 | 3896 | } |
3689 | 3897 | } |
3690 | 3898 | |
@@ -3718,7 +3926,9 @@ discard block |
||
3718 | 3926 | { |
3719 | 3927 | return false; |
3720 | 3928 | } |
3721 | - } else $altitude = 0; |
|
3929 | + } else { |
|
3930 | + $altitude = 0; |
|
3931 | + } |
|
3722 | 3932 | |
3723 | 3933 | if ($heading != "") |
3724 | 3934 | { |
@@ -3747,7 +3957,9 @@ discard block |
||
3747 | 3957 | { |
3748 | 3958 | $timeelapsed = microtime(true); |
3749 | 3959 | $image_array = $Image->getSpotterImage($registration); |
3750 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3960 | + if ($globalDebugTimeElapsed) { |
|
3961 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3962 | + } |
|
3751 | 3963 | if (!isset($image_array[0]['registration'])) |
3752 | 3964 | { |
3753 | 3965 | //echo "Add image !!!! \n"; |
@@ -3755,14 +3967,21 @@ discard block |
||
3755 | 3967 | } |
3756 | 3968 | $timeelapsed = microtime(true); |
3757 | 3969 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
3758 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3759 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
3970 | + if ($globalDebugTimeElapsed) { |
|
3971 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3972 | + } |
|
3973 | + if ($owner_info['owner'] != '') { |
|
3974 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
3975 | + } |
|
3760 | 3976 | } |
3761 | 3977 | |
3762 | 3978 | if ($globalIVAO && $aircraft_icao != '') |
3763 | 3979 | { |
3764 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
3765 | - else $airline_icao = ''; |
|
3980 | + if (isset($airline_array[0]['icao'])) { |
|
3981 | + $airline_icao = $airline_array[0]['icao']; |
|
3982 | + } else { |
|
3983 | + $airline_icao = ''; |
|
3984 | + } |
|
3766 | 3985 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
3767 | 3986 | if (!isset($image_array[0]['registration'])) |
3768 | 3987 | { |
@@ -3807,16 +4026,28 @@ discard block |
||
3807 | 4026 | { |
3808 | 4027 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
3809 | 4028 | } |
3810 | - if ($registration == '') $registration = 'NA'; |
|
4029 | + if ($registration == '') { |
|
4030 | + $registration = 'NA'; |
|
4031 | + } |
|
3811 | 4032 | if ($latitude == '' && $longitude == '') { |
3812 | 4033 | $latitude = 0; |
3813 | 4034 | $longitude = 0; |
3814 | 4035 | } |
3815 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
3816 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
3817 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
3818 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
3819 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
4036 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
4037 | + $squawk = NULL; |
|
4038 | + } |
|
4039 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
4040 | + $verticalrate = NULL; |
|
4041 | + } |
|
4042 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
4043 | + $heading = 0; |
|
4044 | + } |
|
4045 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
4046 | + $groundspeed = 0; |
|
4047 | + } |
|
4048 | + if (!isset($aircraft_owner)) { |
|
4049 | + $aircraft_owner = NULL; |
|
4050 | + } |
|
3820 | 4051 | $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) |
3821 | 4052 | 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)"; |
3822 | 4053 | |
@@ -3827,9 +4058,13 @@ discard block |
||
3827 | 4058 | if ($airline_type == '') { |
3828 | 4059 | $timeelapsed = microtime(true); |
3829 | 4060 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
3830 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
4061 | + if ($globalDebugTimeElapsed) { |
|
4062 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
4063 | + } |
|
4064 | + } |
|
4065 | + if ($airline_type == null) { |
|
4066 | + $airline_type = ''; |
|
3831 | 4067 | } |
3832 | - if ($airline_type == null) $airline_type = ''; |
|
3833 | 4068 | $aircraft_type = $aircraft_array[0]['type']; |
3834 | 4069 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
3835 | 4070 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -3993,7 +4228,9 @@ discard block |
||
3993 | 4228 | } |
3994 | 4229 | } |
3995 | 4230 | $query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
3996 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4231 | + if ($limit) { |
|
4232 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4233 | + } |
|
3997 | 4234 | |
3998 | 4235 | $sth = $this->db->prepare($query); |
3999 | 4236 | $sth->execute($query_values); |
@@ -4066,7 +4303,9 @@ discard block |
||
4066 | 4303 | } |
4067 | 4304 | |
4068 | 4305 | $query .= " GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
4069 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4306 | + if ($limit) { |
|
4307 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4308 | + } |
|
4070 | 4309 | |
4071 | 4310 | |
4072 | 4311 | $sth = $this->db->prepare($query); |
@@ -4110,7 +4349,9 @@ discard block |
||
4110 | 4349 | } |
4111 | 4350 | } |
4112 | 4351 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
4113 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4352 | + if ($limit) { |
|
4353 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4354 | + } |
|
4114 | 4355 | |
4115 | 4356 | |
4116 | 4357 | $sth = $this->db->prepare($query); |
@@ -4186,7 +4427,9 @@ discard block |
||
4186 | 4427 | } |
4187 | 4428 | } |
4188 | 4429 | $query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
4189 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4430 | + if ($limit) { |
|
4431 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4432 | + } |
|
4190 | 4433 | |
4191 | 4434 | $sth = $this->db->prepare($query); |
4192 | 4435 | $sth->execute($query_values); |
@@ -4228,7 +4471,9 @@ discard block |
||
4228 | 4471 | } |
4229 | 4472 | } |
4230 | 4473 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
4231 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4474 | + if ($limit) { |
|
4475 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4476 | + } |
|
4232 | 4477 | |
4233 | 4478 | |
4234 | 4479 | $sth = $this->db->prepare($query); |
@@ -4471,7 +4716,9 @@ discard block |
||
4471 | 4716 | date_default_timezone_set($globalTimezone); |
4472 | 4717 | $datetime = new DateTime($date); |
4473 | 4718 | $offset = $datetime->format('P'); |
4474 | - } else $offset = '+00:00'; |
|
4719 | + } else { |
|
4720 | + $offset = '+00:00'; |
|
4721 | + } |
|
4475 | 4722 | |
4476 | 4723 | if ($globalDBdriver == 'mysql') { |
4477 | 4724 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4519,7 +4766,9 @@ discard block |
||
4519 | 4766 | date_default_timezone_set($globalTimezone); |
4520 | 4767 | $datetime = new DateTime($date); |
4521 | 4768 | $offset = $datetime->format('P'); |
4522 | - } else $offset = '+00:00'; |
|
4769 | + } else { |
|
4770 | + $offset = '+00:00'; |
|
4771 | + } |
|
4523 | 4772 | |
4524 | 4773 | if ($globalDBdriver == 'mysql') { |
4525 | 4774 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4795,7 +5044,9 @@ discard block |
||
4795 | 5044 | } |
4796 | 5045 | $query .= " GROUP BY spotter_output.airline_country |
4797 | 5046 | ORDER BY airline_country_count DESC"; |
4798 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5047 | + if ($limit) { |
|
5048 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5049 | + } |
|
4799 | 5050 | |
4800 | 5051 | $sth = $this->db->prepare($query); |
4801 | 5052 | $sth->execute($query_values); |
@@ -4823,7 +5074,9 @@ discard block |
||
4823 | 5074 | global $globalDBdriver; |
4824 | 5075 | //$filter_query = $this->getFilter($filters,true,true); |
4825 | 5076 | $Connection= new Connection($this->db); |
4826 | - if (!$Connection->tableExists('countries')) return array(); |
|
5077 | + if (!$Connection->tableExists('countries')) { |
|
5078 | + return array(); |
|
5079 | + } |
|
4827 | 5080 | /* |
4828 | 5081 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
4829 | 5082 | FROM countries c, spotter_output s |
@@ -4855,7 +5108,9 @@ discard block |
||
4855 | 5108 | } |
4856 | 5109 | $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 "; |
4857 | 5110 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
4858 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5111 | + if ($limit) { |
|
5112 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5113 | + } |
|
4859 | 5114 | |
4860 | 5115 | |
4861 | 5116 | $sth = $this->db->prepare($query); |
@@ -4932,7 +5187,9 @@ discard block |
||
4932 | 5187 | } |
4933 | 5188 | |
4934 | 5189 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
4935 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5190 | + if ($limit) { |
|
5191 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5192 | + } |
|
4936 | 5193 | |
4937 | 5194 | $sth = $this->db->prepare($query); |
4938 | 5195 | $sth->execute($query_values); |
@@ -5006,7 +5263,9 @@ discard block |
||
5006 | 5263 | } |
5007 | 5264 | |
5008 | 5265 | $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"; |
5009 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5266 | + if ($limit) { |
|
5267 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5268 | + } |
|
5010 | 5269 | |
5011 | 5270 | $sth = $this->db->prepare($query); |
5012 | 5271 | $sth->execute($query_values); |
@@ -5053,7 +5312,9 @@ discard block |
||
5053 | 5312 | } |
5054 | 5313 | |
5055 | 5314 | $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"; |
5056 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5315 | + if ($limit) { |
|
5316 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5317 | + } |
|
5057 | 5318 | |
5058 | 5319 | $sth = $this->db->prepare($query); |
5059 | 5320 | $sth->execute(); |
@@ -5106,7 +5367,9 @@ discard block |
||
5106 | 5367 | if($row['registration'] != "") |
5107 | 5368 | { |
5108 | 5369 | $image_array = $Image->getSpotterImage($row['registration']); |
5109 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5370 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5371 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5372 | + } |
|
5110 | 5373 | } |
5111 | 5374 | $temp_array['registration_count'] = $row['registration_count']; |
5112 | 5375 | |
@@ -5181,7 +5444,9 @@ discard block |
||
5181 | 5444 | if($row['registration'] != "") |
5182 | 5445 | { |
5183 | 5446 | $image_array = $Image->getSpotterImage($row['registration']); |
5184 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5447 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5448 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5449 | + } |
|
5185 | 5450 | } |
5186 | 5451 | $temp_array['registration_count'] = $row['registration_count']; |
5187 | 5452 | |
@@ -5288,7 +5553,9 @@ discard block |
||
5288 | 5553 | if($row['registration'] != "") |
5289 | 5554 | { |
5290 | 5555 | $image_array = $Image->getSpotterImage($row['registration']); |
5291 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5556 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5557 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5558 | + } |
|
5292 | 5559 | } |
5293 | 5560 | $temp_array['registration_count'] = $row['registration_count']; |
5294 | 5561 | $aircraft_array[] = $temp_array; |
@@ -5413,7 +5680,9 @@ discard block |
||
5413 | 5680 | date_default_timezone_set($globalTimezone); |
5414 | 5681 | $datetime = new DateTime($date); |
5415 | 5682 | $offset = $datetime->format('P'); |
5416 | - } else $offset = '+00:00'; |
|
5683 | + } else { |
|
5684 | + $offset = '+00:00'; |
|
5685 | + } |
|
5417 | 5686 | |
5418 | 5687 | if ($globalDBdriver == 'mysql') { |
5419 | 5688 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -5460,7 +5729,9 @@ discard block |
||
5460 | 5729 | date_default_timezone_set($globalTimezone); |
5461 | 5730 | $datetime = new DateTime($date); |
5462 | 5731 | $offset = $datetime->format('P'); |
5463 | - } else $offset = '+00:00'; |
|
5732 | + } else { |
|
5733 | + $offset = '+00:00'; |
|
5734 | + } |
|
5464 | 5735 | |
5465 | 5736 | if ($globalDBdriver == 'mysql') { |
5466 | 5737 | $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 |
@@ -5489,7 +5760,9 @@ discard block |
||
5489 | 5760 | if($row['registration'] != "") |
5490 | 5761 | { |
5491 | 5762 | $image_array = $Image->getSpotterImage($row['registration']); |
5492 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5763 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5764 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5765 | + } |
|
5493 | 5766 | } |
5494 | 5767 | $temp_array['registration_count'] = $row['registration_count']; |
5495 | 5768 | |
@@ -5514,7 +5787,9 @@ discard block |
||
5514 | 5787 | date_default_timezone_set($globalTimezone); |
5515 | 5788 | $datetime = new DateTime($date); |
5516 | 5789 | $offset = $datetime->format('P'); |
5517 | - } else $offset = '+00:00'; |
|
5790 | + } else { |
|
5791 | + $offset = '+00:00'; |
|
5792 | + } |
|
5518 | 5793 | |
5519 | 5794 | if ($globalDBdriver == 'mysql') { |
5520 | 5795 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5652,8 +5927,11 @@ discard block |
||
5652 | 5927 | if($row['registration'] != "") |
5653 | 5928 | { |
5654 | 5929 | $image_array = $Image->getSpotterImage($row['registration']); |
5655 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5656 | - else $temp_array['image_thumbnail'] = ''; |
|
5930 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5931 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5932 | + } else { |
|
5933 | + $temp_array['image_thumbnail'] = ''; |
|
5934 | + } |
|
5657 | 5935 | } |
5658 | 5936 | $temp_array['registration_count'] = $row['registration_count']; |
5659 | 5937 | $aircraft_array[] = $temp_array; |
@@ -5696,8 +5974,11 @@ discard block |
||
5696 | 5974 | if($row['registration'] != "") |
5697 | 5975 | { |
5698 | 5976 | $image_array = $Image->getSpotterImage($row['registration']); |
5699 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5700 | - else $temp_array['image_thumbnail'] = ''; |
|
5977 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5978 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5979 | + } else { |
|
5980 | + $temp_array['image_thumbnail'] = ''; |
|
5981 | + } |
|
5701 | 5982 | } |
5702 | 5983 | $temp_array['registration_count'] = $row['registration_count']; |
5703 | 5984 | $aircraft_array[] = $temp_array; |
@@ -5740,8 +6021,11 @@ discard block |
||
5740 | 6021 | if($row['registration'] != "") |
5741 | 6022 | { |
5742 | 6023 | $image_array = $Image->getSpotterImage($row['registration']); |
5743 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5744 | - else $temp_array['image_thumbnail'] = ''; |
|
6024 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
6025 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6026 | + } else { |
|
6027 | + $temp_array['image_thumbnail'] = ''; |
|
6028 | + } |
|
5745 | 6029 | } |
5746 | 6030 | $temp_array['registration_count'] = $row['registration_count']; |
5747 | 6031 | $aircraft_array[] = $temp_array; |
@@ -5890,7 +6174,9 @@ discard block |
||
5890 | 6174 | if($row['registration'] != "") |
5891 | 6175 | { |
5892 | 6176 | $image_array = $Image->getSpotterImage($row['registration']); |
5893 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6177 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
6178 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6179 | + } |
|
5894 | 6180 | } |
5895 | 6181 | $temp_array['registration_count'] = $row['registration_count']; |
5896 | 6182 | |
@@ -6007,7 +6293,9 @@ discard block |
||
6007 | 6293 | if($row['registration'] != "") |
6008 | 6294 | { |
6009 | 6295 | $image_array = $Image->getSpotterImage($row['registration']); |
6010 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6296 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
6297 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6298 | + } |
|
6011 | 6299 | } |
6012 | 6300 | $temp_array['registration_count'] = $row['registration_count']; |
6013 | 6301 | |
@@ -6173,7 +6461,9 @@ discard block |
||
6173 | 6461 | } |
6174 | 6462 | } |
6175 | 6463 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
6176 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6464 | + if ($limit) { |
|
6465 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6466 | + } |
|
6177 | 6467 | |
6178 | 6468 | $sth = $this->db->prepare($query); |
6179 | 6469 | $sth->execute($query_values); |
@@ -6192,7 +6482,9 @@ discard block |
||
6192 | 6482 | if($row['registration'] != "") |
6193 | 6483 | { |
6194 | 6484 | $image_array = $Image->getSpotterImage($row['registration']); |
6195 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6485 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
6486 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6487 | + } |
|
6196 | 6488 | } |
6197 | 6489 | |
6198 | 6490 | $aircraft_array[] = $temp_array; |
@@ -6233,7 +6525,9 @@ discard block |
||
6233 | 6525 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
6234 | 6526 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6235 | 6527 | $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"; |
6236 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6528 | + if ($limit) { |
|
6529 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6530 | + } |
|
6237 | 6531 | |
6238 | 6532 | $sth = $this->db->prepare($query); |
6239 | 6533 | $sth->execute(); |
@@ -6253,7 +6547,9 @@ discard block |
||
6253 | 6547 | if($row['registration'] != "") |
6254 | 6548 | { |
6255 | 6549 | $image_array = $Image->getSpotterImage($row['registration']); |
6256 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6550 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
6551 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6552 | + } |
|
6257 | 6553 | } |
6258 | 6554 | |
6259 | 6555 | $aircraft_array[] = $temp_array; |
@@ -6319,7 +6615,9 @@ discard block |
||
6319 | 6615 | } |
6320 | 6616 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
6321 | 6617 | ORDER BY airport_departure_icao_count DESC"; |
6322 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6618 | + if ($limit) { |
|
6619 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6620 | + } |
|
6323 | 6621 | |
6324 | 6622 | $sth = $this->db->prepare($query); |
6325 | 6623 | $sth->execute($query_values); |
@@ -6370,7 +6668,9 @@ discard block |
||
6370 | 6668 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6371 | 6669 | $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 |
6372 | 6670 | ORDER BY airport_departure_icao_count DESC"; |
6373 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6671 | + if ($limit) { |
|
6672 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6673 | + } |
|
6374 | 6674 | |
6375 | 6675 | $sth = $this->db->prepare($query); |
6376 | 6676 | $sth->execute(); |
@@ -6448,7 +6748,9 @@ discard block |
||
6448 | 6748 | } |
6449 | 6749 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
6450 | 6750 | ORDER BY airport_departure_icao_count DESC"; |
6451 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6751 | + if ($limit) { |
|
6752 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6753 | + } |
|
6452 | 6754 | //echo $query; |
6453 | 6755 | $sth = $this->db->prepare($query); |
6454 | 6756 | $sth->execute($query_values); |
@@ -6500,7 +6802,9 @@ discard block |
||
6500 | 6802 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6501 | 6803 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
6502 | 6804 | ORDER BY airport_departure_icao_count DESC"; |
6503 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6805 | + if ($limit) { |
|
6806 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6807 | + } |
|
6504 | 6808 | |
6505 | 6809 | $sth = $this->db->prepare($query); |
6506 | 6810 | $sth->execute(); |
@@ -6895,7 +7199,9 @@ discard block |
||
6895 | 7199 | date_default_timezone_set($globalTimezone); |
6896 | 7200 | $datetime = new DateTime($date); |
6897 | 7201 | $offset = $datetime->format('P'); |
6898 | - } else $offset = '+00:00'; |
|
7202 | + } else { |
|
7203 | + $offset = '+00:00'; |
|
7204 | + } |
|
6899 | 7205 | |
6900 | 7206 | if ($globalDBdriver == 'mysql') { |
6901 | 7207 | $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 |
@@ -6945,7 +7251,9 @@ discard block |
||
6945 | 7251 | date_default_timezone_set($globalTimezone); |
6946 | 7252 | $datetime = new DateTime($date); |
6947 | 7253 | $offset = $datetime->format('P'); |
6948 | - } else $offset = '+00:00'; |
|
7254 | + } else { |
|
7255 | + $offset = '+00:00'; |
|
7256 | + } |
|
6949 | 7257 | |
6950 | 7258 | if ($globalDBdriver == 'mysql') { |
6951 | 7259 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -7294,7 +7602,9 @@ discard block |
||
7294 | 7602 | } |
7295 | 7603 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7296 | 7604 | ORDER BY airport_arrival_icao_count DESC"; |
7297 | - if ($limit) $query .= " LIMIT 10"; |
|
7605 | + if ($limit) { |
|
7606 | + $query .= " LIMIT 10"; |
|
7607 | + } |
|
7298 | 7608 | |
7299 | 7609 | |
7300 | 7610 | $sth = $this->db->prepare($query); |
@@ -7314,7 +7624,9 @@ discard block |
||
7314 | 7624 | if ($icaoaskey) { |
7315 | 7625 | $icao = $row['arrival_airport_icao']; |
7316 | 7626 | $airport_array[$icao] = $temp_array; |
7317 | - } else $airport_array[] = $temp_array; |
|
7627 | + } else { |
|
7628 | + $airport_array[] = $temp_array; |
|
7629 | + } |
|
7318 | 7630 | } |
7319 | 7631 | |
7320 | 7632 | return $airport_array; |
@@ -7351,7 +7663,9 @@ discard block |
||
7351 | 7663 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
7352 | 7664 | $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 |
7353 | 7665 | ORDER BY airport_arrival_icao_count DESC"; |
7354 | - if ($limit) $query .= " LIMIT 10"; |
|
7666 | + if ($limit) { |
|
7667 | + $query .= " LIMIT 10"; |
|
7668 | + } |
|
7355 | 7669 | |
7356 | 7670 | |
7357 | 7671 | $sth = $this->db->prepare($query); |
@@ -7372,7 +7686,9 @@ discard block |
||
7372 | 7686 | if ($icaoaskey) { |
7373 | 7687 | $icao = $row['arrival_airport_icao']; |
7374 | 7688 | $airport_array[$icao] = $temp_array; |
7375 | - } else $airport_array[] = $temp_array; |
|
7689 | + } else { |
|
7690 | + $airport_array[] = $temp_array; |
|
7691 | + } |
|
7376 | 7692 | } |
7377 | 7693 | |
7378 | 7694 | return $airport_array; |
@@ -7435,7 +7751,9 @@ discard block |
||
7435 | 7751 | } |
7436 | 7752 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
7437 | 7753 | ORDER BY airport_arrival_icao_count DESC"; |
7438 | - if ($limit) $query .= " LIMIT 10"; |
|
7754 | + if ($limit) { |
|
7755 | + $query .= " LIMIT 10"; |
|
7756 | + } |
|
7439 | 7757 | |
7440 | 7758 | |
7441 | 7759 | $sth = $this->db->prepare($query); |
@@ -7454,7 +7772,9 @@ discard block |
||
7454 | 7772 | if ($icaoaskey) { |
7455 | 7773 | $icao = $row['arrival_airport_icao']; |
7456 | 7774 | $airport_array[$icao] = $temp_array; |
7457 | - } else $airport_array[] = $temp_array; |
|
7775 | + } else { |
|
7776 | + $airport_array[] = $temp_array; |
|
7777 | + } |
|
7458 | 7778 | } |
7459 | 7779 | |
7460 | 7780 | return $airport_array; |
@@ -7491,7 +7811,9 @@ discard block |
||
7491 | 7811 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
7492 | 7812 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
7493 | 7813 | ORDER BY airport_arrival_icao_count DESC"; |
7494 | - if ($limit) $query .= " LIMIT 10"; |
|
7814 | + if ($limit) { |
|
7815 | + $query .= " LIMIT 10"; |
|
7816 | + } |
|
7495 | 7817 | |
7496 | 7818 | |
7497 | 7819 | $sth = $this->db->prepare($query); |
@@ -7512,7 +7834,9 @@ discard block |
||
7512 | 7834 | if ($icaoaskey) { |
7513 | 7835 | $icao = $row['arrival_airport_icao']; |
7514 | 7836 | $airport_array[$icao] = $temp_array; |
7515 | - } else $airport_array[] = $temp_array; |
|
7837 | + } else { |
|
7838 | + $airport_array[] = $temp_array; |
|
7839 | + } |
|
7516 | 7840 | } |
7517 | 7841 | |
7518 | 7842 | return $airport_array; |
@@ -7893,7 +8217,9 @@ discard block |
||
7893 | 8217 | date_default_timezone_set($globalTimezone); |
7894 | 8218 | $datetime = new DateTime($date); |
7895 | 8219 | $offset = $datetime->format('P'); |
7896 | - } else $offset = '+00:00'; |
|
8220 | + } else { |
|
8221 | + $offset = '+00:00'; |
|
8222 | + } |
|
7897 | 8223 | |
7898 | 8224 | if ($globalDBdriver == 'mysql') { |
7899 | 8225 | $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 |
@@ -7943,7 +8269,9 @@ discard block |
||
7943 | 8269 | date_default_timezone_set($globalTimezone); |
7944 | 8270 | $datetime = new DateTime($date); |
7945 | 8271 | $offset = $datetime->format('P'); |
7946 | - } else $offset = '+00:00'; |
|
8272 | + } else { |
|
8273 | + $offset = '+00:00'; |
|
8274 | + } |
|
7947 | 8275 | |
7948 | 8276 | if ($globalDBdriver == 'mysql') { |
7949 | 8277 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -8334,7 +8662,9 @@ discard block |
||
8334 | 8662 | } |
8335 | 8663 | $query .= " GROUP BY spotter_output.arrival_airport_country |
8336 | 8664 | ORDER BY airport_arrival_country_count DESC"; |
8337 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
8665 | + if ($limit) { |
|
8666 | + $query .= " LIMIT 10 OFFSET 0"; |
|
8667 | + } |
|
8338 | 8668 | |
8339 | 8669 | |
8340 | 8670 | $sth = $this->db->prepare($query); |
@@ -8621,7 +8951,9 @@ discard block |
||
8621 | 8951 | date_default_timezone_set($globalTimezone); |
8622 | 8952 | $datetime = new DateTime($date); |
8623 | 8953 | $offset = $datetime->format('P'); |
8624 | - } else $offset = '+00:00'; |
|
8954 | + } else { |
|
8955 | + $offset = '+00:00'; |
|
8956 | + } |
|
8625 | 8957 | |
8626 | 8958 | if ($globalDBdriver == 'mysql') { |
8627 | 8959 | $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 |
@@ -8877,12 +9209,18 @@ discard block |
||
8877 | 9209 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
8878 | 9210 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
8879 | 9211 | if ($olderthanmonths > 0) { |
8880 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
8881 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
9212 | + if ($globalDBdriver == 'mysql') { |
|
9213 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
9214 | + } else { |
|
9215 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
9216 | + } |
|
8882 | 9217 | } |
8883 | 9218 | if ($sincedate != '') { |
8884 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
8885 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
9219 | + if ($globalDBdriver == 'mysql') { |
|
9220 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
9221 | + } else { |
|
9222 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
9223 | + } |
|
8886 | 9224 | } |
8887 | 9225 | $query_values = array(); |
8888 | 9226 | if ($year != '') { |
@@ -8913,7 +9251,9 @@ discard block |
||
8913 | 9251 | } |
8914 | 9252 | } |
8915 | 9253 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
8916 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
9254 | + if ($limit) { |
|
9255 | + $query .= " LIMIT 10 OFFSET 0"; |
|
9256 | + } |
|
8917 | 9257 | |
8918 | 9258 | $sth = $this->db->prepare($query); |
8919 | 9259 | $sth->execute($query_values); |
@@ -8947,15 +9287,23 @@ discard block |
||
8947 | 9287 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
8948 | 9288 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
8949 | 9289 | if ($olderthanmonths > 0) { |
8950 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
8951 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
9290 | + if ($globalDBdriver == 'mysql') { |
|
9291 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
9292 | + } else { |
|
9293 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
9294 | + } |
|
8952 | 9295 | } |
8953 | 9296 | if ($sincedate != '') { |
8954 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
8955 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
9297 | + if ($globalDBdriver == 'mysql') { |
|
9298 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
9299 | + } else { |
|
9300 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
9301 | + } |
|
8956 | 9302 | } |
8957 | 9303 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
8958 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
9304 | + if ($limit) { |
|
9305 | + $query .= " LIMIT 10 OFFSET 0"; |
|
9306 | + } |
|
8959 | 9307 | |
8960 | 9308 | $sth = $this->db->prepare($query); |
8961 | 9309 | $sth->execute(); |
@@ -8992,7 +9340,9 @@ discard block |
||
8992 | 9340 | date_default_timezone_set($globalTimezone); |
8993 | 9341 | $datetime = new DateTime(); |
8994 | 9342 | $offset = $datetime->format('P'); |
8995 | - } else $offset = '+00:00'; |
|
9343 | + } else { |
|
9344 | + $offset = '+00:00'; |
|
9345 | + } |
|
8996 | 9346 | |
8997 | 9347 | if ($globalDBdriver == 'mysql') { |
8998 | 9348 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9041,7 +9391,9 @@ discard block |
||
9041 | 9391 | date_default_timezone_set($globalTimezone); |
9042 | 9392 | $datetime = new DateTime(); |
9043 | 9393 | $offset = $datetime->format('P'); |
9044 | - } else $offset = '+00:00'; |
|
9394 | + } else { |
|
9395 | + $offset = '+00:00'; |
|
9396 | + } |
|
9045 | 9397 | $filter_query = $this->getFilter($filters,true,true); |
9046 | 9398 | if ($globalDBdriver == 'mysql') { |
9047 | 9399 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9090,7 +9442,9 @@ discard block |
||
9090 | 9442 | date_default_timezone_set($globalTimezone); |
9091 | 9443 | $datetime = new DateTime(); |
9092 | 9444 | $offset = $datetime->format('P'); |
9093 | - } else $offset = '+00:00'; |
|
9445 | + } else { |
|
9446 | + $offset = '+00:00'; |
|
9447 | + } |
|
9094 | 9448 | $filter_query = $this->getFilter($filters,true,true); |
9095 | 9449 | if ($globalDBdriver == 'mysql') { |
9096 | 9450 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9136,7 +9490,9 @@ discard block |
||
9136 | 9490 | date_default_timezone_set($globalTimezone); |
9137 | 9491 | $datetime = new DateTime(); |
9138 | 9492 | $offset = $datetime->format('P'); |
9139 | - } else $offset = '+00:00'; |
|
9493 | + } else { |
|
9494 | + $offset = '+00:00'; |
|
9495 | + } |
|
9140 | 9496 | $filter_query = $this->getFilter($filters,true,true); |
9141 | 9497 | if ($globalDBdriver == 'mysql') { |
9142 | 9498 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9184,7 +9540,9 @@ discard block |
||
9184 | 9540 | date_default_timezone_set($globalTimezone); |
9185 | 9541 | $datetime = new DateTime(); |
9186 | 9542 | $offset = $datetime->format('P'); |
9187 | - } else $offset = '+00:00'; |
|
9543 | + } else { |
|
9544 | + $offset = '+00:00'; |
|
9545 | + } |
|
9188 | 9546 | |
9189 | 9547 | if ($globalDBdriver == 'mysql') { |
9190 | 9548 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9232,7 +9590,9 @@ discard block |
||
9232 | 9590 | date_default_timezone_set($globalTimezone); |
9233 | 9591 | $datetime = new DateTime(); |
9234 | 9592 | $offset = $datetime->format('P'); |
9235 | - } else $offset = '+00:00'; |
|
9593 | + } else { |
|
9594 | + $offset = '+00:00'; |
|
9595 | + } |
|
9236 | 9596 | |
9237 | 9597 | if ($globalDBdriver == 'mysql') { |
9238 | 9598 | $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 |
@@ -9279,7 +9639,9 @@ discard block |
||
9279 | 9639 | date_default_timezone_set($globalTimezone); |
9280 | 9640 | $datetime = new DateTime(); |
9281 | 9641 | $offset = $datetime->format('P'); |
9282 | - } else $offset = '+00:00'; |
|
9642 | + } else { |
|
9643 | + $offset = '+00:00'; |
|
9644 | + } |
|
9283 | 9645 | |
9284 | 9646 | if ($globalDBdriver == 'mysql') { |
9285 | 9647 | $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 |
@@ -9327,7 +9689,9 @@ discard block |
||
9327 | 9689 | date_default_timezone_set($globalTimezone); |
9328 | 9690 | $datetime = new DateTime(); |
9329 | 9691 | $offset = $datetime->format('P'); |
9330 | - } else $offset = '+00:00'; |
|
9692 | + } else { |
|
9693 | + $offset = '+00:00'; |
|
9694 | + } |
|
9331 | 9695 | $filter_query = $this->getFilter($filters,true,true); |
9332 | 9696 | if ($globalDBdriver == 'mysql') { |
9333 | 9697 | $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 |
@@ -9372,7 +9736,9 @@ discard block |
||
9372 | 9736 | date_default_timezone_set($globalTimezone); |
9373 | 9737 | $datetime = new DateTime(); |
9374 | 9738 | $offset = $datetime->format('P'); |
9375 | - } else $offset = '+00:00'; |
|
9739 | + } else { |
|
9740 | + $offset = '+00:00'; |
|
9741 | + } |
|
9376 | 9742 | $filter_query = $this->getFilter($filters,true,true); |
9377 | 9743 | |
9378 | 9744 | if ($globalDBdriver == 'mysql') { |
@@ -9419,7 +9785,9 @@ discard block |
||
9419 | 9785 | date_default_timezone_set($globalTimezone); |
9420 | 9786 | $datetime = new DateTime(); |
9421 | 9787 | $offset = $datetime->format('P'); |
9422 | - } else $offset = '+00:00'; |
|
9788 | + } else { |
|
9789 | + $offset = '+00:00'; |
|
9790 | + } |
|
9423 | 9791 | |
9424 | 9792 | if ($globalDBdriver == 'mysql') { |
9425 | 9793 | $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 |
@@ -9465,7 +9833,9 @@ discard block |
||
9465 | 9833 | date_default_timezone_set($globalTimezone); |
9466 | 9834 | $datetime = new DateTime(); |
9467 | 9835 | $offset = $datetime->format('P'); |
9468 | - } else $offset = '+00:00'; |
|
9836 | + } else { |
|
9837 | + $offset = '+00:00'; |
|
9838 | + } |
|
9469 | 9839 | $filter_query = $this->getFilter($filters,true,true); |
9470 | 9840 | |
9471 | 9841 | if ($globalDBdriver == 'mysql') { |
@@ -9512,7 +9882,9 @@ discard block |
||
9512 | 9882 | date_default_timezone_set($globalTimezone); |
9513 | 9883 | $datetime = new DateTime(); |
9514 | 9884 | $offset = $datetime->format('P'); |
9515 | - } else $offset = '+00:00'; |
|
9885 | + } else { |
|
9886 | + $offset = '+00:00'; |
|
9887 | + } |
|
9516 | 9888 | |
9517 | 9889 | if ($globalDBdriver == 'mysql') { |
9518 | 9890 | $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 |
@@ -9559,7 +9931,9 @@ discard block |
||
9559 | 9931 | date_default_timezone_set($globalTimezone); |
9560 | 9932 | $datetime = new DateTime(); |
9561 | 9933 | $offset = $datetime->format('P'); |
9562 | - } else $offset = '+00:00'; |
|
9934 | + } else { |
|
9935 | + $offset = '+00:00'; |
|
9936 | + } |
|
9563 | 9937 | |
9564 | 9938 | if ($globalDBdriver == 'mysql') { |
9565 | 9939 | $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 |
@@ -9604,7 +9978,9 @@ discard block |
||
9604 | 9978 | date_default_timezone_set($globalTimezone); |
9605 | 9979 | $datetime = new DateTime(); |
9606 | 9980 | $offset = $datetime->format('P'); |
9607 | - } else $offset = '+00:00'; |
|
9981 | + } else { |
|
9982 | + $offset = '+00:00'; |
|
9983 | + } |
|
9608 | 9984 | $filter_query = $this->getFilter($filters,true,true); |
9609 | 9985 | |
9610 | 9986 | if ($globalDBdriver == 'mysql') { |
@@ -9652,7 +10028,9 @@ discard block |
||
9652 | 10028 | date_default_timezone_set($globalTimezone); |
9653 | 10029 | $datetime = new DateTime(); |
9654 | 10030 | $offset = $datetime->format('P'); |
9655 | - } else $offset = '+00:00'; |
|
10031 | + } else { |
|
10032 | + $offset = '+00:00'; |
|
10033 | + } |
|
9656 | 10034 | |
9657 | 10035 | if ($globalDBdriver == 'mysql') { |
9658 | 10036 | $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 |
@@ -9698,7 +10076,9 @@ discard block |
||
9698 | 10076 | date_default_timezone_set($globalTimezone); |
9699 | 10077 | $datetime = new DateTime(); |
9700 | 10078 | $offset = $datetime->format('P'); |
9701 | - } else $offset = '+00:00'; |
|
10079 | + } else { |
|
10080 | + $offset = '+00:00'; |
|
10081 | + } |
|
9702 | 10082 | $filter_query = $this->getFilter($filters,true,true); |
9703 | 10083 | |
9704 | 10084 | if ($globalDBdriver == 'mysql') { |
@@ -9746,7 +10126,9 @@ discard block |
||
9746 | 10126 | date_default_timezone_set($globalTimezone); |
9747 | 10127 | $datetime = new DateTime(); |
9748 | 10128 | $offset = $datetime->format('P'); |
9749 | - } else $offset = '+00:00'; |
|
10129 | + } else { |
|
10130 | + $offset = '+00:00'; |
|
10131 | + } |
|
9750 | 10132 | |
9751 | 10133 | if ($globalDBdriver == 'mysql') { |
9752 | 10134 | $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 |
@@ -9793,7 +10175,9 @@ discard block |
||
9793 | 10175 | date_default_timezone_set($globalTimezone); |
9794 | 10176 | $datetime = new DateTime(); |
9795 | 10177 | $offset = $datetime->format('P'); |
9796 | - } else $offset = '+00:00'; |
|
10178 | + } else { |
|
10179 | + $offset = '+00:00'; |
|
10180 | + } |
|
9797 | 10181 | $filter_query = $this->getFilter($filters,true,true); |
9798 | 10182 | if ($globalDBdriver == 'mysql') { |
9799 | 10183 | $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 |
@@ -9842,7 +10226,9 @@ discard block |
||
9842 | 10226 | date_default_timezone_set($globalTimezone); |
9843 | 10227 | $datetime = new DateTime(); |
9844 | 10228 | $offset = $datetime->format('P'); |
9845 | - } else $offset = '+00:00'; |
|
10229 | + } else { |
|
10230 | + $offset = '+00:00'; |
|
10231 | + } |
|
9846 | 10232 | |
9847 | 10233 | $orderby_sql = ''; |
9848 | 10234 | if ($orderby == "hour") |
@@ -9908,7 +10294,9 @@ discard block |
||
9908 | 10294 | date_default_timezone_set($globalTimezone); |
9909 | 10295 | $datetime = new DateTime(); |
9910 | 10296 | $offset = $datetime->format('P'); |
9911 | - } else $offset = '+00:00'; |
|
10297 | + } else { |
|
10298 | + $offset = '+00:00'; |
|
10299 | + } |
|
9912 | 10300 | |
9913 | 10301 | $orderby_sql = ''; |
9914 | 10302 | if ($orderby == "hour") |
@@ -9975,7 +10363,9 @@ discard block |
||
9975 | 10363 | date_default_timezone_set($globalTimezone); |
9976 | 10364 | $datetime = new DateTime(); |
9977 | 10365 | $offset = $datetime->format('P'); |
9978 | - } else $offset = '+00:00'; |
|
10366 | + } else { |
|
10367 | + $offset = '+00:00'; |
|
10368 | + } |
|
9979 | 10369 | |
9980 | 10370 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
9981 | 10371 | |
@@ -10026,7 +10416,9 @@ discard block |
||
10026 | 10416 | date_default_timezone_set($globalTimezone); |
10027 | 10417 | $datetime = new DateTime(); |
10028 | 10418 | $offset = $datetime->format('P'); |
10029 | - } else $offset = '+00:00'; |
|
10419 | + } else { |
|
10420 | + $offset = '+00:00'; |
|
10421 | + } |
|
10030 | 10422 | |
10031 | 10423 | if ($globalDBdriver == 'mysql') { |
10032 | 10424 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10073,7 +10465,9 @@ discard block |
||
10073 | 10465 | date_default_timezone_set($globalTimezone); |
10074 | 10466 | $datetime = new DateTime(); |
10075 | 10467 | $offset = $datetime->format('P'); |
10076 | - } else $offset = '+00:00'; |
|
10468 | + } else { |
|
10469 | + $offset = '+00:00'; |
|
10470 | + } |
|
10077 | 10471 | |
10078 | 10472 | if ($globalDBdriver == 'mysql') { |
10079 | 10473 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10120,7 +10514,9 @@ discard block |
||
10120 | 10514 | date_default_timezone_set($globalTimezone); |
10121 | 10515 | $datetime = new DateTime(); |
10122 | 10516 | $offset = $datetime->format('P'); |
10123 | - } else $offset = '+00:00'; |
|
10517 | + } else { |
|
10518 | + $offset = '+00:00'; |
|
10519 | + } |
|
10124 | 10520 | |
10125 | 10521 | if ($globalDBdriver == 'mysql') { |
10126 | 10522 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10168,7 +10564,9 @@ discard block |
||
10168 | 10564 | date_default_timezone_set($globalTimezone); |
10169 | 10565 | $datetime = new DateTime(); |
10170 | 10566 | $offset = $datetime->format('P'); |
10171 | - } else $offset = '+00:00'; |
|
10567 | + } else { |
|
10568 | + $offset = '+00:00'; |
|
10569 | + } |
|
10172 | 10570 | |
10173 | 10571 | if ($globalDBdriver == 'mysql') { |
10174 | 10572 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10216,7 +10614,9 @@ discard block |
||
10216 | 10614 | date_default_timezone_set($globalTimezone); |
10217 | 10615 | $datetime = new DateTime($date); |
10218 | 10616 | $offset = $datetime->format('P'); |
10219 | - } else $offset = '+00:00'; |
|
10617 | + } else { |
|
10618 | + $offset = '+00:00'; |
|
10619 | + } |
|
10220 | 10620 | |
10221 | 10621 | if ($globalDBdriver == 'mysql') { |
10222 | 10622 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10264,7 +10664,9 @@ discard block |
||
10264 | 10664 | date_default_timezone_set($globalTimezone); |
10265 | 10665 | $datetime = new DateTime(); |
10266 | 10666 | $offset = $datetime->format('P'); |
10267 | - } else $offset = '+00:00'; |
|
10667 | + } else { |
|
10668 | + $offset = '+00:00'; |
|
10669 | + } |
|
10268 | 10670 | |
10269 | 10671 | if ($globalDBdriver == 'mysql') { |
10270 | 10672 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10311,7 +10713,9 @@ discard block |
||
10311 | 10713 | date_default_timezone_set($globalTimezone); |
10312 | 10714 | $datetime = new DateTime(); |
10313 | 10715 | $offset = $datetime->format('P'); |
10314 | - } else $offset = '+00:00'; |
|
10716 | + } else { |
|
10717 | + $offset = '+00:00'; |
|
10718 | + } |
|
10315 | 10719 | |
10316 | 10720 | if ($globalDBdriver == 'mysql') { |
10317 | 10721 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10358,7 +10762,9 @@ discard block |
||
10358 | 10762 | date_default_timezone_set($globalTimezone); |
10359 | 10763 | $datetime = new DateTime(); |
10360 | 10764 | $offset = $datetime->format('P'); |
10361 | - } else $offset = '+00:00'; |
|
10765 | + } else { |
|
10766 | + $offset = '+00:00'; |
|
10767 | + } |
|
10362 | 10768 | |
10363 | 10769 | if ($globalDBdriver == 'mysql') { |
10364 | 10770 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10408,7 +10814,9 @@ discard block |
||
10408 | 10814 | date_default_timezone_set($globalTimezone); |
10409 | 10815 | $datetime = new DateTime(); |
10410 | 10816 | $offset = $datetime->format('P'); |
10411 | - } else $offset = '+00:00'; |
|
10817 | + } else { |
|
10818 | + $offset = '+00:00'; |
|
10819 | + } |
|
10412 | 10820 | |
10413 | 10821 | if ($globalDBdriver == 'mysql') { |
10414 | 10822 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10455,7 +10863,9 @@ discard block |
||
10455 | 10863 | date_default_timezone_set($globalTimezone); |
10456 | 10864 | $datetime = new DateTime(); |
10457 | 10865 | $offset = $datetime->format('P'); |
10458 | - } else $offset = '+00:00'; |
|
10866 | + } else { |
|
10867 | + $offset = '+00:00'; |
|
10868 | + } |
|
10459 | 10869 | |
10460 | 10870 | if ($globalDBdriver == 'mysql') { |
10461 | 10871 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10666,8 +11076,11 @@ discard block |
||
10666 | 11076 | $query_values = array_merge($query_values,array(':month' => $month)); |
10667 | 11077 | } |
10668 | 11078 | } |
10669 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
10670 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
11079 | + if (empty($query_values)) { |
|
11080 | + $queryi .= $this->getFilter($filters); |
|
11081 | + } else { |
|
11082 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
11083 | + } |
|
10671 | 11084 | |
10672 | 11085 | //echo $query; |
10673 | 11086 | $sth = $this->db->prepare($queryi); |
@@ -10746,8 +11159,11 @@ discard block |
||
10746 | 11159 | $query_values = array_merge($query_values,array(':month' => $month)); |
10747 | 11160 | } |
10748 | 11161 | } |
10749 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
10750 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
11162 | + if ($query == '') { |
|
11163 | + $queryi .= $this->getFilter($filters); |
|
11164 | + } else { |
|
11165 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
11166 | + } |
|
10751 | 11167 | |
10752 | 11168 | |
10753 | 11169 | $sth = $this->db->prepare($queryi); |
@@ -10770,7 +11186,9 @@ discard block |
||
10770 | 11186 | date_default_timezone_set($globalTimezone); |
10771 | 11187 | $datetime = new DateTime(); |
10772 | 11188 | $offset = $datetime->format('P'); |
10773 | - } else $offset = '+00:00'; |
|
11189 | + } else { |
|
11190 | + $offset = '+00:00'; |
|
11191 | + } |
|
10774 | 11192 | |
10775 | 11193 | if ($globalDBdriver == 'mysql') { |
10776 | 11194 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10956,7 +11374,9 @@ discard block |
||
10956 | 11374 | */ |
10957 | 11375 | public function parseDirection($direction = 0) |
10958 | 11376 | { |
10959 | - if ($direction == '') $direction = 0; |
|
11377 | + if ($direction == '') { |
|
11378 | + $direction = 0; |
|
11379 | + } |
|
10960 | 11380 | $direction_array = array(); |
10961 | 11381 | $temp_array = array(); |
10962 | 11382 | |
@@ -11057,7 +11477,9 @@ discard block |
||
11057 | 11477 | if (isset($result->AirlineFlightInfoResult)) |
11058 | 11478 | { |
11059 | 11479 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
11060 | - } else return ''; |
|
11480 | + } else { |
|
11481 | + return ''; |
|
11482 | + } |
|
11061 | 11483 | |
11062 | 11484 | $registration = $this->convertAircraftRegistration($registration); |
11063 | 11485 | |
@@ -11086,7 +11508,9 @@ discard block |
||
11086 | 11508 | if (count($row) > 0) { |
11087 | 11509 | //return $row['Registration']; |
11088 | 11510 | return $row['registration']; |
11089 | - } else return ''; |
|
11511 | + } else { |
|
11512 | + return ''; |
|
11513 | + } |
|
11090 | 11514 | |
11091 | 11515 | } |
11092 | 11516 | |
@@ -11109,9 +11533,14 @@ discard block |
||
11109 | 11533 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
11110 | 11534 | $sth->closeCursor(); |
11111 | 11535 | if (count($row) > 0) { |
11112 | - if ($row['type_flight'] == null) return ''; |
|
11113 | - else return $row['type_flight']; |
|
11114 | - } else return ''; |
|
11536 | + if ($row['type_flight'] == null) { |
|
11537 | + return ''; |
|
11538 | + } else { |
|
11539 | + return $row['type_flight']; |
|
11540 | + } |
|
11541 | + } else { |
|
11542 | + return ''; |
|
11543 | + } |
|
11115 | 11544 | |
11116 | 11545 | } |
11117 | 11546 | |
@@ -11129,7 +11558,9 @@ discard block |
||
11129 | 11558 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
11130 | 11559 | |
11131 | 11560 | $Connection = new Connection($this->db); |
11132 | - if (!$Connection->tableExists('countries')) return ''; |
|
11561 | + if (!$Connection->tableExists('countries')) { |
|
11562 | + return ''; |
|
11563 | + } |
|
11133 | 11564 | |
11134 | 11565 | try { |
11135 | 11566 | /* |
@@ -11149,9 +11580,13 @@ discard block |
||
11149 | 11580 | $sth->closeCursor(); |
11150 | 11581 | if (count($row) > 0) { |
11151 | 11582 | return $row; |
11152 | - } else return ''; |
|
11583 | + } else { |
|
11584 | + return ''; |
|
11585 | + } |
|
11153 | 11586 | } catch (PDOException $e) { |
11154 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
11587 | + if (isset($globalDebug) && $globalDebug) { |
|
11588 | + echo 'Error : '.$e->getMessage()."\n"; |
|
11589 | + } |
|
11155 | 11590 | return ''; |
11156 | 11591 | } |
11157 | 11592 | |
@@ -11169,7 +11604,9 @@ discard block |
||
11169 | 11604 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
11170 | 11605 | |
11171 | 11606 | $Connection = new Connection($this->db); |
11172 | - if (!$Connection->tableExists('countries')) return ''; |
|
11607 | + if (!$Connection->tableExists('countries')) { |
|
11608 | + return ''; |
|
11609 | + } |
|
11173 | 11610 | |
11174 | 11611 | try { |
11175 | 11612 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -11181,9 +11618,13 @@ discard block |
||
11181 | 11618 | $sth->closeCursor(); |
11182 | 11619 | if (count($row) > 0) { |
11183 | 11620 | return $row; |
11184 | - } else return ''; |
|
11621 | + } else { |
|
11622 | + return ''; |
|
11623 | + } |
|
11185 | 11624 | } catch (PDOException $e) { |
11186 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
11625 | + if (isset($globalDebug) && $globalDebug) { |
|
11626 | + echo 'Error : '.$e->getMessage()."\n"; |
|
11627 | + } |
|
11187 | 11628 | return ''; |
11188 | 11629 | } |
11189 | 11630 | |
@@ -11433,7 +11874,9 @@ discard block |
||
11433 | 11874 | { |
11434 | 11875 | global $globalBitlyAccessToken; |
11435 | 11876 | |
11436 | - if ($globalBitlyAccessToken == '') return $url; |
|
11877 | + if ($globalBitlyAccessToken == '') { |
|
11878 | + return $url; |
|
11879 | + } |
|
11437 | 11880 | |
11438 | 11881 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
11439 | 11882 | |
@@ -11582,7 +12025,9 @@ discard block |
||
11582 | 12025 | |
11583 | 12026 | |
11584 | 12027 | // routes |
11585 | - if ($globalDebug) print "Routes...\n"; |
|
12028 | + if ($globalDebug) { |
|
12029 | + print "Routes...\n"; |
|
12030 | + } |
|
11586 | 12031 | if ($globalDBdriver == 'mysql') { |
11587 | 12032 | $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)"; |
11588 | 12033 | } else { |
@@ -11601,7 +12046,9 @@ discard block |
||
11601 | 12046 | } |
11602 | 12047 | } |
11603 | 12048 | |
11604 | - if ($globalDebug) print "Airlines...\n"; |
|
12049 | + if ($globalDebug) { |
|
12050 | + print "Airlines...\n"; |
|
12051 | + } |
|
11605 | 12052 | //airlines |
11606 | 12053 | if ($globalDBdriver == 'mysql') { |
11607 | 12054 | $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)"; |
@@ -11615,10 +12062,15 @@ discard block |
||
11615 | 12062 | if (is_numeric(substr($row['ident'], -1, 1))) |
11616 | 12063 | { |
11617 | 12064 | $fromsource = NULL; |
11618 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
11619 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
11620 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
11621 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
12065 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
12066 | + $fromsource = 'vatsim'; |
|
12067 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
12068 | + $fromsource = 'ivao'; |
|
12069 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
12070 | + $fromsource = 'vatsim'; |
|
12071 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
12072 | + $fromsource = 'ivao'; |
|
12073 | + } |
|
11622 | 12074 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
11623 | 12075 | if (isset($airline_array[0]['name'])) { |
11624 | 12076 | $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"; |
@@ -11628,13 +12080,17 @@ discard block |
||
11628 | 12080 | } |
11629 | 12081 | } |
11630 | 12082 | |
11631 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
12083 | + if ($globalDebug) { |
|
12084 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
12085 | + } |
|
11632 | 12086 | //duplicate modes |
11633 | 12087 | $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"; |
11634 | 12088 | $sth = $this->db->prepare($query); |
11635 | 12089 | $sth->execute(); |
11636 | 12090 | |
11637 | - if ($globalDebug) print "Aircraft...\n"; |
|
12091 | + if ($globalDebug) { |
|
12092 | + print "Aircraft...\n"; |
|
12093 | + } |
|
11638 | 12094 | //aircraft |
11639 | 12095 | if ($globalDBdriver == 'mysql') { |
11640 | 12096 | $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)"; |
@@ -11677,26 +12133,38 @@ discard block |
||
11677 | 12133 | if (isset($closestAirports[0])) { |
11678 | 12134 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
11679 | 12135 | $airport_icao = $closestAirports[0]['icao']; |
11680 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
12136 | + if ($globalDebug) { |
|
12137 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
12138 | + } |
|
11681 | 12139 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
11682 | 12140 | foreach ($closestAirports as $airport) { |
11683 | 12141 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
11684 | 12142 | $airport_icao = $airport['icao']; |
11685 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
12143 | + if ($globalDebug) { |
|
12144 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
12145 | + } |
|
11686 | 12146 | break; |
11687 | 12147 | } |
11688 | 12148 | } |
11689 | 12149 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
11690 | 12150 | $airport_icao = $closestAirports[0]['icao']; |
11691 | - 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"; |
|
12151 | + if ($globalDebug) { |
|
12152 | + 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"; |
|
12153 | + } |
|
11692 | 12154 | } else { |
11693 | - 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"; |
|
12155 | + if ($globalDebug) { |
|
12156 | + 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"; |
|
12157 | + } |
|
11694 | 12158 | } |
11695 | 12159 | } else { |
11696 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
12160 | + if ($globalDebug) { |
|
12161 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
12162 | + } |
|
11697 | 12163 | } |
11698 | 12164 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
11699 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
12165 | + if ($globalDebug) { |
|
12166 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
12167 | + } |
|
11700 | 12168 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
11701 | 12169 | $sthu = $this->db->prepare($update_query); |
11702 | 12170 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |