@@ -73,7 +73,9 @@ discard block |
||
| 73 | 73 | if (isset($filter[0]['source'])) { |
| 74 | 74 | $filters = array_merge($filters,$filter); |
| 75 | 75 | } |
| 76 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 76 | + if (is_array($globalFilter)) { |
|
| 77 | + $filter = array_merge($filter,$globalFilter); |
|
| 78 | + } |
|
| 77 | 79 | $filter_query_join = ''; |
| 78 | 80 | $filter_query_where = ''; |
| 79 | 81 | foreach($filters as $flt) { |
@@ -157,8 +159,11 @@ discard block |
||
| 157 | 159 | $filter_query_where .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
| 158 | 160 | } |
| 159 | 161 | } |
| 160 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 161 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 162 | + if ($filter_query_where == '' && $where) { |
|
| 163 | + $filter_query_where = ' WHERE'; |
|
| 164 | + } elseif ($filter_query_where != '' && $and) { |
|
| 165 | + $filter_query_where .= ' AND'; |
|
| 166 | + } |
|
| 162 | 167 | if ($filter_query_where != '') { |
| 163 | 168 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 164 | 169 | } |
@@ -181,10 +186,18 @@ discard block |
||
| 181 | 186 | $Image = new Image($this->db); |
| 182 | 187 | $Schedule = new Schedule($this->db); |
| 183 | 188 | $ACARS = new ACARS($this->db); |
| 184 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 185 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 186 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 187 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 189 | + if (!isset($globalIVAO)) { |
|
| 190 | + $globalIVAO = FALSE; |
|
| 191 | + } |
|
| 192 | + if (!isset($globalVATSIM)) { |
|
| 193 | + $globalVATSIM = FALSE; |
|
| 194 | + } |
|
| 195 | + if (!isset($globalphpVMS)) { |
|
| 196 | + $globalphpVMS = FALSE; |
|
| 197 | + } |
|
| 198 | + if (!isset($globalVAM)) { |
|
| 199 | + $globalVAM = FALSE; |
|
| 200 | + } |
|
| 188 | 201 | date_default_timezone_set('UTC'); |
| 189 | 202 | |
| 190 | 203 | if (!is_string($query)) |
@@ -230,21 +243,35 @@ discard block |
||
| 230 | 243 | } else { |
| 231 | 244 | $temp_array['spotter_id'] = ''; |
| 232 | 245 | } |
| 233 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 234 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
| 246 | + if (isset($row['flightaware_id'])) { |
|
| 247 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 248 | + } |
|
| 249 | + if (isset($row['modes'])) { |
|
| 250 | + $temp_array['modes'] = $row['modes']; |
|
| 251 | + } |
|
| 235 | 252 | $temp_array['ident'] = $row['ident']; |
| 236 | 253 | if (isset($row['registration']) && $row['registration'] != '') { |
| 237 | 254 | $temp_array['registration'] = $row['registration']; |
| 238 | 255 | } elseif (isset($temp_array['modes'])) { |
| 239 | 256 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
| 240 | - } else $temp_array['registration'] = ''; |
|
| 241 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 257 | + } else { |
|
| 258 | + $temp_array['registration'] = ''; |
|
| 259 | + } |
|
| 260 | + if (isset($row['aircraft_icao'])) { |
|
| 261 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 262 | + } |
|
| 242 | 263 | |
| 243 | 264 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
| 244 | 265 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
| 245 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 246 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 247 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 266 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
| 267 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 268 | + } |
|
| 269 | + if (isset($row['latitude'])) { |
|
| 270 | + $temp_array['latitude'] = $row['latitude']; |
|
| 271 | + } |
|
| 272 | + if (isset($row['longitude'])) { |
|
| 273 | + $temp_array['longitude'] = $row['longitude']; |
|
| 274 | + } |
|
| 248 | 275 | /* |
| 249 | 276 | if (Connection->tableExists('countries')) { |
| 250 | 277 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -254,8 +281,12 @@ discard block |
||
| 254 | 281 | } |
| 255 | 282 | } |
| 256 | 283 | */ |
| 257 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
| 258 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 284 | + if (isset($row['waypoints'])) { |
|
| 285 | + $temp_array['waypoints'] = $row['waypoints']; |
|
| 286 | + } |
|
| 287 | + if (isset($row['format_source'])) { |
|
| 288 | + $temp_array['format_source'] = $row['format_source']; |
|
| 289 | + } |
|
| 259 | 290 | if (isset($row['route_stop']) && $row['route_stop'] != '') { |
| 260 | 291 | $temp_array['route_stop'] = $row['route_stop']; |
| 261 | 292 | $allroute = explode(' ',$row['route_stop']); |
@@ -271,13 +302,19 @@ discard block |
||
| 271 | 302 | } |
| 272 | 303 | } |
| 273 | 304 | } |
| 274 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
| 305 | + if (isset($row['altitude'])) { |
|
| 306 | + $temp_array['altitude'] = $row['altitude']; |
|
| 307 | + } |
|
| 275 | 308 | if (isset($row['heading'])) { |
| 276 | 309 | $temp_array['heading'] = $row['heading']; |
| 277 | 310 | $heading_direction = $this->parseDirection($row['heading']); |
| 278 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 311 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 312 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 313 | + } |
|
| 314 | + } |
|
| 315 | + if (isset($row['ground_speed'])) { |
|
| 316 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 279 | 317 | } |
| 280 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 281 | 318 | $temp_array['image'] = ""; |
| 282 | 319 | $temp_array['image_thumbnail'] = ""; |
| 283 | 320 | $temp_array['image_source'] = ""; |
@@ -285,7 +322,9 @@ discard block |
||
| 285 | 322 | |
| 286 | 323 | if (isset($row['highlight'])) { |
| 287 | 324 | $temp_array['highlight'] = $row['highlight']; |
| 288 | - } else $temp_array['highlight'] = ''; |
|
| 325 | + } else { |
|
| 326 | + $temp_array['highlight'] = ''; |
|
| 327 | + } |
|
| 289 | 328 | |
| 290 | 329 | if (isset($row['date'])) { |
| 291 | 330 | $dateArray = $this->parseDateString($row['date']); |
@@ -341,7 +380,9 @@ discard block |
||
| 341 | 380 | |
| 342 | 381 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 343 | 382 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 344 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 383 | + } else { |
|
| 384 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 385 | + } |
|
| 345 | 386 | } else { |
| 346 | 387 | $temp_array['aircraft_shadow'] = 'default.png'; |
| 347 | 388 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -349,11 +390,17 @@ discard block |
||
| 349 | 390 | } |
| 350 | 391 | } |
| 351 | 392 | $fromsource = NULL; |
| 352 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 353 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 354 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 355 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 356 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 393 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 394 | + $fromsource = $globalAirlinesSource; |
|
| 395 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 396 | + $fromsource = 'vatsim'; |
|
| 397 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 398 | + $fromsource = 'ivao'; |
|
| 399 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 400 | + $fromsource = 'vatsim'; |
|
| 401 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 402 | + $fromsource = 'ivao'; |
|
| 403 | + } |
|
| 357 | 404 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 358 | 405 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 359 | 406 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -376,12 +423,18 @@ discard block |
||
| 376 | 423 | } |
| 377 | 424 | } else { |
| 378 | 425 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 379 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 380 | - else $temp_array['airline_iata'] = 'N/A'; |
|
| 426 | + if (isset($row['airline_iata'])) { |
|
| 427 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 428 | + } else { |
|
| 429 | + $temp_array['airline_iata'] = 'N/A'; |
|
| 430 | + } |
|
| 381 | 431 | $temp_array['airline_name'] = $row['airline_name']; |
| 382 | 432 | $temp_array['airline_country'] = $row['airline_country']; |
| 383 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 384 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
| 433 | + if (isset($row['airline_callsign'])) { |
|
| 434 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 435 | + } else { |
|
| 436 | + $temp_array['airline_callsign'] = 'N/A'; |
|
| 437 | + } |
|
| 385 | 438 | $temp_array['airline_type'] = $row['airline_type']; |
| 386 | 439 | if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') { |
| 387 | 440 | $airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']); |
@@ -408,7 +461,9 @@ discard block |
||
| 408 | 461 | } |
| 409 | 462 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
| 410 | 463 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
| 411 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 464 | + if ($owner_info['owner'] != '') { |
|
| 465 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 466 | + } |
|
| 412 | 467 | $temp_array['aircraft_base'] = $owner_info['base']; |
| 413 | 468 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 414 | 469 | } |
@@ -416,11 +471,18 @@ discard block |
||
| 416 | 471 | if($temp_array['registration'] != "" || (($globalIVAO || $globalVATSIM || $globalphpVMS || $globalVAM) && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
| 417 | 472 | { |
| 418 | 473 | if ($globalIVAO) { |
| 419 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 420 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 421 | - } elseif (isset($temp_array['aircraft_type']) && isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage($temp_array['registration'],$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 422 | - elseif (isset($temp_array['aircraft_type'])) $image_array = $Image->getSpotterImage($temp_array['registration'],$temp_array['aircraft_type']); |
|
| 423 | - else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 474 | + if (isset($temp_array['airline_icao'])) { |
|
| 475 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 476 | + } else { |
|
| 477 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 478 | + } |
|
| 479 | + } elseif (isset($temp_array['aircraft_type']) && isset($temp_array['airline_icao'])) { |
|
| 480 | + $image_array = $Image->getSpotterImage($temp_array['registration'],$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 481 | + } elseif (isset($temp_array['aircraft_type'])) { |
|
| 482 | + $image_array = $Image->getSpotterImage($temp_array['registration'],$temp_array['aircraft_type']); |
|
| 483 | + } else { |
|
| 484 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 485 | + } |
|
| 424 | 486 | if (count($image_array) > 0) { |
| 425 | 487 | $temp_array['image'] = $image_array[0]['image']; |
| 426 | 488 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -472,7 +534,9 @@ discard block |
||
| 472 | 534 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
| 473 | 535 | if ($row['departure_airport_icao'] != '') { |
| 474 | 536 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
| 475 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 537 | + if (!isset($departure_airport_array[0]['name'])) { |
|
| 538 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 539 | + } |
|
| 476 | 540 | /* |
| 477 | 541 | } elseif ($row['departure_airport_name'] != '') { |
| 478 | 542 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -480,7 +544,9 @@ discard block |
||
| 480 | 544 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 481 | 545 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
| 482 | 546 | */ |
| 483 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 547 | + } else { |
|
| 548 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 549 | + } |
|
| 484 | 550 | if (isset($departure_airport_array[0]['name'])) { |
| 485 | 551 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
| 486 | 552 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -500,8 +566,12 @@ discard block |
||
| 500 | 566 | |
| 501 | 567 | if ($row['arrival_airport_icao'] != '') { |
| 502 | 568 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
| 503 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 504 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 569 | + if (count($arrival_airport_array) == 0) { |
|
| 570 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 571 | + } |
|
| 572 | + } else { |
|
| 573 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 574 | + } |
|
| 505 | 575 | if (isset($arrival_airport_array[0]['name'])) { |
| 506 | 576 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
| 507 | 577 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -517,27 +587,45 @@ discard block |
||
| 517 | 587 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 518 | 588 | } |
| 519 | 589 | */ |
| 520 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 521 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 522 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 523 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 524 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 590 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
| 591 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 592 | + } |
|
| 593 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
| 594 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 595 | + } |
|
| 596 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 597 | + $temp_array['source_name'] = $row['source_name']; |
|
| 598 | + } |
|
| 599 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 600 | + $temp_array['over_country'] = $row['over_country']; |
|
| 601 | + } |
|
| 602 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 603 | + $temp_array['distance'] = $row['distance']; |
|
| 604 | + } |
|
| 525 | 605 | if (isset($row['squawk'])) { |
| 526 | 606 | $temp_array['squawk'] = $row['squawk']; |
| 527 | 607 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 528 | 608 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
| 529 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 609 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 610 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 611 | + } |
|
| 530 | 612 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 531 | 613 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
| 532 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 533 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 614 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 615 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 616 | + } |
|
| 617 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
| 618 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 619 | + } |
|
| 534 | 620 | } |
| 535 | 621 | |
| 536 | 622 | $temp_array['query_number_rows'] = $num_rows; |
| 537 | 623 | |
| 538 | 624 | $spotter_array[] = $temp_array; |
| 539 | 625 | } |
| 540 | - if ($num_rows == 0) return array(); |
|
| 626 | + if ($num_rows == 0) { |
|
| 627 | + return array(); |
|
| 628 | + } |
|
| 541 | 629 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 542 | 630 | return $spotter_array; |
| 543 | 631 | } |
@@ -570,7 +658,9 @@ discard block |
||
| 570 | 658 | foreach ($q_array as $q_item){ |
| 571 | 659 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
| 572 | 660 | $additional_query .= " AND ("; |
| 573 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 661 | + if (is_int($q_item)) { |
|
| 662 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 663 | + } |
|
| 574 | 664 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 575 | 665 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
| 576 | 666 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -591,7 +681,9 @@ discard block |
||
| 591 | 681 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
| 592 | 682 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
| 593 | 683 | $translate = $Translation->ident2icao($q_item); |
| 594 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 684 | + if ($translate != $q_item) { |
|
| 685 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 686 | + } |
|
| 595 | 687 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
| 596 | 688 | $additional_query .= ")"; |
| 597 | 689 | } |
@@ -818,7 +910,9 @@ discard block |
||
| 818 | 910 | date_default_timezone_set($globalTimezone); |
| 819 | 911 | $datetime = new DateTime(); |
| 820 | 912 | $offset = $datetime->format('P'); |
| 821 | - } else $offset = '+00:00'; |
|
| 913 | + } else { |
|
| 914 | + $offset = '+00:00'; |
|
| 915 | + } |
|
| 822 | 916 | |
| 823 | 917 | if ($date_array[1] != "") |
| 824 | 918 | { |
@@ -850,8 +944,12 @@ discard block |
||
| 850 | 944 | { |
| 851 | 945 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 852 | 946 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 853 | - } else $limit_query = ""; |
|
| 854 | - } else $limit_query = ""; |
|
| 947 | + } else { |
|
| 948 | + $limit_query = ""; |
|
| 949 | + } |
|
| 950 | + } else { |
|
| 951 | + $limit_query = ""; |
|
| 952 | + } |
|
| 855 | 953 | |
| 856 | 954 | |
| 857 | 955 | if ($sort != "") |
@@ -919,8 +1017,12 @@ discard block |
||
| 919 | 1017 | { |
| 920 | 1018 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 921 | 1019 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 922 | - } else $limit_query = ""; |
|
| 923 | - } else $limit_query = ""; |
|
| 1020 | + } else { |
|
| 1021 | + $limit_query = ""; |
|
| 1022 | + } |
|
| 1023 | + } else { |
|
| 1024 | + $limit_query = ""; |
|
| 1025 | + } |
|
| 924 | 1026 | |
| 925 | 1027 | if ($sort != "") |
| 926 | 1028 | { |
@@ -1244,7 +1346,9 @@ discard block |
||
| 1244 | 1346 | global $global_query; |
| 1245 | 1347 | |
| 1246 | 1348 | date_default_timezone_set('UTC'); |
| 1247 | - if ($id == '') return array(); |
|
| 1349 | + if ($id == '') { |
|
| 1350 | + return array(); |
|
| 1351 | + } |
|
| 1248 | 1352 | $additional_query = "spotter_output.spotter_id = :id"; |
| 1249 | 1353 | $query_values = array(':id' => $id); |
| 1250 | 1354 | |
@@ -1359,8 +1463,11 @@ discard block |
||
| 1359 | 1463 | if ($sort != "") |
| 1360 | 1464 | { |
| 1361 | 1465 | $search_orderby_array = $this->getOrderBy(); |
| 1362 | - if (isset($search_orderby_array[$sort]['sql'])) $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1363 | - else $orderby_query = " ORDER BY spotter_output.date DESC"; |
|
| 1466 | + if (isset($search_orderby_array[$sort]['sql'])) { |
|
| 1467 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1468 | + } else { |
|
| 1469 | + $orderby_query = " ORDER BY spotter_output.date DESC"; |
|
| 1470 | + } |
|
| 1364 | 1471 | } else { |
| 1365 | 1472 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1366 | 1473 | } |
@@ -1985,7 +2092,9 @@ discard block |
||
| 1985 | 2092 | { |
| 1986 | 2093 | $highlight = $row['highlight']; |
| 1987 | 2094 | } |
| 1988 | - if (isset($highlight)) return $highlight; |
|
| 2095 | + if (isset($highlight)) { |
|
| 2096 | + return $highlight; |
|
| 2097 | + } |
|
| 1989 | 2098 | } |
| 1990 | 2099 | |
| 1991 | 2100 | |
@@ -2013,7 +2122,9 @@ discard block |
||
| 2013 | 2122 | $sth->closeCursor(); |
| 2014 | 2123 | if (count($row) > 0) { |
| 2015 | 2124 | return $row['usage']; |
| 2016 | - } else return ''; |
|
| 2125 | + } else { |
|
| 2126 | + return ''; |
|
| 2127 | + } |
|
| 2017 | 2128 | } |
| 2018 | 2129 | |
| 2019 | 2130 | /** |
@@ -2038,7 +2149,9 @@ discard block |
||
| 2038 | 2149 | $sth->closeCursor(); |
| 2039 | 2150 | if (count($row) > 0) { |
| 2040 | 2151 | return $row['icao']; |
| 2041 | - } else return ''; |
|
| 2152 | + } else { |
|
| 2153 | + return ''; |
|
| 2154 | + } |
|
| 2042 | 2155 | } |
| 2043 | 2156 | |
| 2044 | 2157 | /** |
@@ -2066,7 +2179,9 @@ discard block |
||
| 2066 | 2179 | $airport_longitude = $row['longitude']; |
| 2067 | 2180 | $Common = new Common(); |
| 2068 | 2181 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
| 2069 | - } else return ''; |
|
| 2182 | + } else { |
|
| 2183 | + return ''; |
|
| 2184 | + } |
|
| 2070 | 2185 | } |
| 2071 | 2186 | |
| 2072 | 2187 | /** |
@@ -2178,7 +2293,9 @@ discard block |
||
| 2178 | 2293 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2179 | 2294 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2180 | 2295 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2181 | - } else return array(); |
|
| 2296 | + } else { |
|
| 2297 | + return array(); |
|
| 2298 | + } |
|
| 2182 | 2299 | if ($globalDBdriver == 'mysql') { |
| 2183 | 2300 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
| 2184 | 2301 | } else { |
@@ -2213,7 +2330,9 @@ discard block |
||
| 2213 | 2330 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2214 | 2331 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2215 | 2332 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2216 | - } else return array(); |
|
| 2333 | + } else { |
|
| 2334 | + return array(); |
|
| 2335 | + } |
|
| 2217 | 2336 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2218 | 2337 | $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.")"; |
| 2219 | 2338 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2248,7 +2367,9 @@ discard block |
||
| 2248 | 2367 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2249 | 2368 | { |
| 2250 | 2369 | global $globalUseRealAirlines; |
| 2251 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2370 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2371 | + $fromsource = NULL; |
|
| 2372 | + } |
|
| 2252 | 2373 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
| 2253 | 2374 | if ($airline_icao == 'NA') { |
| 2254 | 2375 | $airline_array = array(); |
@@ -2317,7 +2438,9 @@ discard block |
||
| 2317 | 2438 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
| 2318 | 2439 | { |
| 2319 | 2440 | global $globalUseRealAirlines; |
| 2320 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2441 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2442 | + $fromsource = NULL; |
|
| 2443 | + } |
|
| 2321 | 2444 | $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
| 2322 | 2445 | $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"; |
| 2323 | 2446 | $sth = $this->db->prepare($query); |
@@ -2333,7 +2456,9 @@ discard block |
||
| 2333 | 2456 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2334 | 2457 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2335 | 2458 | $sth->closeCursor(); |
| 2336 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2459 | + if ($row['nb'] == 0) { |
|
| 2460 | + $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2461 | + } |
|
| 2337 | 2462 | } |
| 2338 | 2463 | return $result; |
| 2339 | 2464 | } |
@@ -2396,15 +2521,20 @@ discard block |
||
| 2396 | 2521 | 'A320-211' => 'A320', |
| 2397 | 2522 | '747-8i' => 'B748', |
| 2398 | 2523 | 'A380' => 'A388'); |
| 2399 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
| 2524 | + if (isset($all_aircraft[$aircraft_type])) { |
|
| 2525 | + return $all_aircraft[$aircraft_type]; |
|
| 2526 | + } |
|
| 2400 | 2527 | |
| 2401 | 2528 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
| 2402 | 2529 | $aircraft_type = strtoupper($aircraft_type); |
| 2403 | 2530 | $sth = $this->db->prepare($query); |
| 2404 | 2531 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
| 2405 | 2532 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2406 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
| 2407 | - else return ''; |
|
| 2533 | + if (isset($result[0]['icao'])) { |
|
| 2534 | + return $result[0]['icao']; |
|
| 2535 | + } else { |
|
| 2536 | + return ''; |
|
| 2537 | + } |
|
| 2408 | 2538 | } |
| 2409 | 2539 | |
| 2410 | 2540 | /** |
@@ -2432,11 +2562,15 @@ discard block |
||
| 2432 | 2562 | $sth->closeCursor(); |
| 2433 | 2563 | if (isset($row['icaotypecode'])) { |
| 2434 | 2564 | $icao = $row['icaotypecode']; |
| 2435 | - if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2565 | + if (isset($this->aircraft_correct_icaotype[$icao])) { |
|
| 2566 | + $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2567 | + } |
|
| 2436 | 2568 | return $icao; |
| 2437 | 2569 | } elseif ($source_type == 'flarm') { |
| 2438 | 2570 | return $this->getAllAircraftType($aircraft_modes); |
| 2439 | - } else return ''; |
|
| 2571 | + } else { |
|
| 2572 | + return ''; |
|
| 2573 | + } |
|
| 2440 | 2574 | } |
| 2441 | 2575 | |
| 2442 | 2576 | /** |
@@ -2459,7 +2593,9 @@ discard block |
||
| 2459 | 2593 | $sth->closeCursor(); |
| 2460 | 2594 | if (isset($row['icaotypecode'])) { |
| 2461 | 2595 | return $row['icaotypecode']; |
| 2462 | - } else return ''; |
|
| 2596 | + } else { |
|
| 2597 | + return ''; |
|
| 2598 | + } |
|
| 2463 | 2599 | } |
| 2464 | 2600 | |
| 2465 | 2601 | /** |
@@ -2505,7 +2641,9 @@ discard block |
||
| 2505 | 2641 | $sth->closeCursor(); |
| 2506 | 2642 | if (isset($row['operator_correct'])) { |
| 2507 | 2643 | return $row['operator_correct']; |
| 2508 | - } else return $operator; |
|
| 2644 | + } else { |
|
| 2645 | + return $operator; |
|
| 2646 | + } |
|
| 2509 | 2647 | } |
| 2510 | 2648 | |
| 2511 | 2649 | /** |
@@ -2518,7 +2656,9 @@ discard block |
||
| 2518 | 2656 | public function getRouteInfo($callsign) |
| 2519 | 2657 | { |
| 2520 | 2658 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2521 | - if ($callsign == '') return array(); |
|
| 2659 | + if ($callsign == '') { |
|
| 2660 | + return array(); |
|
| 2661 | + } |
|
| 2522 | 2662 | $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"; |
| 2523 | 2663 | |
| 2524 | 2664 | $sth = $this->db->prepare($query); |
@@ -2528,7 +2668,9 @@ discard block |
||
| 2528 | 2668 | $sth->closeCursor(); |
| 2529 | 2669 | if (count($row) > 0) { |
| 2530 | 2670 | return $row; |
| 2531 | - } else return array(); |
|
| 2671 | + } else { |
|
| 2672 | + return array(); |
|
| 2673 | + } |
|
| 2532 | 2674 | } |
| 2533 | 2675 | |
| 2534 | 2676 | /** |
@@ -2581,7 +2723,9 @@ discard block |
||
| 2581 | 2723 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 2582 | 2724 | $sth->closeCursor(); |
| 2583 | 2725 | return $result; |
| 2584 | - } else return array(); |
|
| 2726 | + } else { |
|
| 2727 | + return array(); |
|
| 2728 | + } |
|
| 2585 | 2729 | } |
| 2586 | 2730 | |
| 2587 | 2731 | |
@@ -2740,8 +2884,11 @@ discard block |
||
| 2740 | 2884 | $query .= " ORDER BY spotter_output.source_name ASC"; |
| 2741 | 2885 | |
| 2742 | 2886 | $sth = $this->db->prepare($query); |
| 2743 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 2744 | - else $sth->execute(); |
|
| 2887 | + if (!empty($query_values)) { |
|
| 2888 | + $sth->execute($query_values); |
|
| 2889 | + } else { |
|
| 2890 | + $sth->execute(); |
|
| 2891 | + } |
|
| 2745 | 2892 | |
| 2746 | 2893 | $source_array = array(); |
| 2747 | 2894 | $temp_array = array(); |
@@ -2774,9 +2921,13 @@ discard block |
||
| 2774 | 2921 | WHERE spotter_output.airline_icao <> '' |
| 2775 | 2922 | ORDER BY spotter_output.airline_name ASC"; |
| 2776 | 2923 | */ |
| 2777 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2778 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2779 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2924 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2925 | + $forsource = $globalAirlinesSource; |
|
| 2926 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2927 | + $forsource = 'vatsim'; |
|
| 2928 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2929 | + $forsource = 'ivao'; |
|
| 2930 | + } |
|
| 2780 | 2931 | if ($forsource === NULL) { |
| 2781 | 2932 | $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"; |
| 2782 | 2933 | $query_data = array(); |
@@ -2819,9 +2970,13 @@ discard block |
||
| 2819 | 2970 | { |
| 2820 | 2971 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
| 2821 | 2972 | $filter_query = $this->getFilter($filters,true,true); |
| 2822 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2823 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2824 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2973 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2974 | + $forsource = $globalAirlinesSource; |
|
| 2975 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2976 | + $forsource = 'vatsim'; |
|
| 2977 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2978 | + $forsource = 'ivao'; |
|
| 2979 | + } |
|
| 2825 | 2980 | if ($forsource === NULL) { |
| 2826 | 2981 | $query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC"; |
| 2827 | 2982 | $query_data = array(); |
@@ -3132,7 +3287,9 @@ discard block |
||
| 3132 | 3287 | date_default_timezone_set($globalTimezone); |
| 3133 | 3288 | $datetime = new DateTime(); |
| 3134 | 3289 | $offset = $datetime->format('P'); |
| 3135 | - } else $offset = '+00:00'; |
|
| 3290 | + } else { |
|
| 3291 | + $offset = '+00:00'; |
|
| 3292 | + } |
|
| 3136 | 3293 | if ($airport_icao == '') { |
| 3137 | 3294 | if ($globalDBdriver == 'mysql') { |
| 3138 | 3295 | $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"; |
@@ -3164,7 +3321,9 @@ discard block |
||
| 3164 | 3321 | date_default_timezone_set($globalTimezone); |
| 3165 | 3322 | $datetime = new DateTime(); |
| 3166 | 3323 | $offset = $datetime->format('P'); |
| 3167 | - } else $offset = '+00:00'; |
|
| 3324 | + } else { |
|
| 3325 | + $offset = '+00:00'; |
|
| 3326 | + } |
|
| 3168 | 3327 | if ($airport_icao == '') { |
| 3169 | 3328 | if ($globalDBdriver == 'mysql') { |
| 3170 | 3329 | $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"; |
@@ -3197,7 +3356,9 @@ discard block |
||
| 3197 | 3356 | date_default_timezone_set($globalTimezone); |
| 3198 | 3357 | $datetime = new DateTime(); |
| 3199 | 3358 | $offset = $datetime->format('P'); |
| 3200 | - } else $offset = '+00:00'; |
|
| 3359 | + } else { |
|
| 3360 | + $offset = '+00:00'; |
|
| 3361 | + } |
|
| 3201 | 3362 | if ($airport_icao == '') { |
| 3202 | 3363 | if ($globalDBdriver == 'mysql') { |
| 3203 | 3364 | $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 |
@@ -3236,7 +3397,9 @@ discard block |
||
| 3236 | 3397 | date_default_timezone_set($globalTimezone); |
| 3237 | 3398 | $datetime = new DateTime(); |
| 3238 | 3399 | $offset = $datetime->format('P'); |
| 3239 | - } else $offset = '+00:00'; |
|
| 3400 | + } else { |
|
| 3401 | + $offset = '+00:00'; |
|
| 3402 | + } |
|
| 3240 | 3403 | if ($airport_icao == '') { |
| 3241 | 3404 | if ($globalDBdriver == 'mysql') { |
| 3242 | 3405 | $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 |
@@ -3281,7 +3444,9 @@ discard block |
||
| 3281 | 3444 | date_default_timezone_set($globalTimezone); |
| 3282 | 3445 | $datetime = new DateTime(); |
| 3283 | 3446 | $offset = $datetime->format('P'); |
| 3284 | - } else $offset = '+00:00'; |
|
| 3447 | + } else { |
|
| 3448 | + $offset = '+00:00'; |
|
| 3449 | + } |
|
| 3285 | 3450 | if ($airport_icao == '') { |
| 3286 | 3451 | if ($globalDBdriver == 'mysql') { |
| 3287 | 3452 | $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"; |
@@ -3316,7 +3481,9 @@ discard block |
||
| 3316 | 3481 | date_default_timezone_set($globalTimezone); |
| 3317 | 3482 | $datetime = new DateTime(); |
| 3318 | 3483 | $offset = $datetime->format('P'); |
| 3319 | - } else $offset = '+00:00'; |
|
| 3484 | + } else { |
|
| 3485 | + $offset = '+00:00'; |
|
| 3486 | + } |
|
| 3320 | 3487 | if ($airport_icao == '') { |
| 3321 | 3488 | if ($globalDBdriver == 'mysql') { |
| 3322 | 3489 | $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 |
@@ -3358,7 +3525,9 @@ discard block |
||
| 3358 | 3525 | date_default_timezone_set($globalTimezone); |
| 3359 | 3526 | $datetime = new DateTime(); |
| 3360 | 3527 | $offset = $datetime->format('P'); |
| 3361 | - } else $offset = '+00:00'; |
|
| 3528 | + } else { |
|
| 3529 | + $offset = '+00:00'; |
|
| 3530 | + } |
|
| 3362 | 3531 | if ($airport_icao == '') { |
| 3363 | 3532 | if ($globalDBdriver == 'mysql') { |
| 3364 | 3533 | $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"; |
@@ -3392,7 +3561,9 @@ discard block |
||
| 3392 | 3561 | date_default_timezone_set($globalTimezone); |
| 3393 | 3562 | $datetime = new DateTime(); |
| 3394 | 3563 | $offset = $datetime->format('P'); |
| 3395 | - } else $offset = '+00:00'; |
|
| 3564 | + } else { |
|
| 3565 | + $offset = '+00:00'; |
|
| 3566 | + } |
|
| 3396 | 3567 | if ($airport_icao == '') { |
| 3397 | 3568 | if ($globalDBdriver == 'mysql') { |
| 3398 | 3569 | $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 |
@@ -3440,7 +3611,9 @@ discard block |
||
| 3440 | 3611 | date_default_timezone_set($globalTimezone); |
| 3441 | 3612 | $datetime = new DateTime(); |
| 3442 | 3613 | $offset = $datetime->format('P'); |
| 3443 | - } else $offset = '+00:00'; |
|
| 3614 | + } else { |
|
| 3615 | + $offset = '+00:00'; |
|
| 3616 | + } |
|
| 3444 | 3617 | |
| 3445 | 3618 | if ($globalDBdriver == 'mysql') { |
| 3446 | 3619 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3560,7 +3733,9 @@ discard block |
||
| 3560 | 3733 | */ |
| 3561 | 3734 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3562 | 3735 | { |
| 3563 | - if ($groundspeed == '') $groundspeed = NULL; |
|
| 3736 | + if ($groundspeed == '') { |
|
| 3737 | + $groundspeed = NULL; |
|
| 3738 | + } |
|
| 3564 | 3739 | $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'; |
| 3565 | 3740 | $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); |
| 3566 | 3741 | |
@@ -3610,10 +3785,18 @@ discard block |
||
| 3610 | 3785 | $Image = new Image($this->db); |
| 3611 | 3786 | $Common = new Common(); |
| 3612 | 3787 | |
| 3613 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 3614 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 3615 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 3616 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 3788 | + if (!isset($globalIVAO)) { |
|
| 3789 | + $globalIVAO = FALSE; |
|
| 3790 | + } |
|
| 3791 | + if (!isset($globalVATSIM)) { |
|
| 3792 | + $globalVATSIM = FALSE; |
|
| 3793 | + } |
|
| 3794 | + if (!isset($globalphpVMS)) { |
|
| 3795 | + $globalphpVMS = FALSE; |
|
| 3796 | + } |
|
| 3797 | + if (!isset($globalVAM)) { |
|
| 3798 | + $globalVAM = FALSE; |
|
| 3799 | + } |
|
| 3617 | 3800 | date_default_timezone_set('UTC'); |
| 3618 | 3801 | |
| 3619 | 3802 | //getting the registration |
@@ -3626,23 +3809,33 @@ discard block |
||
| 3626 | 3809 | if ($ModeS != '') { |
| 3627 | 3810 | $timeelapsed = microtime(true); |
| 3628 | 3811 | $registration = $this->getAircraftRegistrationBymodeS($ModeS,$source_type); |
| 3629 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3812 | + if ($globalDebugTimeElapsed) { |
|
| 3813 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3814 | + } |
|
| 3630 | 3815 | } else { |
| 3631 | 3816 | $myhex = explode('-',$flightaware_id); |
| 3632 | 3817 | if (count($myhex) > 0) { |
| 3633 | 3818 | $timeelapsed = microtime(true); |
| 3634 | 3819 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0],$source_type); |
| 3635 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3820 | + if ($globalDebugTimeElapsed) { |
|
| 3821 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3822 | + } |
|
| 3636 | 3823 | } |
| 3637 | 3824 | } |
| 3638 | 3825 | } |
| 3639 | 3826 | } |
| 3640 | 3827 | $fromsource = NULL; |
| 3641 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 3642 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 3643 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
| 3644 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 3645 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 3828 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 3829 | + $fromsource = $globalAirlinesSource; |
|
| 3830 | + } elseif ($format_source == 'vatsimtxt') { |
|
| 3831 | + $fromsource = 'vatsim'; |
|
| 3832 | + } elseif ($format_source == 'whazzup') { |
|
| 3833 | + $fromsource = 'ivao'; |
|
| 3834 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 3835 | + $fromsource = 'vatsim'; |
|
| 3836 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 3837 | + $fromsource = 'ivao'; |
|
| 3838 | + } |
|
| 3646 | 3839 | //getting the airline information |
| 3647 | 3840 | if ($ident != "") |
| 3648 | 3841 | { |
@@ -3666,15 +3859,21 @@ discard block |
||
| 3666 | 3859 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
| 3667 | 3860 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3668 | 3861 | } |
| 3669 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3862 | + if ($globalDebugTimeElapsed) { |
|
| 3863 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3864 | + } |
|
| 3670 | 3865 | |
| 3671 | 3866 | } else { |
| 3672 | 3867 | $timeelapsed = microtime(true); |
| 3673 | 3868 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3674 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3869 | + if ($globalDebugTimeElapsed) { |
|
| 3870 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3871 | + } |
|
| 3675 | 3872 | } |
| 3676 | 3873 | } |
| 3677 | - } else $airline_array = array(); |
|
| 3874 | + } else { |
|
| 3875 | + $airline_array = array(); |
|
| 3876 | + } |
|
| 3678 | 3877 | |
| 3679 | 3878 | //getting the aircraft information |
| 3680 | 3879 | $aircraft_array = array(); |
@@ -3688,27 +3887,37 @@ discard block |
||
| 3688 | 3887 | { |
| 3689 | 3888 | $timeelapsed = microtime(true); |
| 3690 | 3889 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3691 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3890 | + if ($globalDebugTimeElapsed) { |
|
| 3891 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3892 | + } |
|
| 3692 | 3893 | } else { |
| 3693 | 3894 | $timeelapsed = microtime(true); |
| 3694 | 3895 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3695 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3896 | + if ($globalDebugTimeElapsed) { |
|
| 3897 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3898 | + } |
|
| 3696 | 3899 | } |
| 3697 | 3900 | } |
| 3698 | 3901 | } else { |
| 3699 | 3902 | if ($ModeS != '') { |
| 3700 | 3903 | $timeelapsed = microtime(true); |
| 3701 | 3904 | $aircraft_icao = $this->getAllAircraftType($ModeS,$source_type); |
| 3702 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3905 | + if ($globalDebugTimeElapsed) { |
|
| 3906 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3907 | + } |
|
| 3703 | 3908 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3704 | 3909 | { |
| 3705 | 3910 | $timeelapsed = microtime(true); |
| 3706 | 3911 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3707 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3912 | + if ($globalDebugTimeElapsed) { |
|
| 3913 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3914 | + } |
|
| 3708 | 3915 | } else { |
| 3709 | 3916 | $timeelapsed = microtime(true); |
| 3710 | 3917 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3711 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3918 | + if ($globalDebugTimeElapsed) { |
|
| 3919 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3920 | + } |
|
| 3712 | 3921 | } |
| 3713 | 3922 | } |
| 3714 | 3923 | } |
@@ -3724,7 +3933,9 @@ discard block |
||
| 3724 | 3933 | } else { |
| 3725 | 3934 | $timeelapsed = microtime(true); |
| 3726 | 3935 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3727 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3936 | + if ($globalDebugTimeElapsed) { |
|
| 3937 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3938 | + } |
|
| 3728 | 3939 | } |
| 3729 | 3940 | } |
| 3730 | 3941 | |
@@ -3739,7 +3950,9 @@ discard block |
||
| 3739 | 3950 | } else { |
| 3740 | 3951 | $timeelapsed = microtime(true); |
| 3741 | 3952 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3742 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3953 | + if ($globalDebugTimeElapsed) { |
|
| 3954 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3955 | + } |
|
| 3743 | 3956 | } |
| 3744 | 3957 | } |
| 3745 | 3958 | |
@@ -3773,7 +3986,9 @@ discard block |
||
| 3773 | 3986 | { |
| 3774 | 3987 | return false; |
| 3775 | 3988 | } |
| 3776 | - } else $altitude = 0; |
|
| 3989 | + } else { |
|
| 3990 | + $altitude = 0; |
|
| 3991 | + } |
|
| 3777 | 3992 | |
| 3778 | 3993 | if ($heading != "") |
| 3779 | 3994 | { |
@@ -3802,7 +4017,9 @@ discard block |
||
| 3802 | 4017 | { |
| 3803 | 4018 | $timeelapsed = microtime(true); |
| 3804 | 4019 | $image_array = $Image->getSpotterImage($registration); |
| 3805 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4020 | + if ($globalDebugTimeElapsed) { |
|
| 4021 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4022 | + } |
|
| 3806 | 4023 | if (!isset($image_array[0]['registration'])) |
| 3807 | 4024 | { |
| 3808 | 4025 | //echo "Add image !!!! \n"; |
@@ -3810,14 +4027,21 @@ discard block |
||
| 3810 | 4027 | } |
| 3811 | 4028 | $timeelapsed = microtime(true); |
| 3812 | 4029 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3813 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3814 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 4030 | + if ($globalDebugTimeElapsed) { |
|
| 4031 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4032 | + } |
|
| 4033 | + if ($owner_info['owner'] != '') { |
|
| 4034 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 4035 | + } |
|
| 3815 | 4036 | } |
| 3816 | 4037 | |
| 3817 | 4038 | if (($globalIVAO || $globalVATSIM || $globalphpVMS || $globalVAM) && $aircraft_icao != '') |
| 3818 | 4039 | { |
| 3819 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3820 | - else $airline_icao = ''; |
|
| 4040 | + if (isset($airline_array[0]['icao'])) { |
|
| 4041 | + $airline_icao = $airline_array[0]['icao']; |
|
| 4042 | + } else { |
|
| 4043 | + $airline_icao = ''; |
|
| 4044 | + } |
|
| 3821 | 4045 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3822 | 4046 | if (!isset($image_array[0]['registration'])) |
| 3823 | 4047 | { |
@@ -3862,16 +4086,28 @@ discard block |
||
| 3862 | 4086 | { |
| 3863 | 4087 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
| 3864 | 4088 | } |
| 3865 | - if ($registration == '') $registration = 'NA'; |
|
| 4089 | + if ($registration == '') { |
|
| 4090 | + $registration = 'NA'; |
|
| 4091 | + } |
|
| 3866 | 4092 | if ($latitude == '' && $longitude == '') { |
| 3867 | 4093 | $latitude = 0; |
| 3868 | 4094 | $longitude = 0; |
| 3869 | 4095 | } |
| 3870 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3871 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3872 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3873 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3874 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 4096 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
| 4097 | + $squawk = NULL; |
|
| 4098 | + } |
|
| 4099 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
| 4100 | + $verticalrate = NULL; |
|
| 4101 | + } |
|
| 4102 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 4103 | + $heading = 0; |
|
| 4104 | + } |
|
| 4105 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 4106 | + $groundspeed = 0; |
|
| 4107 | + } |
|
| 4108 | + if (!isset($aircraft_owner)) { |
|
| 4109 | + $aircraft_owner = NULL; |
|
| 4110 | + } |
|
| 3875 | 4111 | $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) |
| 3876 | 4112 | 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)"; |
| 3877 | 4113 | |
@@ -3882,9 +4118,13 @@ discard block |
||
| 3882 | 4118 | if ($airline_type == '') { |
| 3883 | 4119 | $timeelapsed = microtime(true); |
| 3884 | 4120 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3885 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4121 | + if ($globalDebugTimeElapsed) { |
|
| 4122 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4123 | + } |
|
| 4124 | + } |
|
| 4125 | + if ($airline_type == null) { |
|
| 4126 | + $airline_type = ''; |
|
| 3886 | 4127 | } |
| 3887 | - if ($airline_type == null) $airline_type = ''; |
|
| 3888 | 4128 | $aircraft_type = $aircraft_array[0]['type']; |
| 3889 | 4129 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
| 3890 | 4130 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -4048,7 +4288,9 @@ discard block |
||
| 4048 | 4288 | } |
| 4049 | 4289 | } |
| 4050 | 4290 | $query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
| 4051 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4291 | + if ($limit) { |
|
| 4292 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4293 | + } |
|
| 4052 | 4294 | |
| 4053 | 4295 | $sth = $this->db->prepare($query); |
| 4054 | 4296 | $sth->execute($query_values); |
@@ -4121,7 +4363,9 @@ discard block |
||
| 4121 | 4363 | } |
| 4122 | 4364 | |
| 4123 | 4365 | $query .= " GROUP BY spotter_output.pilot_id,s.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 4124 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4366 | + if ($limit) { |
|
| 4367 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4368 | + } |
|
| 4125 | 4369 | |
| 4126 | 4370 | |
| 4127 | 4371 | $sth = $this->db->prepare($query); |
@@ -4165,7 +4409,9 @@ discard block |
||
| 4165 | 4409 | } |
| 4166 | 4410 | } |
| 4167 | 4411 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 4168 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4412 | + if ($limit) { |
|
| 4413 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4414 | + } |
|
| 4169 | 4415 | |
| 4170 | 4416 | |
| 4171 | 4417 | $sth = $this->db->prepare($query); |
@@ -4241,7 +4487,9 @@ discard block |
||
| 4241 | 4487 | } |
| 4242 | 4488 | } |
| 4243 | 4489 | $query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4244 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4490 | + if ($limit) { |
|
| 4491 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4492 | + } |
|
| 4245 | 4493 | |
| 4246 | 4494 | $sth = $this->db->prepare($query); |
| 4247 | 4495 | $sth->execute($query_values); |
@@ -4283,7 +4531,9 @@ discard block |
||
| 4283 | 4531 | } |
| 4284 | 4532 | } |
| 4285 | 4533 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4286 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4534 | + if ($limit) { |
|
| 4535 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4536 | + } |
|
| 4287 | 4537 | |
| 4288 | 4538 | |
| 4289 | 4539 | $sth = $this->db->prepare($query); |
@@ -4528,7 +4778,9 @@ discard block |
||
| 4528 | 4778 | date_default_timezone_set($globalTimezone); |
| 4529 | 4779 | $datetime = new DateTime($date); |
| 4530 | 4780 | $offset = $datetime->format('P'); |
| 4531 | - } else $offset = '+00:00'; |
|
| 4781 | + } else { |
|
| 4782 | + $offset = '+00:00'; |
|
| 4783 | + } |
|
| 4532 | 4784 | |
| 4533 | 4785 | if ($globalDBdriver == 'mysql') { |
| 4534 | 4786 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4576,7 +4828,9 @@ discard block |
||
| 4576 | 4828 | date_default_timezone_set($globalTimezone); |
| 4577 | 4829 | $datetime = new DateTime($date); |
| 4578 | 4830 | $offset = $datetime->format('P'); |
| 4579 | - } else $offset = '+00:00'; |
|
| 4831 | + } else { |
|
| 4832 | + $offset = '+00:00'; |
|
| 4833 | + } |
|
| 4580 | 4834 | |
| 4581 | 4835 | if ($globalDBdriver == 'mysql') { |
| 4582 | 4836 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4696,9 +4950,13 @@ discard block |
||
| 4696 | 4950 | $sth = $this->db->prepare($query); |
| 4697 | 4951 | $sth->execute($query_values); |
| 4698 | 4952 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4699 | - if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4700 | - elseif ($result[0]['duration'] == '') return 0; |
|
| 4701 | - else return $result[0]['duration']; |
|
| 4953 | + if (is_numeric($result[0]['duration'])) { |
|
| 4954 | + return gmdate('H:i:s',$result[0]['duration']); |
|
| 4955 | + } elseif ($result[0]['duration'] == '') { |
|
| 4956 | + return 0; |
|
| 4957 | + } else { |
|
| 4958 | + return $result[0]['duration']; |
|
| 4959 | + } |
|
| 4702 | 4960 | } |
| 4703 | 4961 | |
| 4704 | 4962 | /** |
@@ -4787,8 +5045,11 @@ discard block |
||
| 4787 | 5045 | $sth = $this->db->prepare($query); |
| 4788 | 5046 | $sth->execute($query_values); |
| 4789 | 5047 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4790 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4791 | - else return $result[0]['duration']; |
|
| 5048 | + if (is_int($result[0]['duration'])) { |
|
| 5049 | + return gmdate('H:i:s',$result[0]['duration']); |
|
| 5050 | + } else { |
|
| 5051 | + return $result[0]['duration']; |
|
| 5052 | + } |
|
| 4792 | 5053 | } |
| 4793 | 5054 | |
| 4794 | 5055 | /** |
@@ -4992,7 +5253,9 @@ discard block |
||
| 4992 | 5253 | } |
| 4993 | 5254 | $query .= " GROUP BY spotter_output.airline_country, countries.iso3 |
| 4994 | 5255 | ORDER BY airline_country_count DESC"; |
| 4995 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5256 | + if ($limit) { |
|
| 5257 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5258 | + } |
|
| 4996 | 5259 | |
| 4997 | 5260 | $sth = $this->db->prepare($query); |
| 4998 | 5261 | $sth->execute($query_values); |
@@ -5021,7 +5284,9 @@ discard block |
||
| 5021 | 5284 | global $globalDBdriver; |
| 5022 | 5285 | //$filter_query = $this->getFilter($filters,true,true); |
| 5023 | 5286 | $Connection= new Connection($this->db); |
| 5024 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 5287 | + if (!$Connection->tableExists('countries')) { |
|
| 5288 | + return array(); |
|
| 5289 | + } |
|
| 5025 | 5290 | /* |
| 5026 | 5291 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 5027 | 5292 | FROM countries c, spotter_output s |
@@ -5053,7 +5318,9 @@ discard block |
||
| 5053 | 5318 | } |
| 5054 | 5319 | $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 "; |
| 5055 | 5320 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
| 5056 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5321 | + if ($limit) { |
|
| 5322 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5323 | + } |
|
| 5057 | 5324 | |
| 5058 | 5325 | |
| 5059 | 5326 | $sth = $this->db->prepare($query); |
@@ -5130,7 +5397,9 @@ discard block |
||
| 5130 | 5397 | } |
| 5131 | 5398 | |
| 5132 | 5399 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 5133 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5400 | + if ($limit) { |
|
| 5401 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5402 | + } |
|
| 5134 | 5403 | |
| 5135 | 5404 | $sth = $this->db->prepare($query); |
| 5136 | 5405 | $sth->execute($query_values); |
@@ -5204,7 +5473,9 @@ discard block |
||
| 5204 | 5473 | } |
| 5205 | 5474 | |
| 5206 | 5475 | $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"; |
| 5207 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5476 | + if ($limit) { |
|
| 5477 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5478 | + } |
|
| 5208 | 5479 | |
| 5209 | 5480 | $sth = $this->db->prepare($query); |
| 5210 | 5481 | $sth->execute($query_values); |
@@ -5251,7 +5522,9 @@ discard block |
||
| 5251 | 5522 | } |
| 5252 | 5523 | |
| 5253 | 5524 | $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"; |
| 5254 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5525 | + if ($limit) { |
|
| 5526 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5527 | + } |
|
| 5255 | 5528 | |
| 5256 | 5529 | $sth = $this->db->prepare($query); |
| 5257 | 5530 | $sth->execute(); |
@@ -5304,7 +5577,9 @@ discard block |
||
| 5304 | 5577 | if($row['registration'] != "") |
| 5305 | 5578 | { |
| 5306 | 5579 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5307 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5580 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5581 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5582 | + } |
|
| 5308 | 5583 | } |
| 5309 | 5584 | $temp_array['registration_count'] = $row['registration_count']; |
| 5310 | 5585 | |
@@ -5379,7 +5654,9 @@ discard block |
||
| 5379 | 5654 | if($row['registration'] != "") |
| 5380 | 5655 | { |
| 5381 | 5656 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5382 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5657 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5658 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5659 | + } |
|
| 5383 | 5660 | } |
| 5384 | 5661 | $temp_array['registration_count'] = $row['registration_count']; |
| 5385 | 5662 | |
@@ -5486,7 +5763,9 @@ discard block |
||
| 5486 | 5763 | if($row['registration'] != "") |
| 5487 | 5764 | { |
| 5488 | 5765 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5489 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5766 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5767 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5768 | + } |
|
| 5490 | 5769 | } |
| 5491 | 5770 | $temp_array['registration_count'] = $row['registration_count']; |
| 5492 | 5771 | $aircraft_array[] = $temp_array; |
@@ -5611,7 +5890,9 @@ discard block |
||
| 5611 | 5890 | date_default_timezone_set($globalTimezone); |
| 5612 | 5891 | $datetime = new DateTime($date); |
| 5613 | 5892 | $offset = $datetime->format('P'); |
| 5614 | - } else $offset = '+00:00'; |
|
| 5893 | + } else { |
|
| 5894 | + $offset = '+00:00'; |
|
| 5895 | + } |
|
| 5615 | 5896 | |
| 5616 | 5897 | if ($globalDBdriver == 'mysql') { |
| 5617 | 5898 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -5658,7 +5939,9 @@ discard block |
||
| 5658 | 5939 | date_default_timezone_set($globalTimezone); |
| 5659 | 5940 | $datetime = new DateTime($date); |
| 5660 | 5941 | $offset = $datetime->format('P'); |
| 5661 | - } else $offset = '+00:00'; |
|
| 5942 | + } else { |
|
| 5943 | + $offset = '+00:00'; |
|
| 5944 | + } |
|
| 5662 | 5945 | |
| 5663 | 5946 | if ($globalDBdriver == 'mysql') { |
| 5664 | 5947 | $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 |
@@ -5687,7 +5970,9 @@ discard block |
||
| 5687 | 5970 | if($row['registration'] != "") |
| 5688 | 5971 | { |
| 5689 | 5972 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5690 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5973 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5974 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5975 | + } |
|
| 5691 | 5976 | } |
| 5692 | 5977 | $temp_array['registration_count'] = $row['registration_count']; |
| 5693 | 5978 | |
@@ -5712,7 +5997,9 @@ discard block |
||
| 5712 | 5997 | date_default_timezone_set($globalTimezone); |
| 5713 | 5998 | $datetime = new DateTime($date); |
| 5714 | 5999 | $offset = $datetime->format('P'); |
| 5715 | - } else $offset = '+00:00'; |
|
| 6000 | + } else { |
|
| 6001 | + $offset = '+00:00'; |
|
| 6002 | + } |
|
| 5716 | 6003 | |
| 5717 | 6004 | if ($globalDBdriver == 'mysql') { |
| 5718 | 6005 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5908,8 +6195,11 @@ discard block |
||
| 5908 | 6195 | if($row['registration'] != "") |
| 5909 | 6196 | { |
| 5910 | 6197 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5911 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5912 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6198 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6199 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6200 | + } else { |
|
| 6201 | + $temp_array['image_thumbnail'] = ''; |
|
| 6202 | + } |
|
| 5913 | 6203 | } |
| 5914 | 6204 | $temp_array['registration_count'] = $row['registration_count']; |
| 5915 | 6205 | $aircraft_array[] = $temp_array; |
@@ -5983,8 +6273,11 @@ discard block |
||
| 5983 | 6273 | if($row['registration'] != "") |
| 5984 | 6274 | { |
| 5985 | 6275 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5986 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5987 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6276 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6277 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6278 | + } else { |
|
| 6279 | + $temp_array['image_thumbnail'] = ''; |
|
| 6280 | + } |
|
| 5988 | 6281 | } |
| 5989 | 6282 | $temp_array['registration_count'] = $row['registration_count']; |
| 5990 | 6283 | $aircraft_array[] = $temp_array; |
@@ -6058,8 +6351,11 @@ discard block |
||
| 6058 | 6351 | if($row['registration'] != "") |
| 6059 | 6352 | { |
| 6060 | 6353 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6061 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6062 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6354 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6355 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6356 | + } else { |
|
| 6357 | + $temp_array['image_thumbnail'] = ''; |
|
| 6358 | + } |
|
| 6063 | 6359 | } |
| 6064 | 6360 | $temp_array['registration_count'] = $row['registration_count']; |
| 6065 | 6361 | $aircraft_array[] = $temp_array; |
@@ -6270,7 +6566,9 @@ discard block |
||
| 6270 | 6566 | if($row['registration'] != "") |
| 6271 | 6567 | { |
| 6272 | 6568 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6273 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6569 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6570 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6571 | + } |
|
| 6274 | 6572 | } |
| 6275 | 6573 | $temp_array['registration_count'] = $row['registration_count']; |
| 6276 | 6574 | |
@@ -6387,7 +6685,9 @@ discard block |
||
| 6387 | 6685 | if($row['registration'] != "") |
| 6388 | 6686 | { |
| 6389 | 6687 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6390 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6688 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6689 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6690 | + } |
|
| 6391 | 6691 | } |
| 6392 | 6692 | $temp_array['registration_count'] = $row['registration_count']; |
| 6393 | 6693 | |
@@ -6553,7 +6853,9 @@ discard block |
||
| 6553 | 6853 | } |
| 6554 | 6854 | } |
| 6555 | 6855 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 6556 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6856 | + if ($limit) { |
|
| 6857 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6858 | + } |
|
| 6557 | 6859 | |
| 6558 | 6860 | $sth = $this->db->prepare($query); |
| 6559 | 6861 | $sth->execute($query_values); |
@@ -6572,7 +6874,9 @@ discard block |
||
| 6572 | 6874 | if($row['registration'] != "") |
| 6573 | 6875 | { |
| 6574 | 6876 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6575 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6877 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6878 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6879 | + } |
|
| 6576 | 6880 | } |
| 6577 | 6881 | |
| 6578 | 6882 | $aircraft_array[] = $temp_array; |
@@ -6613,7 +6917,9 @@ discard block |
||
| 6613 | 6917 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6614 | 6918 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6615 | 6919 | $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"; |
| 6616 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6920 | + if ($limit) { |
|
| 6921 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6922 | + } |
|
| 6617 | 6923 | |
| 6618 | 6924 | $sth = $this->db->prepare($query); |
| 6619 | 6925 | $sth->execute(); |
@@ -6633,7 +6939,9 @@ discard block |
||
| 6633 | 6939 | if($row['registration'] != "") |
| 6634 | 6940 | { |
| 6635 | 6941 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6636 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6942 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6943 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6944 | + } |
|
| 6637 | 6945 | } |
| 6638 | 6946 | |
| 6639 | 6947 | $aircraft_array[] = $temp_array; |
@@ -6699,7 +7007,9 @@ discard block |
||
| 6699 | 7007 | } |
| 6700 | 7008 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, airport.latitude, airport.longitude |
| 6701 | 7009 | ORDER BY airport_departure_icao_count DESC"; |
| 6702 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7010 | + if ($limit) { |
|
| 7011 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7012 | + } |
|
| 6703 | 7013 | |
| 6704 | 7014 | $sth = $this->db->prepare($query); |
| 6705 | 7015 | $sth->execute($query_values); |
@@ -6751,7 +7061,9 @@ discard block |
||
| 6751 | 7061 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6752 | 7062 | $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 |
| 6753 | 7063 | ORDER BY airport_departure_icao_count DESC"; |
| 6754 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7064 | + if ($limit) { |
|
| 7065 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7066 | + } |
|
| 6755 | 7067 | |
| 6756 | 7068 | $sth = $this->db->prepare($query); |
| 6757 | 7069 | $sth->execute(); |
@@ -6829,7 +7141,9 @@ discard block |
||
| 6829 | 7141 | } |
| 6830 | 7142 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude |
| 6831 | 7143 | ORDER BY airport_departure_icao_count DESC"; |
| 6832 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7144 | + if ($limit) { |
|
| 7145 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7146 | + } |
|
| 6833 | 7147 | //echo $query; |
| 6834 | 7148 | $sth = $this->db->prepare($query); |
| 6835 | 7149 | $sth->execute($query_values); |
@@ -6883,7 +7197,9 @@ discard block |
||
| 6883 | 7197 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6884 | 7198 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 6885 | 7199 | ORDER BY airport_departure_icao_count DESC"; |
| 6886 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7200 | + if ($limit) { |
|
| 7201 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7202 | + } |
|
| 6887 | 7203 | |
| 6888 | 7204 | $sth = $this->db->prepare($query); |
| 6889 | 7205 | $sth->execute(); |
@@ -7274,7 +7590,9 @@ discard block |
||
| 7274 | 7590 | date_default_timezone_set($globalTimezone); |
| 7275 | 7591 | $datetime = new DateTime($date); |
| 7276 | 7592 | $offset = $datetime->format('P'); |
| 7277 | - } else $offset = '+00:00'; |
|
| 7593 | + } else { |
|
| 7594 | + $offset = '+00:00'; |
|
| 7595 | + } |
|
| 7278 | 7596 | |
| 7279 | 7597 | if ($globalDBdriver == 'mysql') { |
| 7280 | 7598 | $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 |
@@ -7324,7 +7642,9 @@ discard block |
||
| 7324 | 7642 | date_default_timezone_set($globalTimezone); |
| 7325 | 7643 | $datetime = new DateTime($date); |
| 7326 | 7644 | $offset = $datetime->format('P'); |
| 7327 | - } else $offset = '+00:00'; |
|
| 7645 | + } else { |
|
| 7646 | + $offset = '+00:00'; |
|
| 7647 | + } |
|
| 7328 | 7648 | |
| 7329 | 7649 | if ($globalDBdriver == 'mysql') { |
| 7330 | 7650 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count,countries.iso3 AS departure_airport_country_iso3 |
@@ -7670,7 +7990,9 @@ discard block |
||
| 7670 | 7990 | } |
| 7671 | 7991 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, airport.latitude, airport.longitude |
| 7672 | 7992 | ORDER BY airport_arrival_icao_count DESC"; |
| 7673 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7993 | + if ($limit) { |
|
| 7994 | + $query .= " LIMIT 10"; |
|
| 7995 | + } |
|
| 7674 | 7996 | |
| 7675 | 7997 | |
| 7676 | 7998 | $sth = $this->db->prepare($query); |
@@ -7692,7 +8014,9 @@ discard block |
||
| 7692 | 8014 | if ($icaoaskey) { |
| 7693 | 8015 | $icao = $row['arrival_airport_icao']; |
| 7694 | 8016 | $airport_array[$icao] = $temp_array; |
| 7695 | - } else $airport_array[] = $temp_array; |
|
| 8017 | + } else { |
|
| 8018 | + $airport_array[] = $temp_array; |
|
| 8019 | + } |
|
| 7696 | 8020 | } |
| 7697 | 8021 | |
| 7698 | 8022 | return $airport_array; |
@@ -7729,7 +8053,9 @@ discard block |
||
| 7729 | 8053 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 7730 | 8054 | $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, countries.iso3 |
| 7731 | 8055 | ORDER BY airport_arrival_icao_count DESC"; |
| 7732 | - if ($limit) $query .= " LIMIT 10"; |
|
| 8056 | + if ($limit) { |
|
| 8057 | + $query .= " LIMIT 10"; |
|
| 8058 | + } |
|
| 7733 | 8059 | |
| 7734 | 8060 | |
| 7735 | 8061 | $sth = $this->db->prepare($query); |
@@ -7751,7 +8077,9 @@ discard block |
||
| 7751 | 8077 | if ($icaoaskey) { |
| 7752 | 8078 | $icao = $row['arrival_airport_icao']; |
| 7753 | 8079 | $airport_array[$icao] = $temp_array; |
| 7754 | - } else $airport_array[] = $temp_array; |
|
| 8080 | + } else { |
|
| 8081 | + $airport_array[] = $temp_array; |
|
| 8082 | + } |
|
| 7755 | 8083 | } |
| 7756 | 8084 | |
| 7757 | 8085 | return $airport_array; |
@@ -7814,7 +8142,9 @@ discard block |
||
| 7814 | 8142 | } |
| 7815 | 8143 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country, airport.latitude, airport.longitude |
| 7816 | 8144 | ORDER BY airport_arrival_icao_count DESC"; |
| 7817 | - if ($limit) $query .= " LIMIT 10"; |
|
| 8145 | + if ($limit) { |
|
| 8146 | + $query .= " LIMIT 10"; |
|
| 8147 | + } |
|
| 7818 | 8148 | |
| 7819 | 8149 | |
| 7820 | 8150 | $sth = $this->db->prepare($query); |
@@ -7833,7 +8163,9 @@ discard block |
||
| 7833 | 8163 | if ($icaoaskey) { |
| 7834 | 8164 | $icao = $row['arrival_airport_icao']; |
| 7835 | 8165 | $airport_array[$icao] = $temp_array; |
| 7836 | - } else $airport_array[] = $temp_array; |
|
| 8166 | + } else { |
|
| 8167 | + $airport_array[] = $temp_array; |
|
| 8168 | + } |
|
| 7837 | 8169 | } |
| 7838 | 8170 | |
| 7839 | 8171 | return $airport_array; |
@@ -7870,7 +8202,9 @@ discard block |
||
| 7870 | 8202 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 7871 | 8203 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 7872 | 8204 | ORDER BY airport_arrival_icao_count DESC"; |
| 7873 | - if ($limit) $query .= " LIMIT 10"; |
|
| 8205 | + if ($limit) { |
|
| 8206 | + $query .= " LIMIT 10"; |
|
| 8207 | + } |
|
| 7874 | 8208 | |
| 7875 | 8209 | |
| 7876 | 8210 | $sth = $this->db->prepare($query); |
@@ -7891,7 +8225,9 @@ discard block |
||
| 7891 | 8225 | if ($icaoaskey) { |
| 7892 | 8226 | $icao = $row['arrival_airport_icao']; |
| 7893 | 8227 | $airport_array[$icao] = $temp_array; |
| 7894 | - } else $airport_array[] = $temp_array; |
|
| 8228 | + } else { |
|
| 8229 | + $airport_array[] = $temp_array; |
|
| 8230 | + } |
|
| 7895 | 8231 | } |
| 7896 | 8232 | |
| 7897 | 8233 | return $airport_array; |
@@ -8269,7 +8605,9 @@ discard block |
||
| 8269 | 8605 | date_default_timezone_set($globalTimezone); |
| 8270 | 8606 | $datetime = new DateTime($date); |
| 8271 | 8607 | $offset = $datetime->format('P'); |
| 8272 | - } else $offset = '+00:00'; |
|
| 8608 | + } else { |
|
| 8609 | + $offset = '+00:00'; |
|
| 8610 | + } |
|
| 8273 | 8611 | |
| 8274 | 8612 | if ($globalDBdriver == 'mysql') { |
| 8275 | 8613 | $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 |
@@ -8319,7 +8657,9 @@ discard block |
||
| 8319 | 8657 | date_default_timezone_set($globalTimezone); |
| 8320 | 8658 | $datetime = new DateTime($date); |
| 8321 | 8659 | $offset = $datetime->format('P'); |
| 8322 | - } else $offset = '+00:00'; |
|
| 8660 | + } else { |
|
| 8661 | + $offset = '+00:00'; |
|
| 8662 | + } |
|
| 8323 | 8663 | |
| 8324 | 8664 | if ($globalDBdriver == 'mysql') { |
| 8325 | 8665 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count, countries.iso3 AS arrival_airport_country_iso3 |
@@ -8702,7 +9042,9 @@ discard block |
||
| 8702 | 9042 | } |
| 8703 | 9043 | $query .= " GROUP BY spotter_output.arrival_airport_country, countries.iso3 |
| 8704 | 9044 | ORDER BY airport_arrival_country_count DESC"; |
| 8705 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9045 | + if ($limit) { |
|
| 9046 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9047 | + } |
|
| 8706 | 9048 | |
| 8707 | 9049 | |
| 8708 | 9050 | $sth = $this->db->prepare($query); |
@@ -8990,7 +9332,9 @@ discard block |
||
| 8990 | 9332 | date_default_timezone_set($globalTimezone); |
| 8991 | 9333 | $datetime = new DateTime($date); |
| 8992 | 9334 | $offset = $datetime->format('P'); |
| 8993 | - } else $offset = '+00:00'; |
|
| 9335 | + } else { |
|
| 9336 | + $offset = '+00:00'; |
|
| 9337 | + } |
|
| 8994 | 9338 | |
| 8995 | 9339 | if ($globalDBdriver == 'mysql') { |
| 8996 | 9340 | $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 |
@@ -9246,12 +9590,18 @@ discard block |
||
| 9246 | 9590 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
| 9247 | 9591 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
| 9248 | 9592 | if ($olderthanmonths > 0) { |
| 9249 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 9250 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 9593 | + if ($globalDBdriver == 'mysql') { |
|
| 9594 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 9595 | + } else { |
|
| 9596 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 9597 | + } |
|
| 9251 | 9598 | } |
| 9252 | 9599 | if ($sincedate != '') { |
| 9253 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 9254 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 9600 | + if ($globalDBdriver == 'mysql') { |
|
| 9601 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 9602 | + } else { |
|
| 9603 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 9604 | + } |
|
| 9255 | 9605 | } |
| 9256 | 9606 | $query_values = array(); |
| 9257 | 9607 | if ($year != '') { |
@@ -9282,7 +9632,9 @@ discard block |
||
| 9282 | 9632 | } |
| 9283 | 9633 | } |
| 9284 | 9634 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 9285 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9635 | + if ($limit) { |
|
| 9636 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9637 | + } |
|
| 9286 | 9638 | |
| 9287 | 9639 | $sth = $this->db->prepare($query); |
| 9288 | 9640 | $sth->execute($query_values); |
@@ -9316,15 +9668,23 @@ discard block |
||
| 9316 | 9668 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
| 9317 | 9669 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 9318 | 9670 | if ($olderthanmonths > 0) { |
| 9319 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 9320 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 9671 | + if ($globalDBdriver == 'mysql') { |
|
| 9672 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 9673 | + } else { |
|
| 9674 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 9675 | + } |
|
| 9321 | 9676 | } |
| 9322 | 9677 | if ($sincedate != '') { |
| 9323 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 9324 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 9678 | + if ($globalDBdriver == 'mysql') { |
|
| 9679 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 9680 | + } else { |
|
| 9681 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 9682 | + } |
|
| 9325 | 9683 | } |
| 9326 | 9684 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 9327 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9685 | + if ($limit) { |
|
| 9686 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9687 | + } |
|
| 9328 | 9688 | |
| 9329 | 9689 | $sth = $this->db->prepare($query); |
| 9330 | 9690 | $sth->execute(); |
@@ -9361,7 +9721,9 @@ discard block |
||
| 9361 | 9721 | date_default_timezone_set($globalTimezone); |
| 9362 | 9722 | $datetime = new DateTime(); |
| 9363 | 9723 | $offset = $datetime->format('P'); |
| 9364 | - } else $offset = '+00:00'; |
|
| 9724 | + } else { |
|
| 9725 | + $offset = '+00:00'; |
|
| 9726 | + } |
|
| 9365 | 9727 | |
| 9366 | 9728 | if ($globalDBdriver == 'mysql') { |
| 9367 | 9729 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9410,7 +9772,9 @@ discard block |
||
| 9410 | 9772 | date_default_timezone_set($globalTimezone); |
| 9411 | 9773 | $datetime = new DateTime(); |
| 9412 | 9774 | $offset = $datetime->format('P'); |
| 9413 | - } else $offset = '+00:00'; |
|
| 9775 | + } else { |
|
| 9776 | + $offset = '+00:00'; |
|
| 9777 | + } |
|
| 9414 | 9778 | $filter_query = $this->getFilter($filters,true,true); |
| 9415 | 9779 | if ($globalDBdriver == 'mysql') { |
| 9416 | 9780 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9459,7 +9823,9 @@ discard block |
||
| 9459 | 9823 | date_default_timezone_set($globalTimezone); |
| 9460 | 9824 | $datetime = new DateTime(); |
| 9461 | 9825 | $offset = $datetime->format('P'); |
| 9462 | - } else $offset = '+00:00'; |
|
| 9826 | + } else { |
|
| 9827 | + $offset = '+00:00'; |
|
| 9828 | + } |
|
| 9463 | 9829 | $filter_query = $this->getFilter($filters,true,true); |
| 9464 | 9830 | if ($globalDBdriver == 'mysql') { |
| 9465 | 9831 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9505,7 +9871,9 @@ discard block |
||
| 9505 | 9871 | date_default_timezone_set($globalTimezone); |
| 9506 | 9872 | $datetime = new DateTime(); |
| 9507 | 9873 | $offset = $datetime->format('P'); |
| 9508 | - } else $offset = '+00:00'; |
|
| 9874 | + } else { |
|
| 9875 | + $offset = '+00:00'; |
|
| 9876 | + } |
|
| 9509 | 9877 | $filter_query = $this->getFilter($filters,true,true); |
| 9510 | 9878 | if ($globalDBdriver == 'mysql') { |
| 9511 | 9879 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9553,7 +9921,9 @@ discard block |
||
| 9553 | 9921 | date_default_timezone_set($globalTimezone); |
| 9554 | 9922 | $datetime = new DateTime(); |
| 9555 | 9923 | $offset = $datetime->format('P'); |
| 9556 | - } else $offset = '+00:00'; |
|
| 9924 | + } else { |
|
| 9925 | + $offset = '+00:00'; |
|
| 9926 | + } |
|
| 9557 | 9927 | |
| 9558 | 9928 | if ($globalDBdriver == 'mysql') { |
| 9559 | 9929 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9601,7 +9971,9 @@ discard block |
||
| 9601 | 9971 | date_default_timezone_set($globalTimezone); |
| 9602 | 9972 | $datetime = new DateTime(); |
| 9603 | 9973 | $offset = $datetime->format('P'); |
| 9604 | - } else $offset = '+00:00'; |
|
| 9974 | + } else { |
|
| 9975 | + $offset = '+00:00'; |
|
| 9976 | + } |
|
| 9605 | 9977 | |
| 9606 | 9978 | if ($globalDBdriver == 'mysql') { |
| 9607 | 9979 | $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 |
@@ -9648,7 +10020,9 @@ discard block |
||
| 9648 | 10020 | date_default_timezone_set($globalTimezone); |
| 9649 | 10021 | $datetime = new DateTime(); |
| 9650 | 10022 | $offset = $datetime->format('P'); |
| 9651 | - } else $offset = '+00:00'; |
|
| 10023 | + } else { |
|
| 10024 | + $offset = '+00:00'; |
|
| 10025 | + } |
|
| 9652 | 10026 | |
| 9653 | 10027 | if ($globalDBdriver == 'mysql') { |
| 9654 | 10028 | $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 |
@@ -9696,7 +10070,9 @@ discard block |
||
| 9696 | 10070 | date_default_timezone_set($globalTimezone); |
| 9697 | 10071 | $datetime = new DateTime(); |
| 9698 | 10072 | $offset = $datetime->format('P'); |
| 9699 | - } else $offset = '+00:00'; |
|
| 10073 | + } else { |
|
| 10074 | + $offset = '+00:00'; |
|
| 10075 | + } |
|
| 9700 | 10076 | $filter_query = $this->getFilter($filters,true,true); |
| 9701 | 10077 | if ($globalDBdriver == 'mysql') { |
| 9702 | 10078 | $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 |
@@ -9741,7 +10117,9 @@ discard block |
||
| 9741 | 10117 | date_default_timezone_set($globalTimezone); |
| 9742 | 10118 | $datetime = new DateTime(); |
| 9743 | 10119 | $offset = $datetime->format('P'); |
| 9744 | - } else $offset = '+00:00'; |
|
| 10120 | + } else { |
|
| 10121 | + $offset = '+00:00'; |
|
| 10122 | + } |
|
| 9745 | 10123 | $filter_query = $this->getFilter($filters,true,true); |
| 9746 | 10124 | |
| 9747 | 10125 | if ($globalDBdriver == 'mysql') { |
@@ -9788,7 +10166,9 @@ discard block |
||
| 9788 | 10166 | date_default_timezone_set($globalTimezone); |
| 9789 | 10167 | $datetime = new DateTime(); |
| 9790 | 10168 | $offset = $datetime->format('P'); |
| 9791 | - } else $offset = '+00:00'; |
|
| 10169 | + } else { |
|
| 10170 | + $offset = '+00:00'; |
|
| 10171 | + } |
|
| 9792 | 10172 | |
| 9793 | 10173 | if ($globalDBdriver == 'mysql') { |
| 9794 | 10174 | $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 |
@@ -9834,7 +10214,9 @@ discard block |
||
| 9834 | 10214 | date_default_timezone_set($globalTimezone); |
| 9835 | 10215 | $datetime = new DateTime(); |
| 9836 | 10216 | $offset = $datetime->format('P'); |
| 9837 | - } else $offset = '+00:00'; |
|
| 10217 | + } else { |
|
| 10218 | + $offset = '+00:00'; |
|
| 10219 | + } |
|
| 9838 | 10220 | $filter_query = $this->getFilter($filters,true,true); |
| 9839 | 10221 | |
| 9840 | 10222 | if ($globalDBdriver == 'mysql') { |
@@ -9881,7 +10263,9 @@ discard block |
||
| 9881 | 10263 | date_default_timezone_set($globalTimezone); |
| 9882 | 10264 | $datetime = new DateTime(); |
| 9883 | 10265 | $offset = $datetime->format('P'); |
| 9884 | - } else $offset = '+00:00'; |
|
| 10266 | + } else { |
|
| 10267 | + $offset = '+00:00'; |
|
| 10268 | + } |
|
| 9885 | 10269 | |
| 9886 | 10270 | if ($globalDBdriver == 'mysql') { |
| 9887 | 10271 | $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 |
@@ -9928,7 +10312,9 @@ discard block |
||
| 9928 | 10312 | date_default_timezone_set($globalTimezone); |
| 9929 | 10313 | $datetime = new DateTime(); |
| 9930 | 10314 | $offset = $datetime->format('P'); |
| 9931 | - } else $offset = '+00:00'; |
|
| 10315 | + } else { |
|
| 10316 | + $offset = '+00:00'; |
|
| 10317 | + } |
|
| 9932 | 10318 | |
| 9933 | 10319 | if ($globalDBdriver == 'mysql') { |
| 9934 | 10320 | $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 |
@@ -9973,7 +10359,9 @@ discard block |
||
| 9973 | 10359 | date_default_timezone_set($globalTimezone); |
| 9974 | 10360 | $datetime = new DateTime(); |
| 9975 | 10361 | $offset = $datetime->format('P'); |
| 9976 | - } else $offset = '+00:00'; |
|
| 10362 | + } else { |
|
| 10363 | + $offset = '+00:00'; |
|
| 10364 | + } |
|
| 9977 | 10365 | $filter_query = $this->getFilter($filters,true,true); |
| 9978 | 10366 | |
| 9979 | 10367 | if ($globalDBdriver == 'mysql') { |
@@ -10021,7 +10409,9 @@ discard block |
||
| 10021 | 10409 | date_default_timezone_set($globalTimezone); |
| 10022 | 10410 | $datetime = new DateTime(); |
| 10023 | 10411 | $offset = $datetime->format('P'); |
| 10024 | - } else $offset = '+00:00'; |
|
| 10412 | + } else { |
|
| 10413 | + $offset = '+00:00'; |
|
| 10414 | + } |
|
| 10025 | 10415 | |
| 10026 | 10416 | if ($globalDBdriver == 'mysql') { |
| 10027 | 10417 | $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 |
@@ -10067,7 +10457,9 @@ discard block |
||
| 10067 | 10457 | date_default_timezone_set($globalTimezone); |
| 10068 | 10458 | $datetime = new DateTime(); |
| 10069 | 10459 | $offset = $datetime->format('P'); |
| 10070 | - } else $offset = '+00:00'; |
|
| 10460 | + } else { |
|
| 10461 | + $offset = '+00:00'; |
|
| 10462 | + } |
|
| 10071 | 10463 | $filter_query = $this->getFilter($filters,true,true); |
| 10072 | 10464 | |
| 10073 | 10465 | if ($globalDBdriver == 'mysql') { |
@@ -10115,7 +10507,9 @@ discard block |
||
| 10115 | 10507 | date_default_timezone_set($globalTimezone); |
| 10116 | 10508 | $datetime = new DateTime(); |
| 10117 | 10509 | $offset = $datetime->format('P'); |
| 10118 | - } else $offset = '+00:00'; |
|
| 10510 | + } else { |
|
| 10511 | + $offset = '+00:00'; |
|
| 10512 | + } |
|
| 10119 | 10513 | |
| 10120 | 10514 | if ($globalDBdriver == 'mysql') { |
| 10121 | 10515 | $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 |
@@ -10162,7 +10556,9 @@ discard block |
||
| 10162 | 10556 | date_default_timezone_set($globalTimezone); |
| 10163 | 10557 | $datetime = new DateTime(); |
| 10164 | 10558 | $offset = $datetime->format('P'); |
| 10165 | - } else $offset = '+00:00'; |
|
| 10559 | + } else { |
|
| 10560 | + $offset = '+00:00'; |
|
| 10561 | + } |
|
| 10166 | 10562 | $filter_query = $this->getFilter($filters,true,true); |
| 10167 | 10563 | if ($globalDBdriver == 'mysql') { |
| 10168 | 10564 | $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 |
@@ -10211,7 +10607,9 @@ discard block |
||
| 10211 | 10607 | date_default_timezone_set($globalTimezone); |
| 10212 | 10608 | $datetime = new DateTime(); |
| 10213 | 10609 | $offset = $datetime->format('P'); |
| 10214 | - } else $offset = '+00:00'; |
|
| 10610 | + } else { |
|
| 10611 | + $offset = '+00:00'; |
|
| 10612 | + } |
|
| 10215 | 10613 | |
| 10216 | 10614 | $orderby_sql = ''; |
| 10217 | 10615 | if ($orderby == "hour") |
@@ -10277,7 +10675,9 @@ discard block |
||
| 10277 | 10675 | date_default_timezone_set($globalTimezone); |
| 10278 | 10676 | $datetime = new DateTime(); |
| 10279 | 10677 | $offset = $datetime->format('P'); |
| 10280 | - } else $offset = '+00:00'; |
|
| 10678 | + } else { |
|
| 10679 | + $offset = '+00:00'; |
|
| 10680 | + } |
|
| 10281 | 10681 | |
| 10282 | 10682 | $orderby_sql = ''; |
| 10283 | 10683 | if ($orderby == "hour") |
@@ -10344,7 +10744,9 @@ discard block |
||
| 10344 | 10744 | date_default_timezone_set($globalTimezone); |
| 10345 | 10745 | $datetime = new DateTime(); |
| 10346 | 10746 | $offset = $datetime->format('P'); |
| 10347 | - } else $offset = '+00:00'; |
|
| 10747 | + } else { |
|
| 10748 | + $offset = '+00:00'; |
|
| 10749 | + } |
|
| 10348 | 10750 | |
| 10349 | 10751 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
| 10350 | 10752 | |
@@ -10395,7 +10797,9 @@ discard block |
||
| 10395 | 10797 | date_default_timezone_set($globalTimezone); |
| 10396 | 10798 | $datetime = new DateTime(); |
| 10397 | 10799 | $offset = $datetime->format('P'); |
| 10398 | - } else $offset = '+00:00'; |
|
| 10800 | + } else { |
|
| 10801 | + $offset = '+00:00'; |
|
| 10802 | + } |
|
| 10399 | 10803 | |
| 10400 | 10804 | if ($globalDBdriver == 'mysql') { |
| 10401 | 10805 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10442,7 +10846,9 @@ discard block |
||
| 10442 | 10846 | date_default_timezone_set($globalTimezone); |
| 10443 | 10847 | $datetime = new DateTime(); |
| 10444 | 10848 | $offset = $datetime->format('P'); |
| 10445 | - } else $offset = '+00:00'; |
|
| 10849 | + } else { |
|
| 10850 | + $offset = '+00:00'; |
|
| 10851 | + } |
|
| 10446 | 10852 | |
| 10447 | 10853 | if ($globalDBdriver == 'mysql') { |
| 10448 | 10854 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10489,7 +10895,9 @@ discard block |
||
| 10489 | 10895 | date_default_timezone_set($globalTimezone); |
| 10490 | 10896 | $datetime = new DateTime(); |
| 10491 | 10897 | $offset = $datetime->format('P'); |
| 10492 | - } else $offset = '+00:00'; |
|
| 10898 | + } else { |
|
| 10899 | + $offset = '+00:00'; |
|
| 10900 | + } |
|
| 10493 | 10901 | |
| 10494 | 10902 | if ($globalDBdriver == 'mysql') { |
| 10495 | 10903 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10537,7 +10945,9 @@ discard block |
||
| 10537 | 10945 | date_default_timezone_set($globalTimezone); |
| 10538 | 10946 | $datetime = new DateTime(); |
| 10539 | 10947 | $offset = $datetime->format('P'); |
| 10540 | - } else $offset = '+00:00'; |
|
| 10948 | + } else { |
|
| 10949 | + $offset = '+00:00'; |
|
| 10950 | + } |
|
| 10541 | 10951 | |
| 10542 | 10952 | if ($globalDBdriver == 'mysql') { |
| 10543 | 10953 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10585,7 +10995,9 @@ discard block |
||
| 10585 | 10995 | date_default_timezone_set($globalTimezone); |
| 10586 | 10996 | $datetime = new DateTime($date); |
| 10587 | 10997 | $offset = $datetime->format('P'); |
| 10588 | - } else $offset = '+00:00'; |
|
| 10998 | + } else { |
|
| 10999 | + $offset = '+00:00'; |
|
| 11000 | + } |
|
| 10589 | 11001 | |
| 10590 | 11002 | if ($globalDBdriver == 'mysql') { |
| 10591 | 11003 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10633,7 +11045,9 @@ discard block |
||
| 10633 | 11045 | date_default_timezone_set($globalTimezone); |
| 10634 | 11046 | $datetime = new DateTime(); |
| 10635 | 11047 | $offset = $datetime->format('P'); |
| 10636 | - } else $offset = '+00:00'; |
|
| 11048 | + } else { |
|
| 11049 | + $offset = '+00:00'; |
|
| 11050 | + } |
|
| 10637 | 11051 | |
| 10638 | 11052 | if ($globalDBdriver == 'mysql') { |
| 10639 | 11053 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10680,7 +11094,9 @@ discard block |
||
| 10680 | 11094 | date_default_timezone_set($globalTimezone); |
| 10681 | 11095 | $datetime = new DateTime(); |
| 10682 | 11096 | $offset = $datetime->format('P'); |
| 10683 | - } else $offset = '+00:00'; |
|
| 11097 | + } else { |
|
| 11098 | + $offset = '+00:00'; |
|
| 11099 | + } |
|
| 10684 | 11100 | |
| 10685 | 11101 | if ($globalDBdriver == 'mysql') { |
| 10686 | 11102 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10727,7 +11143,9 @@ discard block |
||
| 10727 | 11143 | date_default_timezone_set($globalTimezone); |
| 10728 | 11144 | $datetime = new DateTime(); |
| 10729 | 11145 | $offset = $datetime->format('P'); |
| 10730 | - } else $offset = '+00:00'; |
|
| 11146 | + } else { |
|
| 11147 | + $offset = '+00:00'; |
|
| 11148 | + } |
|
| 10731 | 11149 | |
| 10732 | 11150 | if ($globalDBdriver == 'mysql') { |
| 10733 | 11151 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10777,7 +11195,9 @@ discard block |
||
| 10777 | 11195 | date_default_timezone_set($globalTimezone); |
| 10778 | 11196 | $datetime = new DateTime(); |
| 10779 | 11197 | $offset = $datetime->format('P'); |
| 10780 | - } else $offset = '+00:00'; |
|
| 11198 | + } else { |
|
| 11199 | + $offset = '+00:00'; |
|
| 11200 | + } |
|
| 10781 | 11201 | |
| 10782 | 11202 | if ($globalDBdriver == 'mysql') { |
| 10783 | 11203 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10824,7 +11244,9 @@ discard block |
||
| 10824 | 11244 | date_default_timezone_set($globalTimezone); |
| 10825 | 11245 | $datetime = new DateTime(); |
| 10826 | 11246 | $offset = $datetime->format('P'); |
| 10827 | - } else $offset = '+00:00'; |
|
| 11247 | + } else { |
|
| 11248 | + $offset = '+00:00'; |
|
| 11249 | + } |
|
| 10828 | 11250 | |
| 10829 | 11251 | if ($globalDBdriver == 'mysql') { |
| 10830 | 11252 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -11035,8 +11457,11 @@ discard block |
||
| 11035 | 11457 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 11036 | 11458 | } |
| 11037 | 11459 | } |
| 11038 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 11039 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11460 | + if (empty($query_values)) { |
|
| 11461 | + $queryi .= $this->getFilter($filters); |
|
| 11462 | + } else { |
|
| 11463 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11464 | + } |
|
| 11040 | 11465 | |
| 11041 | 11466 | $sth = $this->db->prepare($queryi); |
| 11042 | 11467 | $sth->execute($query_values); |
@@ -11114,8 +11539,11 @@ discard block |
||
| 11114 | 11539 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 11115 | 11540 | } |
| 11116 | 11541 | } |
| 11117 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 11118 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11542 | + if ($query == '') { |
|
| 11543 | + $queryi .= $this->getFilter($filters); |
|
| 11544 | + } else { |
|
| 11545 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11546 | + } |
|
| 11119 | 11547 | |
| 11120 | 11548 | |
| 11121 | 11549 | $sth = $this->db->prepare($queryi); |
@@ -11138,7 +11566,9 @@ discard block |
||
| 11138 | 11566 | date_default_timezone_set($globalTimezone); |
| 11139 | 11567 | $datetime = new DateTime(); |
| 11140 | 11568 | $offset = $datetime->format('P'); |
| 11141 | - } else $offset = '+00:00'; |
|
| 11569 | + } else { |
|
| 11570 | + $offset = '+00:00'; |
|
| 11571 | + } |
|
| 11142 | 11572 | |
| 11143 | 11573 | if ($globalDBdriver == 'mysql') { |
| 11144 | 11574 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -11324,7 +11754,9 @@ discard block |
||
| 11324 | 11754 | */ |
| 11325 | 11755 | public function parseDirection($direction = 0) |
| 11326 | 11756 | { |
| 11327 | - if ($direction == '') $direction = 0; |
|
| 11757 | + if ($direction == '') { |
|
| 11758 | + $direction = 0; |
|
| 11759 | + } |
|
| 11328 | 11760 | $direction_array = array(); |
| 11329 | 11761 | $temp_array = array(); |
| 11330 | 11762 | |
@@ -11425,7 +11857,9 @@ discard block |
||
| 11425 | 11857 | if (isset($result->AirlineFlightInfoResult)) |
| 11426 | 11858 | { |
| 11427 | 11859 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
| 11428 | - } else return ''; |
|
| 11860 | + } else { |
|
| 11861 | + return ''; |
|
| 11862 | + } |
|
| 11429 | 11863 | |
| 11430 | 11864 | $registration = $this->convertAircraftRegistration($registration); |
| 11431 | 11865 | |
@@ -11459,7 +11893,9 @@ discard block |
||
| 11459 | 11893 | return $row['registration']; |
| 11460 | 11894 | } elseif ($source_type == 'flarm') { |
| 11461 | 11895 | return $this->getAircraftRegistrationBymodeS($aircraft_modes); |
| 11462 | - } else return ''; |
|
| 11896 | + } else { |
|
| 11897 | + return ''; |
|
| 11898 | + } |
|
| 11463 | 11899 | |
| 11464 | 11900 | } |
| 11465 | 11901 | |
@@ -11486,11 +11922,16 @@ discard block |
||
| 11486 | 11922 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 11487 | 11923 | $sth->closeCursor(); |
| 11488 | 11924 | if (count($row) > 0) { |
| 11489 | - if ($row['type_flight'] == null) return ''; |
|
| 11490 | - else return $row['type_flight']; |
|
| 11925 | + if ($row['type_flight'] == null) { |
|
| 11926 | + return ''; |
|
| 11927 | + } else { |
|
| 11928 | + return $row['type_flight']; |
|
| 11929 | + } |
|
| 11491 | 11930 | } elseif ($source_type == 'flarm') { |
| 11492 | 11931 | return $this->getAircraftTypeBymodeS($aircraft_modes); |
| 11493 | - } else return ''; |
|
| 11932 | + } else { |
|
| 11933 | + return ''; |
|
| 11934 | + } |
|
| 11494 | 11935 | |
| 11495 | 11936 | } |
| 11496 | 11937 | |
@@ -11508,7 +11949,9 @@ discard block |
||
| 11508 | 11949 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 11509 | 11950 | |
| 11510 | 11951 | $Connection = new Connection($this->db); |
| 11511 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 11952 | + if (!$Connection->tableExists('countries')) { |
|
| 11953 | + return ''; |
|
| 11954 | + } |
|
| 11512 | 11955 | |
| 11513 | 11956 | try { |
| 11514 | 11957 | /* |
@@ -11528,9 +11971,13 @@ discard block |
||
| 11528 | 11971 | $sth->closeCursor(); |
| 11529 | 11972 | if (count($row) > 0) { |
| 11530 | 11973 | return $row; |
| 11531 | - } else return ''; |
|
| 11974 | + } else { |
|
| 11975 | + return ''; |
|
| 11976 | + } |
|
| 11532 | 11977 | } catch (PDOException $e) { |
| 11533 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 11978 | + if (isset($globalDebug) && $globalDebug) { |
|
| 11979 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 11980 | + } |
|
| 11534 | 11981 | return ''; |
| 11535 | 11982 | } |
| 11536 | 11983 | |
@@ -11548,7 +11995,9 @@ discard block |
||
| 11548 | 11995 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
| 11549 | 11996 | |
| 11550 | 11997 | $Connection = new Connection($this->db); |
| 11551 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 11998 | + if (!$Connection->tableExists('countries')) { |
|
| 11999 | + return ''; |
|
| 12000 | + } |
|
| 11552 | 12001 | |
| 11553 | 12002 | try { |
| 11554 | 12003 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -11560,9 +12009,13 @@ discard block |
||
| 11560 | 12009 | $sth->closeCursor(); |
| 11561 | 12010 | if (count($row) > 0) { |
| 11562 | 12011 | return $row; |
| 11563 | - } else return ''; |
|
| 12012 | + } else { |
|
| 12013 | + return ''; |
|
| 12014 | + } |
|
| 11564 | 12015 | } catch (PDOException $e) { |
| 11565 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 12016 | + if (isset($globalDebug) && $globalDebug) { |
|
| 12017 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 12018 | + } |
|
| 11566 | 12019 | return ''; |
| 11567 | 12020 | } |
| 11568 | 12021 | |
@@ -11812,7 +12265,9 @@ discard block |
||
| 11812 | 12265 | { |
| 11813 | 12266 | global $globalBitlyAccessToken; |
| 11814 | 12267 | |
| 11815 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 12268 | + if ($globalBitlyAccessToken == '') { |
|
| 12269 | + return $url; |
|
| 12270 | + } |
|
| 11816 | 12271 | |
| 11817 | 12272 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 11818 | 12273 | |
@@ -11961,7 +12416,9 @@ discard block |
||
| 11961 | 12416 | |
| 11962 | 12417 | |
| 11963 | 12418 | // routes |
| 11964 | - if ($globalDebug) print "Routes...\n"; |
|
| 12419 | + if ($globalDebug) { |
|
| 12420 | + print "Routes...\n"; |
|
| 12421 | + } |
|
| 11965 | 12422 | if ($globalDBdriver == 'mysql') { |
| 11966 | 12423 | $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)"; |
| 11967 | 12424 | } else { |
@@ -11980,7 +12437,9 @@ discard block |
||
| 11980 | 12437 | } |
| 11981 | 12438 | } |
| 11982 | 12439 | |
| 11983 | - if ($globalDebug) print "Airlines...\n"; |
|
| 12440 | + if ($globalDebug) { |
|
| 12441 | + print "Airlines...\n"; |
|
| 12442 | + } |
|
| 11984 | 12443 | //airlines |
| 11985 | 12444 | if ($globalDBdriver == 'mysql') { |
| 11986 | 12445 | $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)"; |
@@ -11994,10 +12453,15 @@ discard block |
||
| 11994 | 12453 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 11995 | 12454 | { |
| 11996 | 12455 | $fromsource = NULL; |
| 11997 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 11998 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 11999 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 12000 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 12456 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 12457 | + $fromsource = 'vatsim'; |
|
| 12458 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 12459 | + $fromsource = 'ivao'; |
|
| 12460 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 12461 | + $fromsource = 'vatsim'; |
|
| 12462 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 12463 | + $fromsource = 'ivao'; |
|
| 12464 | + } |
|
| 12001 | 12465 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
| 12002 | 12466 | if (isset($airline_array[0]['name'])) { |
| 12003 | 12467 | $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"; |
@@ -12007,13 +12471,17 @@ discard block |
||
| 12007 | 12471 | } |
| 12008 | 12472 | } |
| 12009 | 12473 | |
| 12010 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
| 12474 | + if ($globalDebug) { |
|
| 12475 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
| 12476 | + } |
|
| 12011 | 12477 | //duplicate modes |
| 12012 | 12478 | $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"; |
| 12013 | 12479 | $sth = $this->db->prepare($query); |
| 12014 | 12480 | $sth->execute(); |
| 12015 | 12481 | |
| 12016 | - if ($globalDebug) print "Aircraft...\n"; |
|
| 12482 | + if ($globalDebug) { |
|
| 12483 | + print "Aircraft...\n"; |
|
| 12484 | + } |
|
| 12017 | 12485 | //aircraft |
| 12018 | 12486 | if ($globalDBdriver == 'mysql') { |
| 12019 | 12487 | $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)"; |
@@ -12056,26 +12524,38 @@ discard block |
||
| 12056 | 12524 | if (isset($closestAirports[0])) { |
| 12057 | 12525 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
| 12058 | 12526 | $airport_icao = $closestAirports[0]['icao']; |
| 12059 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12527 | + if ($globalDebug) { |
|
| 12528 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12529 | + } |
|
| 12060 | 12530 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
| 12061 | 12531 | foreach ($closestAirports as $airport) { |
| 12062 | 12532 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
| 12063 | 12533 | $airport_icao = $airport['icao']; |
| 12064 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12534 | + if ($globalDebug) { |
|
| 12535 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12536 | + } |
|
| 12065 | 12537 | break; |
| 12066 | 12538 | } |
| 12067 | 12539 | } |
| 12068 | 12540 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
| 12069 | 12541 | $airport_icao = $closestAirports[0]['icao']; |
| 12070 | - 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"; |
|
| 12542 | + if ($globalDebug) { |
|
| 12543 | + 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"; |
|
| 12544 | + } |
|
| 12071 | 12545 | } else { |
| 12072 | - 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"; |
|
| 12546 | + if ($globalDebug) { |
|
| 12547 | + 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"; |
|
| 12548 | + } |
|
| 12073 | 12549 | } |
| 12074 | 12550 | } else { |
| 12075 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 12551 | + if ($globalDebug) { |
|
| 12552 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 12553 | + } |
|
| 12076 | 12554 | } |
| 12077 | 12555 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 12078 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
| 12556 | + if ($globalDebug) { |
|
| 12557 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
| 12558 | + } |
|
| 12079 | 12559 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
| 12080 | 12560 | $sthu = $this->db->prepare($update_query); |
| 12081 | 12561 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
@@ -23,7 +23,9 @@ discard block |
||
| 23 | 23 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
| 24 | 24 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
| 25 | 25 | $reg = $registration; |
| 26 | - if ($reg == '' && $aircraft_icao != '') $reg = $aircraft_icao.$airline_icao; |
|
| 26 | + if ($reg == '' && $aircraft_icao != '') { |
|
| 27 | + $reg = $aircraft_icao.$airline_icao; |
|
| 28 | + } |
|
| 27 | 29 | $reg = trim($reg); |
| 28 | 30 | $query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration |
| 29 | 31 | FROM spotter_image |
@@ -31,8 +33,11 @@ discard block |
||
| 31 | 33 | $sth = $this->db->prepare($query); |
| 32 | 34 | $sth->execute(array(':registration' => $reg)); |
| 33 | 35 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 34 | - if (!empty($result)) return $result; |
|
| 35 | - elseif ($registration != '') return $this->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 36 | + if (!empty($result)) { |
|
| 37 | + return $result; |
|
| 38 | + } elseif ($registration != '') { |
|
| 39 | + return $this->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 40 | + } |
|
| 36 | 41 | } |
| 37 | 42 | |
| 38 | 43 | /** |
@@ -44,8 +49,11 @@ discard block |
||
| 44 | 49 | public function getExifCopyright($url) { |
| 45 | 50 | $exif = exif_read_data($url); |
| 46 | 51 | $copyright = ''; |
| 47 | - if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright']; |
|
| 48 | - elseif (isset($exif['copyright'])) $copyright = $exif['copyright']; |
|
| 52 | + if (isset($exif['COMPUTED']['copyright'])) { |
|
| 53 | + $copyright = $exif['COMPUTED']['copyright']; |
|
| 54 | + } elseif (isset($exif['copyright'])) { |
|
| 55 | + $copyright = $exif['copyright']; |
|
| 56 | + } |
|
| 49 | 57 | if ($copyright != '') { |
| 50 | 58 | $copyright = str_replace('Copyright ','',$copyright); |
| 51 | 59 | $copyright = str_replace('© ','',$copyright); |
@@ -63,18 +71,29 @@ discard block |
||
| 63 | 71 | public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
| 64 | 72 | { |
| 65 | 73 | global $globalDebug,$globalAircraftImageFetch; |
| 66 | - if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) return ''; |
|
| 74 | + if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) { |
|
| 75 | + return ''; |
|
| 76 | + } |
|
| 67 | 77 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
| 68 | 78 | $registration = trim($registration); |
| 69 | 79 | //getting the aircraft image |
| 70 | - if ($globalDebug && $registration != '') echo 'Try to find an aircraft image for '.$registration.'...'; |
|
| 71 | - elseif ($globalDebug && $aircraft_icao != '') echo 'Try to find an aircraft image for '.$aircraft_icao.'...'; |
|
| 72 | - elseif ($globalDebug && $airline_icao != '') echo 'Try to find an aircraft image for '.$airline_icao.'...'; |
|
| 73 | - else return "success"; |
|
| 80 | + if ($globalDebug && $registration != '') { |
|
| 81 | + echo 'Try to find an aircraft image for '.$registration.'...'; |
|
| 82 | + } elseif ($globalDebug && $aircraft_icao != '') { |
|
| 83 | + echo 'Try to find an aircraft image for '.$aircraft_icao.'...'; |
|
| 84 | + } elseif ($globalDebug && $airline_icao != '') { |
|
| 85 | + echo 'Try to find an aircraft image for '.$airline_icao.'...'; |
|
| 86 | + } else { |
|
| 87 | + return "success"; |
|
| 88 | + } |
|
| 74 | 89 | $image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao); |
| 75 | - if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao; |
|
| 90 | + if ($registration == '' && $aircraft_icao != '') { |
|
| 91 | + $registration = $aircraft_icao.$airline_icao; |
|
| 92 | + } |
|
| 76 | 93 | if ($image_url['original'] != '') { |
| 77 | - if ($globalDebug) echo 'Found !'."\n"; |
|
| 94 | + if ($globalDebug) { |
|
| 95 | + echo 'Found !'."\n"; |
|
| 96 | + } |
|
| 78 | 97 | $query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
| 79 | 98 | try { |
| 80 | 99 | $sth = $this->db->prepare($query); |
@@ -83,7 +102,9 @@ discard block |
||
| 83 | 102 | echo $e->getMessage()."\n"; |
| 84 | 103 | return "error"; |
| 85 | 104 | } |
| 86 | - } elseif ($globalDebug) echo "Not found :'(\n"; |
|
| 105 | + } elseif ($globalDebug) { |
|
| 106 | + echo "Not found :'(\n"; |
|
| 107 | + } |
|
| 87 | 108 | return "success"; |
| 88 | 109 | } |
| 89 | 110 | |
@@ -98,40 +119,84 @@ discard block |
||
| 98 | 119 | { |
| 99 | 120 | global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO; |
| 100 | 121 | $Spotter = new Spotter($this->db); |
| 101 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 122 | + if (!isset($globalIVAO)) { |
|
| 123 | + $globalIVAO = FALSE; |
|
| 124 | + } |
|
| 102 | 125 | $aircraft_registration = filter_var($aircraft_registration,FILTER_SANITIZE_STRING); |
| 103 | 126 | if ($aircraft_registration != '') { |
| 104 | - if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 127 | + if (strpos($aircraft_registration,'/') !== false) { |
|
| 128 | + return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 129 | + } |
|
| 105 | 130 | $aircraft_registration = urlencode(trim($aircraft_registration)); |
| 106 | 131 | $aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration); |
| 107 | - if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name']; |
|
| 108 | - else $aircraft_name = ''; |
|
| 109 | - if (isset($aircraft_info[0]['aircraft_icao'])) $aircraft_name = $aircraft_info[0]['aircraft_icao']; |
|
| 110 | - else $aircraft_icao = ''; |
|
| 111 | - if (isset($aircraft_info[0]['airline_icao'])) $airline_icao = $aircraft_info[0]['airline_icao']; |
|
| 112 | - else $airline_icao = ''; |
|
| 132 | + if (isset($aircraft_info[0]['aircraft_name'])) { |
|
| 133 | + $aircraft_name = $aircraft_info[0]['aircraft_name']; |
|
| 134 | + } else { |
|
| 135 | + $aircraft_name = ''; |
|
| 136 | + } |
|
| 137 | + if (isset($aircraft_info[0]['aircraft_icao'])) { |
|
| 138 | + $aircraft_name = $aircraft_info[0]['aircraft_icao']; |
|
| 139 | + } else { |
|
| 140 | + $aircraft_icao = ''; |
|
| 141 | + } |
|
| 142 | + if (isset($aircraft_info[0]['airline_icao'])) { |
|
| 143 | + $airline_icao = $aircraft_info[0]['airline_icao']; |
|
| 144 | + } else { |
|
| 145 | + $airline_icao = ''; |
|
| 146 | + } |
|
| 113 | 147 | } elseif ($aircraft_icao != '') { |
| 114 | 148 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao); |
| 115 | - if (isset($aircraft_info[0]['type'])) $aircraft_name = $aircraft_info[0]['type']; |
|
| 116 | - else $aircraft_name = ''; |
|
| 149 | + if (isset($aircraft_info[0]['type'])) { |
|
| 150 | + $aircraft_name = $aircraft_info[0]['type']; |
|
| 151 | + } else { |
|
| 152 | + $aircraft_name = ''; |
|
| 153 | + } |
|
| 117 | 154 | $aircraft_registration = $aircraft_icao; |
| 118 | - } else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
| 119 | - if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
| 155 | + } else { |
|
| 156 | + return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
| 157 | + } |
|
| 158 | + if (!isset($globalAircraftImageSources)) { |
|
| 159 | + $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
| 160 | + } |
|
| 120 | 161 | foreach ($globalAircraftImageSources as $source) { |
| 121 | 162 | $source = strtolower($source); |
| 122 | - if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl($aircraft_icao,$airline_icao); |
|
| 123 | - if ($source == 'planespotters' && !$globalIVAO) $images_array = $this->fromPlanespotters($aircraft_registration,$aircraft_name); |
|
| 124 | - if ($source == 'flickr') $images_array = $this->fromFlickr($aircraft_registration,$aircraft_name); |
|
| 125 | - if ($source == 'bing') $images_array = $this->fromBing($aircraft_registration,$aircraft_name); |
|
| 126 | - if ($source == 'deviantart') $images_array = $this->fromDeviantart($aircraft_registration,$aircraft_name); |
|
| 127 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia($aircraft_registration,$aircraft_name); |
|
| 128 | - if ($source == 'jetphotos' && !$globalIVAO) $images_array = $this->fromJetPhotos($aircraft_registration,$aircraft_name); |
|
| 129 | - if ($source == 'planepictures' && !$globalIVAO) $images_array = $this->fromPlanePictures($aircraft_registration,$aircraft_name); |
|
| 130 | - if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData($aircraft_registration,$aircraft_name); |
|
| 131 | - if ($source == 'customsources') $images_array = $this->fromCustomSource($aircraft_registration,$aircraft_name); |
|
| 132 | - if (isset($images_array) && $images_array['original'] != '') return $images_array; |
|
| 163 | + if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') { |
|
| 164 | + $images_array = $this->fromIvaoMtl($aircraft_icao,$airline_icao); |
|
| 165 | + } |
|
| 166 | + if ($source == 'planespotters' && !$globalIVAO) { |
|
| 167 | + $images_array = $this->fromPlanespotters($aircraft_registration,$aircraft_name); |
|
| 168 | + } |
|
| 169 | + if ($source == 'flickr') { |
|
| 170 | + $images_array = $this->fromFlickr($aircraft_registration,$aircraft_name); |
|
| 171 | + } |
|
| 172 | + if ($source == 'bing') { |
|
| 173 | + $images_array = $this->fromBing($aircraft_registration,$aircraft_name); |
|
| 174 | + } |
|
| 175 | + if ($source == 'deviantart') { |
|
| 176 | + $images_array = $this->fromDeviantart($aircraft_registration,$aircraft_name); |
|
| 177 | + } |
|
| 178 | + if ($source == 'wikimedia') { |
|
| 179 | + $images_array = $this->fromWikimedia($aircraft_registration,$aircraft_name); |
|
| 180 | + } |
|
| 181 | + if ($source == 'jetphotos' && !$globalIVAO) { |
|
| 182 | + $images_array = $this->fromJetPhotos($aircraft_registration,$aircraft_name); |
|
| 183 | + } |
|
| 184 | + if ($source == 'planepictures' && !$globalIVAO) { |
|
| 185 | + $images_array = $this->fromPlanePictures($aircraft_registration,$aircraft_name); |
|
| 186 | + } |
|
| 187 | + if ($source == 'airportdata' && !$globalIVAO) { |
|
| 188 | + $images_array = $this->fromAirportData($aircraft_registration,$aircraft_name); |
|
| 189 | + } |
|
| 190 | + if ($source == 'customsources') { |
|
| 191 | + $images_array = $this->fromCustomSource($aircraft_registration,$aircraft_name); |
|
| 192 | + } |
|
| 193 | + if (isset($images_array) && $images_array['original'] != '') { |
|
| 194 | + return $images_array; |
|
| 195 | + } |
|
| 196 | + } |
|
| 197 | + if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) { |
|
| 198 | + return $this->findAircraftImage($aircraft_icao); |
|
| 133 | 199 | } |
| 134 | - if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) return $this->findAircraftImage($aircraft_icao); |
|
| 135 | 200 | return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
| 136 | 201 | } |
| 137 | 202 | |
@@ -288,8 +353,11 @@ discard block |
||
| 288 | 353 | */ |
| 289 | 354 | public function fromFlickr($aircraft_registration,$aircraft_name='') { |
| 290 | 355 | $Common = new Common(); |
| 291 | - if ($aircraft_name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.','.urlencode($aircraft_name); |
|
| 292 | - else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.',aircraft'; |
|
| 356 | + if ($aircraft_name != '') { |
|
| 357 | + $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.','.urlencode($aircraft_name); |
|
| 358 | + } else { |
|
| 359 | + $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.',aircraft'; |
|
| 360 | + } |
|
| 293 | 361 | $data = $Common->getData($url); |
| 294 | 362 | if ($xml = simplexml_load_string($data)) { |
| 295 | 363 | if (isset($xml->channel->item)) { |
@@ -333,9 +401,14 @@ discard block |
||
| 333 | 401 | public function fromBing($aircraft_registration,$aircraft_name='') { |
| 334 | 402 | global $globalImageBingKey; |
| 335 | 403 | $Common = new Common(); |
| 336 | - if (!isset($globalImageBingKey) || $globalImageBingKey == '') return false; |
|
| 337 | - if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27'; |
|
| 338 | - else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27'; |
|
| 404 | + if (!isset($globalImageBingKey) || $globalImageBingKey == '') { |
|
| 405 | + return false; |
|
| 406 | + } |
|
| 407 | + if ($aircraft_name != '') { |
|
| 408 | + $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27'; |
|
| 409 | + } else { |
|
| 410 | + $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27'; |
|
| 411 | + } |
|
| 339 | 412 | $headers = array("Authorization: Basic " . base64_encode("ignored:".$globalImageBingKey)); |
| 340 | 413 | $data = $Common->getData($url,'get','',$headers); |
| 341 | 414 | $result = json_decode($data); |
@@ -389,13 +462,18 @@ discard block |
||
| 389 | 462 | */ |
| 390 | 463 | public function fromWikimedia($aircraft_registration,$aircraft_name='') { |
| 391 | 464 | $Common = new Common(); |
| 392 | - if ($aircraft_name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20'.urlencode($aircraft_name); |
|
| 393 | - else $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20aircraft'; |
|
| 465 | + if ($aircraft_name != '') { |
|
| 466 | + $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20'.urlencode($aircraft_name); |
|
| 467 | + } else { |
|
| 468 | + $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20aircraft'; |
|
| 469 | + } |
|
| 394 | 470 | $data = $Common->getData($url); |
| 395 | 471 | $result = json_decode($data); |
| 396 | 472 | if (isset($result->query->search[0]->title)) { |
| 397 | 473 | $fileo = $result->query->search[0]->title; |
| 398 | - if (substr($fileo,-3) == 'pdf') return false; |
|
| 474 | + if (substr($fileo,-3) == 'pdf') { |
|
| 475 | + return false; |
|
| 476 | + } |
|
| 399 | 477 | $file = urlencode($fileo); |
| 400 | 478 | $url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file; |
| 401 | 479 | $data2 = $Common->getData($url2); |
@@ -466,18 +544,27 @@ discard block |
||
| 466 | 544 | $image_url = array(); |
| 467 | 545 | $image_url['thumbnail'] = $url_thumbnail; |
| 468 | 546 | $image_url['original'] = $url; |
| 469 | - if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
|
| 470 | - else $exifCopyright = ''; |
|
| 471 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
| 472 | - elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
|
| 473 | - else $image_url['copyright'] = $source['source_website']; |
|
| 547 | + if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) { |
|
| 548 | + $exifCopyright = $this->getExifCopyright($url); |
|
| 549 | + } else { |
|
| 550 | + $exifCopyright = ''; |
|
| 551 | + } |
|
| 552 | + if ($exifCopyright != '') { |
|
| 553 | + $image_url['copyright'] = $exifCopyright; |
|
| 554 | + } elseif (isset($source['copyright'])) { |
|
| 555 | + $image_url['copyright'] = $source['copyright']; |
|
| 556 | + } else { |
|
| 557 | + $image_url['copyright'] = $source['source_website']; |
|
| 558 | + } |
|
| 474 | 559 | $image_url['source_website'] = $source['source_website']; |
| 475 | 560 | $image_url['source'] = $source['source']; |
| 476 | 561 | return $image_url; |
| 477 | 562 | } |
| 478 | 563 | } |
| 479 | 564 | return false; |
| 480 | - } else return false; |
|
| 565 | + } else { |
|
| 566 | + return false; |
|
| 567 | + } |
|
| 481 | 568 | } |
| 482 | 569 | } |
| 483 | 570 | |