@@ -258,7 +258,9 @@ discard block |
||
| 258 | 258 | // Update table countries |
| 259 | 259 | if ($Connection->tableExists('airspace')) { |
| 260 | 260 | $error .= update_db::update_countries(); |
| 261 | - if ($error != '') return $error; |
|
| 261 | + if ($error != '') { |
|
| 262 | + return $error; |
|
| 263 | + } |
|
| 262 | 264 | } |
| 263 | 265 | // Update schema_version to 7 |
| 264 | 266 | $query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'"; |
@@ -314,7 +316,9 @@ discard block |
||
| 314 | 316 | $error = ''; |
| 315 | 317 | // Update table aircraft |
| 316 | 318 | $error .= create_db::import_file('../db/source_location.sql'); |
| 317 | - if ($error != '') return $error; |
|
| 319 | + if ($error != '') { |
|
| 320 | + return $error; |
|
| 321 | + } |
|
| 318 | 322 | // Update schema_version to 6 |
| 319 | 323 | $query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'"; |
| 320 | 324 | try { |
@@ -331,7 +335,9 @@ discard block |
||
| 331 | 335 | $error = ''; |
| 332 | 336 | // Update table aircraft |
| 333 | 337 | $error .= create_db::import_file('../db/notam.sql'); |
| 334 | - if ($error != '') return $error; |
|
| 338 | + if ($error != '') { |
|
| 339 | + return $error; |
|
| 340 | + } |
|
| 335 | 341 | $query = "DELETE FROM config WHERE name = 'last_update_db'; |
| 336 | 342 | INSERT INTO config (name,value) VALUES ('last_update_db',NOW()); |
| 337 | 343 | DELETE FROM config WHERE name = 'last_update_notam_db'; |
@@ -365,7 +371,9 @@ discard block |
||
| 365 | 371 | $error = ''; |
| 366 | 372 | // Update table atc |
| 367 | 373 | $error .= create_db::import_file('../db/atc.sql'); |
| 368 | - if ($error != '') return $error; |
|
| 374 | + if ($error != '') { |
|
| 375 | + return $error; |
|
| 376 | + } |
|
| 369 | 377 | |
| 370 | 378 | $query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'"; |
| 371 | 379 | try { |
@@ -389,13 +397,21 @@ discard block |
||
| 389 | 397 | $error = ''; |
| 390 | 398 | // Add tables |
| 391 | 399 | $error .= create_db::import_file('../db/aircraft_owner.sql'); |
| 392 | - if ($error != '') return $error; |
|
| 400 | + if ($error != '') { |
|
| 401 | + return $error; |
|
| 402 | + } |
|
| 393 | 403 | $error .= create_db::import_file('../db/metar.sql'); |
| 394 | - if ($error != '') return $error; |
|
| 404 | + if ($error != '') { |
|
| 405 | + return $error; |
|
| 406 | + } |
|
| 395 | 407 | $error .= create_db::import_file('../db/taf.sql'); |
| 396 | - if ($error != '') return $error; |
|
| 408 | + if ($error != '') { |
|
| 409 | + return $error; |
|
| 410 | + } |
|
| 397 | 411 | $error .= create_db::import_file('../db/airport.sql'); |
| 398 | - if ($error != '') return $error; |
|
| 412 | + if ($error != '') { |
|
| 413 | + return $error; |
|
| 414 | + } |
|
| 399 | 415 | |
| 400 | 416 | $query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'"; |
| 401 | 417 | try { |
@@ -469,19 +485,33 @@ discard block |
||
| 469 | 485 | $error = ''; |
| 470 | 486 | // Add tables |
| 471 | 487 | $error .= create_db::import_file('../db/stats.sql'); |
| 472 | - if ($error != '') return $error; |
|
| 488 | + if ($error != '') { |
|
| 489 | + return $error; |
|
| 490 | + } |
|
| 473 | 491 | $error .= create_db::import_file('../db/stats_aircraft.sql'); |
| 474 | - if ($error != '') return $error; |
|
| 492 | + if ($error != '') { |
|
| 493 | + return $error; |
|
| 494 | + } |
|
| 475 | 495 | $error .= create_db::import_file('../db/stats_airline.sql'); |
| 476 | - if ($error != '') return $error; |
|
| 496 | + if ($error != '') { |
|
| 497 | + return $error; |
|
| 498 | + } |
|
| 477 | 499 | $error .= create_db::import_file('../db/stats_airport.sql'); |
| 478 | - if ($error != '') return $error; |
|
| 500 | + if ($error != '') { |
|
| 501 | + return $error; |
|
| 502 | + } |
|
| 479 | 503 | $error .= create_db::import_file('../db/stats_owner.sql'); |
| 480 | - if ($error != '') return $error; |
|
| 504 | + if ($error != '') { |
|
| 505 | + return $error; |
|
| 506 | + } |
|
| 481 | 507 | $error .= create_db::import_file('../db/stats_pilot.sql'); |
| 482 | - if ($error != '') return $error; |
|
| 508 | + if ($error != '') { |
|
| 509 | + return $error; |
|
| 510 | + } |
|
| 483 | 511 | $error .= create_db::import_file('../db/spotter_archive_output.sql'); |
| 484 | - if ($error != '') return $error; |
|
| 512 | + if ($error != '') { |
|
| 513 | + return $error; |
|
| 514 | + } |
|
| 485 | 515 | |
| 486 | 516 | $query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'"; |
| 487 | 517 | try { |
@@ -521,7 +551,9 @@ discard block |
||
| 521 | 551 | // Add tables |
| 522 | 552 | if (!$Connection->tableExists('stats_flight')) { |
| 523 | 553 | $error .= create_db::import_file('../db/stats_flight.sql'); |
| 524 | - if ($error != '') return $error; |
|
| 554 | + if ($error != '') { |
|
| 555 | + return $error; |
|
| 556 | + } |
|
| 525 | 557 | } |
| 526 | 558 | $query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'"; |
| 527 | 559 | try { |
@@ -545,7 +577,9 @@ discard block |
||
| 545 | 577 | } catch(PDOException $e) { |
| 546 | 578 | return "error (update stats) : ".$e->getMessage()."\n"; |
| 547 | 579 | } |
| 548 | - if ($error != '') return $error; |
|
| 580 | + if ($error != '') { |
|
| 581 | + return $error; |
|
| 582 | + } |
|
| 549 | 583 | $query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'"; |
| 550 | 584 | try { |
| 551 | 585 | $sth = $Connection->db->prepare($query); |
@@ -566,7 +600,9 @@ discard block |
||
| 566 | 600 | if (!$Connection->tableExists('stats_callsign')) { |
| 567 | 601 | $error .= create_db::import_file('../db/stats_callsign.sql'); |
| 568 | 602 | } |
| 569 | - if ($error != '') return $error; |
|
| 603 | + if ($error != '') { |
|
| 604 | + return $error; |
|
| 605 | + } |
|
| 570 | 606 | $query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'"; |
| 571 | 607 | try { |
| 572 | 608 | $sth = $Connection->db->prepare($query); |
@@ -584,7 +620,9 @@ discard block |
||
| 584 | 620 | if (!$Connection->tableExists('stats_country')) { |
| 585 | 621 | $error .= create_db::import_file('../db/stats_country.sql'); |
| 586 | 622 | } |
| 587 | - if ($error != '') return $error; |
|
| 623 | + if ($error != '') { |
|
| 624 | + return $error; |
|
| 625 | + } |
|
| 588 | 626 | $query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'"; |
| 589 | 627 | try { |
| 590 | 628 | $sth = $Connection->db->prepare($query); |
@@ -607,7 +645,9 @@ discard block |
||
| 607 | 645 | return "error (update stats) : ".$e->getMessage()."\n"; |
| 608 | 646 | } |
| 609 | 647 | } |
| 610 | - if ($error != '') return $error; |
|
| 648 | + if ($error != '') { |
|
| 649 | + return $error; |
|
| 650 | + } |
|
| 611 | 651 | $query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'"; |
| 612 | 652 | try { |
| 613 | 653 | $sth = $Connection->db->prepare($query); |
@@ -623,7 +663,9 @@ discard block |
||
| 623 | 663 | $error = ''; |
| 624 | 664 | // Update airport table |
| 625 | 665 | $error .= create_db::import_file('../db/airport.sql'); |
| 626 | - if ($error != '') return 'Import airport.sql : '.$error; |
|
| 666 | + if ($error != '') { |
|
| 667 | + return 'Import airport.sql : '.$error; |
|
| 668 | + } |
|
| 627 | 669 | // Remove primary key on Spotter_Archive |
| 628 | 670 | $query = "alter table spotter_archive drop spotter_archive_id"; |
| 629 | 671 | try { |
@@ -699,7 +741,9 @@ discard block |
||
| 699 | 741 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 700 | 742 | } |
| 701 | 743 | } |
| 702 | - if ($error != '') return $error; |
|
| 744 | + if ($error != '') { |
|
| 745 | + return $error; |
|
| 746 | + } |
|
| 703 | 747 | $query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'"; |
| 704 | 748 | try { |
| 705 | 749 | $sth = $Connection->db->prepare($query); |
@@ -717,7 +761,9 @@ discard block |
||
| 717 | 761 | // Update airline table |
| 718 | 762 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
| 719 | 763 | $error .= create_db::import_file('../db/airlines.sql'); |
| 720 | - if ($error != '') return 'Import airlines.sql : '.$error; |
|
| 764 | + if ($error != '') { |
|
| 765 | + return 'Import airlines.sql : '.$error; |
|
| 766 | + } |
|
| 721 | 767 | } |
| 722 | 768 | if (!$Connection->checkColumnName('aircraft_modes','type_flight')) { |
| 723 | 769 | // Add column over_country |
@@ -729,7 +775,9 @@ discard block |
||
| 729 | 775 | return "error (add over_country) : ".$e->getMessage()."\n"; |
| 730 | 776 | } |
| 731 | 777 | } |
| 732 | - if ($error != '') return $error; |
|
| 778 | + if ($error != '') { |
|
| 779 | + return $error; |
|
| 780 | + } |
|
| 733 | 781 | /* |
| 734 | 782 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
| 735 | 783 | // Force update ModeS (this will put type_flight data |
@@ -759,7 +807,9 @@ discard block |
||
| 759 | 807 | } catch(PDOException $e) { |
| 760 | 808 | return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n"; |
| 761 | 809 | } |
| 762 | - if ($error != '') return $error; |
|
| 810 | + if ($error != '') { |
|
| 811 | + return $error; |
|
| 812 | + } |
|
| 763 | 813 | } |
| 764 | 814 | $query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'"; |
| 765 | 815 | try { |
@@ -782,7 +832,9 @@ discard block |
||
| 782 | 832 | } else { |
| 783 | 833 | $error .= create_db::import_file('../db/pgsql/stats_source.sql'); |
| 784 | 834 | } |
| 785 | - if ($error != '') return $error; |
|
| 835 | + if ($error != '') { |
|
| 836 | + return $error; |
|
| 837 | + } |
|
| 786 | 838 | } |
| 787 | 839 | $query = "UPDATE config SET value = '23' WHERE name = 'schema_version'"; |
| 788 | 840 | try { |
@@ -804,12 +856,16 @@ discard block |
||
| 804 | 856 | if ($globalDBdriver == 'mysql') { |
| 805 | 857 | if (!$Connection->tableExists('tle')) { |
| 806 | 858 | $error .= create_db::import_file('../db/tle.sql'); |
| 807 | - if ($error != '') return $error; |
|
| 859 | + if ($error != '') { |
|
| 860 | + return $error; |
|
| 861 | + } |
|
| 808 | 862 | } |
| 809 | 863 | } else { |
| 810 | 864 | if (!$Connection->tableExists('tle')) { |
| 811 | 865 | $error .= create_db::import_file('../db/pgsql/tle.sql'); |
| 812 | - if ($error != '') return $error; |
|
| 866 | + if ($error != '') { |
|
| 867 | + return $error; |
|
| 868 | + } |
|
| 813 | 869 | } |
| 814 | 870 | $query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)"; |
| 815 | 871 | try { |
@@ -849,7 +905,9 @@ discard block |
||
| 849 | 905 | } else { |
| 850 | 906 | $error .= create_db::import_file('../db/pgsql/airlines.sql'); |
| 851 | 907 | } |
| 852 | - if ($error != '') return 'Import airlines.sql : '.$error; |
|
| 908 | + if ($error != '') { |
|
| 909 | + return 'Import airlines.sql : '.$error; |
|
| 910 | + } |
|
| 853 | 911 | if (!$Connection->checkColumnName('airlines','forsource')) { |
| 854 | 912 | // Add forsource to airlines |
| 855 | 913 | $query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL"; |
@@ -1324,8 +1382,11 @@ discard block |
||
| 1324 | 1382 | if ($Connection->tableExists('aircraft')) { |
| 1325 | 1383 | if (!$Connection->tableExists('config')) { |
| 1326 | 1384 | $version = '1'; |
| 1327 | - if ($update) return self::update_from_1(); |
|
| 1328 | - else return $version; |
|
| 1385 | + if ($update) { |
|
| 1386 | + return self::update_from_1(); |
|
| 1387 | + } else { |
|
| 1388 | + return $version; |
|
| 1389 | + } |
|
| 1329 | 1390 | } else { |
| 1330 | 1391 | $Connection = new Connection(); |
| 1331 | 1392 | $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
@@ -1339,130 +1400,225 @@ discard block |
||
| 1339 | 1400 | if ($update) { |
| 1340 | 1401 | if ($result['value'] == '2') { |
| 1341 | 1402 | $error = self::update_from_2(); |
| 1342 | - if ($error != '') return $error; |
|
| 1343 | - else return self::check_version(true); |
|
| 1403 | + if ($error != '') { |
|
| 1404 | + return $error; |
|
| 1405 | + } else { |
|
| 1406 | + return self::check_version(true); |
|
| 1407 | + } |
|
| 1344 | 1408 | } elseif ($result['value'] == '3') { |
| 1345 | 1409 | $error = self::update_from_3(); |
| 1346 | - if ($error != '') return $error; |
|
| 1347 | - else return self::check_version(true); |
|
| 1410 | + if ($error != '') { |
|
| 1411 | + return $error; |
|
| 1412 | + } else { |
|
| 1413 | + return self::check_version(true); |
|
| 1414 | + } |
|
| 1348 | 1415 | } elseif ($result['value'] == '4') { |
| 1349 | 1416 | $error = self::update_from_4(); |
| 1350 | - if ($error != '') return $error; |
|
| 1351 | - else return self::check_version(true); |
|
| 1417 | + if ($error != '') { |
|
| 1418 | + return $error; |
|
| 1419 | + } else { |
|
| 1420 | + return self::check_version(true); |
|
| 1421 | + } |
|
| 1352 | 1422 | } elseif ($result['value'] == '5') { |
| 1353 | 1423 | $error = self::update_from_5(); |
| 1354 | - if ($error != '') return $error; |
|
| 1355 | - else return self::check_version(true); |
|
| 1424 | + if ($error != '') { |
|
| 1425 | + return $error; |
|
| 1426 | + } else { |
|
| 1427 | + return self::check_version(true); |
|
| 1428 | + } |
|
| 1356 | 1429 | } elseif ($result['value'] == '6') { |
| 1357 | 1430 | $error = self::update_from_6(); |
| 1358 | - if ($error != '') return $error; |
|
| 1359 | - else return self::check_version(true); |
|
| 1431 | + if ($error != '') { |
|
| 1432 | + return $error; |
|
| 1433 | + } else { |
|
| 1434 | + return self::check_version(true); |
|
| 1435 | + } |
|
| 1360 | 1436 | } elseif ($result['value'] == '7') { |
| 1361 | 1437 | $error = self::update_from_7(); |
| 1362 | - if ($error != '') return $error; |
|
| 1363 | - else return self::check_version(true); |
|
| 1438 | + if ($error != '') { |
|
| 1439 | + return $error; |
|
| 1440 | + } else { |
|
| 1441 | + return self::check_version(true); |
|
| 1442 | + } |
|
| 1364 | 1443 | } elseif ($result['value'] == '8') { |
| 1365 | 1444 | $error = self::update_from_8(); |
| 1366 | - if ($error != '') return $error; |
|
| 1367 | - else return self::check_version(true); |
|
| 1445 | + if ($error != '') { |
|
| 1446 | + return $error; |
|
| 1447 | + } else { |
|
| 1448 | + return self::check_version(true); |
|
| 1449 | + } |
|
| 1368 | 1450 | } elseif ($result['value'] == '9') { |
| 1369 | 1451 | $error = self::update_from_9(); |
| 1370 | - if ($error != '') return $error; |
|
| 1371 | - else return self::check_version(true); |
|
| 1452 | + if ($error != '') { |
|
| 1453 | + return $error; |
|
| 1454 | + } else { |
|
| 1455 | + return self::check_version(true); |
|
| 1456 | + } |
|
| 1372 | 1457 | } elseif ($result['value'] == '10') { |
| 1373 | 1458 | $error = self::update_from_10(); |
| 1374 | - if ($error != '') return $error; |
|
| 1375 | - else return self::check_version(true); |
|
| 1459 | + if ($error != '') { |
|
| 1460 | + return $error; |
|
| 1461 | + } else { |
|
| 1462 | + return self::check_version(true); |
|
| 1463 | + } |
|
| 1376 | 1464 | } elseif ($result['value'] == '11') { |
| 1377 | 1465 | $error = self::update_from_11(); |
| 1378 | - if ($error != '') return $error; |
|
| 1379 | - else return self::check_version(true); |
|
| 1466 | + if ($error != '') { |
|
| 1467 | + return $error; |
|
| 1468 | + } else { |
|
| 1469 | + return self::check_version(true); |
|
| 1470 | + } |
|
| 1380 | 1471 | } elseif ($result['value'] == '12') { |
| 1381 | 1472 | $error = self::update_from_12(); |
| 1382 | - if ($error != '') return $error; |
|
| 1383 | - else return self::check_version(true); |
|
| 1473 | + if ($error != '') { |
|
| 1474 | + return $error; |
|
| 1475 | + } else { |
|
| 1476 | + return self::check_version(true); |
|
| 1477 | + } |
|
| 1384 | 1478 | } elseif ($result['value'] == '13') { |
| 1385 | 1479 | $error = self::update_from_13(); |
| 1386 | - if ($error != '') return $error; |
|
| 1387 | - else return self::check_version(true); |
|
| 1480 | + if ($error != '') { |
|
| 1481 | + return $error; |
|
| 1482 | + } else { |
|
| 1483 | + return self::check_version(true); |
|
| 1484 | + } |
|
| 1388 | 1485 | } elseif ($result['value'] == '14') { |
| 1389 | 1486 | $error = self::update_from_14(); |
| 1390 | - if ($error != '') return $error; |
|
| 1391 | - else return self::check_version(true); |
|
| 1487 | + if ($error != '') { |
|
| 1488 | + return $error; |
|
| 1489 | + } else { |
|
| 1490 | + return self::check_version(true); |
|
| 1491 | + } |
|
| 1392 | 1492 | } elseif ($result['value'] == '15') { |
| 1393 | 1493 | $error = self::update_from_15(); |
| 1394 | - if ($error != '') return $error; |
|
| 1395 | - else return self::check_version(true); |
|
| 1494 | + if ($error != '') { |
|
| 1495 | + return $error; |
|
| 1496 | + } else { |
|
| 1497 | + return self::check_version(true); |
|
| 1498 | + } |
|
| 1396 | 1499 | } elseif ($result['value'] == '16') { |
| 1397 | 1500 | $error = self::update_from_16(); |
| 1398 | - if ($error != '') return $error; |
|
| 1399 | - else return self::check_version(true); |
|
| 1501 | + if ($error != '') { |
|
| 1502 | + return $error; |
|
| 1503 | + } else { |
|
| 1504 | + return self::check_version(true); |
|
| 1505 | + } |
|
| 1400 | 1506 | } elseif ($result['value'] == '17') { |
| 1401 | 1507 | $error = self::update_from_17(); |
| 1402 | - if ($error != '') return $error; |
|
| 1403 | - else return self::check_version(true); |
|
| 1508 | + if ($error != '') { |
|
| 1509 | + return $error; |
|
| 1510 | + } else { |
|
| 1511 | + return self::check_version(true); |
|
| 1512 | + } |
|
| 1404 | 1513 | } elseif ($result['value'] == '18') { |
| 1405 | 1514 | $error = self::update_from_18(); |
| 1406 | - if ($error != '') return $error; |
|
| 1407 | - else return self::check_version(true); |
|
| 1515 | + if ($error != '') { |
|
| 1516 | + return $error; |
|
| 1517 | + } else { |
|
| 1518 | + return self::check_version(true); |
|
| 1519 | + } |
|
| 1408 | 1520 | } elseif ($result['value'] == '19') { |
| 1409 | 1521 | $error = self::update_from_19(); |
| 1410 | - if ($error != '') return $error; |
|
| 1411 | - else return self::check_version(true); |
|
| 1522 | + if ($error != '') { |
|
| 1523 | + return $error; |
|
| 1524 | + } else { |
|
| 1525 | + return self::check_version(true); |
|
| 1526 | + } |
|
| 1412 | 1527 | } elseif ($result['value'] == '20') { |
| 1413 | 1528 | $error = self::update_from_20(); |
| 1414 | - if ($error != '') return $error; |
|
| 1415 | - else return self::check_version(true); |
|
| 1529 | + if ($error != '') { |
|
| 1530 | + return $error; |
|
| 1531 | + } else { |
|
| 1532 | + return self::check_version(true); |
|
| 1533 | + } |
|
| 1416 | 1534 | } elseif ($result['value'] == '21') { |
| 1417 | 1535 | $error = self::update_from_21(); |
| 1418 | - if ($error != '') return $error; |
|
| 1419 | - else return self::check_version(true); |
|
| 1536 | + if ($error != '') { |
|
| 1537 | + return $error; |
|
| 1538 | + } else { |
|
| 1539 | + return self::check_version(true); |
|
| 1540 | + } |
|
| 1420 | 1541 | } elseif ($result['value'] == '22') { |
| 1421 | 1542 | $error = self::update_from_22(); |
| 1422 | - if ($error != '') return $error; |
|
| 1423 | - else return self::check_version(true); |
|
| 1543 | + if ($error != '') { |
|
| 1544 | + return $error; |
|
| 1545 | + } else { |
|
| 1546 | + return self::check_version(true); |
|
| 1547 | + } |
|
| 1424 | 1548 | } elseif ($result['value'] == '23') { |
| 1425 | 1549 | $error = self::update_from_23(); |
| 1426 | - if ($error != '') return $error; |
|
| 1427 | - else return self::check_version(true); |
|
| 1550 | + if ($error != '') { |
|
| 1551 | + return $error; |
|
| 1552 | + } else { |
|
| 1553 | + return self::check_version(true); |
|
| 1554 | + } |
|
| 1428 | 1555 | } elseif ($result['value'] == '24') { |
| 1429 | 1556 | $error = self::update_from_24(); |
| 1430 | - if ($error != '') return $error; |
|
| 1431 | - else return self::check_version(true); |
|
| 1557 | + if ($error != '') { |
|
| 1558 | + return $error; |
|
| 1559 | + } else { |
|
| 1560 | + return self::check_version(true); |
|
| 1561 | + } |
|
| 1432 | 1562 | } elseif ($result['value'] == '25') { |
| 1433 | 1563 | $error = self::update_from_25(); |
| 1434 | - if ($error != '') return $error; |
|
| 1435 | - else return self::check_version(true); |
|
| 1564 | + if ($error != '') { |
|
| 1565 | + return $error; |
|
| 1566 | + } else { |
|
| 1567 | + return self::check_version(true); |
|
| 1568 | + } |
|
| 1436 | 1569 | } elseif ($result['value'] == '26') { |
| 1437 | 1570 | $error = self::update_from_26(); |
| 1438 | - if ($error != '') return $error; |
|
| 1439 | - else return self::check_version(true); |
|
| 1571 | + if ($error != '') { |
|
| 1572 | + return $error; |
|
| 1573 | + } else { |
|
| 1574 | + return self::check_version(true); |
|
| 1575 | + } |
|
| 1440 | 1576 | } elseif ($result['value'] == '27') { |
| 1441 | 1577 | $error = self::update_from_27(); |
| 1442 | - if ($error != '') return $error; |
|
| 1443 | - else return self::check_version(true); |
|
| 1578 | + if ($error != '') { |
|
| 1579 | + return $error; |
|
| 1580 | + } else { |
|
| 1581 | + return self::check_version(true); |
|
| 1582 | + } |
|
| 1444 | 1583 | } elseif ($result['value'] == '28') { |
| 1445 | 1584 | $error = self::update_from_28(); |
| 1446 | - if ($error != '') return $error; |
|
| 1447 | - else return self::check_version(true); |
|
| 1585 | + if ($error != '') { |
|
| 1586 | + return $error; |
|
| 1587 | + } else { |
|
| 1588 | + return self::check_version(true); |
|
| 1589 | + } |
|
| 1448 | 1590 | } elseif ($result['value'] == '29') { |
| 1449 | 1591 | $error = self::update_from_29(); |
| 1450 | - if ($error != '') return $error; |
|
| 1451 | - else return self::check_version(true); |
|
| 1592 | + if ($error != '') { |
|
| 1593 | + return $error; |
|
| 1594 | + } else { |
|
| 1595 | + return self::check_version(true); |
|
| 1596 | + } |
|
| 1452 | 1597 | } elseif ($result['value'] == '30') { |
| 1453 | 1598 | $error = self::update_from_30(); |
| 1454 | - if ($error != '') return $error; |
|
| 1455 | - else return self::check_version(true); |
|
| 1599 | + if ($error != '') { |
|
| 1600 | + return $error; |
|
| 1601 | + } else { |
|
| 1602 | + return self::check_version(true); |
|
| 1603 | + } |
|
| 1456 | 1604 | } elseif ($result['value'] == '31') { |
| 1457 | 1605 | $error = self::update_from_31(); |
| 1458 | - if ($error != '') return $error; |
|
| 1459 | - else return self::check_version(true); |
|
| 1460 | - } else return ''; |
|
| 1606 | + if ($error != '') { |
|
| 1607 | + return $error; |
|
| 1608 | + } else { |
|
| 1609 | + return self::check_version(true); |
|
| 1610 | + } |
|
| 1611 | + } else { |
|
| 1612 | + return ''; |
|
| 1613 | + } |
|
| 1614 | + } else { |
|
| 1615 | + return $result['value']; |
|
| 1461 | 1616 | } |
| 1462 | - else return $result['value']; |
|
| 1463 | 1617 | } |
| 1464 | 1618 | |
| 1465 | - } else return $version; |
|
| 1619 | + } else { |
|
| 1620 | + return $version; |
|
| 1621 | + } |
|
| 1466 | 1622 | } |
| 1467 | 1623 | |
| 1468 | 1624 | } |
@@ -27,7 +27,9 @@ discard block |
||
| 27 | 27 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 30 | + if (is_array($globalFilter)) { |
|
| 31 | + $filter = array_merge($filter,$globalFilter); |
|
| 32 | + } |
|
| 31 | 33 | $filter_query_join = ''; |
| 32 | 34 | $filter_query_where = ''; |
| 33 | 35 | foreach($filters as $flt) { |
@@ -77,8 +79,11 @@ discard block |
||
| 77 | 79 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 78 | 80 | } |
| 79 | 81 | } |
| 80 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 81 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 82 | + if ($filter_query_where == '' && $where) { |
|
| 83 | + $filter_query_where = ' WHERE'; |
|
| 84 | + } elseif ($filter_query_where != '' && $and) { |
|
| 85 | + $filter_query_where .= ' AND'; |
|
| 86 | + } |
|
| 82 | 87 | $filter_query = $filter_query_join.$filter_query_where; |
| 83 | 88 | return $filter_query; |
| 84 | 89 | } |
@@ -98,10 +103,18 @@ discard block |
||
| 98 | 103 | $Image = new Image($this->db); |
| 99 | 104 | $Schedule = new Schedule($this->db); |
| 100 | 105 | $ACARS = new ACARS($this->db); |
| 101 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 102 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 103 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 104 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 106 | + if (!isset($globalIVAO)) { |
|
| 107 | + $globalIVAO = FALSE; |
|
| 108 | + } |
|
| 109 | + if (!isset($globalVATSIM)) { |
|
| 110 | + $globalVATSIM = FALSE; |
|
| 111 | + } |
|
| 112 | + if (!isset($globalphpVMS)) { |
|
| 113 | + $globalphpVMS = FALSE; |
|
| 114 | + } |
|
| 115 | + if (!isset($globalVAM)) { |
|
| 116 | + $globalVAM = FALSE; |
|
| 117 | + } |
|
| 105 | 118 | date_default_timezone_set('UTC'); |
| 106 | 119 | |
| 107 | 120 | if (!is_string($query)) |
@@ -148,21 +161,35 @@ discard block |
||
| 148 | 161 | } else { |
| 149 | 162 | $temp_array['spotter_id'] = ''; |
| 150 | 163 | } |
| 151 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 152 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
| 164 | + if (isset($row['flightaware_id'])) { |
|
| 165 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 166 | + } |
|
| 167 | + if (isset($row['modes'])) { |
|
| 168 | + $temp_array['modes'] = $row['modes']; |
|
| 169 | + } |
|
| 153 | 170 | $temp_array['ident'] = $row['ident']; |
| 154 | 171 | if (isset($row['registration']) && $row['registration'] != '') { |
| 155 | 172 | $temp_array['registration'] = $row['registration']; |
| 156 | 173 | } elseif (isset($temp_array['modes'])) { |
| 157 | 174 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
| 158 | - } else $temp_array['registration'] = ''; |
|
| 159 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 175 | + } else { |
|
| 176 | + $temp_array['registration'] = ''; |
|
| 177 | + } |
|
| 178 | + if (isset($row['aircraft_icao'])) { |
|
| 179 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 180 | + } |
|
| 160 | 181 | |
| 161 | 182 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
| 162 | 183 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
| 163 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 164 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 165 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 184 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
| 185 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 186 | + } |
|
| 187 | + if (isset($row['latitude'])) { |
|
| 188 | + $temp_array['latitude'] = $row['latitude']; |
|
| 189 | + } |
|
| 190 | + if (isset($row['longitude'])) { |
|
| 191 | + $temp_array['longitude'] = $row['longitude']; |
|
| 192 | + } |
|
| 166 | 193 | /* |
| 167 | 194 | if (Connection->tableExists('countries')) { |
| 168 | 195 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -172,8 +199,12 @@ discard block |
||
| 172 | 199 | } |
| 173 | 200 | } |
| 174 | 201 | */ |
| 175 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
| 176 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 202 | + if (isset($row['waypoints'])) { |
|
| 203 | + $temp_array['waypoints'] = $row['waypoints']; |
|
| 204 | + } |
|
| 205 | + if (isset($row['format_source'])) { |
|
| 206 | + $temp_array['format_source'] = $row['format_source']; |
|
| 207 | + } |
|
| 177 | 208 | if (isset($row['route_stop'])) { |
| 178 | 209 | $temp_array['route_stop'] = $row['route_stop']; |
| 179 | 210 | if ($row['route_stop'] != '') { |
@@ -192,13 +223,19 @@ discard block |
||
| 192 | 223 | } |
| 193 | 224 | } |
| 194 | 225 | } |
| 195 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
| 226 | + if (isset($row['altitude'])) { |
|
| 227 | + $temp_array['altitude'] = $row['altitude']; |
|
| 228 | + } |
|
| 196 | 229 | if (isset($row['heading'])) { |
| 197 | 230 | $temp_array['heading'] = $row['heading']; |
| 198 | 231 | $heading_direction = $this->parseDirection($row['heading']); |
| 199 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 232 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 233 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 234 | + } |
|
| 235 | + } |
|
| 236 | + if (isset($row['ground_speed'])) { |
|
| 237 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 200 | 238 | } |
| 201 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 202 | 239 | $temp_array['image'] = ""; |
| 203 | 240 | $temp_array['image_thumbnail'] = ""; |
| 204 | 241 | $temp_array['image_source'] = ""; |
@@ -206,7 +243,9 @@ discard block |
||
| 206 | 243 | |
| 207 | 244 | if (isset($row['highlight'])) { |
| 208 | 245 | $temp_array['highlight'] = $row['highlight']; |
| 209 | - } else $temp_array['highlight'] = ''; |
|
| 246 | + } else { |
|
| 247 | + $temp_array['highlight'] = ''; |
|
| 248 | + } |
|
| 210 | 249 | |
| 211 | 250 | if (isset($row['date'])) { |
| 212 | 251 | $dateArray = $this->parseDateString($row['date']); |
@@ -254,7 +293,9 @@ discard block |
||
| 254 | 293 | |
| 255 | 294 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 256 | 295 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 257 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 296 | + } else { |
|
| 297 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 298 | + } |
|
| 258 | 299 | } else { |
| 259 | 300 | $temp_array['aircraft_shadow'] = 'default.png'; |
| 260 | 301 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -262,11 +303,17 @@ discard block |
||
| 262 | 303 | } |
| 263 | 304 | } |
| 264 | 305 | $fromsource = NULL; |
| 265 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 266 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 267 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 268 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 269 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 306 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 307 | + $fromsource = $globalAirlinesSource; |
|
| 308 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 309 | + $fromsource = 'vatsim'; |
|
| 310 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 311 | + $fromsource = 'ivao'; |
|
| 312 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 313 | + $fromsource = 'vatsim'; |
|
| 314 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 315 | + $fromsource = 'ivao'; |
|
| 316 | + } |
|
| 270 | 317 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 271 | 318 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 272 | 319 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -289,12 +336,18 @@ discard block |
||
| 289 | 336 | } |
| 290 | 337 | } else { |
| 291 | 338 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 292 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 293 | - else $temp_array['airline_iata'] = 'N/A'; |
|
| 339 | + if (isset($row['airline_iata'])) { |
|
| 340 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 341 | + } else { |
|
| 342 | + $temp_array['airline_iata'] = 'N/A'; |
|
| 343 | + } |
|
| 294 | 344 | $temp_array['airline_name'] = $row['airline_name']; |
| 295 | 345 | $temp_array['airline_country'] = $row['airline_country']; |
| 296 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 297 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
| 346 | + if (isset($row['airline_callsign'])) { |
|
| 347 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 348 | + } else { |
|
| 349 | + $temp_array['airline_callsign'] = 'N/A'; |
|
| 350 | + } |
|
| 298 | 351 | $temp_array['airline_type'] = $row['airline_type']; |
| 299 | 352 | if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') { |
| 300 | 353 | $airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']); |
@@ -321,7 +374,9 @@ discard block |
||
| 321 | 374 | } |
| 322 | 375 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
| 323 | 376 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
| 324 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 377 | + if ($owner_info['owner'] != '') { |
|
| 378 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 379 | + } |
|
| 325 | 380 | $temp_array['aircraft_base'] = $owner_info['base']; |
| 326 | 381 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 327 | 382 | } |
@@ -329,9 +384,14 @@ discard block |
||
| 329 | 384 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
| 330 | 385 | { |
| 331 | 386 | if ($globalIVAO) { |
| 332 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 333 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 334 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 387 | + if (isset($temp_array['airline_icao'])) { |
|
| 388 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 389 | + } else { |
|
| 390 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 391 | + } |
|
| 392 | + } else { |
|
| 393 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 394 | + } |
|
| 335 | 395 | if (count($image_array) > 0) { |
| 336 | 396 | $temp_array['image'] = $image_array[0]['image']; |
| 337 | 397 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -383,7 +443,9 @@ discard block |
||
| 383 | 443 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
| 384 | 444 | if ($row['departure_airport_icao'] != '') { |
| 385 | 445 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
| 386 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 446 | + if (!isset($departure_airport_array[0]['name'])) { |
|
| 447 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 448 | + } |
|
| 387 | 449 | /* |
| 388 | 450 | } elseif ($row['departure_airport_name'] != '') { |
| 389 | 451 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -391,7 +453,9 @@ discard block |
||
| 391 | 453 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 392 | 454 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
| 393 | 455 | */ |
| 394 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 456 | + } else { |
|
| 457 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 458 | + } |
|
| 395 | 459 | if (isset($departure_airport_array[0]['name'])) { |
| 396 | 460 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
| 397 | 461 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -411,8 +475,12 @@ discard block |
||
| 411 | 475 | |
| 412 | 476 | if ($row['arrival_airport_icao'] != '') { |
| 413 | 477 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
| 414 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 415 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 478 | + if (count($arrival_airport_array) == 0) { |
|
| 479 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 480 | + } |
|
| 481 | + } else { |
|
| 482 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 483 | + } |
|
| 416 | 484 | if (isset($arrival_airport_array[0]['name'])) { |
| 417 | 485 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
| 418 | 486 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -428,27 +496,45 @@ discard block |
||
| 428 | 496 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 429 | 497 | } |
| 430 | 498 | */ |
| 431 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 432 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 433 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 434 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 435 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 499 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
| 500 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 501 | + } |
|
| 502 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
| 503 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 504 | + } |
|
| 505 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 506 | + $temp_array['source_name'] = $row['source_name']; |
|
| 507 | + } |
|
| 508 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 509 | + $temp_array['over_country'] = $row['over_country']; |
|
| 510 | + } |
|
| 511 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 512 | + $temp_array['distance'] = $row['distance']; |
|
| 513 | + } |
|
| 436 | 514 | if (isset($row['squawk'])) { |
| 437 | 515 | $temp_array['squawk'] = $row['squawk']; |
| 438 | 516 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 439 | 517 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
| 440 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 518 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 519 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 520 | + } |
|
| 441 | 521 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 442 | 522 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
| 443 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 444 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 523 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 524 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 525 | + } |
|
| 526 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
| 527 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 528 | + } |
|
| 445 | 529 | } |
| 446 | 530 | |
| 447 | 531 | $temp_array['query_number_rows'] = $num_rows; |
| 448 | 532 | |
| 449 | 533 | $spotter_array[] = $temp_array; |
| 450 | 534 | } |
| 451 | - if ($num_rows == 0) return array(); |
|
| 535 | + if ($num_rows == 0) { |
|
| 536 | + return array(); |
|
| 537 | + } |
|
| 452 | 538 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 453 | 539 | return $spotter_array; |
| 454 | 540 | } |
@@ -481,7 +567,9 @@ discard block |
||
| 481 | 567 | foreach ($q_array as $q_item){ |
| 482 | 568 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
| 483 | 569 | $additional_query .= " AND ("; |
| 484 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 570 | + if (is_int($q_item)) { |
|
| 571 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 572 | + } |
|
| 485 | 573 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 486 | 574 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
| 487 | 575 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -502,7 +590,9 @@ discard block |
||
| 502 | 590 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
| 503 | 591 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
| 504 | 592 | $translate = $Translation->ident2icao($q_item); |
| 505 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 593 | + if ($translate != $q_item) { |
|
| 594 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 595 | + } |
|
| 506 | 596 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
| 507 | 597 | $additional_query .= ")"; |
| 508 | 598 | } |
@@ -729,7 +819,9 @@ discard block |
||
| 729 | 819 | date_default_timezone_set($globalTimezone); |
| 730 | 820 | $datetime = new DateTime(); |
| 731 | 821 | $offset = $datetime->format('P'); |
| 732 | - } else $offset = '+00:00'; |
|
| 822 | + } else { |
|
| 823 | + $offset = '+00:00'; |
|
| 824 | + } |
|
| 733 | 825 | |
| 734 | 826 | if ($date_array[1] != "") |
| 735 | 827 | { |
@@ -761,8 +853,12 @@ discard block |
||
| 761 | 853 | { |
| 762 | 854 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 763 | 855 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 764 | - } else $limit_query = ""; |
|
| 765 | - } else $limit_query = ""; |
|
| 856 | + } else { |
|
| 857 | + $limit_query = ""; |
|
| 858 | + } |
|
| 859 | + } else { |
|
| 860 | + $limit_query = ""; |
|
| 861 | + } |
|
| 766 | 862 | |
| 767 | 863 | |
| 768 | 864 | if ($sort != "") |
@@ -830,8 +926,12 @@ discard block |
||
| 830 | 926 | { |
| 831 | 927 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 832 | 928 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 833 | - } else $limit_query = ""; |
|
| 834 | - } else $limit_query = ""; |
|
| 929 | + } else { |
|
| 930 | + $limit_query = ""; |
|
| 931 | + } |
|
| 932 | + } else { |
|
| 933 | + $limit_query = ""; |
|
| 934 | + } |
|
| 835 | 935 | |
| 836 | 936 | if ($sort != "") |
| 837 | 937 | { |
@@ -1155,7 +1255,9 @@ discard block |
||
| 1155 | 1255 | global $global_query; |
| 1156 | 1256 | |
| 1157 | 1257 | date_default_timezone_set('UTC'); |
| 1158 | - if ($id == '') return array(); |
|
| 1258 | + if ($id == '') { |
|
| 1259 | + return array(); |
|
| 1260 | + } |
|
| 1159 | 1261 | $additional_query = "spotter_output.spotter_id = :id"; |
| 1160 | 1262 | $query_values = array(':id' => $id); |
| 1161 | 1263 | |
@@ -1787,7 +1889,9 @@ discard block |
||
| 1787 | 1889 | { |
| 1788 | 1890 | $highlight = $row['highlight']; |
| 1789 | 1891 | } |
| 1790 | - if (isset($highlight)) return $highlight; |
|
| 1892 | + if (isset($highlight)) { |
|
| 1893 | + return $highlight; |
|
| 1894 | + } |
|
| 1791 | 1895 | } |
| 1792 | 1896 | |
| 1793 | 1897 | |
@@ -1815,7 +1919,9 @@ discard block |
||
| 1815 | 1919 | $sth->closeCursor(); |
| 1816 | 1920 | if (count($row) > 0) { |
| 1817 | 1921 | return $row['usage']; |
| 1818 | - } else return ''; |
|
| 1922 | + } else { |
|
| 1923 | + return ''; |
|
| 1924 | + } |
|
| 1819 | 1925 | } |
| 1820 | 1926 | |
| 1821 | 1927 | /** |
@@ -1840,7 +1946,9 @@ discard block |
||
| 1840 | 1946 | $sth->closeCursor(); |
| 1841 | 1947 | if (count($row) > 0) { |
| 1842 | 1948 | return $row['icao']; |
| 1843 | - } else return ''; |
|
| 1949 | + } else { |
|
| 1950 | + return ''; |
|
| 1951 | + } |
|
| 1844 | 1952 | } |
| 1845 | 1953 | |
| 1846 | 1954 | /** |
@@ -1868,7 +1976,9 @@ discard block |
||
| 1868 | 1976 | $airport_longitude = $row['longitude']; |
| 1869 | 1977 | $Common = new Common(); |
| 1870 | 1978 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
| 1871 | - } else return ''; |
|
| 1979 | + } else { |
|
| 1980 | + return ''; |
|
| 1981 | + } |
|
| 1872 | 1982 | } |
| 1873 | 1983 | |
| 1874 | 1984 | /** |
@@ -1980,7 +2090,9 @@ discard block |
||
| 1980 | 2090 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1981 | 2091 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1982 | 2092 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1983 | - } else return array(); |
|
| 2093 | + } else { |
|
| 2094 | + return array(); |
|
| 2095 | + } |
|
| 1984 | 2096 | if ($globalDBdriver == 'mysql') { |
| 1985 | 2097 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
| 1986 | 2098 | } else { |
@@ -2015,7 +2127,9 @@ discard block |
||
| 2015 | 2127 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2016 | 2128 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2017 | 2129 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2018 | - } else return array(); |
|
| 2130 | + } else { |
|
| 2131 | + return array(); |
|
| 2132 | + } |
|
| 2019 | 2133 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2020 | 2134 | $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.")"; |
| 2021 | 2135 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2050,7 +2164,9 @@ discard block |
||
| 2050 | 2164 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2051 | 2165 | { |
| 2052 | 2166 | global $globalUseRealAirlines; |
| 2053 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2167 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2168 | + $fromsource = NULL; |
|
| 2169 | + } |
|
| 2054 | 2170 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
| 2055 | 2171 | if ($airline_icao == 'NA') { |
| 2056 | 2172 | $airline_array = array(); |
@@ -2100,7 +2216,9 @@ discard block |
||
| 2100 | 2216 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2101 | 2217 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2102 | 2218 | $sth->closeCursor(); |
| 2103 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao); |
|
| 2219 | + if ($row['nb'] == 0) { |
|
| 2220 | + $result = $this->getAllAirlineInfo($airline_icao); |
|
| 2221 | + } |
|
| 2104 | 2222 | } |
| 2105 | 2223 | return $result; |
| 2106 | 2224 | } |
@@ -2116,7 +2234,9 @@ discard block |
||
| 2116 | 2234 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
| 2117 | 2235 | { |
| 2118 | 2236 | global $globalUseRealAirlines; |
| 2119 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2237 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2238 | + $fromsource = NULL; |
|
| 2239 | + } |
|
| 2120 | 2240 | $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
| 2121 | 2241 | $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"; |
| 2122 | 2242 | $sth = $this->db->prepare($query); |
@@ -2132,7 +2252,9 @@ discard block |
||
| 2132 | 2252 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2133 | 2253 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2134 | 2254 | $sth->closeCursor(); |
| 2135 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2255 | + if ($row['nb'] == 0) { |
|
| 2256 | + $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2257 | + } |
|
| 2136 | 2258 | } |
| 2137 | 2259 | return $result; |
| 2138 | 2260 | } |
@@ -2195,15 +2317,20 @@ discard block |
||
| 2195 | 2317 | 'A320-211' => 'A320', |
| 2196 | 2318 | '747-8i' => 'B748', |
| 2197 | 2319 | 'A380' => 'A388'); |
| 2198 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
| 2320 | + if (isset($all_aircraft[$aircraft_type])) { |
|
| 2321 | + return $all_aircraft[$aircraft_type]; |
|
| 2322 | + } |
|
| 2199 | 2323 | |
| 2200 | 2324 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
| 2201 | 2325 | $aircraft_type = strtoupper($aircraft_type); |
| 2202 | 2326 | $sth = $this->db->prepare($query); |
| 2203 | 2327 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
| 2204 | 2328 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2205 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
| 2206 | - else return ''; |
|
| 2329 | + if (isset($result[0]['icao'])) { |
|
| 2330 | + return $result[0]['icao']; |
|
| 2331 | + } else { |
|
| 2332 | + return ''; |
|
| 2333 | + } |
|
| 2207 | 2334 | } |
| 2208 | 2335 | |
| 2209 | 2336 | /** |
@@ -2226,7 +2353,9 @@ discard block |
||
| 2226 | 2353 | $sth->closeCursor(); |
| 2227 | 2354 | if (isset($row['icaotypecode'])) { |
| 2228 | 2355 | return $row['icaotypecode']; |
| 2229 | - } else return ''; |
|
| 2356 | + } else { |
|
| 2357 | + return ''; |
|
| 2358 | + } |
|
| 2230 | 2359 | } |
| 2231 | 2360 | |
| 2232 | 2361 | /** |
@@ -2249,7 +2378,9 @@ discard block |
||
| 2249 | 2378 | $sth->closeCursor(); |
| 2250 | 2379 | if (isset($row['icaotypecode'])) { |
| 2251 | 2380 | return $row['icaotypecode']; |
| 2252 | - } else return ''; |
|
| 2381 | + } else { |
|
| 2382 | + return ''; |
|
| 2383 | + } |
|
| 2253 | 2384 | } |
| 2254 | 2385 | |
| 2255 | 2386 | /** |
@@ -2271,7 +2402,9 @@ discard block |
||
| 2271 | 2402 | $sth->closeCursor(); |
| 2272 | 2403 | if (isset($row['operator_correct'])) { |
| 2273 | 2404 | return $row['operator_correct']; |
| 2274 | - } else return $operator; |
|
| 2405 | + } else { |
|
| 2406 | + return $operator; |
|
| 2407 | + } |
|
| 2275 | 2408 | } |
| 2276 | 2409 | |
| 2277 | 2410 | /** |
@@ -2284,7 +2417,9 @@ discard block |
||
| 2284 | 2417 | public function getRouteInfo($callsign) |
| 2285 | 2418 | { |
| 2286 | 2419 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2287 | - if ($callsign == '') return array(); |
|
| 2420 | + if ($callsign == '') { |
|
| 2421 | + return array(); |
|
| 2422 | + } |
|
| 2288 | 2423 | $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"; |
| 2289 | 2424 | |
| 2290 | 2425 | $sth = $this->db->prepare($query); |
@@ -2294,7 +2429,9 @@ discard block |
||
| 2294 | 2429 | $sth->closeCursor(); |
| 2295 | 2430 | if (count($row) > 0) { |
| 2296 | 2431 | return $row; |
| 2297 | - } else return array(); |
|
| 2432 | + } else { |
|
| 2433 | + return array(); |
|
| 2434 | + } |
|
| 2298 | 2435 | } |
| 2299 | 2436 | |
| 2300 | 2437 | /** |
@@ -2347,7 +2484,9 @@ discard block |
||
| 2347 | 2484 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 2348 | 2485 | $sth->closeCursor(); |
| 2349 | 2486 | return $result; |
| 2350 | - } else return array(); |
|
| 2487 | + } else { |
|
| 2488 | + return array(); |
|
| 2489 | + } |
|
| 2351 | 2490 | } |
| 2352 | 2491 | |
| 2353 | 2492 | |
@@ -2506,8 +2645,11 @@ discard block |
||
| 2506 | 2645 | $query .= " ORDER BY spotter_output.source_name ASC"; |
| 2507 | 2646 | |
| 2508 | 2647 | $sth = $this->db->prepare($query); |
| 2509 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 2510 | - else $sth->execute(); |
|
| 2648 | + if (!empty($query_values)) { |
|
| 2649 | + $sth->execute($query_values); |
|
| 2650 | + } else { |
|
| 2651 | + $sth->execute(); |
|
| 2652 | + } |
|
| 2511 | 2653 | |
| 2512 | 2654 | $source_array = array(); |
| 2513 | 2655 | $temp_array = array(); |
@@ -2540,9 +2682,13 @@ discard block |
||
| 2540 | 2682 | WHERE spotter_output.airline_icao <> '' |
| 2541 | 2683 | ORDER BY spotter_output.airline_name ASC"; |
| 2542 | 2684 | */ |
| 2543 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2544 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2545 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2685 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2686 | + $forsource = $globalAirlinesSource; |
|
| 2687 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2688 | + $forsource = 'vatsim'; |
|
| 2689 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2690 | + $forsource = 'ivao'; |
|
| 2691 | + } |
|
| 2546 | 2692 | if ($forsource === NULL) { |
| 2547 | 2693 | $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"; |
| 2548 | 2694 | $query_data = array(); |
@@ -2834,7 +2980,9 @@ discard block |
||
| 2834 | 2980 | date_default_timezone_set($globalTimezone); |
| 2835 | 2981 | $datetime = new DateTime(); |
| 2836 | 2982 | $offset = $datetime->format('P'); |
| 2837 | - } else $offset = '+00:00'; |
|
| 2983 | + } else { |
|
| 2984 | + $offset = '+00:00'; |
|
| 2985 | + } |
|
| 2838 | 2986 | if ($airport_icao == '') { |
| 2839 | 2987 | if ($globalDBdriver == 'mysql') { |
| 2840 | 2988 | $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"; |
@@ -2866,7 +3014,9 @@ discard block |
||
| 2866 | 3014 | date_default_timezone_set($globalTimezone); |
| 2867 | 3015 | $datetime = new DateTime(); |
| 2868 | 3016 | $offset = $datetime->format('P'); |
| 2869 | - } else $offset = '+00:00'; |
|
| 3017 | + } else { |
|
| 3018 | + $offset = '+00:00'; |
|
| 3019 | + } |
|
| 2870 | 3020 | if ($airport_icao == '') { |
| 2871 | 3021 | if ($globalDBdriver == 'mysql') { |
| 2872 | 3022 | $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"; |
@@ -2899,7 +3049,9 @@ discard block |
||
| 2899 | 3049 | date_default_timezone_set($globalTimezone); |
| 2900 | 3050 | $datetime = new DateTime(); |
| 2901 | 3051 | $offset = $datetime->format('P'); |
| 2902 | - } else $offset = '+00:00'; |
|
| 3052 | + } else { |
|
| 3053 | + $offset = '+00:00'; |
|
| 3054 | + } |
|
| 2903 | 3055 | if ($airport_icao == '') { |
| 2904 | 3056 | if ($globalDBdriver == 'mysql') { |
| 2905 | 3057 | $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 |
@@ -2938,7 +3090,9 @@ discard block |
||
| 2938 | 3090 | date_default_timezone_set($globalTimezone); |
| 2939 | 3091 | $datetime = new DateTime(); |
| 2940 | 3092 | $offset = $datetime->format('P'); |
| 2941 | - } else $offset = '+00:00'; |
|
| 3093 | + } else { |
|
| 3094 | + $offset = '+00:00'; |
|
| 3095 | + } |
|
| 2942 | 3096 | if ($airport_icao == '') { |
| 2943 | 3097 | if ($globalDBdriver == 'mysql') { |
| 2944 | 3098 | $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 |
@@ -2983,7 +3137,9 @@ discard block |
||
| 2983 | 3137 | date_default_timezone_set($globalTimezone); |
| 2984 | 3138 | $datetime = new DateTime(); |
| 2985 | 3139 | $offset = $datetime->format('P'); |
| 2986 | - } else $offset = '+00:00'; |
|
| 3140 | + } else { |
|
| 3141 | + $offset = '+00:00'; |
|
| 3142 | + } |
|
| 2987 | 3143 | if ($airport_icao == '') { |
| 2988 | 3144 | if ($globalDBdriver == 'mysql') { |
| 2989 | 3145 | $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"; |
@@ -3018,7 +3174,9 @@ discard block |
||
| 3018 | 3174 | date_default_timezone_set($globalTimezone); |
| 3019 | 3175 | $datetime = new DateTime(); |
| 3020 | 3176 | $offset = $datetime->format('P'); |
| 3021 | - } else $offset = '+00:00'; |
|
| 3177 | + } else { |
|
| 3178 | + $offset = '+00:00'; |
|
| 3179 | + } |
|
| 3022 | 3180 | if ($airport_icao == '') { |
| 3023 | 3181 | if ($globalDBdriver == 'mysql') { |
| 3024 | 3182 | $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 |
@@ -3060,7 +3218,9 @@ discard block |
||
| 3060 | 3218 | date_default_timezone_set($globalTimezone); |
| 3061 | 3219 | $datetime = new DateTime(); |
| 3062 | 3220 | $offset = $datetime->format('P'); |
| 3063 | - } else $offset = '+00:00'; |
|
| 3221 | + } else { |
|
| 3222 | + $offset = '+00:00'; |
|
| 3223 | + } |
|
| 3064 | 3224 | if ($airport_icao == '') { |
| 3065 | 3225 | if ($globalDBdriver == 'mysql') { |
| 3066 | 3226 | $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"; |
@@ -3094,7 +3254,9 @@ discard block |
||
| 3094 | 3254 | date_default_timezone_set($globalTimezone); |
| 3095 | 3255 | $datetime = new DateTime(); |
| 3096 | 3256 | $offset = $datetime->format('P'); |
| 3097 | - } else $offset = '+00:00'; |
|
| 3257 | + } else { |
|
| 3258 | + $offset = '+00:00'; |
|
| 3259 | + } |
|
| 3098 | 3260 | if ($airport_icao == '') { |
| 3099 | 3261 | if ($globalDBdriver == 'mysql') { |
| 3100 | 3262 | $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 |
@@ -3142,7 +3304,9 @@ discard block |
||
| 3142 | 3304 | date_default_timezone_set($globalTimezone); |
| 3143 | 3305 | $datetime = new DateTime(); |
| 3144 | 3306 | $offset = $datetime->format('P'); |
| 3145 | - } else $offset = '+00:00'; |
|
| 3307 | + } else { |
|
| 3308 | + $offset = '+00:00'; |
|
| 3309 | + } |
|
| 3146 | 3310 | |
| 3147 | 3311 | if ($globalDBdriver == 'mysql') { |
| 3148 | 3312 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3262,7 +3426,9 @@ discard block |
||
| 3262 | 3426 | */ |
| 3263 | 3427 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3264 | 3428 | { |
| 3265 | - if ($groundspeed == '') $groundspeed = NULL; |
|
| 3429 | + if ($groundspeed == '') { |
|
| 3430 | + $groundspeed = NULL; |
|
| 3431 | + } |
|
| 3266 | 3432 | $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'; |
| 3267 | 3433 | $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); |
| 3268 | 3434 | |
@@ -3312,10 +3478,18 @@ discard block |
||
| 3312 | 3478 | $Image = new Image($this->db); |
| 3313 | 3479 | $Common = new Common(); |
| 3314 | 3480 | |
| 3315 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 3316 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 3317 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 3318 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 3481 | + if (!isset($globalIVAO)) { |
|
| 3482 | + $globalIVAO = FALSE; |
|
| 3483 | + } |
|
| 3484 | + if (!isset($globalVATSIM)) { |
|
| 3485 | + $globalVATSIM = FALSE; |
|
| 3486 | + } |
|
| 3487 | + if (!isset($globalphpVMS)) { |
|
| 3488 | + $globalphpVMS = FALSE; |
|
| 3489 | + } |
|
| 3490 | + if (!isset($globalVAM)) { |
|
| 3491 | + $globalVAM = FALSE; |
|
| 3492 | + } |
|
| 3319 | 3493 | date_default_timezone_set('UTC'); |
| 3320 | 3494 | |
| 3321 | 3495 | //getting the registration |
@@ -3328,23 +3502,33 @@ discard block |
||
| 3328 | 3502 | if ($ModeS != '') { |
| 3329 | 3503 | $timeelapsed = microtime(true); |
| 3330 | 3504 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
| 3331 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3505 | + if ($globalDebugTimeElapsed) { |
|
| 3506 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3507 | + } |
|
| 3332 | 3508 | } else { |
| 3333 | 3509 | $myhex = explode('-',$flightaware_id); |
| 3334 | 3510 | if (count($myhex) > 0) { |
| 3335 | 3511 | $timeelapsed = microtime(true); |
| 3336 | 3512 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
| 3337 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3513 | + if ($globalDebugTimeElapsed) { |
|
| 3514 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3515 | + } |
|
| 3338 | 3516 | } |
| 3339 | 3517 | } |
| 3340 | 3518 | } |
| 3341 | 3519 | } |
| 3342 | 3520 | $fromsource = NULL; |
| 3343 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 3344 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 3345 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
| 3346 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 3347 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 3521 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 3522 | + $fromsource = $globalAirlinesSource; |
|
| 3523 | + } elseif ($format_source == 'vatsimtxt') { |
|
| 3524 | + $fromsource = 'vatsim'; |
|
| 3525 | + } elseif ($format_source == 'whazzup') { |
|
| 3526 | + $fromsource = 'ivao'; |
|
| 3527 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 3528 | + $fromsource = 'vatsim'; |
|
| 3529 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 3530 | + $fromsource = 'ivao'; |
|
| 3531 | + } |
|
| 3348 | 3532 | //getting the airline information |
| 3349 | 3533 | if ($ident != "") |
| 3350 | 3534 | { |
@@ -3368,15 +3552,21 @@ discard block |
||
| 3368 | 3552 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
| 3369 | 3553 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3370 | 3554 | } |
| 3371 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3555 | + if ($globalDebugTimeElapsed) { |
|
| 3556 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3557 | + } |
|
| 3372 | 3558 | |
| 3373 | 3559 | } else { |
| 3374 | 3560 | $timeelapsed = microtime(true); |
| 3375 | 3561 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3376 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3562 | + if ($globalDebugTimeElapsed) { |
|
| 3563 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3564 | + } |
|
| 3377 | 3565 | } |
| 3378 | 3566 | } |
| 3379 | - } else $airline_array = array(); |
|
| 3567 | + } else { |
|
| 3568 | + $airline_array = array(); |
|
| 3569 | + } |
|
| 3380 | 3570 | |
| 3381 | 3571 | //getting the aircraft information |
| 3382 | 3572 | $aircraft_array = array(); |
@@ -3390,27 +3580,37 @@ discard block |
||
| 3390 | 3580 | { |
| 3391 | 3581 | $timeelapsed = microtime(true); |
| 3392 | 3582 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3393 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3583 | + if ($globalDebugTimeElapsed) { |
|
| 3584 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3585 | + } |
|
| 3394 | 3586 | } else { |
| 3395 | 3587 | $timeelapsed = microtime(true); |
| 3396 | 3588 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3397 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3589 | + if ($globalDebugTimeElapsed) { |
|
| 3590 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3591 | + } |
|
| 3398 | 3592 | } |
| 3399 | 3593 | } |
| 3400 | 3594 | } else { |
| 3401 | 3595 | if ($ModeS != '') { |
| 3402 | 3596 | $timeelapsed = microtime(true); |
| 3403 | 3597 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
| 3404 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3598 | + if ($globalDebugTimeElapsed) { |
|
| 3599 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3600 | + } |
|
| 3405 | 3601 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3406 | 3602 | { |
| 3407 | 3603 | $timeelapsed = microtime(true); |
| 3408 | 3604 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3409 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3605 | + if ($globalDebugTimeElapsed) { |
|
| 3606 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3607 | + } |
|
| 3410 | 3608 | } else { |
| 3411 | 3609 | $timeelapsed = microtime(true); |
| 3412 | 3610 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3413 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3611 | + if ($globalDebugTimeElapsed) { |
|
| 3612 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3613 | + } |
|
| 3414 | 3614 | } |
| 3415 | 3615 | } |
| 3416 | 3616 | } |
@@ -3426,7 +3626,9 @@ discard block |
||
| 3426 | 3626 | } else { |
| 3427 | 3627 | $timeelapsed = microtime(true); |
| 3428 | 3628 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3429 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3629 | + if ($globalDebugTimeElapsed) { |
|
| 3630 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3631 | + } |
|
| 3430 | 3632 | } |
| 3431 | 3633 | } |
| 3432 | 3634 | |
@@ -3441,7 +3643,9 @@ discard block |
||
| 3441 | 3643 | } else { |
| 3442 | 3644 | $timeelapsed = microtime(true); |
| 3443 | 3645 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3444 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3646 | + if ($globalDebugTimeElapsed) { |
|
| 3647 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3648 | + } |
|
| 3445 | 3649 | } |
| 3446 | 3650 | } |
| 3447 | 3651 | |
@@ -3475,7 +3679,9 @@ discard block |
||
| 3475 | 3679 | { |
| 3476 | 3680 | return false; |
| 3477 | 3681 | } |
| 3478 | - } else $altitude = 0; |
|
| 3682 | + } else { |
|
| 3683 | + $altitude = 0; |
|
| 3684 | + } |
|
| 3479 | 3685 | |
| 3480 | 3686 | if ($heading != "") |
| 3481 | 3687 | { |
@@ -3504,7 +3710,9 @@ discard block |
||
| 3504 | 3710 | { |
| 3505 | 3711 | $timeelapsed = microtime(true); |
| 3506 | 3712 | $image_array = $Image->getSpotterImage($registration); |
| 3507 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3713 | + if ($globalDebugTimeElapsed) { |
|
| 3714 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3715 | + } |
|
| 3508 | 3716 | if (!isset($image_array[0]['registration'])) |
| 3509 | 3717 | { |
| 3510 | 3718 | //echo "Add image !!!! \n"; |
@@ -3512,14 +3720,21 @@ discard block |
||
| 3512 | 3720 | } |
| 3513 | 3721 | $timeelapsed = microtime(true); |
| 3514 | 3722 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3515 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3516 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 3723 | + if ($globalDebugTimeElapsed) { |
|
| 3724 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3725 | + } |
|
| 3726 | + if ($owner_info['owner'] != '') { |
|
| 3727 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 3728 | + } |
|
| 3517 | 3729 | } |
| 3518 | 3730 | |
| 3519 | 3731 | if ($globalIVAO && $aircraft_icao != '') |
| 3520 | 3732 | { |
| 3521 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3522 | - else $airline_icao = ''; |
|
| 3733 | + if (isset($airline_array[0]['icao'])) { |
|
| 3734 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3735 | + } else { |
|
| 3736 | + $airline_icao = ''; |
|
| 3737 | + } |
|
| 3523 | 3738 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3524 | 3739 | if (!isset($image_array[0]['registration'])) |
| 3525 | 3740 | { |
@@ -3564,16 +3779,28 @@ discard block |
||
| 3564 | 3779 | { |
| 3565 | 3780 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
| 3566 | 3781 | } |
| 3567 | - if ($registration == '') $registration = 'NA'; |
|
| 3782 | + if ($registration == '') { |
|
| 3783 | + $registration = 'NA'; |
|
| 3784 | + } |
|
| 3568 | 3785 | if ($latitude == '' && $longitude == '') { |
| 3569 | 3786 | $latitude = 0; |
| 3570 | 3787 | $longitude = 0; |
| 3571 | 3788 | } |
| 3572 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3573 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3574 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3575 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3576 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3789 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
| 3790 | + $squawk = NULL; |
|
| 3791 | + } |
|
| 3792 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
| 3793 | + $verticalrate = NULL; |
|
| 3794 | + } |
|
| 3795 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 3796 | + $heading = 0; |
|
| 3797 | + } |
|
| 3798 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 3799 | + $groundspeed = 0; |
|
| 3800 | + } |
|
| 3801 | + if (!isset($aircraft_owner)) { |
|
| 3802 | + $aircraft_owner = NULL; |
|
| 3803 | + } |
|
| 3577 | 3804 | $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) |
| 3578 | 3805 | 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)"; |
| 3579 | 3806 | |
@@ -3584,9 +3811,13 @@ discard block |
||
| 3584 | 3811 | if ($airline_type == '') { |
| 3585 | 3812 | $timeelapsed = microtime(true); |
| 3586 | 3813 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3587 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3814 | + if ($globalDebugTimeElapsed) { |
|
| 3815 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3816 | + } |
|
| 3817 | + } |
|
| 3818 | + if ($airline_type == null) { |
|
| 3819 | + $airline_type = ''; |
|
| 3588 | 3820 | } |
| 3589 | - if ($airline_type == null) $airline_type = ''; |
|
| 3590 | 3821 | $aircraft_type = $aircraft_array[0]['type']; |
| 3591 | 3822 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
| 3592 | 3823 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -3722,7 +3953,9 @@ discard block |
||
| 3722 | 3953 | } |
| 3723 | 3954 | } |
| 3724 | 3955 | $query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
| 3725 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 3956 | + if ($limit) { |
|
| 3957 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 3958 | + } |
|
| 3726 | 3959 | |
| 3727 | 3960 | $sth = $this->db->prepare($query); |
| 3728 | 3961 | $sth->execute(); |
@@ -3767,7 +4000,9 @@ discard block |
||
| 3767 | 4000 | } |
| 3768 | 4001 | } |
| 3769 | 4002 | $query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 3770 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4003 | + if ($limit) { |
|
| 4004 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4005 | + } |
|
| 3771 | 4006 | |
| 3772 | 4007 | |
| 3773 | 4008 | $sth = $this->db->prepare($query); |
@@ -3813,7 +4048,9 @@ discard block |
||
| 3813 | 4048 | } |
| 3814 | 4049 | } |
| 3815 | 4050 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 3816 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4051 | + if ($limit) { |
|
| 4052 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4053 | + } |
|
| 3817 | 4054 | |
| 3818 | 4055 | |
| 3819 | 4056 | $sth = $this->db->prepare($query); |
@@ -3861,7 +4098,9 @@ discard block |
||
| 3861 | 4098 | } |
| 3862 | 4099 | } |
| 3863 | 4100 | $query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
| 3864 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4101 | + if ($limit) { |
|
| 4102 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4103 | + } |
|
| 3865 | 4104 | |
| 3866 | 4105 | |
| 3867 | 4106 | $sth = $this->db->prepare($query); |
@@ -3906,7 +4145,9 @@ discard block |
||
| 3906 | 4145 | } |
| 3907 | 4146 | } |
| 3908 | 4147 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
| 3909 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4148 | + if ($limit) { |
|
| 4149 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4150 | + } |
|
| 3910 | 4151 | |
| 3911 | 4152 | |
| 3912 | 4153 | $sth = $this->db->prepare($query); |
@@ -4149,7 +4390,9 @@ discard block |
||
| 4149 | 4390 | date_default_timezone_set($globalTimezone); |
| 4150 | 4391 | $datetime = new DateTime($date); |
| 4151 | 4392 | $offset = $datetime->format('P'); |
| 4152 | - } else $offset = '+00:00'; |
|
| 4393 | + } else { |
|
| 4394 | + $offset = '+00:00'; |
|
| 4395 | + } |
|
| 4153 | 4396 | |
| 4154 | 4397 | if ($globalDBdriver == 'mysql') { |
| 4155 | 4398 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4197,7 +4440,9 @@ discard block |
||
| 4197 | 4440 | date_default_timezone_set($globalTimezone); |
| 4198 | 4441 | $datetime = new DateTime($date); |
| 4199 | 4442 | $offset = $datetime->format('P'); |
| 4200 | - } else $offset = '+00:00'; |
|
| 4443 | + } else { |
|
| 4444 | + $offset = '+00:00'; |
|
| 4445 | + } |
|
| 4201 | 4446 | |
| 4202 | 4447 | if ($globalDBdriver == 'mysql') { |
| 4203 | 4448 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4415,7 +4660,9 @@ discard block |
||
| 4415 | 4660 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' |
| 4416 | 4661 | GROUP BY spotter_output.airline_country |
| 4417 | 4662 | ORDER BY airline_country_count DESC"; |
| 4418 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4663 | + if ($limit) { |
|
| 4664 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4665 | + } |
|
| 4419 | 4666 | |
| 4420 | 4667 | $sth = $this->db->prepare($query); |
| 4421 | 4668 | $sth->execute(); |
@@ -4443,7 +4690,9 @@ discard block |
||
| 4443 | 4690 | global $globalDBdriver; |
| 4444 | 4691 | //$filter_query = $this->getFilter($filters,true,true); |
| 4445 | 4692 | $Connection= new Connection($this->db); |
| 4446 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 4693 | + if (!$Connection->tableExists('countries')) { |
|
| 4694 | + return array(); |
|
| 4695 | + } |
|
| 4447 | 4696 | /* |
| 4448 | 4697 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 4449 | 4698 | FROM countries c, spotter_output s |
@@ -4475,7 +4724,9 @@ discard block |
||
| 4475 | 4724 | } |
| 4476 | 4725 | $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 "; |
| 4477 | 4726 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
| 4478 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4727 | + if ($limit) { |
|
| 4728 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4729 | + } |
|
| 4479 | 4730 | |
| 4480 | 4731 | |
| 4481 | 4732 | $sth = $this->db->prepare($query); |
@@ -4525,7 +4776,9 @@ discard block |
||
| 4525 | 4776 | } |
| 4526 | 4777 | |
| 4527 | 4778 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 4528 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4779 | + if ($limit) { |
|
| 4780 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4781 | + } |
|
| 4529 | 4782 | |
| 4530 | 4783 | $sth = $this->db->prepare($query); |
| 4531 | 4784 | $sth->execute(); |
@@ -4571,7 +4824,9 @@ discard block |
||
| 4571 | 4824 | } |
| 4572 | 4825 | |
| 4573 | 4826 | $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"; |
| 4574 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4827 | + if ($limit) { |
|
| 4828 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4829 | + } |
|
| 4575 | 4830 | |
| 4576 | 4831 | $sth = $this->db->prepare($query); |
| 4577 | 4832 | $sth->execute(); |
@@ -4618,7 +4873,9 @@ discard block |
||
| 4618 | 4873 | } |
| 4619 | 4874 | |
| 4620 | 4875 | $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"; |
| 4621 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4876 | + if ($limit) { |
|
| 4877 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4878 | + } |
|
| 4622 | 4879 | |
| 4623 | 4880 | $sth = $this->db->prepare($query); |
| 4624 | 4881 | $sth->execute(); |
@@ -4671,7 +4928,9 @@ discard block |
||
| 4671 | 4928 | if($row['registration'] != "") |
| 4672 | 4929 | { |
| 4673 | 4930 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4674 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 4931 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 4932 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 4933 | + } |
|
| 4675 | 4934 | } |
| 4676 | 4935 | $temp_array['registration_count'] = $row['registration_count']; |
| 4677 | 4936 | |
@@ -4746,7 +5005,9 @@ discard block |
||
| 4746 | 5005 | if($row['registration'] != "") |
| 4747 | 5006 | { |
| 4748 | 5007 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4749 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5008 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5009 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5010 | + } |
|
| 4750 | 5011 | } |
| 4751 | 5012 | $temp_array['registration_count'] = $row['registration_count']; |
| 4752 | 5013 | |
@@ -4853,7 +5114,9 @@ discard block |
||
| 4853 | 5114 | if($row['registration'] != "") |
| 4854 | 5115 | { |
| 4855 | 5116 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4856 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5117 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5118 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5119 | + } |
|
| 4857 | 5120 | } |
| 4858 | 5121 | $temp_array['registration_count'] = $row['registration_count']; |
| 4859 | 5122 | $aircraft_array[] = $temp_array; |
@@ -4978,7 +5241,9 @@ discard block |
||
| 4978 | 5241 | date_default_timezone_set($globalTimezone); |
| 4979 | 5242 | $datetime = new DateTime($date); |
| 4980 | 5243 | $offset = $datetime->format('P'); |
| 4981 | - } else $offset = '+00:00'; |
|
| 5244 | + } else { |
|
| 5245 | + $offset = '+00:00'; |
|
| 5246 | + } |
|
| 4982 | 5247 | |
| 4983 | 5248 | if ($globalDBdriver == 'mysql') { |
| 4984 | 5249 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -5025,7 +5290,9 @@ discard block |
||
| 5025 | 5290 | date_default_timezone_set($globalTimezone); |
| 5026 | 5291 | $datetime = new DateTime($date); |
| 5027 | 5292 | $offset = $datetime->format('P'); |
| 5028 | - } else $offset = '+00:00'; |
|
| 5293 | + } else { |
|
| 5294 | + $offset = '+00:00'; |
|
| 5295 | + } |
|
| 5029 | 5296 | |
| 5030 | 5297 | if ($globalDBdriver == 'mysql') { |
| 5031 | 5298 | $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 |
@@ -5054,7 +5321,9 @@ discard block |
||
| 5054 | 5321 | if($row['registration'] != "") |
| 5055 | 5322 | { |
| 5056 | 5323 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5057 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5324 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5325 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5326 | + } |
|
| 5058 | 5327 | } |
| 5059 | 5328 | $temp_array['registration_count'] = $row['registration_count']; |
| 5060 | 5329 | |
@@ -5079,7 +5348,9 @@ discard block |
||
| 5079 | 5348 | date_default_timezone_set($globalTimezone); |
| 5080 | 5349 | $datetime = new DateTime($date); |
| 5081 | 5350 | $offset = $datetime->format('P'); |
| 5082 | - } else $offset = '+00:00'; |
|
| 5351 | + } else { |
|
| 5352 | + $offset = '+00:00'; |
|
| 5353 | + } |
|
| 5083 | 5354 | |
| 5084 | 5355 | if ($globalDBdriver == 'mysql') { |
| 5085 | 5356 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5177,8 +5448,11 @@ discard block |
||
| 5177 | 5448 | if($row['registration'] != "") |
| 5178 | 5449 | { |
| 5179 | 5450 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5180 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5181 | - else $temp_array['image_thumbnail'] = ''; |
|
| 5451 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5452 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5453 | + } else { |
|
| 5454 | + $temp_array['image_thumbnail'] = ''; |
|
| 5455 | + } |
|
| 5182 | 5456 | } |
| 5183 | 5457 | $temp_array['registration_count'] = $row['registration_count']; |
| 5184 | 5458 | $aircraft_array[] = $temp_array; |
@@ -5285,7 +5559,9 @@ discard block |
||
| 5285 | 5559 | if($row['registration'] != "") |
| 5286 | 5560 | { |
| 5287 | 5561 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5288 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5562 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5563 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5564 | + } |
|
| 5289 | 5565 | } |
| 5290 | 5566 | $temp_array['registration_count'] = $row['registration_count']; |
| 5291 | 5567 | |
@@ -5402,7 +5678,9 @@ discard block |
||
| 5402 | 5678 | if($row['registration'] != "") |
| 5403 | 5679 | { |
| 5404 | 5680 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5405 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5681 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5682 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5683 | + } |
|
| 5406 | 5684 | } |
| 5407 | 5685 | $temp_array['registration_count'] = $row['registration_count']; |
| 5408 | 5686 | |
@@ -5514,7 +5792,9 @@ discard block |
||
| 5514 | 5792 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5515 | 5793 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5516 | 5794 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 5517 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5795 | + if ($limit) { |
|
| 5796 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5797 | + } |
|
| 5518 | 5798 | |
| 5519 | 5799 | $sth = $this->db->prepare($query); |
| 5520 | 5800 | $sth->execute(); |
@@ -5533,7 +5813,9 @@ discard block |
||
| 5533 | 5813 | if($row['registration'] != "") |
| 5534 | 5814 | { |
| 5535 | 5815 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5536 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5816 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5817 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5818 | + } |
|
| 5537 | 5819 | } |
| 5538 | 5820 | |
| 5539 | 5821 | $aircraft_array[] = $temp_array; |
@@ -5574,7 +5856,9 @@ discard block |
||
| 5574 | 5856 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5575 | 5857 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5576 | 5858 | $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"; |
| 5577 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5859 | + if ($limit) { |
|
| 5860 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5861 | + } |
|
| 5578 | 5862 | |
| 5579 | 5863 | $sth = $this->db->prepare($query); |
| 5580 | 5864 | $sth->execute(); |
@@ -5594,7 +5878,9 @@ discard block |
||
| 5594 | 5878 | if($row['registration'] != "") |
| 5595 | 5879 | { |
| 5596 | 5880 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5597 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5881 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5882 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5883 | + } |
|
| 5598 | 5884 | } |
| 5599 | 5885 | |
| 5600 | 5886 | $aircraft_array[] = $temp_array; |
@@ -5635,7 +5921,9 @@ discard block |
||
| 5635 | 5921 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5636 | 5922 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 5637 | 5923 | ORDER BY airport_departure_icao_count DESC"; |
| 5638 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5924 | + if ($limit) { |
|
| 5925 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5926 | + } |
|
| 5639 | 5927 | |
| 5640 | 5928 | $sth = $this->db->prepare($query); |
| 5641 | 5929 | $sth->execute(); |
@@ -5687,7 +5975,9 @@ discard block |
||
| 5687 | 5975 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5688 | 5976 | $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 |
| 5689 | 5977 | ORDER BY airport_departure_icao_count DESC"; |
| 5690 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5978 | + if ($limit) { |
|
| 5979 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5980 | + } |
|
| 5691 | 5981 | |
| 5692 | 5982 | $sth = $this->db->prepare($query); |
| 5693 | 5983 | $sth->execute(); |
@@ -5739,7 +6029,9 @@ discard block |
||
| 5739 | 6029 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5740 | 6030 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 5741 | 6031 | ORDER BY airport_departure_icao_count DESC"; |
| 5742 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6032 | + if ($limit) { |
|
| 6033 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6034 | + } |
|
| 5743 | 6035 | //echo $query; |
| 5744 | 6036 | $sth = $this->db->prepare($query); |
| 5745 | 6037 | $sth->execute(); |
@@ -5791,7 +6083,9 @@ discard block |
||
| 5791 | 6083 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5792 | 6084 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 5793 | 6085 | ORDER BY airport_departure_icao_count DESC"; |
| 5794 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6086 | + if ($limit) { |
|
| 6087 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6088 | + } |
|
| 5795 | 6089 | |
| 5796 | 6090 | $sth = $this->db->prepare($query); |
| 5797 | 6091 | $sth->execute(); |
@@ -6186,7 +6480,9 @@ discard block |
||
| 6186 | 6480 | date_default_timezone_set($globalTimezone); |
| 6187 | 6481 | $datetime = new DateTime($date); |
| 6188 | 6482 | $offset = $datetime->format('P'); |
| 6189 | - } else $offset = '+00:00'; |
|
| 6483 | + } else { |
|
| 6484 | + $offset = '+00:00'; |
|
| 6485 | + } |
|
| 6190 | 6486 | |
| 6191 | 6487 | if ($globalDBdriver == 'mysql') { |
| 6192 | 6488 | $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 |
@@ -6236,7 +6532,9 @@ discard block |
||
| 6236 | 6532 | date_default_timezone_set($globalTimezone); |
| 6237 | 6533 | $datetime = new DateTime($date); |
| 6238 | 6534 | $offset = $datetime->format('P'); |
| 6239 | - } else $offset = '+00:00'; |
|
| 6535 | + } else { |
|
| 6536 | + $offset = '+00:00'; |
|
| 6537 | + } |
|
| 6240 | 6538 | |
| 6241 | 6539 | if ($globalDBdriver == 'mysql') { |
| 6242 | 6540 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -6449,7 +6747,9 @@ discard block |
||
| 6449 | 6747 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6450 | 6748 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6451 | 6749 | ORDER BY airport_arrival_icao_count DESC"; |
| 6452 | - if ($limit) $query .= " LIMIT 10"; |
|
| 6750 | + if ($limit) { |
|
| 6751 | + $query .= " LIMIT 10"; |
|
| 6752 | + } |
|
| 6453 | 6753 | |
| 6454 | 6754 | |
| 6455 | 6755 | $sth = $this->db->prepare($query); |
@@ -6469,7 +6769,9 @@ discard block |
||
| 6469 | 6769 | if ($icaoaskey) { |
| 6470 | 6770 | $icao = $row['arrival_airport_icao']; |
| 6471 | 6771 | $airport_array[$icao] = $temp_array; |
| 6472 | - } else $airport_array[] = $temp_array; |
|
| 6772 | + } else { |
|
| 6773 | + $airport_array[] = $temp_array; |
|
| 6774 | + } |
|
| 6473 | 6775 | } |
| 6474 | 6776 | |
| 6475 | 6777 | return $airport_array; |
@@ -6506,7 +6808,9 @@ discard block |
||
| 6506 | 6808 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6507 | 6809 | $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 |
| 6508 | 6810 | ORDER BY airport_arrival_icao_count DESC"; |
| 6509 | - if ($limit) $query .= " LIMIT 10"; |
|
| 6811 | + if ($limit) { |
|
| 6812 | + $query .= " LIMIT 10"; |
|
| 6813 | + } |
|
| 6510 | 6814 | |
| 6511 | 6815 | |
| 6512 | 6816 | $sth = $this->db->prepare($query); |
@@ -6527,7 +6831,9 @@ discard block |
||
| 6527 | 6831 | if ($icaoaskey) { |
| 6528 | 6832 | $icao = $row['arrival_airport_icao']; |
| 6529 | 6833 | $airport_array[$icao] = $temp_array; |
| 6530 | - } else $airport_array[] = $temp_array; |
|
| 6834 | + } else { |
|
| 6835 | + $airport_array[] = $temp_array; |
|
| 6836 | + } |
|
| 6531 | 6837 | } |
| 6532 | 6838 | |
| 6533 | 6839 | return $airport_array; |
@@ -6564,7 +6870,9 @@ discard block |
||
| 6564 | 6870 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6565 | 6871 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 6566 | 6872 | ORDER BY airport_arrival_icao_count DESC"; |
| 6567 | - if ($limit) $query .= " LIMIT 10"; |
|
| 6873 | + if ($limit) { |
|
| 6874 | + $query .= " LIMIT 10"; |
|
| 6875 | + } |
|
| 6568 | 6876 | |
| 6569 | 6877 | |
| 6570 | 6878 | $sth = $this->db->prepare($query); |
@@ -6584,7 +6892,9 @@ discard block |
||
| 6584 | 6892 | if ($icaoaskey) { |
| 6585 | 6893 | $icao = $row['arrival_airport_icao']; |
| 6586 | 6894 | $airport_array[$icao] = $temp_array; |
| 6587 | - } else $airport_array[] = $temp_array; |
|
| 6895 | + } else { |
|
| 6896 | + $airport_array[] = $temp_array; |
|
| 6897 | + } |
|
| 6588 | 6898 | } |
| 6589 | 6899 | |
| 6590 | 6900 | return $airport_array; |
@@ -6621,7 +6931,9 @@ discard block |
||
| 6621 | 6931 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6622 | 6932 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 6623 | 6933 | ORDER BY airport_arrival_icao_count DESC"; |
| 6624 | - if ($limit) $query .= " LIMIT 10"; |
|
| 6934 | + if ($limit) { |
|
| 6935 | + $query .= " LIMIT 10"; |
|
| 6936 | + } |
|
| 6625 | 6937 | |
| 6626 | 6938 | |
| 6627 | 6939 | $sth = $this->db->prepare($query); |
@@ -6642,7 +6954,9 @@ discard block |
||
| 6642 | 6954 | if ($icaoaskey) { |
| 6643 | 6955 | $icao = $row['arrival_airport_icao']; |
| 6644 | 6956 | $airport_array[$icao] = $temp_array; |
| 6645 | - } else $airport_array[] = $temp_array; |
|
| 6957 | + } else { |
|
| 6958 | + $airport_array[] = $temp_array; |
|
| 6959 | + } |
|
| 6646 | 6960 | } |
| 6647 | 6961 | |
| 6648 | 6962 | return $airport_array; |
@@ -7023,7 +7337,9 @@ discard block |
||
| 7023 | 7337 | date_default_timezone_set($globalTimezone); |
| 7024 | 7338 | $datetime = new DateTime($date); |
| 7025 | 7339 | $offset = $datetime->format('P'); |
| 7026 | - } else $offset = '+00:00'; |
|
| 7340 | + } else { |
|
| 7341 | + $offset = '+00:00'; |
|
| 7342 | + } |
|
| 7027 | 7343 | |
| 7028 | 7344 | if ($globalDBdriver == 'mysql') { |
| 7029 | 7345 | $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 |
@@ -7073,7 +7389,9 @@ discard block |
||
| 7073 | 7389 | date_default_timezone_set($globalTimezone); |
| 7074 | 7390 | $datetime = new DateTime($date); |
| 7075 | 7391 | $offset = $datetime->format('P'); |
| 7076 | - } else $offset = '+00:00'; |
|
| 7392 | + } else { |
|
| 7393 | + $offset = '+00:00'; |
|
| 7394 | + } |
|
| 7077 | 7395 | |
| 7078 | 7396 | if ($globalDBdriver == 'mysql') { |
| 7079 | 7397 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -7296,7 +7614,9 @@ discard block |
||
| 7296 | 7614 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
| 7297 | 7615 | $query .= " GROUP BY spotter_output.arrival_airport_country |
| 7298 | 7616 | ORDER BY airport_arrival_country_count DESC"; |
| 7299 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7617 | + if ($limit) { |
|
| 7618 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7619 | + } |
|
| 7300 | 7620 | |
| 7301 | 7621 | |
| 7302 | 7622 | $sth = $this->db->prepare($query); |
@@ -7583,7 +7903,9 @@ discard block |
||
| 7583 | 7903 | date_default_timezone_set($globalTimezone); |
| 7584 | 7904 | $datetime = new DateTime($date); |
| 7585 | 7905 | $offset = $datetime->format('P'); |
| 7586 | - } else $offset = '+00:00'; |
|
| 7906 | + } else { |
|
| 7907 | + $offset = '+00:00'; |
|
| 7908 | + } |
|
| 7587 | 7909 | |
| 7588 | 7910 | if ($globalDBdriver == 'mysql') { |
| 7589 | 7911 | $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 |
@@ -7759,15 +8081,23 @@ discard block |
||
| 7759 | 8081 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
| 7760 | 8082 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
| 7761 | 8083 | if ($olderthanmonths > 0) { |
| 7762 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 7763 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 8084 | + if ($globalDBdriver == 'mysql') { |
|
| 8085 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 8086 | + } else { |
|
| 8087 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 8088 | + } |
|
| 7764 | 8089 | } |
| 7765 | 8090 | if ($sincedate != '') { |
| 7766 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 7767 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 8091 | + if ($globalDBdriver == 'mysql') { |
|
| 8092 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 8093 | + } else { |
|
| 8094 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 8095 | + } |
|
| 7768 | 8096 | } |
| 7769 | 8097 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 7770 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 8098 | + if ($limit) { |
|
| 8099 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 8100 | + } |
|
| 7771 | 8101 | |
| 7772 | 8102 | $sth = $this->db->prepare($query); |
| 7773 | 8103 | $sth->execute(); |
@@ -7801,15 +8131,23 @@ discard block |
||
| 7801 | 8131 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
| 7802 | 8132 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 7803 | 8133 | if ($olderthanmonths > 0) { |
| 7804 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7805 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 8134 | + if ($globalDBdriver == 'mysql') { |
|
| 8135 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 8136 | + } else { |
|
| 8137 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 8138 | + } |
|
| 7806 | 8139 | } |
| 7807 | 8140 | if ($sincedate != '') { |
| 7808 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 7809 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 8141 | + if ($globalDBdriver == 'mysql') { |
|
| 8142 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 8143 | + } else { |
|
| 8144 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 8145 | + } |
|
| 7810 | 8146 | } |
| 7811 | 8147 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 7812 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 8148 | + if ($limit) { |
|
| 8149 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 8150 | + } |
|
| 7813 | 8151 | |
| 7814 | 8152 | $sth = $this->db->prepare($query); |
| 7815 | 8153 | $sth->execute(); |
@@ -7846,7 +8184,9 @@ discard block |
||
| 7846 | 8184 | date_default_timezone_set($globalTimezone); |
| 7847 | 8185 | $datetime = new DateTime(); |
| 7848 | 8186 | $offset = $datetime->format('P'); |
| 7849 | - } else $offset = '+00:00'; |
|
| 8187 | + } else { |
|
| 8188 | + $offset = '+00:00'; |
|
| 8189 | + } |
|
| 7850 | 8190 | |
| 7851 | 8191 | if ($globalDBdriver == 'mysql') { |
| 7852 | 8192 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7895,7 +8235,9 @@ discard block |
||
| 7895 | 8235 | date_default_timezone_set($globalTimezone); |
| 7896 | 8236 | $datetime = new DateTime(); |
| 7897 | 8237 | $offset = $datetime->format('P'); |
| 7898 | - } else $offset = '+00:00'; |
|
| 8238 | + } else { |
|
| 8239 | + $offset = '+00:00'; |
|
| 8240 | + } |
|
| 7899 | 8241 | $filter_query = $this->getFilter($filters,true,true); |
| 7900 | 8242 | if ($globalDBdriver == 'mysql') { |
| 7901 | 8243 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7944,7 +8286,9 @@ discard block |
||
| 7944 | 8286 | date_default_timezone_set($globalTimezone); |
| 7945 | 8287 | $datetime = new DateTime(); |
| 7946 | 8288 | $offset = $datetime->format('P'); |
| 7947 | - } else $offset = '+00:00'; |
|
| 8289 | + } else { |
|
| 8290 | + $offset = '+00:00'; |
|
| 8291 | + } |
|
| 7948 | 8292 | $filter_query = $this->getFilter($filters,true,true); |
| 7949 | 8293 | if ($globalDBdriver == 'mysql') { |
| 7950 | 8294 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7990,7 +8334,9 @@ discard block |
||
| 7990 | 8334 | date_default_timezone_set($globalTimezone); |
| 7991 | 8335 | $datetime = new DateTime(); |
| 7992 | 8336 | $offset = $datetime->format('P'); |
| 7993 | - } else $offset = '+00:00'; |
|
| 8337 | + } else { |
|
| 8338 | + $offset = '+00:00'; |
|
| 8339 | + } |
|
| 7994 | 8340 | $filter_query = $this->getFilter($filters,true,true); |
| 7995 | 8341 | if ($globalDBdriver == 'mysql') { |
| 7996 | 8342 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8038,7 +8384,9 @@ discard block |
||
| 8038 | 8384 | date_default_timezone_set($globalTimezone); |
| 8039 | 8385 | $datetime = new DateTime(); |
| 8040 | 8386 | $offset = $datetime->format('P'); |
| 8041 | - } else $offset = '+00:00'; |
|
| 8387 | + } else { |
|
| 8388 | + $offset = '+00:00'; |
|
| 8389 | + } |
|
| 8042 | 8390 | |
| 8043 | 8391 | if ($globalDBdriver == 'mysql') { |
| 8044 | 8392 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8086,7 +8434,9 @@ discard block |
||
| 8086 | 8434 | date_default_timezone_set($globalTimezone); |
| 8087 | 8435 | $datetime = new DateTime(); |
| 8088 | 8436 | $offset = $datetime->format('P'); |
| 8089 | - } else $offset = '+00:00'; |
|
| 8437 | + } else { |
|
| 8438 | + $offset = '+00:00'; |
|
| 8439 | + } |
|
| 8090 | 8440 | |
| 8091 | 8441 | if ($globalDBdriver == 'mysql') { |
| 8092 | 8442 | $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 |
@@ -8133,7 +8483,9 @@ discard block |
||
| 8133 | 8483 | date_default_timezone_set($globalTimezone); |
| 8134 | 8484 | $datetime = new DateTime(); |
| 8135 | 8485 | $offset = $datetime->format('P'); |
| 8136 | - } else $offset = '+00:00'; |
|
| 8486 | + } else { |
|
| 8487 | + $offset = '+00:00'; |
|
| 8488 | + } |
|
| 8137 | 8489 | |
| 8138 | 8490 | if ($globalDBdriver == 'mysql') { |
| 8139 | 8491 | $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 |
@@ -8181,7 +8533,9 @@ discard block |
||
| 8181 | 8533 | date_default_timezone_set($globalTimezone); |
| 8182 | 8534 | $datetime = new DateTime(); |
| 8183 | 8535 | $offset = $datetime->format('P'); |
| 8184 | - } else $offset = '+00:00'; |
|
| 8536 | + } else { |
|
| 8537 | + $offset = '+00:00'; |
|
| 8538 | + } |
|
| 8185 | 8539 | $filter_query = $this->getFilter($filters,true,true); |
| 8186 | 8540 | if ($globalDBdriver == 'mysql') { |
| 8187 | 8541 | $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 |
@@ -8226,7 +8580,9 @@ discard block |
||
| 8226 | 8580 | date_default_timezone_set($globalTimezone); |
| 8227 | 8581 | $datetime = new DateTime(); |
| 8228 | 8582 | $offset = $datetime->format('P'); |
| 8229 | - } else $offset = '+00:00'; |
|
| 8583 | + } else { |
|
| 8584 | + $offset = '+00:00'; |
|
| 8585 | + } |
|
| 8230 | 8586 | $filter_query = $this->getFilter($filters,true,true); |
| 8231 | 8587 | |
| 8232 | 8588 | if ($globalDBdriver == 'mysql') { |
@@ -8273,7 +8629,9 @@ discard block |
||
| 8273 | 8629 | date_default_timezone_set($globalTimezone); |
| 8274 | 8630 | $datetime = new DateTime(); |
| 8275 | 8631 | $offset = $datetime->format('P'); |
| 8276 | - } else $offset = '+00:00'; |
|
| 8632 | + } else { |
|
| 8633 | + $offset = '+00:00'; |
|
| 8634 | + } |
|
| 8277 | 8635 | |
| 8278 | 8636 | if ($globalDBdriver == 'mysql') { |
| 8279 | 8637 | $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 |
@@ -8319,7 +8677,9 @@ discard block |
||
| 8319 | 8677 | date_default_timezone_set($globalTimezone); |
| 8320 | 8678 | $datetime = new DateTime(); |
| 8321 | 8679 | $offset = $datetime->format('P'); |
| 8322 | - } else $offset = '+00:00'; |
|
| 8680 | + } else { |
|
| 8681 | + $offset = '+00:00'; |
|
| 8682 | + } |
|
| 8323 | 8683 | $filter_query = $this->getFilter($filters,true,true); |
| 8324 | 8684 | |
| 8325 | 8685 | if ($globalDBdriver == 'mysql') { |
@@ -8366,7 +8726,9 @@ discard block |
||
| 8366 | 8726 | date_default_timezone_set($globalTimezone); |
| 8367 | 8727 | $datetime = new DateTime(); |
| 8368 | 8728 | $offset = $datetime->format('P'); |
| 8369 | - } else $offset = '+00:00'; |
|
| 8729 | + } else { |
|
| 8730 | + $offset = '+00:00'; |
|
| 8731 | + } |
|
| 8370 | 8732 | |
| 8371 | 8733 | if ($globalDBdriver == 'mysql') { |
| 8372 | 8734 | $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 |
@@ -8413,7 +8775,9 @@ discard block |
||
| 8413 | 8775 | date_default_timezone_set($globalTimezone); |
| 8414 | 8776 | $datetime = new DateTime(); |
| 8415 | 8777 | $offset = $datetime->format('P'); |
| 8416 | - } else $offset = '+00:00'; |
|
| 8778 | + } else { |
|
| 8779 | + $offset = '+00:00'; |
|
| 8780 | + } |
|
| 8417 | 8781 | |
| 8418 | 8782 | if ($globalDBdriver == 'mysql') { |
| 8419 | 8783 | $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 |
@@ -8458,7 +8822,9 @@ discard block |
||
| 8458 | 8822 | date_default_timezone_set($globalTimezone); |
| 8459 | 8823 | $datetime = new DateTime(); |
| 8460 | 8824 | $offset = $datetime->format('P'); |
| 8461 | - } else $offset = '+00:00'; |
|
| 8825 | + } else { |
|
| 8826 | + $offset = '+00:00'; |
|
| 8827 | + } |
|
| 8462 | 8828 | $filter_query = $this->getFilter($filters,true,true); |
| 8463 | 8829 | |
| 8464 | 8830 | if ($globalDBdriver == 'mysql') { |
@@ -8506,7 +8872,9 @@ discard block |
||
| 8506 | 8872 | date_default_timezone_set($globalTimezone); |
| 8507 | 8873 | $datetime = new DateTime(); |
| 8508 | 8874 | $offset = $datetime->format('P'); |
| 8509 | - } else $offset = '+00:00'; |
|
| 8875 | + } else { |
|
| 8876 | + $offset = '+00:00'; |
|
| 8877 | + } |
|
| 8510 | 8878 | |
| 8511 | 8879 | if ($globalDBdriver == 'mysql') { |
| 8512 | 8880 | $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 |
@@ -8552,7 +8920,9 @@ discard block |
||
| 8552 | 8920 | date_default_timezone_set($globalTimezone); |
| 8553 | 8921 | $datetime = new DateTime(); |
| 8554 | 8922 | $offset = $datetime->format('P'); |
| 8555 | - } else $offset = '+00:00'; |
|
| 8923 | + } else { |
|
| 8924 | + $offset = '+00:00'; |
|
| 8925 | + } |
|
| 8556 | 8926 | $filter_query = $this->getFilter($filters,true,true); |
| 8557 | 8927 | |
| 8558 | 8928 | if ($globalDBdriver == 'mysql') { |
@@ -8600,7 +8970,9 @@ discard block |
||
| 8600 | 8970 | date_default_timezone_set($globalTimezone); |
| 8601 | 8971 | $datetime = new DateTime(); |
| 8602 | 8972 | $offset = $datetime->format('P'); |
| 8603 | - } else $offset = '+00:00'; |
|
| 8973 | + } else { |
|
| 8974 | + $offset = '+00:00'; |
|
| 8975 | + } |
|
| 8604 | 8976 | |
| 8605 | 8977 | if ($globalDBdriver == 'mysql') { |
| 8606 | 8978 | $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 |
@@ -8647,7 +9019,9 @@ discard block |
||
| 8647 | 9019 | date_default_timezone_set($globalTimezone); |
| 8648 | 9020 | $datetime = new DateTime(); |
| 8649 | 9021 | $offset = $datetime->format('P'); |
| 8650 | - } else $offset = '+00:00'; |
|
| 9022 | + } else { |
|
| 9023 | + $offset = '+00:00'; |
|
| 9024 | + } |
|
| 8651 | 9025 | $filter_query = $this->getFilter($filters,true,true); |
| 8652 | 9026 | if ($globalDBdriver == 'mysql') { |
| 8653 | 9027 | $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 |
@@ -8696,7 +9070,9 @@ discard block |
||
| 8696 | 9070 | date_default_timezone_set($globalTimezone); |
| 8697 | 9071 | $datetime = new DateTime(); |
| 8698 | 9072 | $offset = $datetime->format('P'); |
| 8699 | - } else $offset = '+00:00'; |
|
| 9073 | + } else { |
|
| 9074 | + $offset = '+00:00'; |
|
| 9075 | + } |
|
| 8700 | 9076 | |
| 8701 | 9077 | $orderby_sql = ''; |
| 8702 | 9078 | if ($orderby == "hour") |
@@ -8762,7 +9138,9 @@ discard block |
||
| 8762 | 9138 | date_default_timezone_set($globalTimezone); |
| 8763 | 9139 | $datetime = new DateTime(); |
| 8764 | 9140 | $offset = $datetime->format('P'); |
| 8765 | - } else $offset = '+00:00'; |
|
| 9141 | + } else { |
|
| 9142 | + $offset = '+00:00'; |
|
| 9143 | + } |
|
| 8766 | 9144 | |
| 8767 | 9145 | $orderby_sql = ''; |
| 8768 | 9146 | if ($orderby == "hour") |
@@ -8829,7 +9207,9 @@ discard block |
||
| 8829 | 9207 | date_default_timezone_set($globalTimezone); |
| 8830 | 9208 | $datetime = new DateTime(); |
| 8831 | 9209 | $offset = $datetime->format('P'); |
| 8832 | - } else $offset = '+00:00'; |
|
| 9210 | + } else { |
|
| 9211 | + $offset = '+00:00'; |
|
| 9212 | + } |
|
| 8833 | 9213 | |
| 8834 | 9214 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
| 8835 | 9215 | |
@@ -8880,7 +9260,9 @@ discard block |
||
| 8880 | 9260 | date_default_timezone_set($globalTimezone); |
| 8881 | 9261 | $datetime = new DateTime(); |
| 8882 | 9262 | $offset = $datetime->format('P'); |
| 8883 | - } else $offset = '+00:00'; |
|
| 9263 | + } else { |
|
| 9264 | + $offset = '+00:00'; |
|
| 9265 | + } |
|
| 8884 | 9266 | |
| 8885 | 9267 | if ($globalDBdriver == 'mysql') { |
| 8886 | 9268 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -8927,7 +9309,9 @@ discard block |
||
| 8927 | 9309 | date_default_timezone_set($globalTimezone); |
| 8928 | 9310 | $datetime = new DateTime(); |
| 8929 | 9311 | $offset = $datetime->format('P'); |
| 8930 | - } else $offset = '+00:00'; |
|
| 9312 | + } else { |
|
| 9313 | + $offset = '+00:00'; |
|
| 9314 | + } |
|
| 8931 | 9315 | |
| 8932 | 9316 | if ($globalDBdriver == 'mysql') { |
| 8933 | 9317 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -8974,7 +9358,9 @@ discard block |
||
| 8974 | 9358 | date_default_timezone_set($globalTimezone); |
| 8975 | 9359 | $datetime = new DateTime(); |
| 8976 | 9360 | $offset = $datetime->format('P'); |
| 8977 | - } else $offset = '+00:00'; |
|
| 9361 | + } else { |
|
| 9362 | + $offset = '+00:00'; |
|
| 9363 | + } |
|
| 8978 | 9364 | |
| 8979 | 9365 | if ($globalDBdriver == 'mysql') { |
| 8980 | 9366 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9022,7 +9408,9 @@ discard block |
||
| 9022 | 9408 | date_default_timezone_set($globalTimezone); |
| 9023 | 9409 | $datetime = new DateTime(); |
| 9024 | 9410 | $offset = $datetime->format('P'); |
| 9025 | - } else $offset = '+00:00'; |
|
| 9411 | + } else { |
|
| 9412 | + $offset = '+00:00'; |
|
| 9413 | + } |
|
| 9026 | 9414 | |
| 9027 | 9415 | if ($globalDBdriver == 'mysql') { |
| 9028 | 9416 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9070,7 +9458,9 @@ discard block |
||
| 9070 | 9458 | date_default_timezone_set($globalTimezone); |
| 9071 | 9459 | $datetime = new DateTime($date); |
| 9072 | 9460 | $offset = $datetime->format('P'); |
| 9073 | - } else $offset = '+00:00'; |
|
| 9461 | + } else { |
|
| 9462 | + $offset = '+00:00'; |
|
| 9463 | + } |
|
| 9074 | 9464 | |
| 9075 | 9465 | if ($globalDBdriver == 'mysql') { |
| 9076 | 9466 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9118,7 +9508,9 @@ discard block |
||
| 9118 | 9508 | date_default_timezone_set($globalTimezone); |
| 9119 | 9509 | $datetime = new DateTime(); |
| 9120 | 9510 | $offset = $datetime->format('P'); |
| 9121 | - } else $offset = '+00:00'; |
|
| 9511 | + } else { |
|
| 9512 | + $offset = '+00:00'; |
|
| 9513 | + } |
|
| 9122 | 9514 | |
| 9123 | 9515 | if ($globalDBdriver == 'mysql') { |
| 9124 | 9516 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9168,7 +9560,9 @@ discard block |
||
| 9168 | 9560 | date_default_timezone_set($globalTimezone); |
| 9169 | 9561 | $datetime = new DateTime(); |
| 9170 | 9562 | $offset = $datetime->format('P'); |
| 9171 | - } else $offset = '+00:00'; |
|
| 9563 | + } else { |
|
| 9564 | + $offset = '+00:00'; |
|
| 9565 | + } |
|
| 9172 | 9566 | |
| 9173 | 9567 | if ($globalDBdriver == 'mysql') { |
| 9174 | 9568 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9215,7 +9609,9 @@ discard block |
||
| 9215 | 9609 | date_default_timezone_set($globalTimezone); |
| 9216 | 9610 | $datetime = new DateTime(); |
| 9217 | 9611 | $offset = $datetime->format('P'); |
| 9218 | - } else $offset = '+00:00'; |
|
| 9612 | + } else { |
|
| 9613 | + $offset = '+00:00'; |
|
| 9614 | + } |
|
| 9219 | 9615 | |
| 9220 | 9616 | if ($globalDBdriver == 'mysql') { |
| 9221 | 9617 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9383,7 +9779,9 @@ discard block |
||
| 9383 | 9779 | date_default_timezone_set($globalTimezone); |
| 9384 | 9780 | $datetime = new DateTime(); |
| 9385 | 9781 | $offset = $datetime->format('P'); |
| 9386 | - } else $offset = '+00:00'; |
|
| 9782 | + } else { |
|
| 9783 | + $offset = '+00:00'; |
|
| 9784 | + } |
|
| 9387 | 9785 | |
| 9388 | 9786 | if ($globalDBdriver == 'mysql') { |
| 9389 | 9787 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9569,7 +9967,9 @@ discard block |
||
| 9569 | 9967 | */ |
| 9570 | 9968 | public function parseDirection($direction = 0) |
| 9571 | 9969 | { |
| 9572 | - if ($direction == '') $direction = 0; |
|
| 9970 | + if ($direction == '') { |
|
| 9971 | + $direction = 0; |
|
| 9972 | + } |
|
| 9573 | 9973 | $direction_array = array(); |
| 9574 | 9974 | $temp_array = array(); |
| 9575 | 9975 | |
@@ -9670,7 +10070,9 @@ discard block |
||
| 9670 | 10070 | if (isset($result->AirlineFlightInfoResult)) |
| 9671 | 10071 | { |
| 9672 | 10072 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
| 9673 | - } else return ''; |
|
| 10073 | + } else { |
|
| 10074 | + return ''; |
|
| 10075 | + } |
|
| 9674 | 10076 | |
| 9675 | 10077 | $registration = $this->convertAircraftRegistration($registration); |
| 9676 | 10078 | |
@@ -9699,7 +10101,9 @@ discard block |
||
| 9699 | 10101 | if (count($row) > 0) { |
| 9700 | 10102 | //return $row['Registration']; |
| 9701 | 10103 | return $row['registration']; |
| 9702 | - } else return ''; |
|
| 10104 | + } else { |
|
| 10105 | + return ''; |
|
| 10106 | + } |
|
| 9703 | 10107 | |
| 9704 | 10108 | } |
| 9705 | 10109 | |
@@ -9722,9 +10126,14 @@ discard block |
||
| 9722 | 10126 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 9723 | 10127 | $sth->closeCursor(); |
| 9724 | 10128 | if (count($row) > 0) { |
| 9725 | - if ($row['type_flight'] == null) return ''; |
|
| 9726 | - else return $row['type_flight']; |
|
| 9727 | - } else return ''; |
|
| 10129 | + if ($row['type_flight'] == null) { |
|
| 10130 | + return ''; |
|
| 10131 | + } else { |
|
| 10132 | + return $row['type_flight']; |
|
| 10133 | + } |
|
| 10134 | + } else { |
|
| 10135 | + return ''; |
|
| 10136 | + } |
|
| 9728 | 10137 | |
| 9729 | 10138 | } |
| 9730 | 10139 | |
@@ -9742,7 +10151,9 @@ discard block |
||
| 9742 | 10151 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 9743 | 10152 | |
| 9744 | 10153 | $Connection = new Connection($this->db); |
| 9745 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 10154 | + if (!$Connection->tableExists('countries')) { |
|
| 10155 | + return ''; |
|
| 10156 | + } |
|
| 9746 | 10157 | |
| 9747 | 10158 | try { |
| 9748 | 10159 | /* |
@@ -9762,9 +10173,13 @@ discard block |
||
| 9762 | 10173 | $sth->closeCursor(); |
| 9763 | 10174 | if (count($row) > 0) { |
| 9764 | 10175 | return $row; |
| 9765 | - } else return ''; |
|
| 10176 | + } else { |
|
| 10177 | + return ''; |
|
| 10178 | + } |
|
| 9766 | 10179 | } catch (PDOException $e) { |
| 9767 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 10180 | + if (isset($globalDebug) && $globalDebug) { |
|
| 10181 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 10182 | + } |
|
| 9768 | 10183 | return ''; |
| 9769 | 10184 | } |
| 9770 | 10185 | |
@@ -9782,7 +10197,9 @@ discard block |
||
| 9782 | 10197 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
| 9783 | 10198 | |
| 9784 | 10199 | $Connection = new Connection($this->db); |
| 9785 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 10200 | + if (!$Connection->tableExists('countries')) { |
|
| 10201 | + return ''; |
|
| 10202 | + } |
|
| 9786 | 10203 | |
| 9787 | 10204 | try { |
| 9788 | 10205 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -9794,9 +10211,13 @@ discard block |
||
| 9794 | 10211 | $sth->closeCursor(); |
| 9795 | 10212 | if (count($row) > 0) { |
| 9796 | 10213 | return $row; |
| 9797 | - } else return ''; |
|
| 10214 | + } else { |
|
| 10215 | + return ''; |
|
| 10216 | + } |
|
| 9798 | 10217 | } catch (PDOException $e) { |
| 9799 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 10218 | + if (isset($globalDebug) && $globalDebug) { |
|
| 10219 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 10220 | + } |
|
| 9800 | 10221 | return ''; |
| 9801 | 10222 | } |
| 9802 | 10223 | |
@@ -9966,7 +10387,9 @@ discard block |
||
| 9966 | 10387 | { |
| 9967 | 10388 | global $globalBitlyAccessToken; |
| 9968 | 10389 | |
| 9969 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 10390 | + if ($globalBitlyAccessToken == '') { |
|
| 10391 | + return $url; |
|
| 10392 | + } |
|
| 9970 | 10393 | |
| 9971 | 10394 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 9972 | 10395 | |
@@ -10115,7 +10538,9 @@ discard block |
||
| 10115 | 10538 | |
| 10116 | 10539 | |
| 10117 | 10540 | // routes |
| 10118 | - if ($globalDebug) print "Routes...\n"; |
|
| 10541 | + if ($globalDebug) { |
|
| 10542 | + print "Routes...\n"; |
|
| 10543 | + } |
|
| 10119 | 10544 | if ($globalDBdriver == 'mysql') { |
| 10120 | 10545 | $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)"; |
| 10121 | 10546 | } else { |
@@ -10134,7 +10559,9 @@ discard block |
||
| 10134 | 10559 | } |
| 10135 | 10560 | } |
| 10136 | 10561 | |
| 10137 | - if ($globalDebug) print "Airlines...\n"; |
|
| 10562 | + if ($globalDebug) { |
|
| 10563 | + print "Airlines...\n"; |
|
| 10564 | + } |
|
| 10138 | 10565 | //airlines |
| 10139 | 10566 | if ($globalDBdriver == 'mysql') { |
| 10140 | 10567 | $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)"; |
@@ -10148,10 +10575,15 @@ discard block |
||
| 10148 | 10575 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 10149 | 10576 | { |
| 10150 | 10577 | $fromsource = NULL; |
| 10151 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 10152 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 10153 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 10154 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 10578 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 10579 | + $fromsource = 'vatsim'; |
|
| 10580 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 10581 | + $fromsource = 'ivao'; |
|
| 10582 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 10583 | + $fromsource = 'vatsim'; |
|
| 10584 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 10585 | + $fromsource = 'ivao'; |
|
| 10586 | + } |
|
| 10155 | 10587 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
| 10156 | 10588 | if (isset($airline_array[0]['name'])) { |
| 10157 | 10589 | $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"; |
@@ -10161,13 +10593,17 @@ discard block |
||
| 10161 | 10593 | } |
| 10162 | 10594 | } |
| 10163 | 10595 | |
| 10164 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
| 10596 | + if ($globalDebug) { |
|
| 10597 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
| 10598 | + } |
|
| 10165 | 10599 | //duplicate modes |
| 10166 | 10600 | $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"; |
| 10167 | 10601 | $sth = $this->db->prepare($query); |
| 10168 | 10602 | $sth->execute(); |
| 10169 | 10603 | |
| 10170 | - if ($globalDebug) print "Aircraft...\n"; |
|
| 10604 | + if ($globalDebug) { |
|
| 10605 | + print "Aircraft...\n"; |
|
| 10606 | + } |
|
| 10171 | 10607 | //aircraft |
| 10172 | 10608 | if ($globalDBdriver == 'mysql') { |
| 10173 | 10609 | $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)"; |
@@ -10210,26 +10646,38 @@ discard block |
||
| 10210 | 10646 | if (isset($closestAirports[0])) { |
| 10211 | 10647 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
| 10212 | 10648 | $airport_icao = $closestAirports[0]['icao']; |
| 10213 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 10649 | + if ($globalDebug) { |
|
| 10650 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 10651 | + } |
|
| 10214 | 10652 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
| 10215 | 10653 | foreach ($closestAirports as $airport) { |
| 10216 | 10654 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
| 10217 | 10655 | $airport_icao = $airport['icao']; |
| 10218 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 10656 | + if ($globalDebug) { |
|
| 10657 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 10658 | + } |
|
| 10219 | 10659 | break; |
| 10220 | 10660 | } |
| 10221 | 10661 | } |
| 10222 | 10662 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
| 10223 | 10663 | $airport_icao = $closestAirports[0]['icao']; |
| 10224 | - 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"; |
|
| 10664 | + if ($globalDebug) { |
|
| 10665 | + 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"; |
|
| 10666 | + } |
|
| 10225 | 10667 | } else { |
| 10226 | - 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"; |
|
| 10668 | + if ($globalDebug) { |
|
| 10669 | + 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"; |
|
| 10670 | + } |
|
| 10227 | 10671 | } |
| 10228 | 10672 | } else { |
| 10229 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 10673 | + if ($globalDebug) { |
|
| 10674 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 10675 | + } |
|
| 10230 | 10676 | } |
| 10231 | 10677 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 10232 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
| 10678 | + if ($globalDebug) { |
|
| 10679 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
| 10680 | + } |
|
| 10233 | 10681 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
| 10234 | 10682 | $sthu = $this->db->prepare($update_query); |
| 10235 | 10683 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |