@@ -63,7 +63,9 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
| 65 | 65 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 66 | - } else $image = $spotter_item['image_thumbnail']; |
|
| 66 | + } else { |
|
| 67 | + $image = $spotter_item['image_thumbnail']; |
|
| 68 | + } |
|
| 67 | 69 | |
| 68 | 70 | } |
| 69 | 71 | /* else { |
@@ -73,7 +75,9 @@ discard block |
||
| 73 | 75 | print '<div class="top">'; |
| 74 | 76 | if (isset($image)) { |
| 75 | 77 | print '<div class="left"><img src="'.$image.'" alt="'.$spotter_item['mmsi'].' '.$spotter_item['ident'].'" title="'.$spotter_item['mmsi'].' '.$spotter_item['ident'].' Image © '.$spotter_item['image_copyright'].'"/>'; |
| 76 | - if ($spotter_item['image_copyright'] != '') print '<br />Image © '.$spotter_item['image_copyright']; |
|
| 78 | + if ($spotter_item['image_copyright'] != '') { |
|
| 79 | + print '<br />Image © '.$spotter_item['image_copyright']; |
|
| 80 | + } |
|
| 77 | 81 | print '</div>'; |
| 78 | 82 | } |
| 79 | 83 | //print '<div class="right"><div class="callsign-details"><div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['famtrackid'].'" target="_blank">'.$spotter_item['ident'].'</a></div>'; |
@@ -39,8 +39,12 @@ discard block |
||
| 39 | 39 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
| 40 | 40 | $race_data = $Marine->getRace($race); |
| 41 | 41 | $filter = array(); |
| 42 | - if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
| 43 | - if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
| 42 | + if ($year != '') { |
|
| 43 | + $filter = array_merge($filter,array('year' => $year)); |
|
| 44 | + } |
|
| 45 | + if ($month != '') { |
|
| 46 | + $filter = array_merge($filter,array('month' => $month)); |
|
| 47 | + } |
|
| 44 | 48 | if ($sort != '') |
| 45 | 49 | { |
| 46 | 50 | $spotter_array = $Marine->getMarineDataByRace($race,$limit_start.",".$absolute_difference, $sort,$filter); |
@@ -62,8 +66,12 @@ discard block |
||
| 62 | 66 | { |
| 63 | 67 | $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['race_name']); |
| 64 | 68 | $ident = $spotter_array[0]['ident']; |
| 65 | - if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
|
| 66 | - if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
|
| 69 | + if (isset($spotter_array[0]['latitude'])) { |
|
| 70 | + $latitude = $spotter_array[0]['latitude']; |
|
| 71 | + } |
|
| 72 | + if (isset($spotter_array[0]['longitude'])) { |
|
| 73 | + $longitude = $spotter_array[0]['longitude']; |
|
| 74 | + } |
|
| 67 | 75 | require_once('header.php'); |
| 68 | 76 | /* |
| 69 | 77 | if (isset($globalArchive) && $globalArchive) { |
@@ -116,7 +124,9 @@ discard block |
||
| 116 | 124 | */ |
| 117 | 125 | print '<div class="info column">'; |
| 118 | 126 | print '<h1>'.$spotter_array[0]['race_name'].'</h1>'; |
| 119 | - if (isset($spotter_array[0]['race_id']) && $spotter_array[0]['race_id'] != '') print '<div><span class="label">'._("race ID").'</span>'.$spotter_array[0]['race_id'].'</div>'; |
|
| 127 | + if (isset($spotter_array[0]['race_id']) && $spotter_array[0]['race_id'] != '') { |
|
| 128 | + print '<div><span class="label">'._("race ID").'</span>'.$spotter_array[0]['race_id'].'</div>'; |
|
| 129 | + } |
|
| 120 | 130 | /* |
| 121 | 131 | if ($year == '' && $month == '') { |
| 122 | 132 | $Stats = new Stats(); |
@@ -142,7 +152,9 @@ discard block |
||
| 142 | 152 | if (isset($race_data['race_startdate']) && $race_data['race_startdate'] != '') { |
| 143 | 153 | if (isset($globalTimezone)) { |
| 144 | 154 | date_default_timezone_set($globalTimezone); |
| 145 | - } else date_default_timezone_set('UTC'); |
|
| 155 | + } else { |
|
| 156 | + date_default_timezone_set('UTC'); |
|
| 157 | + } |
|
| 146 | 158 | print '<div><span class="startdate">'._("Start date").'</span>'.date("r", strtotime($race_data['race_startdate'])).'</div>'; |
| 147 | 159 | } |
| 148 | 160 | print '</div>'; |
@@ -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 { |
@@ -803,12 +855,16 @@ discard block |
||
| 803 | 855 | if ($globalDBdriver == 'mysql') { |
| 804 | 856 | if (!$Connection->tableExists('tle')) { |
| 805 | 857 | $error .= create_db::import_file('../db/tle.sql'); |
| 806 | - if ($error != '') return $error; |
|
| 858 | + if ($error != '') { |
|
| 859 | + return $error; |
|
| 860 | + } |
|
| 807 | 861 | } |
| 808 | 862 | } else { |
| 809 | 863 | if (!$Connection->tableExists('tle')) { |
| 810 | 864 | $error .= create_db::import_file('../db/pgsql/tle.sql'); |
| 811 | - if ($error != '') return $error; |
|
| 865 | + if ($error != '') { |
|
| 866 | + return $error; |
|
| 867 | + } |
|
| 812 | 868 | } |
| 813 | 869 | $query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)"; |
| 814 | 870 | try { |
@@ -848,7 +904,9 @@ discard block |
||
| 848 | 904 | } else { |
| 849 | 905 | $error .= create_db::import_file('../db/pgsql/airlines.sql'); |
| 850 | 906 | } |
| 851 | - if ($error != '') return 'Import airlines.sql : '.$error; |
|
| 907 | + if ($error != '') { |
|
| 908 | + return 'Import airlines.sql : '.$error; |
|
| 909 | + } |
|
| 852 | 910 | if (!$Connection->checkColumnName('airlines','forsource')) { |
| 853 | 911 | // Add forsource to airlines |
| 854 | 912 | $query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL"; |
@@ -1331,20 +1389,28 @@ discard block |
||
| 1331 | 1389 | } |
| 1332 | 1390 | if ($globalDBdriver == 'mysql') { |
| 1333 | 1391 | $error .= create_db::import_file('../db/airlines.sql'); |
| 1334 | - if ($error != '') return $error; |
|
| 1392 | + if ($error != '') { |
|
| 1393 | + return $error; |
|
| 1394 | + } |
|
| 1335 | 1395 | } else { |
| 1336 | 1396 | $error .= create_db::import_file('../db/pgsql/airlines.sql'); |
| 1337 | - if ($error != '') return $error; |
|
| 1397 | + if ($error != '') { |
|
| 1398 | + return $error; |
|
| 1399 | + } |
|
| 1338 | 1400 | } |
| 1339 | 1401 | if ((isset($globalVATSIM) && $globalVATSIM) || (isset($globalIVAO) && $globalIVAO)) { |
| 1340 | 1402 | include_once(dirname(__FILE__).'/class.update_db.php'); |
| 1341 | 1403 | if (isset($globalVATSIM) && $globalVATSIM) { |
| 1342 | 1404 | $error .= update_db::update_vatsim(); |
| 1343 | - if ($error != '') return $error; |
|
| 1405 | + if ($error != '') { |
|
| 1406 | + return $error; |
|
| 1407 | + } |
|
| 1344 | 1408 | } |
| 1345 | 1409 | if (isset($globalIVAO) && $globalIVAO && file_exists('tmp/ivae_feb2013.zip')) { |
| 1346 | 1410 | $error .= update_db::update_IVAO(); |
| 1347 | - if ($error != '') return $error; |
|
| 1411 | + if ($error != '') { |
|
| 1412 | + return $error; |
|
| 1413 | + } |
|
| 1348 | 1414 | } |
| 1349 | 1415 | } |
| 1350 | 1416 | |
@@ -1607,41 +1673,65 @@ discard block |
||
| 1607 | 1673 | if ($globalDBdriver == 'mysql') { |
| 1608 | 1674 | if (!$Connection->tableExists('tracker_output')) { |
| 1609 | 1675 | $error .= create_db::import_file('../db/tracker_output.sql'); |
| 1610 | - if ($error != '') return $error; |
|
| 1676 | + if ($error != '') { |
|
| 1677 | + return $error; |
|
| 1678 | + } |
|
| 1611 | 1679 | } |
| 1612 | 1680 | if (!$Connection->tableExists('tracker_live')) { |
| 1613 | 1681 | $error .= create_db::import_file('../db/tracker_live.sql'); |
| 1614 | - if ($error != '') return $error; |
|
| 1682 | + if ($error != '') { |
|
| 1683 | + return $error; |
|
| 1684 | + } |
|
| 1615 | 1685 | } |
| 1616 | 1686 | if (!$Connection->tableExists('marine_output')) { |
| 1617 | 1687 | $error .= create_db::import_file('../db/marine_output.sql'); |
| 1618 | - if ($error != '') return $error; |
|
| 1688 | + if ($error != '') { |
|
| 1689 | + return $error; |
|
| 1690 | + } |
|
| 1619 | 1691 | } |
| 1620 | 1692 | if (!$Connection->tableExists('marine_live')) { |
| 1621 | 1693 | $error .= create_db::import_file('../db/marine_live.sql'); |
| 1622 | - if ($error != '') return $error; |
|
| 1694 | + if ($error != '') { |
|
| 1695 | + return $error; |
|
| 1696 | + } |
|
| 1623 | 1697 | } |
| 1624 | 1698 | if (!$Connection->tableExists('marine_identity')) { |
| 1625 | 1699 | $error .= create_db::import_file('../db/marine_identity.sql'); |
| 1626 | - if ($error != '') return $error; |
|
| 1700 | + if ($error != '') { |
|
| 1701 | + return $error; |
|
| 1702 | + } |
|
| 1627 | 1703 | } |
| 1628 | 1704 | if (!$Connection->tableExists('marine_mid')) { |
| 1629 | 1705 | $error .= create_db::import_file('../db/marine_mid.sql'); |
| 1630 | - if ($error != '') return $error; |
|
| 1706 | + if ($error != '') { |
|
| 1707 | + return $error; |
|
| 1708 | + } |
|
| 1631 | 1709 | } |
| 1632 | 1710 | } else { |
| 1633 | 1711 | $error .= create_db::import_file('../db/pgsql/tracker_output.sql'); |
| 1634 | - if ($error != '') return $error; |
|
| 1712 | + if ($error != '') { |
|
| 1713 | + return $error; |
|
| 1714 | + } |
|
| 1635 | 1715 | $error .= create_db::import_file('../db/pgsql/tracker_live.sql'); |
| 1636 | - if ($error != '') return $error; |
|
| 1716 | + if ($error != '') { |
|
| 1717 | + return $error; |
|
| 1718 | + } |
|
| 1637 | 1719 | $error .= create_db::import_file('../db/pgsql/marine_output.sql'); |
| 1638 | - if ($error != '') return $error; |
|
| 1720 | + if ($error != '') { |
|
| 1721 | + return $error; |
|
| 1722 | + } |
|
| 1639 | 1723 | $error .= create_db::import_file('../db/pgsql/marine_live.sql'); |
| 1640 | - if ($error != '') return $error; |
|
| 1724 | + if ($error != '') { |
|
| 1725 | + return $error; |
|
| 1726 | + } |
|
| 1641 | 1727 | $error .= create_db::import_file('../db/pgsql/marine_identity.sql'); |
| 1642 | - if ($error != '') return $error; |
|
| 1728 | + if ($error != '') { |
|
| 1729 | + return $error; |
|
| 1730 | + } |
|
| 1643 | 1731 | $error .= create_db::import_file('../db/pgsql/marine_mid.sql'); |
| 1644 | - if ($error != '') return $error; |
|
| 1732 | + if ($error != '') { |
|
| 1733 | + return $error; |
|
| 1734 | + } |
|
| 1645 | 1735 | } |
| 1646 | 1736 | $query = "UPDATE config SET value = '37' WHERE name = 'schema_version'"; |
| 1647 | 1737 | try { |
@@ -1660,39 +1750,61 @@ discard block |
||
| 1660 | 1750 | if ($globalDBdriver == 'mysql') { |
| 1661 | 1751 | if (!$Connection->tableExists('marine_image')) { |
| 1662 | 1752 | $error .= create_db::import_file('../db/marine_image.sql'); |
| 1663 | - if ($error != '') return $error; |
|
| 1753 | + if ($error != '') { |
|
| 1754 | + return $error; |
|
| 1755 | + } |
|
| 1664 | 1756 | } |
| 1665 | 1757 | if (!$Connection->tableExists('marine_archive')) { |
| 1666 | 1758 | $error .= create_db::import_file('../db/marine_archive.sql'); |
| 1667 | - if ($error != '') return $error; |
|
| 1759 | + if ($error != '') { |
|
| 1760 | + return $error; |
|
| 1761 | + } |
|
| 1668 | 1762 | } |
| 1669 | 1763 | if (!$Connection->tableExists('marine_archive_output')) { |
| 1670 | 1764 | $error .= create_db::import_file('../db/marine_archive_output.sql'); |
| 1671 | - if ($error != '') return $error; |
|
| 1765 | + if ($error != '') { |
|
| 1766 | + return $error; |
|
| 1767 | + } |
|
| 1672 | 1768 | } |
| 1673 | 1769 | if (!$Connection->tableExists('tracker_archive')) { |
| 1674 | 1770 | $error .= create_db::import_file('../db/tracker_archive.sql'); |
| 1675 | - if ($error != '') return $error; |
|
| 1771 | + if ($error != '') { |
|
| 1772 | + return $error; |
|
| 1773 | + } |
|
| 1676 | 1774 | } |
| 1677 | 1775 | if (!$Connection->tableExists('tracker_archive_output')) { |
| 1678 | 1776 | $error .= create_db::import_file('../db/tracker_archive_output.sql'); |
| 1679 | - if ($error != '') return $error; |
|
| 1777 | + if ($error != '') { |
|
| 1778 | + return $error; |
|
| 1779 | + } |
|
| 1680 | 1780 | } |
| 1681 | 1781 | if (!$Connection->tableExists('marine_archive_output')) { |
| 1682 | 1782 | $error .= create_db::import_file('../db/tracker_archive_output.sql'); |
| 1683 | - if ($error != '') return $error; |
|
| 1783 | + if ($error != '') { |
|
| 1784 | + return $error; |
|
| 1785 | + } |
|
| 1684 | 1786 | } |
| 1685 | 1787 | } else { |
| 1686 | 1788 | $error .= create_db::import_file('../db/pgsql/marine_image.sql'); |
| 1687 | - if ($error != '') return $error; |
|
| 1789 | + if ($error != '') { |
|
| 1790 | + return $error; |
|
| 1791 | + } |
|
| 1688 | 1792 | $error .= create_db::import_file('../db/pgsql/marine_archive.sql'); |
| 1689 | - if ($error != '') return $error; |
|
| 1793 | + if ($error != '') { |
|
| 1794 | + return $error; |
|
| 1795 | + } |
|
| 1690 | 1796 | $error .= create_db::import_file('../db/pgsql/marine_archive_output.sql'); |
| 1691 | - if ($error != '') return $error; |
|
| 1797 | + if ($error != '') { |
|
| 1798 | + return $error; |
|
| 1799 | + } |
|
| 1692 | 1800 | $error .= create_db::import_file('../db/pgsql/tracker_archive.sql'); |
| 1693 | - if ($error != '') return $error; |
|
| 1801 | + if ($error != '') { |
|
| 1802 | + return $error; |
|
| 1803 | + } |
|
| 1694 | 1804 | $error .= create_db::import_file('../db/pgsql/tracker_archive_output.sql'); |
| 1695 | - if ($error != '') return $error; |
|
| 1805 | + if ($error != '') { |
|
| 1806 | + return $error; |
|
| 1807 | + } |
|
| 1696 | 1808 | } |
| 1697 | 1809 | if ($globalDBdriver == 'mysql') { |
| 1698 | 1810 | $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'"; |
@@ -2063,7 +2175,9 @@ discard block |
||
| 2063 | 2175 | if ($globalDBdriver == 'mysql') { |
| 2064 | 2176 | if (!$Connection->tableExists('tracker_archive_output')) { |
| 2065 | 2177 | $error .= create_db::import_file('../db/tracker_archive_output.sql'); |
| 2066 | - if ($error != '') return $error; |
|
| 2178 | + if ($error != '') { |
|
| 2179 | + return $error; |
|
| 2180 | + } |
|
| 2067 | 2181 | } |
| 2068 | 2182 | $query = "ALTER TABLE tracker_live MODIFY COLUMN altitude float DEFAULT NULL;ALTER TABLE tracker_output MODIFY COLUMN last_altitude float DEFAULT NULL;ALTER TABLE tracker_output MODIFY COLUMN altitude float DEFAULT NULL;ALTER TABLE tracker_archive MODIFY COLUMN altitude float DEFAULT NULL;ALTER TABLE tracker_archive_output MODIFY COLUMN last_altitude float DEFAULT NULL;ALTER TABLE tracker_output MODIFY COLUMN altitude float DEFAULT NULL;"; |
| 2069 | 2183 | } else { |
@@ -2091,14 +2205,22 @@ discard block |
||
| 2091 | 2205 | $error = ''; |
| 2092 | 2206 | if ($globalDBdriver == 'mysql') { |
| 2093 | 2207 | $error .= create_db::import_file('../db/airport.sql'); |
| 2094 | - if ($error != '') return $error; |
|
| 2208 | + if ($error != '') { |
|
| 2209 | + return $error; |
|
| 2210 | + } |
|
| 2095 | 2211 | $error .= create_db::import_file('../db/airlines.sql'); |
| 2096 | - if ($error != '') return $error; |
|
| 2212 | + if ($error != '') { |
|
| 2213 | + return $error; |
|
| 2214 | + } |
|
| 2097 | 2215 | } else { |
| 2098 | 2216 | $error .= create_db::import_file('../db/pgsql/airport.sql'); |
| 2099 | - if ($error != '') return $error; |
|
| 2217 | + if ($error != '') { |
|
| 2218 | + return $error; |
|
| 2219 | + } |
|
| 2100 | 2220 | $error .= create_db::import_file('../db/pgsql/airlines.sql'); |
| 2101 | - if ($error != '') return $error; |
|
| 2221 | + if ($error != '') { |
|
| 2222 | + return $error; |
|
| 2223 | + } |
|
| 2102 | 2224 | } |
| 2103 | 2225 | if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) { |
| 2104 | 2226 | if (file_exists('tmp/ivae_feb2013.zip')) { |
@@ -2115,7 +2237,9 @@ discard block |
||
| 2115 | 2237 | $error .= update_db::update_vatsim(); |
| 2116 | 2238 | } |
| 2117 | 2239 | } |
| 2118 | - if ($error != '') return $error; |
|
| 2240 | + if ($error != '') { |
|
| 2241 | + return $error; |
|
| 2242 | + } |
|
| 2119 | 2243 | $query = "UPDATE config SET value = '45' WHERE name = 'schema_version'"; |
| 2120 | 2244 | try { |
| 2121 | 2245 | $sth = $Connection->db->prepare($query); |
@@ -2133,10 +2257,14 @@ discard block |
||
| 2133 | 2257 | if (!$Connection->tableExists('satellite')) { |
| 2134 | 2258 | if ($globalDBdriver == 'mysql') { |
| 2135 | 2259 | $error .= create_db::import_file('../db/satellite.sql'); |
| 2136 | - if ($error != '') return $error; |
|
| 2260 | + if ($error != '') { |
|
| 2261 | + return $error; |
|
| 2262 | + } |
|
| 2137 | 2263 | } else { |
| 2138 | 2264 | $error .= create_db::import_file('../db/pgsql/satellite.sql'); |
| 2139 | - if ($error != '') return $error; |
|
| 2265 | + if ($error != '') { |
|
| 2266 | + return $error; |
|
| 2267 | + } |
|
| 2140 | 2268 | } |
| 2141 | 2269 | } |
| 2142 | 2270 | $query = "UPDATE config SET value = '46' WHERE name = 'schema_version'"; |
@@ -2156,37 +2284,53 @@ discard block |
||
| 2156 | 2284 | if (!$Connection->tableExists('stats_marine')) { |
| 2157 | 2285 | if ($globalDBdriver == 'mysql') { |
| 2158 | 2286 | $error .= create_db::import_file('../db/stats_marine.sql'); |
| 2159 | - if ($error != '') return $error; |
|
| 2287 | + if ($error != '') { |
|
| 2288 | + return $error; |
|
| 2289 | + } |
|
| 2160 | 2290 | } else { |
| 2161 | 2291 | $error .= create_db::import_file('../db/pgsql/stats_marine.sql'); |
| 2162 | - if ($error != '') return $error; |
|
| 2292 | + if ($error != '') { |
|
| 2293 | + return $error; |
|
| 2294 | + } |
|
| 2163 | 2295 | } |
| 2164 | 2296 | } |
| 2165 | 2297 | if (!$Connection->tableExists('stats_marine_country')) { |
| 2166 | 2298 | if ($globalDBdriver == 'mysql') { |
| 2167 | 2299 | $error .= create_db::import_file('../db/stats_marine_country.sql'); |
| 2168 | - if ($error != '') return $error; |
|
| 2300 | + if ($error != '') { |
|
| 2301 | + return $error; |
|
| 2302 | + } |
|
| 2169 | 2303 | } else { |
| 2170 | 2304 | $error .= create_db::import_file('../db/pgsql/stats_marine_country.sql'); |
| 2171 | - if ($error != '') return $error; |
|
| 2305 | + if ($error != '') { |
|
| 2306 | + return $error; |
|
| 2307 | + } |
|
| 2172 | 2308 | } |
| 2173 | 2309 | } |
| 2174 | 2310 | if (!$Connection->tableExists('stats_tracker')) { |
| 2175 | 2311 | if ($globalDBdriver == 'mysql') { |
| 2176 | 2312 | $error .= create_db::import_file('../db/stats_tracker.sql'); |
| 2177 | - if ($error != '') return $error; |
|
| 2313 | + if ($error != '') { |
|
| 2314 | + return $error; |
|
| 2315 | + } |
|
| 2178 | 2316 | } else { |
| 2179 | 2317 | $error .= create_db::import_file('../db/pgsql/stats_tracker.sql'); |
| 2180 | - if ($error != '') return $error; |
|
| 2318 | + if ($error != '') { |
|
| 2319 | + return $error; |
|
| 2320 | + } |
|
| 2181 | 2321 | } |
| 2182 | 2322 | } |
| 2183 | 2323 | if (!$Connection->tableExists('stats_tracker_country')) { |
| 2184 | 2324 | if ($globalDBdriver == 'mysql') { |
| 2185 | 2325 | $error .= create_db::import_file('../db/stats_tracker_country.sql'); |
| 2186 | - if ($error != '') return $error; |
|
| 2326 | + if ($error != '') { |
|
| 2327 | + return $error; |
|
| 2328 | + } |
|
| 2187 | 2329 | } else { |
| 2188 | 2330 | $error .= create_db::import_file('../db/pgsql/stats_tracker_country.sql'); |
| 2189 | - if ($error != '') return $error; |
|
| 2331 | + if ($error != '') { |
|
| 2332 | + return $error; |
|
| 2333 | + } |
|
| 2190 | 2334 | } |
| 2191 | 2335 | } |
| 2192 | 2336 | $query = "UPDATE config SET value = '47' WHERE name = 'schema_version'"; |
@@ -2206,10 +2350,14 @@ discard block |
||
| 2206 | 2350 | if (!$Connection->tableExists('stats_marine_type')) { |
| 2207 | 2351 | if ($globalDBdriver == 'mysql') { |
| 2208 | 2352 | $error .= create_db::import_file('../db/stats_marine_type.sql'); |
| 2209 | - if ($error != '') return $error; |
|
| 2353 | + if ($error != '') { |
|
| 2354 | + return $error; |
|
| 2355 | + } |
|
| 2210 | 2356 | } else { |
| 2211 | 2357 | $error .= create_db::import_file('../db/pgsql/stats_marine_type.sql'); |
| 2212 | - if ($error != '') return $error; |
|
| 2358 | + if ($error != '') { |
|
| 2359 | + return $error; |
|
| 2360 | + } |
|
| 2213 | 2361 | } |
| 2214 | 2362 | } |
| 2215 | 2363 | $query = "UPDATE config SET value = '48' WHERE name = 'schema_version'"; |
@@ -2229,10 +2377,14 @@ discard block |
||
| 2229 | 2377 | if (!$Connection->tableExists('stats_tracker_type')) { |
| 2230 | 2378 | if ($globalDBdriver == 'mysql') { |
| 2231 | 2379 | $error .= create_db::import_file('../db/stats_tracker_type.sql'); |
| 2232 | - if ($error != '') return $error; |
|
| 2380 | + if ($error != '') { |
|
| 2381 | + return $error; |
|
| 2382 | + } |
|
| 2233 | 2383 | } else { |
| 2234 | 2384 | $error .= create_db::import_file('../db/pgsql/stats_tracker_type.sql'); |
| 2235 | - if ($error != '') return $error; |
|
| 2385 | + if ($error != '') { |
|
| 2386 | + return $error; |
|
| 2387 | + } |
|
| 2236 | 2388 | } |
| 2237 | 2389 | } |
| 2238 | 2390 | $query = "UPDATE config SET value = '49' WHERE name = 'schema_version'"; |
@@ -2251,10 +2403,14 @@ discard block |
||
| 2251 | 2403 | $error = ''; |
| 2252 | 2404 | if ($globalDBdriver == 'mysql') { |
| 2253 | 2405 | $error .= create_db::import_file('../db/airport.sql'); |
| 2254 | - if ($error != '') return $error; |
|
| 2406 | + if ($error != '') { |
|
| 2407 | + return $error; |
|
| 2408 | + } |
|
| 2255 | 2409 | } else { |
| 2256 | 2410 | $error .= create_db::import_file('../db/pgsql/airport.sql'); |
| 2257 | - if ($error != '') return $error; |
|
| 2411 | + if ($error != '') { |
|
| 2412 | + return $error; |
|
| 2413 | + } |
|
| 2258 | 2414 | } |
| 2259 | 2415 | $query = "UPDATE config SET value = '50' WHERE name = 'schema_version'"; |
| 2260 | 2416 | try { |
@@ -2272,14 +2428,22 @@ discard block |
||
| 2272 | 2428 | $error = ''; |
| 2273 | 2429 | if ($globalDBdriver == 'mysql') { |
| 2274 | 2430 | $error .= create_db::import_file('../db/aircraft.sql'); |
| 2275 | - if ($error != '') return $error; |
|
| 2431 | + if ($error != '') { |
|
| 2432 | + return $error; |
|
| 2433 | + } |
|
| 2276 | 2434 | $error .= create_db::import_file('../db/aircraft_block.sql'); |
| 2277 | - if ($error != '') return $error; |
|
| 2435 | + if ($error != '') { |
|
| 2436 | + return $error; |
|
| 2437 | + } |
|
| 2278 | 2438 | } else { |
| 2279 | 2439 | $error .= create_db::import_file('../db/pgsql/aircraft.sql'); |
| 2280 | - if ($error != '') return $error; |
|
| 2440 | + if ($error != '') { |
|
| 2441 | + return $error; |
|
| 2442 | + } |
|
| 2281 | 2443 | $error .= create_db::import_file('../db/pgsql/aircraft_block.sql'); |
| 2282 | - if ($error != '') return $error; |
|
| 2444 | + if ($error != '') { |
|
| 2445 | + return $error; |
|
| 2446 | + } |
|
| 2283 | 2447 | } |
| 2284 | 2448 | $query = "UPDATE config SET value = '51' WHERE name = 'schema_version'"; |
| 2285 | 2449 | try { |
@@ -2528,10 +2692,14 @@ discard block |
||
| 2528 | 2692 | $error = ''; |
| 2529 | 2693 | if ($globalDBdriver == 'mysql') { |
| 2530 | 2694 | $error .= create_db::import_file('../db/marine_race.sql'); |
| 2531 | - if ($error != '') return $error; |
|
| 2695 | + if ($error != '') { |
|
| 2696 | + return $error; |
|
| 2697 | + } |
|
| 2532 | 2698 | } else { |
| 2533 | 2699 | $error .= create_db::import_file('../db/pgsql/marine_race.sql'); |
| 2534 | - if ($error != '') return $error; |
|
| 2700 | + if ($error != '') { |
|
| 2701 | + return $error; |
|
| 2702 | + } |
|
| 2535 | 2703 | } |
| 2536 | 2704 | $query = "UPDATE config SET value = '55' WHERE name = 'schema_version'"; |
| 2537 | 2705 | try { |
@@ -2554,8 +2722,11 @@ discard block |
||
| 2554 | 2722 | if ($Connection->tableExists('aircraft')) { |
| 2555 | 2723 | if (!$Connection->tableExists('config')) { |
| 2556 | 2724 | $version = '1'; |
| 2557 | - if ($update) return self::update_from_1(); |
|
| 2558 | - else return $version; |
|
| 2725 | + if ($update) { |
|
| 2726 | + return self::update_from_1(); |
|
| 2727 | + } else { |
|
| 2728 | + return $version; |
|
| 2729 | + } |
|
| 2559 | 2730 | } else { |
| 2560 | 2731 | $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
| 2561 | 2732 | try { |
@@ -2568,223 +2739,389 @@ discard block |
||
| 2568 | 2739 | if ($update) { |
| 2569 | 2740 | if ($result['value'] == '2') { |
| 2570 | 2741 | $error = self::update_from_2(); |
| 2571 | - if ($error != '') return $error; |
|
| 2572 | - else return self::check_version(true); |
|
| 2742 | + if ($error != '') { |
|
| 2743 | + return $error; |
|
| 2744 | + } else { |
|
| 2745 | + return self::check_version(true); |
|
| 2746 | + } |
|
| 2573 | 2747 | } elseif ($result['value'] == '3') { |
| 2574 | 2748 | $error = self::update_from_3(); |
| 2575 | - if ($error != '') return $error; |
|
| 2576 | - else return self::check_version(true); |
|
| 2749 | + if ($error != '') { |
|
| 2750 | + return $error; |
|
| 2751 | + } else { |
|
| 2752 | + return self::check_version(true); |
|
| 2753 | + } |
|
| 2577 | 2754 | } elseif ($result['value'] == '4') { |
| 2578 | 2755 | $error = self::update_from_4(); |
| 2579 | - if ($error != '') return $error; |
|
| 2580 | - else return self::check_version(true); |
|
| 2756 | + if ($error != '') { |
|
| 2757 | + return $error; |
|
| 2758 | + } else { |
|
| 2759 | + return self::check_version(true); |
|
| 2760 | + } |
|
| 2581 | 2761 | } elseif ($result['value'] == '5') { |
| 2582 | 2762 | $error = self::update_from_5(); |
| 2583 | - if ($error != '') return $error; |
|
| 2584 | - else return self::check_version(true); |
|
| 2763 | + if ($error != '') { |
|
| 2764 | + return $error; |
|
| 2765 | + } else { |
|
| 2766 | + return self::check_version(true); |
|
| 2767 | + } |
|
| 2585 | 2768 | } elseif ($result['value'] == '6') { |
| 2586 | 2769 | $error = self::update_from_6(); |
| 2587 | - if ($error != '') return $error; |
|
| 2588 | - else return self::check_version(true); |
|
| 2770 | + if ($error != '') { |
|
| 2771 | + return $error; |
|
| 2772 | + } else { |
|
| 2773 | + return self::check_version(true); |
|
| 2774 | + } |
|
| 2589 | 2775 | } elseif ($result['value'] == '7') { |
| 2590 | 2776 | $error = self::update_from_7(); |
| 2591 | - if ($error != '') return $error; |
|
| 2592 | - else return self::check_version(true); |
|
| 2777 | + if ($error != '') { |
|
| 2778 | + return $error; |
|
| 2779 | + } else { |
|
| 2780 | + return self::check_version(true); |
|
| 2781 | + } |
|
| 2593 | 2782 | } elseif ($result['value'] == '8') { |
| 2594 | 2783 | $error = self::update_from_8(); |
| 2595 | - if ($error != '') return $error; |
|
| 2596 | - else return self::check_version(true); |
|
| 2784 | + if ($error != '') { |
|
| 2785 | + return $error; |
|
| 2786 | + } else { |
|
| 2787 | + return self::check_version(true); |
|
| 2788 | + } |
|
| 2597 | 2789 | } elseif ($result['value'] == '9') { |
| 2598 | 2790 | $error = self::update_from_9(); |
| 2599 | - if ($error != '') return $error; |
|
| 2600 | - else return self::check_version(true); |
|
| 2791 | + if ($error != '') { |
|
| 2792 | + return $error; |
|
| 2793 | + } else { |
|
| 2794 | + return self::check_version(true); |
|
| 2795 | + } |
|
| 2601 | 2796 | } elseif ($result['value'] == '10') { |
| 2602 | 2797 | $error = self::update_from_10(); |
| 2603 | - if ($error != '') return $error; |
|
| 2604 | - else return self::check_version(true); |
|
| 2798 | + if ($error != '') { |
|
| 2799 | + return $error; |
|
| 2800 | + } else { |
|
| 2801 | + return self::check_version(true); |
|
| 2802 | + } |
|
| 2605 | 2803 | } elseif ($result['value'] == '11') { |
| 2606 | 2804 | $error = self::update_from_11(); |
| 2607 | - if ($error != '') return $error; |
|
| 2608 | - else return self::check_version(true); |
|
| 2805 | + if ($error != '') { |
|
| 2806 | + return $error; |
|
| 2807 | + } else { |
|
| 2808 | + return self::check_version(true); |
|
| 2809 | + } |
|
| 2609 | 2810 | } elseif ($result['value'] == '12') { |
| 2610 | 2811 | $error = self::update_from_12(); |
| 2611 | - if ($error != '') return $error; |
|
| 2612 | - else return self::check_version(true); |
|
| 2812 | + if ($error != '') { |
|
| 2813 | + return $error; |
|
| 2814 | + } else { |
|
| 2815 | + return self::check_version(true); |
|
| 2816 | + } |
|
| 2613 | 2817 | } elseif ($result['value'] == '13') { |
| 2614 | 2818 | $error = self::update_from_13(); |
| 2615 | - if ($error != '') return $error; |
|
| 2616 | - else return self::check_version(true); |
|
| 2819 | + if ($error != '') { |
|
| 2820 | + return $error; |
|
| 2821 | + } else { |
|
| 2822 | + return self::check_version(true); |
|
| 2823 | + } |
|
| 2617 | 2824 | } elseif ($result['value'] == '14') { |
| 2618 | 2825 | $error = self::update_from_14(); |
| 2619 | - if ($error != '') return $error; |
|
| 2620 | - else return self::check_version(true); |
|
| 2826 | + if ($error != '') { |
|
| 2827 | + return $error; |
|
| 2828 | + } else { |
|
| 2829 | + return self::check_version(true); |
|
| 2830 | + } |
|
| 2621 | 2831 | } elseif ($result['value'] == '15') { |
| 2622 | 2832 | $error = self::update_from_15(); |
| 2623 | - if ($error != '') return $error; |
|
| 2624 | - else return self::check_version(true); |
|
| 2833 | + if ($error != '') { |
|
| 2834 | + return $error; |
|
| 2835 | + } else { |
|
| 2836 | + return self::check_version(true); |
|
| 2837 | + } |
|
| 2625 | 2838 | } elseif ($result['value'] == '16') { |
| 2626 | 2839 | $error = self::update_from_16(); |
| 2627 | - if ($error != '') return $error; |
|
| 2628 | - else return self::check_version(true); |
|
| 2840 | + if ($error != '') { |
|
| 2841 | + return $error; |
|
| 2842 | + } else { |
|
| 2843 | + return self::check_version(true); |
|
| 2844 | + } |
|
| 2629 | 2845 | } elseif ($result['value'] == '17') { |
| 2630 | 2846 | $error = self::update_from_17(); |
| 2631 | - if ($error != '') return $error; |
|
| 2632 | - else return self::check_version(true); |
|
| 2847 | + if ($error != '') { |
|
| 2848 | + return $error; |
|
| 2849 | + } else { |
|
| 2850 | + return self::check_version(true); |
|
| 2851 | + } |
|
| 2633 | 2852 | } elseif ($result['value'] == '18') { |
| 2634 | 2853 | $error = self::update_from_18(); |
| 2635 | - if ($error != '') return $error; |
|
| 2636 | - else return self::check_version(true); |
|
| 2854 | + if ($error != '') { |
|
| 2855 | + return $error; |
|
| 2856 | + } else { |
|
| 2857 | + return self::check_version(true); |
|
| 2858 | + } |
|
| 2637 | 2859 | } elseif ($result['value'] == '19') { |
| 2638 | 2860 | $error = self::update_from_19(); |
| 2639 | - if ($error != '') return $error; |
|
| 2640 | - else return self::check_version(true); |
|
| 2861 | + if ($error != '') { |
|
| 2862 | + return $error; |
|
| 2863 | + } else { |
|
| 2864 | + return self::check_version(true); |
|
| 2865 | + } |
|
| 2641 | 2866 | } elseif ($result['value'] == '20') { |
| 2642 | 2867 | $error = self::update_from_20(); |
| 2643 | - if ($error != '') return $error; |
|
| 2644 | - else return self::check_version(true); |
|
| 2868 | + if ($error != '') { |
|
| 2869 | + return $error; |
|
| 2870 | + } else { |
|
| 2871 | + return self::check_version(true); |
|
| 2872 | + } |
|
| 2645 | 2873 | } elseif ($result['value'] == '21') { |
| 2646 | 2874 | $error = self::update_from_21(); |
| 2647 | - if ($error != '') return $error; |
|
| 2648 | - else return self::check_version(true); |
|
| 2875 | + if ($error != '') { |
|
| 2876 | + return $error; |
|
| 2877 | + } else { |
|
| 2878 | + return self::check_version(true); |
|
| 2879 | + } |
|
| 2649 | 2880 | } elseif ($result['value'] == '22') { |
| 2650 | 2881 | $error = self::update_from_22(); |
| 2651 | - if ($error != '') return $error; |
|
| 2652 | - else return self::check_version(true); |
|
| 2882 | + if ($error != '') { |
|
| 2883 | + return $error; |
|
| 2884 | + } else { |
|
| 2885 | + return self::check_version(true); |
|
| 2886 | + } |
|
| 2653 | 2887 | } elseif ($result['value'] == '23') { |
| 2654 | 2888 | $error = self::update_from_23(); |
| 2655 | - if ($error != '') return $error; |
|
| 2656 | - else return self::check_version(true); |
|
| 2889 | + if ($error != '') { |
|
| 2890 | + return $error; |
|
| 2891 | + } else { |
|
| 2892 | + return self::check_version(true); |
|
| 2893 | + } |
|
| 2657 | 2894 | } elseif ($result['value'] == '24') { |
| 2658 | 2895 | $error = self::update_from_24(); |
| 2659 | - if ($error != '') return $error; |
|
| 2660 | - else return self::check_version(true); |
|
| 2896 | + if ($error != '') { |
|
| 2897 | + return $error; |
|
| 2898 | + } else { |
|
| 2899 | + return self::check_version(true); |
|
| 2900 | + } |
|
| 2661 | 2901 | } elseif ($result['value'] == '25') { |
| 2662 | 2902 | $error = self::update_from_25(); |
| 2663 | - if ($error != '') return $error; |
|
| 2664 | - else return self::check_version(true); |
|
| 2903 | + if ($error != '') { |
|
| 2904 | + return $error; |
|
| 2905 | + } else { |
|
| 2906 | + return self::check_version(true); |
|
| 2907 | + } |
|
| 2665 | 2908 | } elseif ($result['value'] == '26') { |
| 2666 | 2909 | $error = self::update_from_26(); |
| 2667 | - if ($error != '') return $error; |
|
| 2668 | - else return self::check_version(true); |
|
| 2910 | + if ($error != '') { |
|
| 2911 | + return $error; |
|
| 2912 | + } else { |
|
| 2913 | + return self::check_version(true); |
|
| 2914 | + } |
|
| 2669 | 2915 | } elseif ($result['value'] == '27') { |
| 2670 | 2916 | $error = self::update_from_27(); |
| 2671 | - if ($error != '') return $error; |
|
| 2672 | - else return self::check_version(true); |
|
| 2917 | + if ($error != '') { |
|
| 2918 | + return $error; |
|
| 2919 | + } else { |
|
| 2920 | + return self::check_version(true); |
|
| 2921 | + } |
|
| 2673 | 2922 | } elseif ($result['value'] == '28') { |
| 2674 | 2923 | $error = self::update_from_28(); |
| 2675 | - if ($error != '') return $error; |
|
| 2676 | - else return self::check_version(true); |
|
| 2924 | + if ($error != '') { |
|
| 2925 | + return $error; |
|
| 2926 | + } else { |
|
| 2927 | + return self::check_version(true); |
|
| 2928 | + } |
|
| 2677 | 2929 | } elseif ($result['value'] == '29') { |
| 2678 | 2930 | $error = self::update_from_29(); |
| 2679 | - if ($error != '') return $error; |
|
| 2680 | - else return self::check_version(true); |
|
| 2931 | + if ($error != '') { |
|
| 2932 | + return $error; |
|
| 2933 | + } else { |
|
| 2934 | + return self::check_version(true); |
|
| 2935 | + } |
|
| 2681 | 2936 | } elseif ($result['value'] == '30') { |
| 2682 | 2937 | $error = self::update_from_30(); |
| 2683 | - if ($error != '') return $error; |
|
| 2684 | - else return self::check_version(true); |
|
| 2938 | + if ($error != '') { |
|
| 2939 | + return $error; |
|
| 2940 | + } else { |
|
| 2941 | + return self::check_version(true); |
|
| 2942 | + } |
|
| 2685 | 2943 | } elseif ($result['value'] == '31') { |
| 2686 | 2944 | $error = self::update_from_31(); |
| 2687 | - if ($error != '') return $error; |
|
| 2688 | - else return self::check_version(true); |
|
| 2945 | + if ($error != '') { |
|
| 2946 | + return $error; |
|
| 2947 | + } else { |
|
| 2948 | + return self::check_version(true); |
|
| 2949 | + } |
|
| 2689 | 2950 | } elseif ($result['value'] == '32') { |
| 2690 | 2951 | $error = self::update_from_32(); |
| 2691 | - if ($error != '') return $error; |
|
| 2692 | - else return self::check_version(true); |
|
| 2952 | + if ($error != '') { |
|
| 2953 | + return $error; |
|
| 2954 | + } else { |
|
| 2955 | + return self::check_version(true); |
|
| 2956 | + } |
|
| 2693 | 2957 | } elseif ($result['value'] == '33') { |
| 2694 | 2958 | $error = self::update_from_33(); |
| 2695 | - if ($error != '') return $error; |
|
| 2696 | - else return self::check_version(true); |
|
| 2959 | + if ($error != '') { |
|
| 2960 | + return $error; |
|
| 2961 | + } else { |
|
| 2962 | + return self::check_version(true); |
|
| 2963 | + } |
|
| 2697 | 2964 | } elseif ($result['value'] == '34') { |
| 2698 | 2965 | $error = self::update_from_34(); |
| 2699 | - if ($error != '') return $error; |
|
| 2700 | - else return self::check_version(true); |
|
| 2966 | + if ($error != '') { |
|
| 2967 | + return $error; |
|
| 2968 | + } else { |
|
| 2969 | + return self::check_version(true); |
|
| 2970 | + } |
|
| 2701 | 2971 | } elseif ($result['value'] == '35') { |
| 2702 | 2972 | $error = self::update_from_35(); |
| 2703 | - if ($error != '') return $error; |
|
| 2704 | - else return self::check_version(true); |
|
| 2973 | + if ($error != '') { |
|
| 2974 | + return $error; |
|
| 2975 | + } else { |
|
| 2976 | + return self::check_version(true); |
|
| 2977 | + } |
|
| 2705 | 2978 | } elseif ($result['value'] == '36') { |
| 2706 | 2979 | $error = self::update_from_36(); |
| 2707 | - if ($error != '') return $error; |
|
| 2708 | - else return self::check_version(true); |
|
| 2980 | + if ($error != '') { |
|
| 2981 | + return $error; |
|
| 2982 | + } else { |
|
| 2983 | + return self::check_version(true); |
|
| 2984 | + } |
|
| 2709 | 2985 | } elseif ($result['value'] == '37') { |
| 2710 | 2986 | $error = self::update_from_37(); |
| 2711 | - if ($error != '') return $error; |
|
| 2712 | - else return self::check_version(true); |
|
| 2987 | + if ($error != '') { |
|
| 2988 | + return $error; |
|
| 2989 | + } else { |
|
| 2990 | + return self::check_version(true); |
|
| 2991 | + } |
|
| 2713 | 2992 | } elseif ($result['value'] == '38') { |
| 2714 | 2993 | $error = self::update_from_38(); |
| 2715 | - if ($error != '') return $error; |
|
| 2716 | - else return self::check_version(true); |
|
| 2994 | + if ($error != '') { |
|
| 2995 | + return $error; |
|
| 2996 | + } else { |
|
| 2997 | + return self::check_version(true); |
|
| 2998 | + } |
|
| 2717 | 2999 | } elseif ($result['value'] == '39') { |
| 2718 | 3000 | $error = self::update_from_39(); |
| 2719 | - if ($error != '') return $error; |
|
| 2720 | - else return self::check_version(true); |
|
| 3001 | + if ($error != '') { |
|
| 3002 | + return $error; |
|
| 3003 | + } else { |
|
| 3004 | + return self::check_version(true); |
|
| 3005 | + } |
|
| 2721 | 3006 | } elseif ($result['value'] == '40') { |
| 2722 | 3007 | $error = self::update_from_40(); |
| 2723 | - if ($error != '') return $error; |
|
| 2724 | - else return self::check_version(true); |
|
| 3008 | + if ($error != '') { |
|
| 3009 | + return $error; |
|
| 3010 | + } else { |
|
| 3011 | + return self::check_version(true); |
|
| 3012 | + } |
|
| 2725 | 3013 | } elseif ($result['value'] == '41') { |
| 2726 | 3014 | $error = self::update_from_41(); |
| 2727 | - if ($error != '') return $error; |
|
| 2728 | - else return self::check_version(true); |
|
| 3015 | + if ($error != '') { |
|
| 3016 | + return $error; |
|
| 3017 | + } else { |
|
| 3018 | + return self::check_version(true); |
|
| 3019 | + } |
|
| 2729 | 3020 | } elseif ($result['value'] == '42') { |
| 2730 | 3021 | $error = self::update_from_42(); |
| 2731 | - if ($error != '') return $error; |
|
| 2732 | - else return self::check_version(true); |
|
| 3022 | + if ($error != '') { |
|
| 3023 | + return $error; |
|
| 3024 | + } else { |
|
| 3025 | + return self::check_version(true); |
|
| 3026 | + } |
|
| 2733 | 3027 | } elseif ($result['value'] == '43') { |
| 2734 | 3028 | $error = self::update_from_43(); |
| 2735 | - if ($error != '') return $error; |
|
| 2736 | - else return self::check_version(true); |
|
| 3029 | + if ($error != '') { |
|
| 3030 | + return $error; |
|
| 3031 | + } else { |
|
| 3032 | + return self::check_version(true); |
|
| 3033 | + } |
|
| 2737 | 3034 | } elseif ($result['value'] == '44') { |
| 2738 | 3035 | $error = self::update_from_44(); |
| 2739 | - if ($error != '') return $error; |
|
| 2740 | - else return self::check_version(true); |
|
| 3036 | + if ($error != '') { |
|
| 3037 | + return $error; |
|
| 3038 | + } else { |
|
| 3039 | + return self::check_version(true); |
|
| 3040 | + } |
|
| 2741 | 3041 | } elseif ($result['value'] == '45') { |
| 2742 | 3042 | $error = self::update_from_45(); |
| 2743 | - if ($error != '') return $error; |
|
| 2744 | - else return self::check_version(true); |
|
| 3043 | + if ($error != '') { |
|
| 3044 | + return $error; |
|
| 3045 | + } else { |
|
| 3046 | + return self::check_version(true); |
|
| 3047 | + } |
|
| 2745 | 3048 | } elseif ($result['value'] == '46') { |
| 2746 | 3049 | $error = self::update_from_46(); |
| 2747 | - if ($error != '') return $error; |
|
| 2748 | - else return self::check_version(true); |
|
| 3050 | + if ($error != '') { |
|
| 3051 | + return $error; |
|
| 3052 | + } else { |
|
| 3053 | + return self::check_version(true); |
|
| 3054 | + } |
|
| 2749 | 3055 | } elseif ($result['value'] == '47') { |
| 2750 | 3056 | $error = self::update_from_47(); |
| 2751 | - if ($error != '') return $error; |
|
| 2752 | - else return self::check_version(true); |
|
| 3057 | + if ($error != '') { |
|
| 3058 | + return $error; |
|
| 3059 | + } else { |
|
| 3060 | + return self::check_version(true); |
|
| 3061 | + } |
|
| 2753 | 3062 | } elseif ($result['value'] == '48') { |
| 2754 | 3063 | $error = self::update_from_48(); |
| 2755 | - if ($error != '') return $error; |
|
| 2756 | - else return self::check_version(true); |
|
| 3064 | + if ($error != '') { |
|
| 3065 | + return $error; |
|
| 3066 | + } else { |
|
| 3067 | + return self::check_version(true); |
|
| 3068 | + } |
|
| 2757 | 3069 | } elseif ($result['value'] == '49') { |
| 2758 | 3070 | $error = self::update_from_49(); |
| 2759 | - if ($error != '') return $error; |
|
| 2760 | - else return self::check_version(true); |
|
| 3071 | + if ($error != '') { |
|
| 3072 | + return $error; |
|
| 3073 | + } else { |
|
| 3074 | + return self::check_version(true); |
|
| 3075 | + } |
|
| 2761 | 3076 | } elseif ($result['value'] == '50') { |
| 2762 | 3077 | $error = self::update_from_50(); |
| 2763 | - if ($error != '') return $error; |
|
| 2764 | - else return self::check_version(true); |
|
| 3078 | + if ($error != '') { |
|
| 3079 | + return $error; |
|
| 3080 | + } else { |
|
| 3081 | + return self::check_version(true); |
|
| 3082 | + } |
|
| 2765 | 3083 | } elseif ($result['value'] == '51') { |
| 2766 | 3084 | $error = self::update_from_51(); |
| 2767 | - if ($error != '') return $error; |
|
| 2768 | - else return self::check_version(true); |
|
| 3085 | + if ($error != '') { |
|
| 3086 | + return $error; |
|
| 3087 | + } else { |
|
| 3088 | + return self::check_version(true); |
|
| 3089 | + } |
|
| 2769 | 3090 | } elseif ($result['value'] == '52') { |
| 2770 | 3091 | $error = self::update_from_52(); |
| 2771 | - if ($error != '') return $error; |
|
| 2772 | - else return self::check_version(true); |
|
| 3092 | + if ($error != '') { |
|
| 3093 | + return $error; |
|
| 3094 | + } else { |
|
| 3095 | + return self::check_version(true); |
|
| 3096 | + } |
|
| 2773 | 3097 | } elseif ($result['value'] == '53') { |
| 2774 | 3098 | $error = self::update_from_53(); |
| 2775 | - if ($error != '') return $error; |
|
| 2776 | - else return self::check_version(true); |
|
| 3099 | + if ($error != '') { |
|
| 3100 | + return $error; |
|
| 3101 | + } else { |
|
| 3102 | + return self::check_version(true); |
|
| 3103 | + } |
|
| 2777 | 3104 | } elseif ($result['value'] == '54') { |
| 2778 | 3105 | $error = self::update_from_54(); |
| 2779 | - if ($error != '') return $error; |
|
| 2780 | - else return self::check_version(true); |
|
| 2781 | - } else return ''; |
|
| 3106 | + if ($error != '') { |
|
| 3107 | + return $error; |
|
| 3108 | + } else { |
|
| 3109 | + return self::check_version(true); |
|
| 3110 | + } |
|
| 3111 | + } else { |
|
| 3112 | + return ''; |
|
| 3113 | + } |
|
| 2782 | 3114 | } else { |
| 2783 | - if (isset($result['value']) && $result['value'] != '') return $result['value']; |
|
| 2784 | - else return 0; |
|
| 3115 | + if (isset($result['value']) && $result['value'] != '') { |
|
| 3116 | + return $result['value']; |
|
| 3117 | + } else { |
|
| 3118 | + return 0; |
|
| 3119 | + } |
|
| 2785 | 3120 | } |
| 2786 | 3121 | } |
| 2787 | - } else return $version; |
|
| 3122 | + } else { |
|
| 3123 | + return $version; |
|
| 3124 | + } |
|
| 2788 | 3125 | } |
| 2789 | 3126 | } |
| 2790 | 3127 | } |
@@ -22,10 +22,14 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function __construct($dbc = null) { |
| 24 | 24 | global $globalFilterName; |
| 25 | - if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
|
| 25 | + if (isset($globalFilterName)) { |
|
| 26 | + $this->filter_name = $globalFilterName; |
|
| 27 | + } |
|
| 26 | 28 | $Connection = new Connection($dbc); |
| 27 | 29 | $this->db = $Connection->db(); |
| 28 | - if ($this->db === null) die('Error: No DB connection. (Stats)'); |
|
| 30 | + if ($this->db === null) { |
|
| 31 | + die('Error: No DB connection. (Stats)'); |
|
| 32 | + } |
|
| 29 | 33 | } |
| 30 | 34 | |
| 31 | 35 | public function addLastStatsUpdate($type,$stats_date) { |
@@ -93,7 +97,9 @@ discard block |
||
| 93 | 97 | |
| 94 | 98 | public function getAllAirlineNames($filter_name = '') { |
| 95 | 99 | global $globalStatsFilters; |
| 96 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 100 | + if ($filter_name == '') { |
|
| 101 | + $filter_name = $this->filter_name; |
|
| 102 | + } |
|
| 97 | 103 | $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
| 98 | 104 | try { |
| 99 | 105 | $sth = $this->db->prepare($query); |
@@ -113,7 +119,9 @@ discard block |
||
| 113 | 119 | return $all; |
| 114 | 120 | } |
| 115 | 121 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
| 116 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 122 | + if ($filter_name == '') { |
|
| 123 | + $filter_name = $this->filter_name; |
|
| 124 | + } |
|
| 117 | 125 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
| 118 | 126 | try { |
| 119 | 127 | $sth = $this->db->prepare($query); |
@@ -125,7 +133,9 @@ discard block |
||
| 125 | 133 | return $all; |
| 126 | 134 | } |
| 127 | 135 | public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
| 128 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 136 | + if ($filter_name == '') { |
|
| 137 | + $filter_name = $this->filter_name; |
|
| 138 | + } |
|
| 129 | 139 | $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
| 130 | 140 | try { |
| 131 | 141 | $sth = $this->db->prepare($query); |
@@ -137,7 +147,9 @@ discard block |
||
| 137 | 147 | return $all; |
| 138 | 148 | } |
| 139 | 149 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
| 140 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 150 | + if ($filter_name == '') { |
|
| 151 | + $filter_name = $this->filter_name; |
|
| 152 | + } |
|
| 141 | 153 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
| 142 | 154 | try { |
| 143 | 155 | $sth = $this->db->prepare($query); |
@@ -150,7 +162,9 @@ discard block |
||
| 150 | 162 | } |
| 151 | 163 | |
| 152 | 164 | public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
| 153 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 165 | + if ($filter_name == '') { |
|
| 166 | + $filter_name = $this->filter_name; |
|
| 167 | + } |
|
| 154 | 168 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
| 155 | 169 | try { |
| 156 | 170 | $sth = $this->db->prepare($query); |
@@ -163,7 +177,9 @@ discard block |
||
| 163 | 177 | } |
| 164 | 178 | |
| 165 | 179 | public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
| 166 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 180 | + if ($filter_name == '') { |
|
| 181 | + $filter_name = $this->filter_name; |
|
| 182 | + } |
|
| 167 | 183 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
| 168 | 184 | try { |
| 169 | 185 | $sth = $this->db->prepare($query); |
@@ -178,7 +194,9 @@ discard block |
||
| 178 | 194 | |
| 179 | 195 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 180 | 196 | global $globalStatsFilters; |
| 181 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 197 | + if ($filter_name == '') { |
|
| 198 | + $filter_name = $this->filter_name; |
|
| 199 | + } |
|
| 182 | 200 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 183 | 201 | $Spotter = new Spotter($this->db); |
| 184 | 202 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -187,8 +205,11 @@ discard block |
||
| 187 | 205 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 188 | 206 | } |
| 189 | 207 | if ($year == '' && $month == '') { |
| 190 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 191 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 208 | + if ($limit) { |
|
| 209 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 210 | + } else { |
|
| 211 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 212 | + } |
|
| 192 | 213 | try { |
| 193 | 214 | $sth = $this->db->prepare($query); |
| 194 | 215 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -196,11 +217,16 @@ discard block |
||
| 196 | 217 | echo "error : ".$e->getMessage(); |
| 197 | 218 | } |
| 198 | 219 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 199 | - } else $all = array(); |
|
| 220 | + } else { |
|
| 221 | + $all = array(); |
|
| 222 | + } |
|
| 200 | 223 | } else { |
| 201 | 224 | if ($year == '' && $month == '') { |
| 202 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 203 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 225 | + if ($limit) { |
|
| 226 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 227 | + } else { |
|
| 228 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND aircraft_icao <> 'NA' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 229 | + } |
|
| 204 | 230 | try { |
| 205 | 231 | $sth = $this->db->prepare($query); |
| 206 | 232 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -208,7 +234,9 @@ discard block |
||
| 208 | 234 | echo "error : ".$e->getMessage(); |
| 209 | 235 | } |
| 210 | 236 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 211 | - } else $all = array(); |
|
| 237 | + } else { |
|
| 238 | + $all = array(); |
|
| 239 | + } |
|
| 212 | 240 | } |
| 213 | 241 | if (empty($all)) { |
| 214 | 242 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -227,10 +255,15 @@ discard block |
||
| 227 | 255 | } |
| 228 | 256 | public function countAllMarineTypes($limit = true, $filter_name = '',$year = '', $month = '') { |
| 229 | 257 | global $globalStatsFilters, $globalVM; |
| 230 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 258 | + if ($filter_name == '') { |
|
| 259 | + $filter_name = $this->filter_name; |
|
| 260 | + } |
|
| 231 | 261 | if ($year == '' && $month == '' && (!isset($globalVM) || $globalVM === FALSE)) { |
| 232 | - if ($limit) $query = "SELECT type AS marine_type, cnt AS marine_type_count, type_id AS marine_type_id FROM stats_marine_type WHERE filter_name = :filter_name ORDER BY marine_type_count DESC LIMIT 10 OFFSET 0"; |
|
| 233 | - else $query = "SELECT type AS marine_type, cnt AS marine_type_count, type_id AS marine_type_id FROM stats_marine_type WHERE filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 262 | + if ($limit) { |
|
| 263 | + $query = "SELECT type AS marine_type, cnt AS marine_type_count, type_id AS marine_type_id FROM stats_marine_type WHERE filter_name = :filter_name ORDER BY marine_type_count DESC LIMIT 10 OFFSET 0"; |
|
| 264 | + } else { |
|
| 265 | + $query = "SELECT type AS marine_type, cnt AS marine_type_count, type_id AS marine_type_id FROM stats_marine_type WHERE filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
| 266 | + } |
|
| 234 | 267 | try { |
| 235 | 268 | $sth = $this->db->prepare($query); |
| 236 | 269 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -238,7 +271,9 @@ discard block |
||
| 238 | 271 | echo "error : ".$e->getMessage(); |
| 239 | 272 | } |
| 240 | 273 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 241 | - } else $all = array(); |
|
| 274 | + } else { |
|
| 275 | + $all = array(); |
|
| 276 | + } |
|
| 242 | 277 | if (empty($all)) { |
| 243 | 278 | $filters = array('year' => $year,'month' => $month); |
| 244 | 279 | if ($filter_name != '') { |
@@ -252,10 +287,15 @@ discard block |
||
| 252 | 287 | } |
| 253 | 288 | public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
| 254 | 289 | global $globalStatsFilters; |
| 255 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 290 | + if ($filter_name == '') { |
|
| 291 | + $filter_name = $this->filter_name; |
|
| 292 | + } |
|
| 256 | 293 | if ($year == '' && $month == '') { |
| 257 | - if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 258 | - else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC"; |
|
| 294 | + if ($limit) { |
|
| 295 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 296 | + } else { |
|
| 297 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC"; |
|
| 298 | + } |
|
| 259 | 299 | try { |
| 260 | 300 | $sth = $this->db->prepare($query); |
| 261 | 301 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -263,7 +303,9 @@ discard block |
||
| 263 | 303 | echo "error : ".$e->getMessage(); |
| 264 | 304 | } |
| 265 | 305 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 266 | - } else $all = array(); |
|
| 306 | + } else { |
|
| 307 | + $all = array(); |
|
| 308 | + } |
|
| 267 | 309 | if (empty($all)) { |
| 268 | 310 | $Spotter = new Spotter($this->db); |
| 269 | 311 | $filters = array(); |
@@ -278,7 +320,9 @@ discard block |
||
| 278 | 320 | } |
| 279 | 321 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 280 | 322 | global $globalStatsFilters; |
| 281 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 323 | + if ($filter_name == '') { |
|
| 324 | + $filter_name = $this->filter_name; |
|
| 325 | + } |
|
| 282 | 326 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 283 | 327 | $Spotter = new Spotter($this->db); |
| 284 | 328 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -287,8 +331,11 @@ discard block |
||
| 287 | 331 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 288 | 332 | } |
| 289 | 333 | if ($year == '' && $month == '') { |
| 290 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
| 291 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
| 334 | + if ($limit) { |
|
| 335 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
| 336 | + } else { |
|
| 337 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
| 338 | + } |
|
| 292 | 339 | try { |
| 293 | 340 | $sth = $this->db->prepare($query); |
| 294 | 341 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -296,11 +343,16 @@ discard block |
||
| 296 | 343 | echo "error : ".$e->getMessage(); |
| 297 | 344 | } |
| 298 | 345 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 299 | - } else $all = array(); |
|
| 346 | + } else { |
|
| 347 | + $all = array(); |
|
| 348 | + } |
|
| 300 | 349 | } else { |
| 301 | 350 | if ($year == '' && $month == '') { |
| 302 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
| 303 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
| 351 | + if ($limit) { |
|
| 352 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
| 353 | + } else { |
|
| 354 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
| 355 | + } |
|
| 304 | 356 | try { |
| 305 | 357 | $sth = $this->db->prepare($query); |
| 306 | 358 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -308,7 +360,9 @@ discard block |
||
| 308 | 360 | echo "error : ".$e->getMessage(); |
| 309 | 361 | } |
| 310 | 362 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 311 | - } else $all = array(); |
|
| 363 | + } else { |
|
| 364 | + $all = array(); |
|
| 365 | + } |
|
| 312 | 366 | } |
| 313 | 367 | if (empty($all)) { |
| 314 | 368 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -328,7 +382,9 @@ discard block |
||
| 328 | 382 | |
| 329 | 383 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
| 330 | 384 | global $globalStatsFilters; |
| 331 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 385 | + if ($filter_name == '') { |
|
| 386 | + $filter_name = $this->filter_name; |
|
| 387 | + } |
|
| 332 | 388 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 333 | 389 | $Spotter = new Spotter($this->db); |
| 334 | 390 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -337,8 +393,11 @@ discard block |
||
| 337 | 393 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 338 | 394 | } |
| 339 | 395 | if ($year == '' && $month == '') { |
| 340 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 341 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
| 396 | + if ($limit) { |
|
| 397 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 398 | + } else { |
|
| 399 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
| 400 | + } |
|
| 342 | 401 | try { |
| 343 | 402 | $sth = $this->db->prepare($query); |
| 344 | 403 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -346,11 +405,16 @@ discard block |
||
| 346 | 405 | echo "error : ".$e->getMessage(); |
| 347 | 406 | } |
| 348 | 407 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 349 | - } else $all = array(); |
|
| 408 | + } else { |
|
| 409 | + $all = array(); |
|
| 410 | + } |
|
| 350 | 411 | } else { |
| 351 | 412 | if ($year == '' && $month == '') { |
| 352 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 353 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
| 413 | + if ($limit) { |
|
| 414 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 415 | + } else { |
|
| 416 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC"; |
|
| 417 | + } |
|
| 354 | 418 | try { |
| 355 | 419 | $sth = $this->db->prepare($query); |
| 356 | 420 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -358,7 +422,9 @@ discard block |
||
| 358 | 422 | echo "error : ".$e->getMessage(); |
| 359 | 423 | } |
| 360 | 424 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 361 | - } else $all = array(); |
|
| 425 | + } else { |
|
| 426 | + $all = array(); |
|
| 427 | + } |
|
| 362 | 428 | } |
| 363 | 429 | if (empty($all)) { |
| 364 | 430 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -377,7 +443,9 @@ discard block |
||
| 377 | 443 | } |
| 378 | 444 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
| 379 | 445 | global $globalStatsFilters; |
| 380 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 446 | + if ($filter_name == '') { |
|
| 447 | + $filter_name = $this->filter_name; |
|
| 448 | + } |
|
| 381 | 449 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 382 | 450 | $Spotter = new Spotter($this->db); |
| 383 | 451 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -385,12 +453,18 @@ discard block |
||
| 385 | 453 | foreach ($airlines as $airline) { |
| 386 | 454 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 387 | 455 | } |
| 388 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 389 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
| 456 | + if ($limit) { |
|
| 457 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 458 | + } else { |
|
| 459 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
| 460 | + } |
|
| 390 | 461 | $query_values = array(':filter_name' => $filter_name); |
| 391 | 462 | } else { |
| 392 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 393 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
| 463 | + if ($limit) { |
|
| 464 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
| 465 | + } else { |
|
| 466 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC"; |
|
| 467 | + } |
|
| 394 | 468 | $query_values = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 395 | 469 | } |
| 396 | 470 | try { |
@@ -418,17 +492,29 @@ discard block |
||
| 418 | 492 | |
| 419 | 493 | public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
| 420 | 494 | global $globalStatsFilters, $globalVATSIM, $globalIVAO; |
| 421 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 495 | + if ($filter_name == '') { |
|
| 496 | + $filter_name = $this->filter_name; |
|
| 497 | + } |
|
| 422 | 498 | if ($year == '' && $month == '') { |
| 423 | - if ($globalVATSIM) $forsource = 'vatsim'; |
|
| 424 | - if ($globalIVAO) $forsource = 'ivao'; |
|
| 499 | + if ($globalVATSIM) { |
|
| 500 | + $forsource = 'vatsim'; |
|
| 501 | + } |
|
| 502 | + if ($globalIVAO) { |
|
| 503 | + $forsource = 'ivao'; |
|
| 504 | + } |
|
| 425 | 505 | if (isset($forsource)) { |
| 426 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 427 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
|
| 506 | + if ($limit) { |
|
| 507 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 508 | + } else { |
|
| 509 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC"; |
|
| 510 | + } |
|
| 428 | 511 | $query_values = array(':filter_name' => $filter_name,':forsource' => $forsource); |
| 429 | 512 | } else { |
| 430 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 431 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
|
| 513 | + if ($limit) { |
|
| 514 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
| 515 | + } else { |
|
| 516 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC"; |
|
| 517 | + } |
|
| 432 | 518 | $query_values = array(':filter_name' => $filter_name); |
| 433 | 519 | } |
| 434 | 520 | try { |
@@ -438,7 +524,9 @@ discard block |
||
| 438 | 524 | echo "error : ".$e->getMessage(); |
| 439 | 525 | } |
| 440 | 526 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 441 | - } else $all = array(); |
|
| 527 | + } else { |
|
| 528 | + $all = array(); |
|
| 529 | + } |
|
| 442 | 530 | if (empty($all)) { |
| 443 | 531 | $Spotter = new Spotter($this->db); |
| 444 | 532 | $filters = array(); |
@@ -453,7 +541,9 @@ discard block |
||
| 453 | 541 | } |
| 454 | 542 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 455 | 543 | global $globalStatsFilters; |
| 456 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 544 | + if ($filter_name == '') { |
|
| 545 | + $filter_name = $this->filter_name; |
|
| 546 | + } |
|
| 457 | 547 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 458 | 548 | $Spotter = new Spotter($this->db); |
| 459 | 549 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -462,8 +552,11 @@ discard block |
||
| 462 | 552 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 463 | 553 | } |
| 464 | 554 | if ($year == '' && $month == '') { |
| 465 | - if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
| 466 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
| 555 | + if ($limit) { |
|
| 556 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
| 557 | + } else { |
|
| 558 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
| 559 | + } |
|
| 467 | 560 | try { |
| 468 | 561 | $sth = $this->db->prepare($query); |
| 469 | 562 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -471,11 +564,16 @@ discard block |
||
| 471 | 564 | echo "error : ".$e->getMessage(); |
| 472 | 565 | } |
| 473 | 566 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 474 | - } else $all = array(); |
|
| 567 | + } else { |
|
| 568 | + $all = array(); |
|
| 569 | + } |
|
| 475 | 570 | } else { |
| 476 | 571 | if ($year == '' && $month == '') { |
| 477 | - if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
| 478 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
| 572 | + if ($limit) { |
|
| 573 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
| 574 | + } else { |
|
| 575 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
| 576 | + } |
|
| 479 | 577 | try { |
| 480 | 578 | $sth = $this->db->prepare($query); |
| 481 | 579 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -483,7 +581,9 @@ discard block |
||
| 483 | 581 | echo "error : ".$e->getMessage(); |
| 484 | 582 | } |
| 485 | 583 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 486 | - } else $all = array(); |
|
| 584 | + } else { |
|
| 585 | + $all = array(); |
|
| 586 | + } |
|
| 487 | 587 | } |
| 488 | 588 | if (empty($all)) { |
| 489 | 589 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -502,7 +602,9 @@ discard block |
||
| 502 | 602 | } |
| 503 | 603 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 504 | 604 | global $globalStatsFilters; |
| 505 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 605 | + if ($filter_name == '') { |
|
| 606 | + $filter_name = $this->filter_name; |
|
| 607 | + } |
|
| 506 | 608 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 507 | 609 | $Spotter = new Spotter($this->db); |
| 508 | 610 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -511,8 +613,11 @@ discard block |
||
| 511 | 613 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 512 | 614 | } |
| 513 | 615 | if ($year == '' && $month == '') { |
| 514 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 515 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
| 616 | + if ($limit) { |
|
| 617 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 618 | + } else { |
|
| 619 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
| 620 | + } |
|
| 516 | 621 | try { |
| 517 | 622 | $sth = $this->db->prepare($query); |
| 518 | 623 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -520,11 +625,16 @@ discard block |
||
| 520 | 625 | echo "error : ".$e->getMessage(); |
| 521 | 626 | } |
| 522 | 627 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 523 | - } else $all = array(); |
|
| 628 | + } else { |
|
| 629 | + $all = array(); |
|
| 630 | + } |
|
| 524 | 631 | } else { |
| 525 | 632 | if ($year == '' && $month == '') { |
| 526 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 527 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
| 633 | + if ($limit) { |
|
| 634 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 635 | + } else { |
|
| 636 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
| 637 | + } |
|
| 528 | 638 | try { |
| 529 | 639 | $sth = $this->db->prepare($query); |
| 530 | 640 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -532,7 +642,9 @@ discard block |
||
| 532 | 642 | echo "error : ".$e->getMessage(); |
| 533 | 643 | } |
| 534 | 644 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 535 | - } else $all = array(); |
|
| 645 | + } else { |
|
| 646 | + $all = array(); |
|
| 647 | + } |
|
| 536 | 648 | } |
| 537 | 649 | if (empty($all)) { |
| 538 | 650 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -551,7 +663,9 @@ discard block |
||
| 551 | 663 | } |
| 552 | 664 | public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 553 | 665 | $Connection = new Connection($this->db); |
| 554 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 666 | + if ($filter_name == '') { |
|
| 667 | + $filter_name = $this->filter_name; |
|
| 668 | + } |
|
| 555 | 669 | if ($Connection->tableExists('countries')) { |
| 556 | 670 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 557 | 671 | $Spotter = new Spotter($this->db); |
@@ -561,8 +675,11 @@ discard block |
||
| 561 | 675 | foreach ($airlines as $airline) { |
| 562 | 676 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 563 | 677 | } |
| 564 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
| 565 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
| 678 | + if ($limit) { |
|
| 679 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
| 680 | + } else { |
|
| 681 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
| 682 | + } |
|
| 566 | 683 | try { |
| 567 | 684 | $sth = $this->db->prepare($query); |
| 568 | 685 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -571,11 +688,16 @@ discard block |
||
| 571 | 688 | } |
| 572 | 689 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 573 | 690 | return $all; |
| 574 | - } else return array(); |
|
| 691 | + } else { |
|
| 692 | + return array(); |
|
| 693 | + } |
|
| 575 | 694 | } else { |
| 576 | 695 | if ($year == '' && $month == '') { |
| 577 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
| 578 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
| 696 | + if ($limit) { |
|
| 697 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
| 698 | + } else { |
|
| 699 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
| 700 | + } |
|
| 579 | 701 | try { |
| 580 | 702 | $sth = $this->db->prepare($query); |
| 581 | 703 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -584,20 +706,29 @@ discard block |
||
| 584 | 706 | } |
| 585 | 707 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 586 | 708 | return $all; |
| 587 | - } else return array(); |
|
| 709 | + } else { |
|
| 710 | + return array(); |
|
| 711 | + } |
|
| 588 | 712 | } |
| 589 | 713 | $Spotter = new Spotter($this->db); |
| 590 | 714 | return $Spotter->countAllFlightOverCountries($limit); |
| 591 | - } else return array(); |
|
| 715 | + } else { |
|
| 716 | + return array(); |
|
| 717 | + } |
|
| 592 | 718 | } |
| 593 | 719 | public function countAllMarineOverCountries($limit = true, $filter_name = '',$year = '',$month = '') { |
| 594 | 720 | $Connection = new Connection($this->db); |
| 595 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 721 | + if ($filter_name == '') { |
|
| 722 | + $filter_name = $this->filter_name; |
|
| 723 | + } |
|
| 596 | 724 | if ($Connection->tableExists('countries')) { |
| 597 | 725 | $all = array(); |
| 598 | 726 | if ($year == '' && $month == '') { |
| 599 | - if ($limit) $query = "SELECT countries.iso3 as marine_country_iso3, countries.iso2 as marine_country_iso2, countries.name as marine_country, cnt as marine_count, lat as marine_country_latitude, lon as marine_country_longitude FROM stats_marine_country, countries WHERE stats_marine_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY marine_count DESC LIMIT 20 OFFSET 0"; |
|
| 600 | - else $query = "SELECT countries.iso3 as marine_country_iso3, countries.iso2 as marine_country_iso2, countries.name as marine_country, cnt as marine_count, lat as marine_country_latitude, lon as marine_country_longitude FROM stats_marine_country, countries WHERE stats_marine_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY marine_count DESC"; |
|
| 727 | + if ($limit) { |
|
| 728 | + $query = "SELECT countries.iso3 as marine_country_iso3, countries.iso2 as marine_country_iso2, countries.name as marine_country, cnt as marine_count, lat as marine_country_latitude, lon as marine_country_longitude FROM stats_marine_country, countries WHERE stats_marine_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY marine_count DESC LIMIT 20 OFFSET 0"; |
|
| 729 | + } else { |
|
| 730 | + $query = "SELECT countries.iso3 as marine_country_iso3, countries.iso2 as marine_country_iso2, countries.name as marine_country, cnt as marine_count, lat as marine_country_latitude, lon as marine_country_longitude FROM stats_marine_country, countries WHERE stats_marine_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY marine_count DESC"; |
|
| 731 | + } |
|
| 601 | 732 | try { |
| 602 | 733 | $sth = $this->db->prepare($query); |
| 603 | 734 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -615,17 +746,24 @@ discard block |
||
| 615 | 746 | $all = $Marine->countAllMarineOverCountries($limit,0,'',$filters); |
| 616 | 747 | } |
| 617 | 748 | return $all; |
| 618 | - } else return array(); |
|
| 749 | + } else { |
|
| 750 | + return array(); |
|
| 751 | + } |
|
| 619 | 752 | } |
| 620 | 753 | public function countAllTrackerOverCountries($limit = true, $filter_name = '',$year = '',$month = '') { |
| 621 | 754 | global $globalStatsFilters; |
| 622 | 755 | $Connection = new Connection($this->db); |
| 623 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 756 | + if ($filter_name == '') { |
|
| 757 | + $filter_name = $this->filter_name; |
|
| 758 | + } |
|
| 624 | 759 | if ($Connection->tableExists('countries')) { |
| 625 | 760 | $all = array(); |
| 626 | 761 | if ($year == '' && $month == '') { |
| 627 | - if ($limit) $query = "SELECT countries.iso3 as tracker_country_iso3, countries.iso2 as tracker_country_iso2, countries.name as tracker_country, cnt as tracker_count, lat as tracker_country_latitude, lon as tracker_country_longitude FROM stats_tracker_country, countries WHERE stats_tracker_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY tracker_count DESC LIMIT 20 OFFSET 0"; |
|
| 628 | - else $query = "SELECT countries.iso3 as tracker_country_iso3, countries.iso2 as tracker_country_iso2, countries.name as tracker_country, cnt as tracker_count, lat as tracker_country_latitude, lon as tracker_country_longitude FROM stats_tracker_country, countries WHERE stats_tracker_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY tracker_count DESC"; |
|
| 762 | + if ($limit) { |
|
| 763 | + $query = "SELECT countries.iso3 as tracker_country_iso3, countries.iso2 as tracker_country_iso2, countries.name as tracker_country, cnt as tracker_count, lat as tracker_country_latitude, lon as tracker_country_longitude FROM stats_tracker_country, countries WHERE stats_tracker_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY tracker_count DESC LIMIT 20 OFFSET 0"; |
|
| 764 | + } else { |
|
| 765 | + $query = "SELECT countries.iso3 as tracker_country_iso3, countries.iso2 as tracker_country_iso2, countries.name as tracker_country, cnt as tracker_count, lat as tracker_country_latitude, lon as tracker_country_longitude FROM stats_tracker_country, countries WHERE stats_tracker_country.iso2 = countries.iso2 AND filter_name = :filter_name ORDER BY tracker_count DESC"; |
|
| 766 | + } |
|
| 629 | 767 | try { |
| 630 | 768 | $sth = $this->db->prepare($query); |
| 631 | 769 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -644,14 +782,21 @@ discard block |
||
| 644 | 782 | $all = $Tracker->countAllTrackerOverCountries($limit,0,'',$filters); |
| 645 | 783 | } |
| 646 | 784 | return $all; |
| 647 | - } else return array(); |
|
| 785 | + } else { |
|
| 786 | + return array(); |
|
| 787 | + } |
|
| 648 | 788 | } |
| 649 | 789 | public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
| 650 | 790 | global $globalStatsFilters; |
| 651 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 791 | + if ($filter_name == '') { |
|
| 792 | + $filter_name = $this->filter_name; |
|
| 793 | + } |
|
| 652 | 794 | if ($year == '' && $month == '') { |
| 653 | - if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
| 654 | - else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
| 795 | + if ($limit) { |
|
| 796 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
| 797 | + } else { |
|
| 798 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
| 799 | + } |
|
| 655 | 800 | try { |
| 656 | 801 | $sth = $this->db->prepare($query); |
| 657 | 802 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -659,7 +804,9 @@ discard block |
||
| 659 | 804 | echo "error : ".$e->getMessage(); |
| 660 | 805 | } |
| 661 | 806 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 662 | - } else $all = array(); |
|
| 807 | + } else { |
|
| 808 | + $all = array(); |
|
| 809 | + } |
|
| 663 | 810 | if (empty($all)) { |
| 664 | 811 | $filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month); |
| 665 | 812 | if ($filter_name != '') { |
@@ -674,7 +821,9 @@ discard block |
||
| 674 | 821 | |
| 675 | 822 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
| 676 | 823 | global $globalStatsFilters; |
| 677 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 824 | + if ($filter_name == '') { |
|
| 825 | + $filter_name = $this->filter_name; |
|
| 826 | + } |
|
| 678 | 827 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 679 | 828 | $Spotter = new Spotter($this->db); |
| 680 | 829 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -683,8 +832,11 @@ discard block |
||
| 683 | 832 | foreach ($airlines as $airline) { |
| 684 | 833 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 685 | 834 | } |
| 686 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
| 687 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
| 835 | + if ($limit) { |
|
| 836 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
| 837 | + } else { |
|
| 838 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
| 839 | + } |
|
| 688 | 840 | try { |
| 689 | 841 | $sth = $this->db->prepare($query); |
| 690 | 842 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -692,11 +844,16 @@ discard block |
||
| 692 | 844 | echo "error : ".$e->getMessage(); |
| 693 | 845 | } |
| 694 | 846 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 695 | - } else $all = array(); |
|
| 847 | + } else { |
|
| 848 | + $all = array(); |
|
| 849 | + } |
|
| 696 | 850 | } else { |
| 697 | 851 | if ($year == '' && $month == '') { |
| 698 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
| 699 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
| 852 | + if ($limit) { |
|
| 853 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
| 854 | + } else { |
|
| 855 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
| 856 | + } |
|
| 700 | 857 | try { |
| 701 | 858 | $sth = $this->db->prepare($query); |
| 702 | 859 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -704,7 +861,9 @@ discard block |
||
| 704 | 861 | echo "error : ".$e->getMessage(); |
| 705 | 862 | } |
| 706 | 863 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 707 | - } else $all = array(); |
|
| 864 | + } else { |
|
| 865 | + $all = array(); |
|
| 866 | + } |
|
| 708 | 867 | } |
| 709 | 868 | if (empty($all)) { |
| 710 | 869 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -723,7 +882,9 @@ discard block |
||
| 723 | 882 | } |
| 724 | 883 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 725 | 884 | global $globalStatsFilters; |
| 726 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 885 | + if ($filter_name == '') { |
|
| 886 | + $filter_name = $this->filter_name; |
|
| 887 | + } |
|
| 727 | 888 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 728 | 889 | $Spotter = new Spotter($this->db); |
| 729 | 890 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -732,8 +893,11 @@ discard block |
||
| 732 | 893 | foreach ($airlines as $airline) { |
| 733 | 894 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 734 | 895 | } |
| 735 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 736 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 896 | + if ($limit) { |
|
| 897 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 898 | + } else { |
|
| 899 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 900 | + } |
|
| 737 | 901 | try { |
| 738 | 902 | $sth = $this->db->prepare($query); |
| 739 | 903 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -741,11 +905,16 @@ discard block |
||
| 741 | 905 | echo "error : ".$e->getMessage(); |
| 742 | 906 | } |
| 743 | 907 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 744 | - } else $all = array(); |
|
| 908 | + } else { |
|
| 909 | + $all = array(); |
|
| 910 | + } |
|
| 745 | 911 | } else { |
| 746 | 912 | if ($year == '' && $month == '') { |
| 747 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 748 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 913 | + if ($limit) { |
|
| 914 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 915 | + } else { |
|
| 916 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport.name AS airport_departure_name,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
| 917 | + } |
|
| 749 | 918 | try { |
| 750 | 919 | $sth = $this->db->prepare($query); |
| 751 | 920 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -753,7 +922,9 @@ discard block |
||
| 753 | 922 | echo "error : ".$e->getMessage(); |
| 754 | 923 | } |
| 755 | 924 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 756 | - } else $all = array(); |
|
| 925 | + } else { |
|
| 926 | + $all = array(); |
|
| 927 | + } |
|
| 757 | 928 | } |
| 758 | 929 | if (empty($all)) { |
| 759 | 930 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -778,7 +949,9 @@ discard block |
||
| 778 | 949 | $icao = $value['airport_departure_icao']; |
| 779 | 950 | if (isset($all[$icao])) { |
| 780 | 951 | $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 781 | - } else $all[$icao] = $value; |
|
| 952 | + } else { |
|
| 953 | + $all[$icao] = $value; |
|
| 954 | + } |
|
| 782 | 955 | } |
| 783 | 956 | $count = array(); |
| 784 | 957 | foreach ($all as $key => $row) { |
@@ -790,7 +963,9 @@ discard block |
||
| 790 | 963 | } |
| 791 | 964 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 792 | 965 | global $globalStatsFilters; |
| 793 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 966 | + if ($filter_name == '') { |
|
| 967 | + $filter_name = $this->filter_name; |
|
| 968 | + } |
|
| 794 | 969 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 795 | 970 | $Spotter = new Spotter($this->db); |
| 796 | 971 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -799,8 +974,11 @@ discard block |
||
| 799 | 974 | foreach ($airlines as $airline) { |
| 800 | 975 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 801 | 976 | } |
| 802 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 803 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 977 | + if ($limit) { |
|
| 978 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 979 | + } else { |
|
| 980 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 981 | + } |
|
| 804 | 982 | try { |
| 805 | 983 | $sth = $this->db->prepare($query); |
| 806 | 984 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -808,11 +986,16 @@ discard block |
||
| 808 | 986 | echo "error : ".$e->getMessage(); |
| 809 | 987 | } |
| 810 | 988 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 811 | - } else $all = array(); |
|
| 989 | + } else { |
|
| 990 | + $all = array(); |
|
| 991 | + } |
|
| 812 | 992 | } else { |
| 813 | 993 | if ($year == '' && $month == '') { |
| 814 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 815 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 994 | + if ($limit) { |
|
| 995 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
| 996 | + } else { |
|
| 997 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport.name AS airport_arrival_name, airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
| 998 | + } |
|
| 816 | 999 | try { |
| 817 | 1000 | $sth = $this->db->prepare($query); |
| 818 | 1001 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -820,7 +1003,9 @@ discard block |
||
| 820 | 1003 | echo "error : ".$e->getMessage(); |
| 821 | 1004 | } |
| 822 | 1005 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 823 | - } else $all = array(); |
|
| 1006 | + } else { |
|
| 1007 | + $all = array(); |
|
| 1008 | + } |
|
| 824 | 1009 | } |
| 825 | 1010 | if (empty($all)) { |
| 826 | 1011 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -845,7 +1030,9 @@ discard block |
||
| 845 | 1030 | $icao = $value['airport_arrival_icao']; |
| 846 | 1031 | if (isset($all[$icao])) { |
| 847 | 1032 | $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 848 | - } else $all[$icao] = $value; |
|
| 1033 | + } else { |
|
| 1034 | + $all[$icao] = $value; |
|
| 1035 | + } |
|
| 849 | 1036 | } |
| 850 | 1037 | $count = array(); |
| 851 | 1038 | foreach ($all as $key => $row) { |
@@ -857,7 +1044,9 @@ discard block |
||
| 857 | 1044 | } |
| 858 | 1045 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
| 859 | 1046 | global $globalDBdriver, $globalStatsFilters; |
| 860 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1047 | + if ($filter_name == '') { |
|
| 1048 | + $filter_name = $this->filter_name; |
|
| 1049 | + } |
|
| 861 | 1050 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 862 | 1051 | $Spotter = new Spotter($this->db); |
| 863 | 1052 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -866,20 +1055,32 @@ discard block |
||
| 866 | 1055 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 867 | 1056 | } |
| 868 | 1057 | if ($globalDBdriver == 'mysql') { |
| 869 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 870 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 1058 | + if ($limit) { |
|
| 1059 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 1060 | + } else { |
|
| 1061 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 1062 | + } |
|
| 871 | 1063 | } else { |
| 872 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 873 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 1064 | + if ($limit) { |
|
| 1065 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 1066 | + } else { |
|
| 1067 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date"; |
|
| 1068 | + } |
|
| 874 | 1069 | } |
| 875 | 1070 | $query_data = array(':filter_name' => $filter_name); |
| 876 | 1071 | } else { |
| 877 | 1072 | if ($globalDBdriver == 'mysql') { |
| 878 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 879 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 1073 | + if ($limit) { |
|
| 1074 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 1075 | + } else { |
|
| 1076 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 1077 | + } |
|
| 880 | 1078 | } else { |
| 881 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 882 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 1079 | + if ($limit) { |
|
| 1080 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 1081 | + } else { |
|
| 1082 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 1083 | + } |
|
| 883 | 1084 | } |
| 884 | 1085 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 885 | 1086 | } |
@@ -907,13 +1108,21 @@ discard block |
||
| 907 | 1108 | |
| 908 | 1109 | public function countAllMarineMonthsLastYear($limit = true,$filter_name = '') { |
| 909 | 1110 | global $globalDBdriver, $globalStatsFilters; |
| 910 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1111 | + if ($filter_name == '') { |
|
| 1112 | + $filter_name = $this->filter_name; |
|
| 1113 | + } |
|
| 911 | 1114 | if ($globalDBdriver == 'mysql') { |
| 912 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND filter_name = :filter_name"; |
|
| 913 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND filter_name = :filter_name"; |
|
| 1115 | + if ($limit) { |
|
| 1116 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND filter_name = :filter_name"; |
|
| 1117 | + } else { |
|
| 1118 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND filter_name = :filter_name"; |
|
| 1119 | + } |
|
| 914 | 1120 | } else { |
| 915 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND filter_name = :filter_name"; |
|
| 916 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND filter_name = :filter_name"; |
|
| 1121 | + if ($limit) { |
|
| 1122 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND filter_name = :filter_name"; |
|
| 1123 | + } else { |
|
| 1124 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'marine_bymonth' AND filter_name = :filter_name"; |
|
| 1125 | + } |
|
| 917 | 1126 | } |
| 918 | 1127 | $query_data = array(':filter_name' => $filter_name); |
| 919 | 1128 | try { |
@@ -936,13 +1145,21 @@ discard block |
||
| 936 | 1145 | |
| 937 | 1146 | public function countAllTrackerMonthsLastYear($limit = true,$filter_name = '') { |
| 938 | 1147 | global $globalDBdriver, $globalStatsFilters; |
| 939 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1148 | + if ($filter_name == '') { |
|
| 1149 | + $filter_name = $this->filter_name; |
|
| 1150 | + } |
|
| 940 | 1151 | if ($globalDBdriver == 'mysql') { |
| 941 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND filter_name = :filter_name"; |
|
| 942 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND filter_name = :filter_name"; |
|
| 1152 | + if ($limit) { |
|
| 1153 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND filter_name = :filter_name"; |
|
| 1154 | + } else { |
|
| 1155 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND filter_name = :filter_name"; |
|
| 1156 | + } |
|
| 943 | 1157 | } else { |
| 944 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND filter_name = :filter_name"; |
|
| 945 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND filter_name = :filter_name"; |
|
| 1158 | + if ($limit) { |
|
| 1159 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND filter_name = :filter_name"; |
|
| 1160 | + } else { |
|
| 1161 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'tracker_bymonth' AND filter_name = :filter_name"; |
|
| 1162 | + } |
|
| 946 | 1163 | } |
| 947 | 1164 | $query_data = array(':filter_name' => $filter_name); |
| 948 | 1165 | try { |
@@ -965,7 +1182,9 @@ discard block |
||
| 965 | 1182 | |
| 966 | 1183 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
| 967 | 1184 | global $globalStatsFilters; |
| 968 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1185 | + if ($filter_name == '') { |
|
| 1186 | + $filter_name = $this->filter_name; |
|
| 1187 | + } |
|
| 969 | 1188 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 970 | 1189 | $Spotter = new Spotter($this->db); |
| 971 | 1190 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1002,7 +1221,9 @@ discard block |
||
| 1002 | 1221 | } |
| 1003 | 1222 | public function countAllMarineDatesLastMonth($filter_name = '') { |
| 1004 | 1223 | global $globalStatsFilters; |
| 1005 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1224 | + if ($filter_name == '') { |
|
| 1225 | + $filter_name = $this->filter_name; |
|
| 1226 | + } |
|
| 1006 | 1227 | $query = "SELECT marine_date as date_name, cnt as date_count FROM stats_marine WHERE stats_type = 'month' AND filter_name = :filter_name"; |
| 1007 | 1228 | $query_data = array(':filter_name' => $filter_name); |
| 1008 | 1229 | try { |
@@ -1024,7 +1245,9 @@ discard block |
||
| 1024 | 1245 | } |
| 1025 | 1246 | public function countAllTrackerDatesLastMonth($filter_name = '') { |
| 1026 | 1247 | global $globalStatsFilters; |
| 1027 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1248 | + if ($filter_name == '') { |
|
| 1249 | + $filter_name = $this->filter_name; |
|
| 1250 | + } |
|
| 1028 | 1251 | $query = "SELECT tracker_date as date_name, cnt as date_count FROM stats_tracker WHERE stats_type = 'month' AND filter_name = :filter_name"; |
| 1029 | 1252 | $query_data = array(':filter_name' => $filter_name); |
| 1030 | 1253 | try { |
@@ -1046,7 +1269,9 @@ discard block |
||
| 1046 | 1269 | } |
| 1047 | 1270 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
| 1048 | 1271 | global $globalDBdriver, $globalStatsFilters; |
| 1049 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1272 | + if ($filter_name == '') { |
|
| 1273 | + $filter_name = $this->filter_name; |
|
| 1274 | + } |
|
| 1050 | 1275 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1051 | 1276 | $Spotter = new Spotter($this->db); |
| 1052 | 1277 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1091,7 +1316,9 @@ discard block |
||
| 1091 | 1316 | } |
| 1092 | 1317 | public function countAllMarineDatesLast7Days($filter_name = '') { |
| 1093 | 1318 | global $globalDBdriver, $globalStatsFilters; |
| 1094 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1319 | + if ($filter_name == '') { |
|
| 1320 | + $filter_name = $this->filter_name; |
|
| 1321 | + } |
|
| 1095 | 1322 | if ($globalDBdriver == 'mysql') { |
| 1096 | 1323 | $query = "SELECT marine_date as date_name, cnt as date_count FROM stats_marine WHERE stats_type = 'month' AND marine_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND filter_name = :filter_name"; |
| 1097 | 1324 | } else { |
@@ -1117,7 +1344,9 @@ discard block |
||
| 1117 | 1344 | } |
| 1118 | 1345 | public function countAllTrackerDatesLast7Days($filter_name = '') { |
| 1119 | 1346 | global $globalDBdriver, $globalStatsFilters; |
| 1120 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1347 | + if ($filter_name == '') { |
|
| 1348 | + $filter_name = $this->filter_name; |
|
| 1349 | + } |
|
| 1121 | 1350 | if ($globalDBdriver == 'mysql') { |
| 1122 | 1351 | $query = "SELECT tracker_date as date_name, cnt as date_count FROM stats_tracker WHERE stats_type = 'month' AND tracker_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND filter_name = :filter_name"; |
| 1123 | 1352 | } else { |
@@ -1143,7 +1372,9 @@ discard block |
||
| 1143 | 1372 | } |
| 1144 | 1373 | public function countAllDates($stats_airline = '',$filter_name = '') { |
| 1145 | 1374 | global $globalStatsFilters; |
| 1146 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1375 | + if ($filter_name == '') { |
|
| 1376 | + $filter_name = $this->filter_name; |
|
| 1377 | + } |
|
| 1147 | 1378 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1148 | 1379 | $Spotter = new Spotter($this->db); |
| 1149 | 1380 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1180,7 +1411,9 @@ discard block |
||
| 1180 | 1411 | } |
| 1181 | 1412 | public function countAllDatesMarine($filter_name = '') { |
| 1182 | 1413 | global $globalStatsFilters; |
| 1183 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1414 | + if ($filter_name == '') { |
|
| 1415 | + $filter_name = $this->filter_name; |
|
| 1416 | + } |
|
| 1184 | 1417 | $query = "SELECT marine_date as date_name, cnt as date_count FROM stats_marine WHERE stats_type = 'date' AND filter_name = :filter_name ORDER BY date_count DESC"; |
| 1185 | 1418 | $query_data = array(':filter_name' => $filter_name); |
| 1186 | 1419 | try { |
@@ -1202,7 +1435,9 @@ discard block |
||
| 1202 | 1435 | } |
| 1203 | 1436 | public function countAllDatesTracker($filter_name = '') { |
| 1204 | 1437 | global $globalStatsFilters; |
| 1205 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1438 | + if ($filter_name == '') { |
|
| 1439 | + $filter_name = $this->filter_name; |
|
| 1440 | + } |
|
| 1206 | 1441 | $query = "SELECT tracker_date as date_name, cnt as date_count FROM stats_tracker WHERE stats_type = 'date' AND filter_name = :filter_name ORDER BY date_count DESC"; |
| 1207 | 1442 | $query_data = array(':filter_name' => $filter_name); |
| 1208 | 1443 | try { |
@@ -1224,7 +1459,9 @@ discard block |
||
| 1224 | 1459 | } |
| 1225 | 1460 | public function countAllDatesByAirlines($filter_name = '') { |
| 1226 | 1461 | global $globalStatsFilters; |
| 1227 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1462 | + if ($filter_name == '') { |
|
| 1463 | + $filter_name = $this->filter_name; |
|
| 1464 | + } |
|
| 1228 | 1465 | $query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name"; |
| 1229 | 1466 | $query_data = array('filter_name' => $filter_name); |
| 1230 | 1467 | try { |
@@ -1246,7 +1483,9 @@ discard block |
||
| 1246 | 1483 | } |
| 1247 | 1484 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
| 1248 | 1485 | global $globalStatsFilters, $globalDBdriver; |
| 1249 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1486 | + if ($filter_name == '') { |
|
| 1487 | + $filter_name = $this->filter_name; |
|
| 1488 | + } |
|
| 1250 | 1489 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1251 | 1490 | $Spotter = new Spotter($this->db); |
| 1252 | 1491 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1331,7 +1570,9 @@ discard block |
||
| 1331 | 1570 | } |
| 1332 | 1571 | public function countAllMilitaryMonths($filter_name = '') { |
| 1333 | 1572 | global $globalStatsFilters; |
| 1334 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1573 | + if ($filter_name == '') { |
|
| 1574 | + $filter_name = $this->filter_name; |
|
| 1575 | + } |
|
| 1335 | 1576 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
| 1336 | 1577 | try { |
| 1337 | 1578 | $sth = $this->db->prepare($query); |
@@ -1352,7 +1593,9 @@ discard block |
||
| 1352 | 1593 | } |
| 1353 | 1594 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
| 1354 | 1595 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 1355 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1596 | + if ($filter_name == '') { |
|
| 1597 | + $filter_name = $this->filter_name; |
|
| 1598 | + } |
|
| 1356 | 1599 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1357 | 1600 | $Spotter = new Spotter($this->db); |
| 1358 | 1601 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1360,12 +1603,18 @@ discard block |
||
| 1360 | 1603 | foreach ($airlines as $airline) { |
| 1361 | 1604 | $alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao'])); |
| 1362 | 1605 | } |
| 1363 | - if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 1364 | - else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 1606 | + if ($limit) { |
|
| 1607 | + $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 1608 | + } else { |
|
| 1609 | + $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date"; |
|
| 1610 | + } |
|
| 1365 | 1611 | $query_data = array(':filter_name' => $filter_name); |
| 1366 | 1612 | } else { |
| 1367 | - if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 1368 | - else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 1613 | + if ($limit) { |
|
| 1614 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 1615 | + } else { |
|
| 1616 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 1617 | + } |
|
| 1369 | 1618 | $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
| 1370 | 1619 | } |
| 1371 | 1620 | if ($orderby == 'hour') { |
@@ -1375,7 +1624,9 @@ discard block |
||
| 1375 | 1624 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
| 1376 | 1625 | } |
| 1377 | 1626 | } |
| 1378 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
| 1627 | + if ($orderby == 'count') { |
|
| 1628 | + $query .= " ORDER BY hour_count DESC"; |
|
| 1629 | + } |
|
| 1379 | 1630 | try { |
| 1380 | 1631 | $sth = $this->db->prepare($query); |
| 1381 | 1632 | $sth->execute($query_data); |
@@ -1399,9 +1650,14 @@ discard block |
||
| 1399 | 1650 | } |
| 1400 | 1651 | public function countAllMarineHours($orderby = 'hour',$limit = true,$filter_name = '') { |
| 1401 | 1652 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 1402 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1403 | - if ($limit) $query = "SELECT marine_date as hour_name, cnt as hour_count FROM stats_marine WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
| 1404 | - else $query = "SELECT marine_date as hour_name, cnt as hour_count FROM stats_marine WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
| 1653 | + if ($filter_name == '') { |
|
| 1654 | + $filter_name = $this->filter_name; |
|
| 1655 | + } |
|
| 1656 | + if ($limit) { |
|
| 1657 | + $query = "SELECT marine_date as hour_name, cnt as hour_count FROM stats_marine WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
| 1658 | + } else { |
|
| 1659 | + $query = "SELECT marine_date as hour_name, cnt as hour_count FROM stats_marine WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
| 1660 | + } |
|
| 1405 | 1661 | $query_data = array(':filter_name' => $filter_name); |
| 1406 | 1662 | if ($orderby == 'hour') { |
| 1407 | 1663 | if ($globalDBdriver == 'mysql') { |
@@ -1410,7 +1666,9 @@ discard block |
||
| 1410 | 1666 | $query .= " ORDER BY CAST(marine_date AS integer) ASC"; |
| 1411 | 1667 | } |
| 1412 | 1668 | } |
| 1413 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
| 1669 | + if ($orderby == 'count') { |
|
| 1670 | + $query .= " ORDER BY hour_count DESC"; |
|
| 1671 | + } |
|
| 1414 | 1672 | try { |
| 1415 | 1673 | $sth = $this->db->prepare($query); |
| 1416 | 1674 | $sth->execute($query_data); |
@@ -1430,9 +1688,14 @@ discard block |
||
| 1430 | 1688 | } |
| 1431 | 1689 | public function countAllTrackerHours($orderby = 'hour',$limit = true,$filter_name = '') { |
| 1432 | 1690 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
| 1433 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1434 | - if ($limit) $query = "SELECT tracker_date as hour_name, cnt as hour_count FROM stats_tracker WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
| 1435 | - else $query = "SELECT tracker_date as hour_name, cnt as hour_count FROM stats_tracker WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
| 1691 | + if ($filter_name == '') { |
|
| 1692 | + $filter_name = $this->filter_name; |
|
| 1693 | + } |
|
| 1694 | + if ($limit) { |
|
| 1695 | + $query = "SELECT tracker_date as hour_name, cnt as hour_count FROM stats_tracker WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
| 1696 | + } else { |
|
| 1697 | + $query = "SELECT tracker_date as hour_name, cnt as hour_count FROM stats_tracker WHERE stats_type = 'hour' AND filter_name = :filter_name"; |
|
| 1698 | + } |
|
| 1436 | 1699 | $query_data = array(':filter_name' => $filter_name); |
| 1437 | 1700 | if ($orderby == 'hour') { |
| 1438 | 1701 | if ($globalDBdriver == 'mysql') { |
@@ -1441,7 +1704,9 @@ discard block |
||
| 1441 | 1704 | $query .= " ORDER BY CAST(tracker_date AS integer) ASC"; |
| 1442 | 1705 | } |
| 1443 | 1706 | } |
| 1444 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
| 1707 | + if ($orderby == 'count') { |
|
| 1708 | + $query .= " ORDER BY hour_count DESC"; |
|
| 1709 | + } |
|
| 1445 | 1710 | try { |
| 1446 | 1711 | $sth = $this->db->prepare($query); |
| 1447 | 1712 | $sth->execute($query_data); |
@@ -1461,8 +1726,12 @@ discard block |
||
| 1461 | 1726 | } |
| 1462 | 1727 | public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
| 1463 | 1728 | global $globalStatsFilters; |
| 1464 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1465 | - if ($year == '') $year = date('Y'); |
|
| 1729 | + if ($filter_name == '') { |
|
| 1730 | + $filter_name = $this->filter_name; |
|
| 1731 | + } |
|
| 1732 | + if ($year == '') { |
|
| 1733 | + $year = date('Y'); |
|
| 1734 | + } |
|
| 1466 | 1735 | $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
| 1467 | 1736 | if (empty($all)) { |
| 1468 | 1737 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -1481,8 +1750,12 @@ discard block |
||
| 1481 | 1750 | } |
| 1482 | 1751 | public function countOverallMarine($filter_name = '',$year = '',$month = '') { |
| 1483 | 1752 | global $globalStatsFilters; |
| 1484 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1485 | - if ($year == '') $year = date('Y'); |
|
| 1753 | + if ($filter_name == '') { |
|
| 1754 | + $filter_name = $this->filter_name; |
|
| 1755 | + } |
|
| 1756 | + if ($year == '') { |
|
| 1757 | + $year = date('Y'); |
|
| 1758 | + } |
|
| 1486 | 1759 | $all = $this->getSumStats('marine_bymonth',$year,'',$filter_name,$month); |
| 1487 | 1760 | if (empty($all)) { |
| 1488 | 1761 | $filters = array('year' => $year,'month' => $month); |
@@ -1497,8 +1770,12 @@ discard block |
||
| 1497 | 1770 | } |
| 1498 | 1771 | public function countOverallTracker($filter_name = '',$year = '',$month = '') { |
| 1499 | 1772 | global $globalStatsFilters; |
| 1500 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1501 | - if ($year == '') $year = date('Y'); |
|
| 1773 | + if ($filter_name == '') { |
|
| 1774 | + $filter_name = $this->filter_name; |
|
| 1775 | + } |
|
| 1776 | + if ($year == '') { |
|
| 1777 | + $year = date('Y'); |
|
| 1778 | + } |
|
| 1502 | 1779 | $all = $this->getSumStats('tracker_bymonth',$year,'',$filter_name,$month); |
| 1503 | 1780 | if (empty($all)) { |
| 1504 | 1781 | $filters = array('year' => $year,'month' => $month); |
@@ -1513,8 +1790,12 @@ discard block |
||
| 1513 | 1790 | } |
| 1514 | 1791 | public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
| 1515 | 1792 | global $globalStatsFilters; |
| 1516 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1517 | - if ($year == '') $year = date('Y'); |
|
| 1793 | + if ($filter_name == '') { |
|
| 1794 | + $filter_name = $this->filter_name; |
|
| 1795 | + } |
|
| 1796 | + if ($year == '') { |
|
| 1797 | + $year = date('Y'); |
|
| 1798 | + } |
|
| 1518 | 1799 | $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
| 1519 | 1800 | if (empty($all)) { |
| 1520 | 1801 | $filters = array(); |
@@ -1530,8 +1811,12 @@ discard block |
||
| 1530 | 1811 | } |
| 1531 | 1812 | public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
| 1532 | 1813 | global $globalStatsFilters; |
| 1533 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1534 | - if ($year == '') $year = date('Y'); |
|
| 1814 | + if ($filter_name == '') { |
|
| 1815 | + $filter_name = $this->filter_name; |
|
| 1816 | + } |
|
| 1817 | + if ($year == '') { |
|
| 1818 | + $year = date('Y'); |
|
| 1819 | + } |
|
| 1535 | 1820 | $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
| 1536 | 1821 | if (empty($all)) { |
| 1537 | 1822 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -1550,7 +1835,9 @@ discard block |
||
| 1550 | 1835 | } |
| 1551 | 1836 | public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
| 1552 | 1837 | global $globalStatsFilters; |
| 1553 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1838 | + if ($filter_name == '') { |
|
| 1839 | + $filter_name = $this->filter_name; |
|
| 1840 | + } |
|
| 1554 | 1841 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1555 | 1842 | $Spotter = new Spotter($this->db); |
| 1556 | 1843 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1568,7 +1855,9 @@ discard block |
||
| 1568 | 1855 | } |
| 1569 | 1856 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1570 | 1857 | $all = $result[0]['nb']; |
| 1571 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 1858 | + } else { |
|
| 1859 | + $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 1860 | + } |
|
| 1572 | 1861 | } else { |
| 1573 | 1862 | if ($year == '' && $month == '') { |
| 1574 | 1863 | $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -1580,7 +1869,9 @@ discard block |
||
| 1580 | 1869 | } |
| 1581 | 1870 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1582 | 1871 | $all = $result[0]['nb']; |
| 1583 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 1872 | + } else { |
|
| 1873 | + $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
| 1874 | + } |
|
| 1584 | 1875 | } |
| 1585 | 1876 | if (empty($all)) { |
| 1586 | 1877 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
@@ -1599,7 +1890,9 @@ discard block |
||
| 1599 | 1890 | } |
| 1600 | 1891 | public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
| 1601 | 1892 | global $globalStatsFilters; |
| 1602 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1893 | + if ($filter_name == '') { |
|
| 1894 | + $filter_name = $this->filter_name; |
|
| 1895 | + } |
|
| 1603 | 1896 | if ($year == '' && $month == '') { |
| 1604 | 1897 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
| 1605 | 1898 | try { |
@@ -1610,7 +1903,9 @@ discard block |
||
| 1610 | 1903 | } |
| 1611 | 1904 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1612 | 1905 | $all = $result[0]['nb_airline']; |
| 1613 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 1906 | + } else { |
|
| 1907 | + $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
| 1908 | + } |
|
| 1614 | 1909 | if (empty($all)) { |
| 1615 | 1910 | $filters = array(); |
| 1616 | 1911 | $filters = array('year' => $year,'month' => $month); |
@@ -1625,7 +1920,9 @@ discard block |
||
| 1625 | 1920 | } |
| 1626 | 1921 | public function countOverallMarineTypes($filter_name = '',$year = '',$month = '') { |
| 1627 | 1922 | global $globalStatsFilters; |
| 1628 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1923 | + if ($filter_name == '') { |
|
| 1924 | + $filter_name = $this->filter_name; |
|
| 1925 | + } |
|
| 1629 | 1926 | $all = array(); |
| 1630 | 1927 | if ($year == '' && $month == '') { |
| 1631 | 1928 | $query = "SELECT COUNT(*) AS nb_type FROM stats_marine_type WHERE filter_name = :filter_name"; |
@@ -1652,7 +1949,9 @@ discard block |
||
| 1652 | 1949 | } |
| 1653 | 1950 | public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
| 1654 | 1951 | global $globalStatsFilters; |
| 1655 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 1952 | + if ($filter_name == '') { |
|
| 1953 | + $filter_name = $this->filter_name; |
|
| 1954 | + } |
|
| 1656 | 1955 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1657 | 1956 | $Spotter = new Spotter($this->db); |
| 1658 | 1957 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1707,7 +2006,9 @@ discard block |
||
| 1707 | 2006 | } |
| 1708 | 2007 | public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
| 1709 | 2008 | global $globalStatsFilters; |
| 1710 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2009 | + if ($filter_name == '') { |
|
| 2010 | + $filter_name = $this->filter_name; |
|
| 2011 | + } |
|
| 1711 | 2012 | //if ($year == '') $year = date('Y'); |
| 1712 | 2013 | if ($year == '' && $month == '') { |
| 1713 | 2014 | $query = "SELECT count(*) as nb FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -1736,7 +2037,9 @@ discard block |
||
| 1736 | 2037 | } |
| 1737 | 2038 | |
| 1738 | 2039 | public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
| 1739 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2040 | + if ($filter_name == '') { |
|
| 2041 | + $filter_name = $this->filter_name; |
|
| 2042 | + } |
|
| 1740 | 2043 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1741 | 2044 | $Spotter = new Spotter($this->db); |
| 1742 | 2045 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1760,7 +2063,9 @@ discard block |
||
| 1760 | 2063 | return $all; |
| 1761 | 2064 | } |
| 1762 | 2065 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
| 1763 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2066 | + if ($filter_name == '') { |
|
| 2067 | + $filter_name = $this->filter_name; |
|
| 2068 | + } |
|
| 1764 | 2069 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
| 1765 | 2070 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 1766 | 2071 | try { |
@@ -1773,7 +2078,9 @@ discard block |
||
| 1773 | 2078 | return $all; |
| 1774 | 2079 | } |
| 1775 | 2080 | public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
| 1776 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2081 | + if ($filter_name == '') { |
|
| 2082 | + $filter_name = $this->filter_name; |
|
| 2083 | + } |
|
| 1777 | 2084 | $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 1778 | 2085 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 1779 | 2086 | try { |
@@ -1784,7 +2091,9 @@ discard block |
||
| 1784 | 2091 | } |
| 1785 | 2092 | } |
| 1786 | 2093 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
| 1787 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2094 | + if ($filter_name == '') { |
|
| 2095 | + $filter_name = $this->filter_name; |
|
| 2096 | + } |
|
| 1788 | 2097 | global $globalArchiveMonths, $globalDBdriver; |
| 1789 | 2098 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1790 | 2099 | $Spotter = new Spotter($this->db); |
@@ -1840,7 +2149,9 @@ discard block |
||
| 1840 | 2149 | } |
| 1841 | 2150 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
| 1842 | 2151 | global $globalArchiveMonths, $globalDBdriver; |
| 1843 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2152 | + if ($filter_name == '') { |
|
| 2153 | + $filter_name = $this->filter_name; |
|
| 2154 | + } |
|
| 1844 | 2155 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1845 | 2156 | $Spotter = new Spotter($this->db); |
| 1846 | 2157 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1873,7 +2184,9 @@ discard block |
||
| 1873 | 2184 | } |
| 1874 | 2185 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
| 1875 | 2186 | global $globalArchiveMonths, $globalDBdriver; |
| 1876 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2187 | + if ($filter_name == '') { |
|
| 2188 | + $filter_name = $this->filter_name; |
|
| 2189 | + } |
|
| 1877 | 2190 | if (strpos($stats_airline,'alliance_') !== FALSE) { |
| 1878 | 2191 | $Spotter = new Spotter($this->db); |
| 1879 | 2192 | $airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline))); |
@@ -1904,7 +2217,9 @@ discard block |
||
| 1904 | 2217 | } |
| 1905 | 2218 | public function getStatsAirlineTotal($filter_name = '') { |
| 1906 | 2219 | global $globalArchiveMonths, $globalDBdriver; |
| 1907 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2220 | + if ($filter_name == '') { |
|
| 2221 | + $filter_name = $this->filter_name; |
|
| 2222 | + } |
|
| 1908 | 2223 | if ($globalDBdriver == 'mysql') { |
| 1909 | 2224 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
| 1910 | 2225 | } else { |
@@ -1921,7 +2236,9 @@ discard block |
||
| 1921 | 2236 | } |
| 1922 | 2237 | public function getStatsOwnerTotal($filter_name = '') { |
| 1923 | 2238 | global $globalArchiveMonths, $globalDBdriver; |
| 1924 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2239 | + if ($filter_name == '') { |
|
| 2240 | + $filter_name = $this->filter_name; |
|
| 2241 | + } |
|
| 1925 | 2242 | if ($globalDBdriver == 'mysql') { |
| 1926 | 2243 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
| 1927 | 2244 | } else { |
@@ -1938,7 +2255,9 @@ discard block |
||
| 1938 | 2255 | } |
| 1939 | 2256 | public function getStatsOwner($owner_name,$filter_name = '') { |
| 1940 | 2257 | global $globalArchiveMonths, $globalDBdriver; |
| 1941 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2258 | + if ($filter_name == '') { |
|
| 2259 | + $filter_name = $this->filter_name; |
|
| 2260 | + } |
|
| 1942 | 2261 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
| 1943 | 2262 | try { |
| 1944 | 2263 | $sth = $this->db->prepare($query); |
@@ -1947,12 +2266,17 @@ discard block |
||
| 1947 | 2266 | echo "error : ".$e->getMessage(); |
| 1948 | 2267 | } |
| 1949 | 2268 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1950 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
| 1951 | - else return 0; |
|
| 2269 | + if (isset($all[0]['cnt'])) { |
|
| 2270 | + return $all[0]['cnt']; |
|
| 2271 | + } else { |
|
| 2272 | + return 0; |
|
| 2273 | + } |
|
| 1952 | 2274 | } |
| 1953 | 2275 | public function getStatsPilotTotal($filter_name = '') { |
| 1954 | 2276 | global $globalArchiveMonths, $globalDBdriver; |
| 1955 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2277 | + if ($filter_name == '') { |
|
| 2278 | + $filter_name = $this->filter_name; |
|
| 2279 | + } |
|
| 1956 | 2280 | if ($globalDBdriver == 'mysql') { |
| 1957 | 2281 | $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
| 1958 | 2282 | } else { |
@@ -1969,7 +2293,9 @@ discard block |
||
| 1969 | 2293 | } |
| 1970 | 2294 | public function getStatsPilot($pilot,$filter_name = '') { |
| 1971 | 2295 | global $globalArchiveMonths, $globalDBdriver; |
| 1972 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2296 | + if ($filter_name == '') { |
|
| 2297 | + $filter_name = $this->filter_name; |
|
| 2298 | + } |
|
| 1973 | 2299 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
| 1974 | 2300 | try { |
| 1975 | 2301 | $sth = $this->db->prepare($query); |
@@ -1978,13 +2304,18 @@ discard block |
||
| 1978 | 2304 | echo "error : ".$e->getMessage(); |
| 1979 | 2305 | } |
| 1980 | 2306 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1981 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
| 1982 | - else return 0; |
|
| 2307 | + if (isset($all[0]['cnt'])) { |
|
| 2308 | + return $all[0]['cnt']; |
|
| 2309 | + } else { |
|
| 2310 | + return 0; |
|
| 2311 | + } |
|
| 1983 | 2312 | } |
| 1984 | 2313 | |
| 1985 | 2314 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 1986 | 2315 | global $globalDBdriver; |
| 1987 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2316 | + if ($filter_name == '') { |
|
| 2317 | + $filter_name = $this->filter_name; |
|
| 2318 | + } |
|
| 1988 | 2319 | if ($globalDBdriver == 'mysql') { |
| 1989 | 2320 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
| 1990 | 2321 | } else { |
@@ -2000,7 +2331,9 @@ discard block |
||
| 2000 | 2331 | } |
| 2001 | 2332 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 2002 | 2333 | global $globalDBdriver; |
| 2003 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
| 2334 | + if ($filter_name == '') { |
|
| 2335 | + $filter_name = $this->filter_name; |
|
| 2336 | + } |
|
| 2004 | 2337 | if ($globalDBdriver == 'mysql') { |
| 2005 | 2338 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
| 2006 | 2339 | } else { |
@@ -2519,27 +2852,37 @@ discard block |
||
| 2519 | 2852 | date_default_timezone_set('UTC'); |
| 2520 | 2853 | if ((isset($globalMarine) && $globalMarine) || (isset($globalMasterServer) && $globalMasterServer)) { |
| 2521 | 2854 | $last_update = $this->getLastStatsUpdate('last_update_stats_marine'); |
| 2522 | - if ($globalDebug) echo '!!! Update Marine stats !!!'."\n"; |
|
| 2855 | + if ($globalDebug) { |
|
| 2856 | + echo '!!! Update Marine stats !!!'."\n"; |
|
| 2857 | + } |
|
| 2523 | 2858 | if (isset($last_update[0]['value'])) { |
| 2524 | 2859 | $last_update_day = $last_update[0]['value']; |
| 2525 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
| 2860 | + } else { |
|
| 2861 | + $last_update_day = '2012-12-12 12:12:12'; |
|
| 2862 | + } |
|
| 2526 | 2863 | $reset = false; |
| 2527 | 2864 | $Marine = new Marine($this->db); |
| 2528 | 2865 | $filtername = 'marine'; |
| 2529 | 2866 | if ($Connection->tableExists('countries')) { |
| 2530 | - if ($globalDebug) echo 'Count all vessels by countries...'."\n"; |
|
| 2867 | + if ($globalDebug) { |
|
| 2868 | + echo 'Count all vessels by countries...'."\n"; |
|
| 2869 | + } |
|
| 2531 | 2870 | $alldata = $Marine->countAllMarineOverCountries(false,0,$last_update_day); |
| 2532 | 2871 | foreach ($alldata as $number) { |
| 2533 | 2872 | echo $this->addStatCountryMarine($number['marine_country_iso2'],$number['marine_country_iso3'],$number['marine_country'],$number['marine_count'],'','',$reset); |
| 2534 | 2873 | } |
| 2535 | 2874 | } |
| 2536 | - if ($globalDebug) echo 'Count all vessels by months...'."\n"; |
|
| 2875 | + if ($globalDebug) { |
|
| 2876 | + echo 'Count all vessels by months...'."\n"; |
|
| 2877 | + } |
|
| 2537 | 2878 | $last_month = date('Y-m-01 00:00:00', strtotime('-1 month', strtotime($last_update_day))); |
| 2538 | 2879 | $filter_last_month = array('since_date' => $last_month); |
| 2539 | 2880 | $alldata = $Marine->countAllMonths($filter_last_month); |
| 2540 | 2881 | $lastyear = false; |
| 2541 | 2882 | foreach ($alldata as $number) { |
| 2542 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 2883 | + if ($number['year_name'] != date('Y')) { |
|
| 2884 | + $lastyear = true; |
|
| 2885 | + } |
|
| 2543 | 2886 | $this->addStat('marine_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 2544 | 2887 | } |
| 2545 | 2888 | echo 'Marine data...'."\n"; |
@@ -2569,7 +2912,9 @@ discard block |
||
| 2569 | 2912 | foreach ($alldata as $number) { |
| 2570 | 2913 | $this->addStatMarine('hour',$number['hour_name'],$number['hour_count']); |
| 2571 | 2914 | } |
| 2572 | - if ($globalDebug) echo 'Count all types...'."\n"; |
|
| 2915 | + if ($globalDebug) { |
|
| 2916 | + echo 'Count all types...'."\n"; |
|
| 2917 | + } |
|
| 2573 | 2918 | $alldata = $Marine->countAllMarineTypes(false,0,$last_update_day); |
| 2574 | 2919 | foreach ($alldata as $number) { |
| 2575 | 2920 | $this->addStatMarineType($number['marine_type'],$number['marine_type_id'],$number['marine_type_count'],'',$reset); |
@@ -2581,26 +2926,36 @@ discard block |
||
| 2581 | 2926 | } |
| 2582 | 2927 | if ((isset($globalTracker) && $globalTracker) || (isset($globalMasterServer) && $globalMasterServer)) { |
| 2583 | 2928 | $last_update = $this->getLastStatsUpdate('last_update_stats_tracker'); |
| 2584 | - if ($globalDebug) echo '!!! Update tracker stats !!!'."\n"; |
|
| 2929 | + if ($globalDebug) { |
|
| 2930 | + echo '!!! Update tracker stats !!!'."\n"; |
|
| 2931 | + } |
|
| 2585 | 2932 | if (isset($last_update[0]['value'])) { |
| 2586 | 2933 | $last_update_day = $last_update[0]['value']; |
| 2587 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
| 2934 | + } else { |
|
| 2935 | + $last_update_day = '2012-12-12 12:12:12'; |
|
| 2936 | + } |
|
| 2588 | 2937 | $reset = false; |
| 2589 | 2938 | $Tracker = new Tracker($this->db); |
| 2590 | 2939 | if ($Connection->tableExists('countries')) { |
| 2591 | - if ($globalDebug) echo 'Count all trackers by countries...'."\n"; |
|
| 2940 | + if ($globalDebug) { |
|
| 2941 | + echo 'Count all trackers by countries...'."\n"; |
|
| 2942 | + } |
|
| 2592 | 2943 | $alldata = $Tracker->countAllTrackerOverCountries(false,0,$last_update_day); |
| 2593 | 2944 | foreach ($alldata as $number) { |
| 2594 | 2945 | $this->addStatCountryTracker($number['tracker_country_iso2'],$number['tracker_country_iso3'],$number['tracker_country'],$number['tracker_count'],'','',$reset); |
| 2595 | 2946 | } |
| 2596 | 2947 | } |
| 2597 | - if ($globalDebug) echo 'Count all vessels by months...'."\n"; |
|
| 2948 | + if ($globalDebug) { |
|
| 2949 | + echo 'Count all vessels by months...'."\n"; |
|
| 2950 | + } |
|
| 2598 | 2951 | $last_month = date('Y-m-01 00:00:00', strtotime('-1 month', strtotime($last_update_day))); |
| 2599 | 2952 | $filter_last_month = array('since_date' => $last_month); |
| 2600 | 2953 | $alldata = $Tracker->countAllMonths($filter_last_month); |
| 2601 | 2954 | $lastyear = false; |
| 2602 | 2955 | foreach ($alldata as $number) { |
| 2603 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 2956 | + if ($number['year_name'] != date('Y')) { |
|
| 2957 | + $lastyear = true; |
|
| 2958 | + } |
|
| 2604 | 2959 | $this->addStat('tracker_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 2605 | 2960 | } |
| 2606 | 2961 | echo 'Tracker data...'."\n"; |
@@ -2630,7 +2985,9 @@ discard block |
||
| 2630 | 2985 | foreach ($alldata as $number) { |
| 2631 | 2986 | $this->addStatTracker('hour',$number['hour_name'],$number['hour_count']); |
| 2632 | 2987 | } |
| 2633 | - if ($globalDebug) echo 'Count all types...'."\n"; |
|
| 2988 | + if ($globalDebug) { |
|
| 2989 | + echo 'Count all types...'."\n"; |
|
| 2990 | + } |
|
| 2634 | 2991 | $alldata = $Tracker->countAllTrackerTypes(false,0,$last_update_day); |
| 2635 | 2992 | foreach ($alldata as $number) { |
| 2636 | 2993 | $this->addStatTrackerType($number['tracker_type'],$number['tracker_type_count'],'',$reset); |
@@ -2642,10 +2999,14 @@ discard block |
||
| 2642 | 2999 | |
| 2643 | 3000 | if (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft) || (isset($globalMasterServer) && $globalMasterServer)) { |
| 2644 | 3001 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
| 2645 | - if ($globalDebug) echo '!!! Update aicraft stats !!!'."\n"; |
|
| 3002 | + if ($globalDebug) { |
|
| 3003 | + echo '!!! Update aicraft stats !!!'."\n"; |
|
| 3004 | + } |
|
| 2646 | 3005 | if (isset($last_update[0]['value'])) { |
| 2647 | 3006 | $last_update_day = $last_update[0]['value']; |
| 2648 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
| 3007 | + } else { |
|
| 3008 | + $last_update_day = '2012-12-12 12:12:12'; |
|
| 3009 | + } |
|
| 2649 | 3010 | $reset = false; |
| 2650 | 3011 | //if ($globalStatsResetYear && date('Y',strtotime($last_update_day)) != date('Y')) { |
| 2651 | 3012 | if ($globalStatsResetYear) { |
@@ -2654,43 +3015,63 @@ discard block |
||
| 2654 | 3015 | } |
| 2655 | 3016 | $Spotter = new Spotter($this->db); |
| 2656 | 3017 | |
| 2657 | - if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
| 3018 | + if ($globalDebug) { |
|
| 3019 | + echo 'Count all aircraft types...'."\n"; |
|
| 3020 | + } |
|
| 2658 | 3021 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
| 2659 | 3022 | foreach ($alldata as $number) { |
| 2660 | 3023 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
| 2661 | 3024 | } |
| 2662 | - if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
| 3025 | + if ($globalDebug) { |
|
| 3026 | + echo 'Count all airlines...'."\n"; |
|
| 3027 | + } |
|
| 2663 | 3028 | $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
| 2664 | 3029 | foreach ($alldata as $number) { |
| 2665 | 3030 | $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
| 2666 | 3031 | } |
| 2667 | - if ($globalDebug) echo 'Count all registrations...'."\n"; |
|
| 3032 | + if ($globalDebug) { |
|
| 3033 | + echo 'Count all registrations...'."\n"; |
|
| 3034 | + } |
|
| 2668 | 3035 | $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
| 2669 | 3036 | foreach ($alldata as $number) { |
| 2670 | 3037 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
| 2671 | 3038 | } |
| 2672 | - if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
| 3039 | + if ($globalDebug) { |
|
| 3040 | + echo 'Count all callsigns...'."\n"; |
|
| 3041 | + } |
|
| 2673 | 3042 | $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
| 2674 | 3043 | foreach ($alldata as $number) { |
| 2675 | 3044 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
| 2676 | 3045 | } |
| 2677 | - if ($globalDebug) echo 'Count all owners...'."\n"; |
|
| 3046 | + if ($globalDebug) { |
|
| 3047 | + echo 'Count all owners...'."\n"; |
|
| 3048 | + } |
|
| 2678 | 3049 | $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
| 2679 | 3050 | foreach ($alldata as $number) { |
| 2680 | 3051 | $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
| 2681 | 3052 | } |
| 2682 | - if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
| 3053 | + if ($globalDebug) { |
|
| 3054 | + echo 'Count all pilots...'."\n"; |
|
| 3055 | + } |
|
| 2683 | 3056 | $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
| 2684 | 3057 | foreach ($alldata as $number) { |
| 2685 | - if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') $number['pilot_id'] = $number['pilot_name']; |
|
| 3058 | + if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') { |
|
| 3059 | + $number['pilot_id'] = $number['pilot_name']; |
|
| 3060 | + } |
|
| 2686 | 3061 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
| 2687 | 3062 | } |
| 2688 | 3063 | |
| 2689 | - if ($globalDebug) echo 'Count all departure airports...'."\n"; |
|
| 3064 | + if ($globalDebug) { |
|
| 3065 | + echo 'Count all departure airports...'."\n"; |
|
| 3066 | + } |
|
| 2690 | 3067 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
| 2691 | - if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
|
| 3068 | + if ($globalDebug) { |
|
| 3069 | + echo 'Count all detected departure airports...'."\n"; |
|
| 3070 | + } |
|
| 2692 | 3071 | $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
| 2693 | - if ($globalDebug) echo 'Order departure airports...'."\n"; |
|
| 3072 | + if ($globalDebug) { |
|
| 3073 | + echo 'Order departure airports...'."\n"; |
|
| 3074 | + } |
|
| 2694 | 3075 | $alldata = array(); |
| 2695 | 3076 | foreach ($pall as $value) { |
| 2696 | 3077 | $icao = $value['airport_departure_icao']; |
@@ -2700,7 +3081,9 @@ discard block |
||
| 2700 | 3081 | $icao = $value['airport_departure_icao']; |
| 2701 | 3082 | if (isset($alldata[$icao])) { |
| 2702 | 3083 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 2703 | - } else $alldata[$icao] = $value; |
|
| 3084 | + } else { |
|
| 3085 | + $alldata[$icao] = $value; |
|
| 3086 | + } |
|
| 2704 | 3087 | } |
| 2705 | 3088 | $count = array(); |
| 2706 | 3089 | foreach ($alldata as $key => $row) { |
@@ -2710,11 +3093,17 @@ discard block |
||
| 2710 | 3093 | foreach ($alldata as $number) { |
| 2711 | 3094 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset); |
| 2712 | 3095 | } |
| 2713 | - if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
| 3096 | + if ($globalDebug) { |
|
| 3097 | + echo 'Count all arrival airports...'."\n"; |
|
| 3098 | + } |
|
| 2714 | 3099 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
| 2715 | - if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
|
| 3100 | + if ($globalDebug) { |
|
| 3101 | + echo 'Count all detected arrival airports...'."\n"; |
|
| 3102 | + } |
|
| 2716 | 3103 | $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
| 2717 | - if ($globalDebug) echo 'Order arrival airports...'."\n"; |
|
| 3104 | + if ($globalDebug) { |
|
| 3105 | + echo 'Order arrival airports...'."\n"; |
|
| 3106 | + } |
|
| 2718 | 3107 | $alldata = array(); |
| 2719 | 3108 | foreach ($pall as $value) { |
| 2720 | 3109 | $icao = $value['airport_arrival_icao']; |
@@ -2724,7 +3113,9 @@ discard block |
||
| 2724 | 3113 | $icao = $value['airport_arrival_icao']; |
| 2725 | 3114 | if (isset($alldata[$icao])) { |
| 2726 | 3115 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 2727 | - } else $alldata[$icao] = $value; |
|
| 3116 | + } else { |
|
| 3117 | + $alldata[$icao] = $value; |
|
| 3118 | + } |
|
| 2728 | 3119 | } |
| 2729 | 3120 | $count = array(); |
| 2730 | 3121 | foreach ($alldata as $key => $row) { |
@@ -2735,7 +3126,9 @@ discard block |
||
| 2735 | 3126 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset); |
| 2736 | 3127 | } |
| 2737 | 3128 | if ($Connection->tableExists('countries')) { |
| 2738 | - if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
|
| 3129 | + if ($globalDebug) { |
|
| 3130 | + echo 'Count all flights by countries...'."\n"; |
|
| 3131 | + } |
|
| 2739 | 3132 | //$SpotterArchive = new SpotterArchive(); |
| 2740 | 3133 | //$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
| 2741 | 3134 | $Spotter = new Spotter($this->db); |
@@ -2746,7 +3139,9 @@ discard block |
||
| 2746 | 3139 | } |
| 2747 | 3140 | |
| 2748 | 3141 | if (isset($globalAccidents) && $globalAccidents) { |
| 2749 | - if ($globalDebug) echo 'Count fatalities stats...'."\n"; |
|
| 3142 | + if ($globalDebug) { |
|
| 3143 | + echo 'Count fatalities stats...'."\n"; |
|
| 3144 | + } |
|
| 2750 | 3145 | $Accident = new Accident($this->db); |
| 2751 | 3146 | $this->deleteStatsByType('fatalities_byyear'); |
| 2752 | 3147 | $alldata = $Accident->countFatalitiesByYear(); |
@@ -2762,48 +3157,68 @@ discard block |
||
| 2762 | 3157 | |
| 2763 | 3158 | // Add by month using getstat if month finish... |
| 2764 | 3159 | //if (date('m',strtotime($last_update_day)) != date('m')) { |
| 2765 | - if ($globalDebug) echo 'Count all flights by months...'."\n"; |
|
| 3160 | + if ($globalDebug) { |
|
| 3161 | + echo 'Count all flights by months...'."\n"; |
|
| 3162 | + } |
|
| 2766 | 3163 | $last_month = date('Y-m-01 00:00:00', strtotime('-1 month', strtotime($last_update_day))); |
| 2767 | 3164 | $filter_last_month = array('since_date' => $last_month); |
| 2768 | 3165 | $Spotter = new Spotter($this->db); |
| 2769 | 3166 | $alldata = $Spotter->countAllMonths($filter_last_month); |
| 2770 | 3167 | $lastyear = false; |
| 2771 | 3168 | foreach ($alldata as $number) { |
| 2772 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 3169 | + if ($number['year_name'] != date('Y')) { |
|
| 3170 | + $lastyear = true; |
|
| 3171 | + } |
|
| 2773 | 3172 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 2774 | 3173 | } |
| 2775 | - if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
|
| 3174 | + if ($globalDebug) { |
|
| 3175 | + echo 'Count all military flights by months...'."\n"; |
|
| 3176 | + } |
|
| 2776 | 3177 | $alldata = $Spotter->countAllMilitaryMonths($filter_last_month); |
| 2777 | 3178 | foreach ($alldata as $number) { |
| 2778 | 3179 | $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 2779 | 3180 | } |
| 2780 | - if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
| 3181 | + if ($globalDebug) { |
|
| 3182 | + echo 'Count all owners by months...'."\n"; |
|
| 3183 | + } |
|
| 2781 | 3184 | $alldata = $Spotter->countAllMonthsOwners($filter_last_month); |
| 2782 | 3185 | foreach ($alldata as $number) { |
| 2783 | 3186 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 2784 | 3187 | } |
| 2785 | - if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
| 3188 | + if ($globalDebug) { |
|
| 3189 | + echo 'Count all pilots by months...'."\n"; |
|
| 3190 | + } |
|
| 2786 | 3191 | $alldata = $Spotter->countAllMonthsPilots($filter_last_month); |
| 2787 | 3192 | foreach ($alldata as $number) { |
| 2788 | 3193 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 2789 | 3194 | } |
| 2790 | - if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
|
| 3195 | + if ($globalDebug) { |
|
| 3196 | + echo 'Count all airlines by months...'."\n"; |
|
| 3197 | + } |
|
| 2791 | 3198 | $alldata = $Spotter->countAllMonthsAirlines($filter_last_month); |
| 2792 | 3199 | foreach ($alldata as $number) { |
| 2793 | 3200 | $this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 2794 | 3201 | } |
| 2795 | - if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
| 3202 | + if ($globalDebug) { |
|
| 3203 | + echo 'Count all aircrafts by months...'."\n"; |
|
| 3204 | + } |
|
| 2796 | 3205 | $alldata = $Spotter->countAllMonthsAircrafts($filter_last_month); |
| 2797 | 3206 | foreach ($alldata as $number) { |
| 2798 | 3207 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 2799 | 3208 | } |
| 2800 | - if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
| 3209 | + if ($globalDebug) { |
|
| 3210 | + echo 'Count all real arrivals by months...'."\n"; |
|
| 3211 | + } |
|
| 2801 | 3212 | $alldata = $Spotter->countAllMonthsRealArrivals($filter_last_month); |
| 2802 | 3213 | foreach ($alldata as $number) { |
| 2803 | 3214 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
| 2804 | 3215 | } |
| 2805 | - if ($globalDebug) echo 'Airports data...'."\n"; |
|
| 2806 | - if ($globalDebug) echo '...Departure'."\n"; |
|
| 3216 | + if ($globalDebug) { |
|
| 3217 | + echo 'Airports data...'."\n"; |
|
| 3218 | + } |
|
| 3219 | + if ($globalDebug) { |
|
| 3220 | + echo '...Departure'."\n"; |
|
| 3221 | + } |
|
| 2807 | 3222 | $this->deleteStatAirport('daily'); |
| 2808 | 3223 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
| 2809 | 3224 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
@@ -2921,7 +3336,9 @@ discard block |
||
| 2921 | 3336 | // Count by airlines |
| 2922 | 3337 | echo '--- Stats by airlines ---'."\n"; |
| 2923 | 3338 | if ($Connection->tableExists('countries')) { |
| 2924 | - if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
|
| 3339 | + if ($globalDebug) { |
|
| 3340 | + echo 'Count all flights by countries by airlines...'."\n"; |
|
| 3341 | + } |
|
| 2925 | 3342 | $SpotterArchive = new SpotterArchive($this->db); |
| 2926 | 3343 | //$Spotter = new Spotter($this->db); |
| 2927 | 3344 | $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
@@ -2930,37 +3347,53 @@ discard block |
||
| 2930 | 3347 | $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
| 2931 | 3348 | } |
| 2932 | 3349 | } |
| 2933 | - if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
|
| 3350 | + if ($globalDebug) { |
|
| 3351 | + echo 'Count all aircraft types by airlines...'."\n"; |
|
| 3352 | + } |
|
| 2934 | 3353 | $Spotter = new Spotter($this->db); |
| 2935 | 3354 | $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
| 2936 | 3355 | foreach ($alldata as $number) { |
| 2937 | 3356 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
| 2938 | 3357 | } |
| 2939 | - if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
|
| 3358 | + if ($globalDebug) { |
|
| 3359 | + echo 'Count all aircraft registrations by airlines...'."\n"; |
|
| 3360 | + } |
|
| 2940 | 3361 | $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
| 2941 | 3362 | foreach ($alldata as $number) { |
| 2942 | 3363 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
| 2943 | 3364 | } |
| 2944 | - if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
|
| 3365 | + if ($globalDebug) { |
|
| 3366 | + echo 'Count all callsigns by airlines...'."\n"; |
|
| 3367 | + } |
|
| 2945 | 3368 | $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
| 2946 | 3369 | foreach ($alldata as $number) { |
| 2947 | 3370 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
| 2948 | 3371 | } |
| 2949 | - if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
|
| 3372 | + if ($globalDebug) { |
|
| 3373 | + echo 'Count all owners by airlines...'."\n"; |
|
| 3374 | + } |
|
| 2950 | 3375 | $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
| 2951 | 3376 | foreach ($alldata as $number) { |
| 2952 | 3377 | $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
| 2953 | 3378 | } |
| 2954 | - if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
|
| 3379 | + if ($globalDebug) { |
|
| 3380 | + echo 'Count all pilots by airlines...'."\n"; |
|
| 3381 | + } |
|
| 2955 | 3382 | $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
| 2956 | 3383 | foreach ($alldata as $number) { |
| 2957 | 3384 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
| 2958 | 3385 | } |
| 2959 | - if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
|
| 3386 | + if ($globalDebug) { |
|
| 3387 | + echo 'Count all departure airports by airlines...'."\n"; |
|
| 3388 | + } |
|
| 2960 | 3389 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
| 2961 | - if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
|
| 3390 | + if ($globalDebug) { |
|
| 3391 | + echo 'Count all detected departure airports by airlines...'."\n"; |
|
| 3392 | + } |
|
| 2962 | 3393 | $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
| 2963 | - if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
|
| 3394 | + if ($globalDebug) { |
|
| 3395 | + echo 'Order detected departure airports by airlines...'."\n"; |
|
| 3396 | + } |
|
| 2964 | 3397 | //$alldata = array(); |
| 2965 | 3398 | foreach ($dall as $value) { |
| 2966 | 3399 | $icao = $value['airport_departure_icao']; |
@@ -2981,11 +3414,17 @@ discard block |
||
| 2981 | 3414 | foreach ($alldata as $number) { |
| 2982 | 3415 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset); |
| 2983 | 3416 | } |
| 2984 | - if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
|
| 3417 | + if ($globalDebug) { |
|
| 3418 | + echo 'Count all arrival airports by airlines...'."\n"; |
|
| 3419 | + } |
|
| 2985 | 3420 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
| 2986 | - if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
|
| 3421 | + if ($globalDebug) { |
|
| 3422 | + echo 'Count all detected arrival airports by airlines...'."\n"; |
|
| 3423 | + } |
|
| 2987 | 3424 | $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
| 2988 | - if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
|
| 3425 | + if ($globalDebug) { |
|
| 3426 | + echo 'Order arrival airports by airlines...'."\n"; |
|
| 3427 | + } |
|
| 2989 | 3428 | //$alldata = array(); |
| 2990 | 3429 | foreach ($dall as $value) { |
| 2991 | 3430 | $icao = $value['airport_arrival_icao']; |
@@ -3004,37 +3443,53 @@ discard block |
||
| 3004 | 3443 | } |
| 3005 | 3444 | $alldata = $pall; |
| 3006 | 3445 | foreach ($alldata as $number) { |
| 3007 | - if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
| 3446 | + if ($number['airline_icao'] != '') { |
|
| 3447 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
| 3448 | + } |
|
| 3449 | + } |
|
| 3450 | + if ($globalDebug) { |
|
| 3451 | + echo 'Count all flights by months by airlines...'."\n"; |
|
| 3008 | 3452 | } |
| 3009 | - if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
|
| 3010 | 3453 | $Spotter = new Spotter($this->db); |
| 3011 | 3454 | $alldata = $Spotter->countAllMonthsByAirlines($filter_last_month); |
| 3012 | 3455 | $lastyear = false; |
| 3013 | 3456 | foreach ($alldata as $number) { |
| 3014 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 3457 | + if ($number['year_name'] != date('Y')) { |
|
| 3458 | + $lastyear = true; |
|
| 3459 | + } |
|
| 3015 | 3460 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 3016 | 3461 | } |
| 3017 | - if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
|
| 3462 | + if ($globalDebug) { |
|
| 3463 | + echo 'Count all owners by months by airlines...'."\n"; |
|
| 3464 | + } |
|
| 3018 | 3465 | $alldata = $Spotter->countAllMonthsOwnersByAirlines($filter_last_month); |
| 3019 | 3466 | foreach ($alldata as $number) { |
| 3020 | 3467 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 3021 | 3468 | } |
| 3022 | - if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
|
| 3469 | + if ($globalDebug) { |
|
| 3470 | + echo 'Count all pilots by months by airlines...'."\n"; |
|
| 3471 | + } |
|
| 3023 | 3472 | $alldata = $Spotter->countAllMonthsPilotsByAirlines($filter_last_month); |
| 3024 | 3473 | foreach ($alldata as $number) { |
| 3025 | 3474 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 3026 | 3475 | } |
| 3027 | - if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
|
| 3476 | + if ($globalDebug) { |
|
| 3477 | + echo 'Count all aircrafts by months by airlines...'."\n"; |
|
| 3478 | + } |
|
| 3028 | 3479 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines($filter_last_month); |
| 3029 | 3480 | foreach ($alldata as $number) { |
| 3030 | 3481 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 3031 | 3482 | } |
| 3032 | - if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
|
| 3483 | + if ($globalDebug) { |
|
| 3484 | + echo 'Count all real arrivals by months by airlines...'."\n"; |
|
| 3485 | + } |
|
| 3033 | 3486 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines($filter_last_month); |
| 3034 | 3487 | foreach ($alldata as $number) { |
| 3035 | 3488 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
| 3036 | 3489 | } |
| 3037 | - if ($globalDebug) echo '...Departure'."\n"; |
|
| 3490 | + if ($globalDebug) { |
|
| 3491 | + echo '...Departure'."\n"; |
|
| 3492 | + } |
|
| 3038 | 3493 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
| 3039 | 3494 | $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
| 3040 | 3495 | foreach ($dall as $value) { |
@@ -3057,7 +3512,9 @@ discard block |
||
| 3057 | 3512 | foreach ($alldata as $number) { |
| 3058 | 3513 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
| 3059 | 3514 | } |
| 3060 | - if ($globalDebug) echo '...Arrival'."\n"; |
|
| 3515 | + if ($globalDebug) { |
|
| 3516 | + echo '...Arrival'."\n"; |
|
| 3517 | + } |
|
| 3061 | 3518 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
| 3062 | 3519 | $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
| 3063 | 3520 | foreach ($dall as $value) { |
@@ -3081,13 +3538,19 @@ discard block |
||
| 3081 | 3538 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
| 3082 | 3539 | } |
| 3083 | 3540 | |
| 3084 | - if ($globalDebug) echo 'Flights data...'."\n"; |
|
| 3085 | - if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
|
| 3541 | + if ($globalDebug) { |
|
| 3542 | + echo 'Flights data...'."\n"; |
|
| 3543 | + } |
|
| 3544 | + if ($globalDebug) { |
|
| 3545 | + echo '-> countAllDatesLastMonth...'."\n"; |
|
| 3546 | + } |
|
| 3086 | 3547 | $alldata = $Spotter->countAllDatesLastMonthByAirlines($filter_last_month); |
| 3087 | 3548 | foreach ($alldata as $number) { |
| 3088 | 3549 | $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
| 3089 | 3550 | } |
| 3090 | - if ($globalDebug) echo '-> countAllDates...'."\n"; |
|
| 3551 | + if ($globalDebug) { |
|
| 3552 | + echo '-> countAllDates...'."\n"; |
|
| 3553 | + } |
|
| 3091 | 3554 | //$previousdata = $this->countAllDatesByAirlines(); |
| 3092 | 3555 | $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines($filter_last_month)); |
| 3093 | 3556 | $values = array(); |
@@ -3100,14 +3563,18 @@ discard block |
||
| 3100 | 3563 | $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
| 3101 | 3564 | } |
| 3102 | 3565 | |
| 3103 | - if ($globalDebug) echo '-> countAllHours...'."\n"; |
|
| 3566 | + if ($globalDebug) { |
|
| 3567 | + echo '-> countAllHours...'."\n"; |
|
| 3568 | + } |
|
| 3104 | 3569 | $alldata = $Spotter->countAllHoursByAirlines('hour',$filter_last_month); |
| 3105 | 3570 | foreach ($alldata as $number) { |
| 3106 | 3571 | $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
| 3107 | 3572 | } |
| 3108 | 3573 | |
| 3109 | 3574 | // Stats by filters |
| 3110 | - if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array(); |
|
| 3575 | + if (!isset($globalStatsFilters) || $globalStatsFilters == '') { |
|
| 3576 | + $globalStatsFilters = array(); |
|
| 3577 | + } |
|
| 3111 | 3578 | foreach ($globalStatsFilters as $name => $filter) { |
| 3112 | 3579 | if (!empty($filter)) { |
| 3113 | 3580 | //$filter_name = $filter['name']; |
@@ -3115,7 +3582,9 @@ discard block |
||
| 3115 | 3582 | $reset = false; |
| 3116 | 3583 | $last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name); |
| 3117 | 3584 | if (isset($filter['resetall']) && isset($last_update[0]['value']) && strtotime($filter['resetall']) > strtotime($last_update[0]['value'])) { |
| 3118 | - if ($globalDebug) echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n"; |
|
| 3585 | + if ($globalDebug) { |
|
| 3586 | + echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n"; |
|
| 3587 | + } |
|
| 3119 | 3588 | $this->deleteOldStats($filter_name); |
| 3120 | 3589 | unset($last_update); |
| 3121 | 3590 | } |
@@ -3132,39 +3601,55 @@ discard block |
||
| 3132 | 3601 | $reset = true; |
| 3133 | 3602 | } |
| 3134 | 3603 | // Count by filter |
| 3135 | - if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
| 3604 | + if ($globalDebug) { |
|
| 3605 | + echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
| 3606 | + } |
|
| 3136 | 3607 | $Spotter = new Spotter($this->db); |
| 3137 | - if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
| 3608 | + if ($globalDebug) { |
|
| 3609 | + echo 'Count all aircraft types...'."\n"; |
|
| 3610 | + } |
|
| 3138 | 3611 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
| 3139 | 3612 | foreach ($alldata as $number) { |
| 3140 | 3613 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset); |
| 3141 | 3614 | } |
| 3142 | - if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
| 3615 | + if ($globalDebug) { |
|
| 3616 | + echo 'Count all airlines...'."\n"; |
|
| 3617 | + } |
|
| 3143 | 3618 | $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
| 3144 | 3619 | foreach ($alldata as $number) { |
| 3145 | 3620 | $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset); |
| 3146 | 3621 | } |
| 3147 | - if ($globalDebug) echo 'Count all aircraft registrations...'."\n"; |
|
| 3622 | + if ($globalDebug) { |
|
| 3623 | + echo 'Count all aircraft registrations...'."\n"; |
|
| 3624 | + } |
|
| 3148 | 3625 | $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
| 3149 | 3626 | foreach ($alldata as $number) { |
| 3150 | 3627 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset); |
| 3151 | 3628 | } |
| 3152 | - if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
| 3629 | + if ($globalDebug) { |
|
| 3630 | + echo 'Count all callsigns...'."\n"; |
|
| 3631 | + } |
|
| 3153 | 3632 | $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
| 3154 | 3633 | foreach ($alldata as $number) { |
| 3155 | 3634 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset); |
| 3156 | 3635 | } |
| 3157 | - if ($globalDebug) echo 'Count all owners...'."\n"; |
|
| 3636 | + if ($globalDebug) { |
|
| 3637 | + echo 'Count all owners...'."\n"; |
|
| 3638 | + } |
|
| 3158 | 3639 | $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
| 3159 | 3640 | foreach ($alldata as $number) { |
| 3160 | 3641 | $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset); |
| 3161 | 3642 | } |
| 3162 | - if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
| 3643 | + if ($globalDebug) { |
|
| 3644 | + echo 'Count all pilots...'."\n"; |
|
| 3645 | + } |
|
| 3163 | 3646 | $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
| 3164 | 3647 | foreach ($alldata as $number) { |
| 3165 | 3648 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
| 3166 | 3649 | } |
| 3167 | - if ($globalDebug) echo 'Count departure airports...'."\n"; |
|
| 3650 | + if ($globalDebug) { |
|
| 3651 | + echo 'Count departure airports...'."\n"; |
|
| 3652 | + } |
|
| 3168 | 3653 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
| 3169 | 3654 | $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
| 3170 | 3655 | $alldata = array(); |
@@ -3176,7 +3661,9 @@ discard block |
||
| 3176 | 3661 | $icao = $value['airport_departure_icao']; |
| 3177 | 3662 | if (isset($alldata[$icao])) { |
| 3178 | 3663 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
| 3179 | - } else $alldata[$icao] = $value; |
|
| 3664 | + } else { |
|
| 3665 | + $alldata[$icao] = $value; |
|
| 3666 | + } |
|
| 3180 | 3667 | } |
| 3181 | 3668 | $count = array(); |
| 3182 | 3669 | foreach ($alldata as $key => $row) { |
@@ -3186,7 +3673,9 @@ discard block |
||
| 3186 | 3673 | foreach ($alldata as $number) { |
| 3187 | 3674 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset); |
| 3188 | 3675 | } |
| 3189 | - if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
| 3676 | + if ($globalDebug) { |
|
| 3677 | + echo 'Count all arrival airports...'."\n"; |
|
| 3678 | + } |
|
| 3190 | 3679 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
| 3191 | 3680 | $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
| 3192 | 3681 | $alldata = array(); |
@@ -3198,7 +3687,9 @@ discard block |
||
| 3198 | 3687 | $icao = $value['airport_arrival_icao']; |
| 3199 | 3688 | if (isset($alldata[$icao])) { |
| 3200 | 3689 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
| 3201 | - } else $alldata[$icao] = $value; |
|
| 3690 | + } else { |
|
| 3691 | + $alldata[$icao] = $value; |
|
| 3692 | + } |
|
| 3202 | 3693 | } |
| 3203 | 3694 | $count = array(); |
| 3204 | 3695 | foreach ($alldata as $key => $row) { |
@@ -3208,35 +3699,49 @@ discard block |
||
| 3208 | 3699 | foreach ($alldata as $number) { |
| 3209 | 3700 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset); |
| 3210 | 3701 | } |
| 3211 | - if ($globalDebug) echo 'Count all months...'."\n"; |
|
| 3702 | + if ($globalDebug) { |
|
| 3703 | + echo 'Count all months...'."\n"; |
|
| 3704 | + } |
|
| 3212 | 3705 | $Spotter = new Spotter($this->db); |
| 3213 | 3706 | $alldata = $Spotter->countAllMonths($filter); |
| 3214 | 3707 | $lastyear = false; |
| 3215 | 3708 | foreach ($alldata as $number) { |
| 3216 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
| 3709 | + if ($number['year_name'] != date('Y')) { |
|
| 3710 | + $lastyear = true; |
|
| 3711 | + } |
|
| 3217 | 3712 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
| 3218 | 3713 | } |
| 3219 | - if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
| 3714 | + if ($globalDebug) { |
|
| 3715 | + echo 'Count all owners by months...'."\n"; |
|
| 3716 | + } |
|
| 3220 | 3717 | $alldata = $Spotter->countAllMonthsOwners($filter); |
| 3221 | 3718 | foreach ($alldata as $number) { |
| 3222 | 3719 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
| 3223 | 3720 | } |
| 3224 | - if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
| 3721 | + if ($globalDebug) { |
|
| 3722 | + echo 'Count all pilots by months...'."\n"; |
|
| 3723 | + } |
|
| 3225 | 3724 | $alldata = $Spotter->countAllMonthsPilots($filter); |
| 3226 | 3725 | foreach ($alldata as $number) { |
| 3227 | 3726 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
| 3228 | 3727 | } |
| 3229 | - if ($globalDebug) echo 'Count all military by months...'."\n"; |
|
| 3728 | + if ($globalDebug) { |
|
| 3729 | + echo 'Count all military by months...'."\n"; |
|
| 3730 | + } |
|
| 3230 | 3731 | $alldata = $Spotter->countAllMilitaryMonths($filter); |
| 3231 | 3732 | foreach ($alldata as $number) { |
| 3232 | 3733 | $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
| 3233 | 3734 | } |
| 3234 | - if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
| 3735 | + if ($globalDebug) { |
|
| 3736 | + echo 'Count all aircrafts by months...'."\n"; |
|
| 3737 | + } |
|
| 3235 | 3738 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
| 3236 | 3739 | foreach ($alldata as $number) { |
| 3237 | 3740 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
| 3238 | 3741 | } |
| 3239 | - if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
| 3742 | + if ($globalDebug) { |
|
| 3743 | + echo 'Count all real arrivals by months...'."\n"; |
|
| 3744 | + } |
|
| 3240 | 3745 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
| 3241 | 3746 | foreach ($alldata as $number) { |
| 3242 | 3747 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
@@ -22,11 +22,15 @@ discard block |
||
| 22 | 22 | require_once('require/class.Spotter.php'); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 25 | +if (!isset($filter_name)) { |
|
| 26 | + $filter_name = ''; |
|
| 27 | +} |
|
| 26 | 28 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 27 | 29 | if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) { |
| 28 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 29 | -} |
|
| 30 | + if (isset($globalFilter['airline'])) { |
|
| 31 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 32 | + } |
|
| 33 | + } |
|
| 30 | 34 | if ($type == 'aircraft' && $airline_icao != '' && $airline_icao != 'all') { |
| 31 | 35 | $Spotter = new Spotter(); |
| 32 | 36 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
@@ -61,7 +65,12 @@ discard block |
||
| 61 | 65 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script> |
| 62 | 66 | <div class="column"> |
| 63 | 67 | <div class="info"> |
| 64 | - <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1> |
|
| 68 | + <h1><?php if (isset($airline_name)) { |
|
| 69 | + echo _("Statistics for ").$airline_name; |
|
| 70 | +} else { |
|
| 71 | + echo _("Statistics"); |
|
| 72 | +} |
|
| 73 | +?></h1> |
|
| 65 | 74 | <?php |
| 66 | 75 | if ($type == 'aircraft') { |
| 67 | 76 | $last_update = $Stats->getLastStatsUpdate(); |
@@ -73,7 +82,9 @@ discard block |
||
| 73 | 82 | if (isset($last_update[0]['value'])) { |
| 74 | 83 | date_default_timezone_set('UTC'); |
| 75 | 84 | $lastupdate = strtotime($last_update[0]['value']); |
| 76 | - if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
|
| 85 | + if (isset($globalTimezone) && $globalTimezone != '') { |
|
| 86 | + date_default_timezone_set($globalTimezone); |
|
| 87 | + } |
|
| 77 | 88 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
| 78 | 89 | } |
| 79 | 90 | |
@@ -166,8 +177,11 @@ discard block |
||
| 166 | 177 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
| 167 | 178 | $aircraft_data = ''; |
| 168 | 179 | foreach($aircraft_array as $aircraft_item) { |
| 169 | - if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
| 170 | - else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
| 180 | + if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') { |
|
| 181 | + $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
| 182 | + } else { |
|
| 183 | + $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
| 184 | + } |
|
| 171 | 185 | } |
| 172 | 186 | $aircraft_data = substr($aircraft_data, 0, -1); |
| 173 | 187 | print 'var series = ['.$aircraft_data.'];'; |
@@ -184,11 +198,17 @@ discard block |
||
| 184 | 198 | <?php |
| 185 | 199 | if ($year != '' && $month != '') { |
| 186 | 200 | ?> |
| 187 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 201 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 202 | + echo '/'.$airline_icao; |
|
| 203 | +} |
|
| 204 | +?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 188 | 205 | <?php |
| 189 | 206 | } else { |
| 190 | 207 | ?> |
| 191 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 208 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 209 | + echo '/'.$airline_icao; |
|
| 210 | +} |
|
| 211 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 192 | 212 | <?php |
| 193 | 213 | } |
| 194 | 214 | ?> |
@@ -217,11 +237,15 @@ discard block |
||
| 217 | 237 | print '</script>'; |
| 218 | 238 | if ($year != '' && $month != '') { |
| 219 | 239 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
| 220 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 240 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 241 | + echo '/'.$airline_icao; |
|
| 242 | + } |
|
| 221 | 243 | print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
| 222 | 244 | } else { |
| 223 | 245 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
| 224 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 246 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 247 | + echo '/'.$airline_icao; |
|
| 248 | + } |
|
| 225 | 249 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
| 226 | 250 | } |
| 227 | 251 | print '</div>'; |
@@ -241,8 +265,9 @@ discard block |
||
| 241 | 265 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
| 242 | 266 | <?php |
| 243 | 267 | $marine_array = $Stats->countAllMarineTypes(true,$filter_name,$year,$month); |
| 244 | - if (count($marine_array) == 0) print _("No data available"); |
|
| 245 | - else { |
|
| 268 | + if (count($marine_array) == 0) { |
|
| 269 | + print _("No data available"); |
|
| 270 | + } else { |
|
| 246 | 271 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
| 247 | 272 | $marine_data = ''; |
| 248 | 273 | foreach($marine_array as $marine_item) { |
@@ -283,8 +308,9 @@ discard block |
||
| 283 | 308 | <h2><?php echo _("Top 10 Races Number of Participants"); ?></h2> |
| 284 | 309 | <?php |
| 285 | 310 | $marine_array = $Marine->countAllCaptainsByRaces(true,$filter_name,$year,$month); |
| 286 | - if (count($marine_array) == 0) print _("No data available"); |
|
| 287 | - else { |
|
| 311 | + if (count($marine_array) == 0) { |
|
| 312 | + print _("No data available"); |
|
| 313 | + } else { |
|
| 288 | 314 | print '<div id="chart991" class="chart" width="100%"></div><script>'; |
| 289 | 315 | $marine_data = ''; |
| 290 | 316 | foreach($marine_array as $marine_item) { |
@@ -331,8 +357,9 @@ discard block |
||
| 331 | 357 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
| 332 | 358 | <?php |
| 333 | 359 | $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
| 334 | - if (count($tracker_array) == 0) print _("No data available"); |
|
| 335 | - else { |
|
| 360 | + if (count($tracker_array) == 0) { |
|
| 361 | + print _("No data available"); |
|
| 362 | + } else { |
|
| 336 | 363 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
| 337 | 364 | $tracker_data = ''; |
| 338 | 365 | foreach($tracker_array as $tracker_item) { |
@@ -376,8 +403,9 @@ discard block |
||
| 376 | 403 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
| 377 | 404 | <?php |
| 378 | 405 | $owner_array = $Satellite->countAllOwners(true); |
| 379 | - if (count($owner_array) == 0) print _("No data available"); |
|
| 380 | - else { |
|
| 406 | + if (count($owner_array) == 0) { |
|
| 407 | + print _("No data available"); |
|
| 408 | + } else { |
|
| 381 | 409 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
| 382 | 410 | $owner_data = ''; |
| 383 | 411 | foreach($owner_array as $owner_item) { |
@@ -396,7 +424,10 @@ discard block |
||
| 396 | 424 | ?> |
| 397 | 425 | <!-- |
| 398 | 426 | <div class="more"> |
| 399 | - <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 427 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 428 | + echo '/'.$airline_icao; |
|
| 429 | +} |
|
| 430 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 400 | 431 | </div> |
| 401 | 432 | --> |
| 402 | 433 | </div> |
@@ -405,8 +436,9 @@ discard block |
||
| 405 | 436 | <h2><?php echo _("Top 10 Most Common Countries Owners"); ?></h2> |
| 406 | 437 | <?php |
| 407 | 438 | $countries_array = $Satellite->countAllCountriesOwners(true); |
| 408 | - if (count($countries_array) == 0) print _("No data available"); |
|
| 409 | - else { |
|
| 439 | + if (count($countries_array) == 0) { |
|
| 440 | + print _("No data available"); |
|
| 441 | + } else { |
|
| 410 | 442 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 411 | 443 | $owner_data = ''; |
| 412 | 444 | foreach($countries_array as $owner_item) { |
@@ -425,7 +457,10 @@ discard block |
||
| 425 | 457 | ?> |
| 426 | 458 | <!-- |
| 427 | 459 | <div class="more"> |
| 428 | - <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 460 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 461 | + echo '/'.$airline_icao; |
|
| 462 | +} |
|
| 463 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 429 | 464 | </div> |
| 430 | 465 | --> |
| 431 | 466 | </div> |
@@ -437,8 +472,9 @@ discard block |
||
| 437 | 472 | <h2><?php echo _("Top 10 Most Common Launch Sites"); ?></h2> |
| 438 | 473 | <?php |
| 439 | 474 | $launch_site_array = $Satellite->countAllLaunchSite(true); |
| 440 | - if (count($launch_site_array) == 0) print _("No data available"); |
|
| 441 | - else { |
|
| 475 | + if (count($launch_site_array) == 0) { |
|
| 476 | + print _("No data available"); |
|
| 477 | + } else { |
|
| 442 | 478 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 443 | 479 | $launch_site_data = ''; |
| 444 | 480 | foreach($launch_site_array as $launch_site_item) { |
@@ -457,7 +493,10 @@ discard block |
||
| 457 | 493 | ?> |
| 458 | 494 | <!-- |
| 459 | 495 | <div class="more"> |
| 460 | - <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 496 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 497 | + echo '/'.$airline_icao; |
|
| 498 | +} |
|
| 499 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 461 | 500 | </div> |
| 462 | 501 | --> |
| 463 | 502 | </div> |
@@ -480,8 +519,9 @@ discard block |
||
| 480 | 519 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
| 481 | 520 | <?php |
| 482 | 521 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
| 483 | - if (count($pilot_array) == 0) print _("No data available"); |
|
| 484 | - else { |
|
| 522 | + if (count($pilot_array) == 0) { |
|
| 523 | + print _("No data available"); |
|
| 524 | + } else { |
|
| 485 | 525 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
| 486 | 526 | $pilot_data = ''; |
| 487 | 527 | foreach($pilot_array as $pilot_item) { |
@@ -499,7 +539,9 @@ discard block |
||
| 499 | 539 | } |
| 500 | 540 | print '<div class="more">'; |
| 501 | 541 | print '<a href="'.$globalURL.'/statistics/pilot'; |
| 502 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 542 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 543 | + echo '/'.$airline_icao; |
|
| 544 | + } |
|
| 503 | 545 | print'" class="btn btn-default btn" role="button">'._("See full statistic").'»</a>'; |
| 504 | 546 | print '</div>'; |
| 505 | 547 | ?> |
@@ -515,8 +557,9 @@ discard block |
||
| 515 | 557 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
| 516 | 558 | <?php |
| 517 | 559 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
| 518 | - if (count($owner_array) == 0) print _("No data available"); |
|
| 519 | - else { |
|
| 560 | + if (count($owner_array) == 0) { |
|
| 561 | + print _("No data available"); |
|
| 562 | + } else { |
|
| 520 | 563 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
| 521 | 564 | $owner_data = ''; |
| 522 | 565 | foreach($owner_array as $owner_item) { |
@@ -534,7 +577,10 @@ discard block |
||
| 534 | 577 | } |
| 535 | 578 | ?> |
| 536 | 579 | <div class="more"> |
| 537 | - <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 580 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 581 | + echo '/'.$airline_icao; |
|
| 582 | +} |
|
| 583 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 538 | 584 | </div> |
| 539 | 585 | </div> |
| 540 | 586 | |
@@ -547,8 +593,9 @@ discard block |
||
| 547 | 593 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
| 548 | 594 | <?php |
| 549 | 595 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
| 550 | - if (count($flightover_array) == 0) print _("No data available"); |
|
| 551 | - else { |
|
| 596 | + if (count($flightover_array) == 0) { |
|
| 597 | + print _("No data available"); |
|
| 598 | + } else { |
|
| 552 | 599 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
| 553 | 600 | print 'var series = ['; |
| 554 | 601 | $flightover_data = ''; |
@@ -590,7 +637,10 @@ discard block |
||
| 590 | 637 | } |
| 591 | 638 | ?> |
| 592 | 639 | <div class="more"> |
| 593 | - <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 640 | + <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 641 | + echo '/'.$airline_icao; |
|
| 642 | +} |
|
| 643 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 594 | 644 | </div> |
| 595 | 645 | </div> |
| 596 | 646 | <?php |
@@ -608,8 +658,9 @@ discard block |
||
| 608 | 658 | <div class="col-md-6"> |
| 609 | 659 | <h2><?php echo _("Top 20 Most Common Country a Vessel was inside"); ?></h2> |
| 610 | 660 | <?php |
| 611 | - if (count($flightover_array) == 0) print _("No data available"); |
|
| 612 | - else { |
|
| 661 | + if (count($flightover_array) == 0) { |
|
| 662 | + print _("No data available"); |
|
| 663 | + } else { |
|
| 613 | 664 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
| 614 | 665 | print 'var series = ['; |
| 615 | 666 | $flightover_data = ''; |
@@ -666,8 +717,9 @@ discard block |
||
| 666 | 717 | <div class="col-md-6"> |
| 667 | 718 | <h2><?php echo _("Top 20 Most Common Country a Tracker was inside"); ?></h2> |
| 668 | 719 | <?php |
| 669 | - if (count($flightover_array) == 0) print _("No data available"); |
|
| 670 | - else { |
|
| 720 | + if (count($flightover_array) == 0) { |
|
| 721 | + print _("No data available"); |
|
| 722 | + } else { |
|
| 671 | 723 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
| 672 | 724 | print 'var series = ['; |
| 673 | 725 | $flightover_data = ''; |
@@ -773,7 +825,9 @@ discard block |
||
| 773 | 825 | });"; |
| 774 | 826 | print '</script>'; |
| 775 | 827 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; |
| 776 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 828 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 829 | + echo '/'.$airline_icao; |
|
| 830 | + } |
|
| 777 | 831 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
| 778 | 832 | } |
| 779 | 833 | ?> |
@@ -837,7 +891,9 @@ discard block |
||
| 837 | 891 | });"; |
| 838 | 892 | print '</script>'; |
| 839 | 893 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival'; |
| 840 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 894 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 895 | + echo '/'.$airline_icao; |
|
| 896 | + } |
|
| 841 | 897 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
| 842 | 898 | } |
| 843 | 899 | ?> |
@@ -856,8 +912,9 @@ discard block |
||
| 856 | 912 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 857 | 913 | <?php |
| 858 | 914 | $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
| 859 | - if (count($year_array) == 0) print _("No data available"); |
|
| 860 | - else { |
|
| 915 | + if (count($year_array) == 0) { |
|
| 916 | + print _("No data available"); |
|
| 917 | + } else { |
|
| 861 | 918 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 862 | 919 | $year_data = ''; |
| 863 | 920 | $year_cnt = ''; |
@@ -876,7 +933,10 @@ discard block |
||
| 876 | 933 | } |
| 877 | 934 | ?> |
| 878 | 935 | <div class="more"> |
| 879 | - <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 936 | + <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 937 | + echo '/'.$airline_icao; |
|
| 938 | +} |
|
| 939 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 880 | 940 | </div> |
| 881 | 941 | </div> |
| 882 | 942 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -884,8 +944,9 @@ discard block |
||
| 884 | 944 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 885 | 945 | <?php |
| 886 | 946 | $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
| 887 | - if (count($month_array) == 0) print _("No data available"); |
|
| 888 | - else { |
|
| 947 | + if (count($month_array) == 0) { |
|
| 948 | + print _("No data available"); |
|
| 949 | + } else { |
|
| 889 | 950 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 890 | 951 | $month_data = ''; |
| 891 | 952 | $month_cnt = ''; |
@@ -904,7 +965,10 @@ discard block |
||
| 904 | 965 | } |
| 905 | 966 | ?> |
| 906 | 967 | <div class="more"> |
| 907 | - <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 968 | + <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 969 | + echo '/'.$airline_icao; |
|
| 970 | +} |
|
| 971 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 908 | 972 | </div> |
| 909 | 973 | </div> |
| 910 | 974 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -913,8 +977,9 @@ discard block |
||
| 913 | 977 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
| 914 | 978 | <?php |
| 915 | 979 | $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
| 916 | - if (empty($date_array)) print _("No data available"); |
|
| 917 | - else { |
|
| 980 | + if (empty($date_array)) { |
|
| 981 | + print _("No data available"); |
|
| 982 | + } else { |
|
| 918 | 983 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
| 919 | 984 | $date_data = ''; |
| 920 | 985 | $date_cnt = ''; |
@@ -933,7 +998,10 @@ discard block |
||
| 933 | 998 | } |
| 934 | 999 | ?> |
| 935 | 1000 | <div class="more"> |
| 936 | - <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 1001 | + <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 1002 | + echo '/'.$airline_icao; |
|
| 1003 | +} |
|
| 1004 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 937 | 1005 | </div> |
| 938 | 1006 | </div> |
| 939 | 1007 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -941,8 +1009,9 @@ discard block |
||
| 941 | 1009 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 942 | 1010 | <?php |
| 943 | 1011 | $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
| 944 | - if (empty($hour_array)) print _("No data available"); |
|
| 945 | - else { |
|
| 1012 | + if (empty($hour_array)) { |
|
| 1013 | + print _("No data available"); |
|
| 1014 | + } else { |
|
| 946 | 1015 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
| 947 | 1016 | $hour_data = ''; |
| 948 | 1017 | $hour_cnt = ''; |
@@ -961,7 +1030,10 @@ discard block |
||
| 961 | 1030 | } |
| 962 | 1031 | ?> |
| 963 | 1032 | <div class="more"> |
| 964 | - <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 1033 | + <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 1034 | + echo '/'.$airline_icao; |
|
| 1035 | +} |
|
| 1036 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 965 | 1037 | </div> |
| 966 | 1038 | </div> |
| 967 | 1039 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -981,8 +1053,9 @@ discard block |
||
| 981 | 1053 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 982 | 1054 | <?php |
| 983 | 1055 | $year_array = $Stats->countAllMarineMonthsLastYear(true,$filter_name); |
| 984 | - if (count($year_array) == 0) print _("No data available"); |
|
| 985 | - else { |
|
| 1056 | + if (count($year_array) == 0) { |
|
| 1057 | + print _("No data available"); |
|
| 1058 | + } else { |
|
| 986 | 1059 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 987 | 1060 | $year_data = ''; |
| 988 | 1061 | $year_cnt = ''; |
@@ -1010,8 +1083,9 @@ discard block |
||
| 1010 | 1083 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 1011 | 1084 | <?php |
| 1012 | 1085 | $month_array = $Stats->countAllMarineDatesLastMonth($filter_name); |
| 1013 | - if (count($month_array) == 0) print _("No data available"); |
|
| 1014 | - else { |
|
| 1086 | + if (count($month_array) == 0) { |
|
| 1087 | + print _("No data available"); |
|
| 1088 | + } else { |
|
| 1015 | 1089 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 1016 | 1090 | $month_data = ''; |
| 1017 | 1091 | $month_cnt = ''; |
@@ -1039,8 +1113,9 @@ discard block |
||
| 1039 | 1113 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
| 1040 | 1114 | <?php |
| 1041 | 1115 | $date_array = $Stats->countAllMarineDatesLast7Days($filter_name); |
| 1042 | - if (empty($date_array)) print _("No data available"); |
|
| 1043 | - else { |
|
| 1116 | + if (empty($date_array)) { |
|
| 1117 | + print _("No data available"); |
|
| 1118 | + } else { |
|
| 1044 | 1119 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
| 1045 | 1120 | $date_data = ''; |
| 1046 | 1121 | $date_cnt = ''; |
@@ -1067,8 +1142,9 @@ discard block |
||
| 1067 | 1142 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 1068 | 1143 | <?php |
| 1069 | 1144 | $hour_array = $Stats->countAllMarineHours('hour',true,$filter_name); |
| 1070 | - if (empty($hour_array)) print _("No data available"); |
|
| 1071 | - else { |
|
| 1145 | + if (empty($hour_array)) { |
|
| 1146 | + print _("No data available"); |
|
| 1147 | + } else { |
|
| 1072 | 1148 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
| 1073 | 1149 | $hour_data = ''; |
| 1074 | 1150 | $hour_cnt = ''; |
@@ -1107,8 +1183,9 @@ discard block |
||
| 1107 | 1183 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 1108 | 1184 | <?php |
| 1109 | 1185 | $year_array = $Stats->countAllTrackerMonthsLastYear(true); |
| 1110 | - if (count($year_array) == 0) print _("No data available"); |
|
| 1111 | - else { |
|
| 1186 | + if (count($year_array) == 0) { |
|
| 1187 | + print _("No data available"); |
|
| 1188 | + } else { |
|
| 1112 | 1189 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 1113 | 1190 | $year_data = ''; |
| 1114 | 1191 | $year_cnt = ''; |
@@ -1136,8 +1213,9 @@ discard block |
||
| 1136 | 1213 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 1137 | 1214 | <?php |
| 1138 | 1215 | $month_array = $Stats->countAllTrackerDatesLastMonth(); |
| 1139 | - if (count($month_array) == 0) print _("No data available"); |
|
| 1140 | - else { |
|
| 1216 | + if (count($month_array) == 0) { |
|
| 1217 | + print _("No data available"); |
|
| 1218 | + } else { |
|
| 1141 | 1219 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 1142 | 1220 | $month_data = ''; |
| 1143 | 1221 | $month_cnt = ''; |
@@ -1165,8 +1243,9 @@ discard block |
||
| 1165 | 1243 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
| 1166 | 1244 | <?php |
| 1167 | 1245 | $date_array = $Stats->countAllTrackerDatesLast7Days(); |
| 1168 | - if (empty($date_array)) print _("No data available"); |
|
| 1169 | - else { |
|
| 1246 | + if (empty($date_array)) { |
|
| 1247 | + print _("No data available"); |
|
| 1248 | + } else { |
|
| 1170 | 1249 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
| 1171 | 1250 | $date_data = ''; |
| 1172 | 1251 | $date_cnt = ''; |
@@ -1193,8 +1272,9 @@ discard block |
||
| 1193 | 1272 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 1194 | 1273 | <?php |
| 1195 | 1274 | $hour_array = $Stats->countAllTrackerHours('hour',true); |
| 1196 | - if (empty($hour_array)) print _("No data available"); |
|
| 1197 | - else { |
|
| 1275 | + if (empty($hour_array)) { |
|
| 1276 | + print _("No data available"); |
|
| 1277 | + } else { |
|
| 1198 | 1278 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
| 1199 | 1279 | $hour_data = ''; |
| 1200 | 1280 | $hour_cnt = ''; |
@@ -1233,8 +1313,9 @@ discard block |
||
| 1233 | 1313 | <h2><?php echo _("Busiest Launch Months of the last 12 Months"); ?></h2> |
| 1234 | 1314 | <?php |
| 1235 | 1315 | $year_array = $Satellite->countAllMonthsLastYear(); |
| 1236 | - if (count($year_array) == 0) print _("No data available"); |
|
| 1237 | - else { |
|
| 1316 | + if (count($year_array) == 0) { |
|
| 1317 | + print _("No data available"); |
|
| 1318 | + } else { |
|
| 1238 | 1319 | print '<div id="chart21" class="chart" width="100%"></div><script>'; |
| 1239 | 1320 | $year_data = ''; |
| 1240 | 1321 | $year_cnt = ''; |
@@ -1264,8 +1345,9 @@ discard block |
||
| 1264 | 1345 | <h2><?php echo _("Busiest Launch Years of the last 10 Years"); ?></h2> |
| 1265 | 1346 | <?php |
| 1266 | 1347 | $year_array = $Satellite->countAllYears(); |
| 1267 | - if (count($year_array) == 0) print _("No data available"); |
|
| 1268 | - else { |
|
| 1348 | + if (count($year_array) == 0) { |
|
| 1349 | + print _("No data available"); |
|
| 1350 | + } else { |
|
| 1269 | 1351 | print '<div id="chart22" class="chart" width="100%"></div><script>'; |
| 1270 | 1352 | $year_data = ''; |
| 1271 | 1353 | $year_cnt = ''; |
@@ -1307,8 +1389,9 @@ discard block |
||
| 1307 | 1389 | <h2><?php echo _("Fatalities by Years"); ?></h2> |
| 1308 | 1390 | <?php |
| 1309 | 1391 | $year_array = $Stats->countFatalitiesByYear(); |
| 1310 | - if (count($year_array) == 0) print _("No data available"); |
|
| 1311 | - else { |
|
| 1392 | + if (count($year_array) == 0) { |
|
| 1393 | + print _("No data available"); |
|
| 1394 | + } else { |
|
| 1312 | 1395 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
| 1313 | 1396 | $year_data = ''; |
| 1314 | 1397 | $year_cnt = ''; |
@@ -1337,8 +1420,9 @@ discard block |
||
| 1337 | 1420 | <h2><?php echo _("Fatalities last 12 Months"); ?></h2> |
| 1338 | 1421 | <?php |
| 1339 | 1422 | $year_array = $Stats->countFatalitiesLast12Months(); |
| 1340 | - if (count($year_array) == 0) print _("No data available"); |
|
| 1341 | - else { |
|
| 1423 | + if (count($year_array) == 0) { |
|
| 1424 | + print _("No data available"); |
|
| 1425 | + } else { |
|
| 1342 | 1426 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
| 1343 | 1427 | $year_data = ''; |
| 1344 | 1428 | $year_cnt = ''; |
@@ -1409,8 +1493,11 @@ discard block |
||
| 1409 | 1493 | $distance = $distance; |
| 1410 | 1494 | $unit = 'km'; |
| 1411 | 1495 | } |
| 1412 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 1413 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 1496 | + if (!isset($polar_data)) { |
|
| 1497 | + $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 1498 | + } else { |
|
| 1499 | + $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 1500 | + } |
|
| 1414 | 1501 | } |
| 1415 | 1502 | ?> |
| 1416 | 1503 | <div class="col-md-6"> |
@@ -1474,9 +1561,12 @@ discard block |
||
| 1474 | 1561 | foreach ($msg as $eachmsg) { |
| 1475 | 1562 | //$eachmsg = $msg[0]; |
| 1476 | 1563 | $data = $eachmsg['source_data']; |
| 1477 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
| 1478 | - else $max = 500; |
|
| 1479 | -?> |
|
| 1564 | + if ($data > 500) { |
|
| 1565 | + $max = (round(($data+100)/100))*100; |
|
| 1566 | + } else { |
|
| 1567 | + $max = 500; |
|
| 1568 | + } |
|
| 1569 | + ?> |
|
| 1480 | 1570 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
| 1481 | 1571 | <script> |
| 1482 | 1572 | var g = new JustGage({ |
@@ -15,7 +15,9 @@ discard block |
||
| 15 | 15 | public function __construct($dbc = null) { |
| 16 | 16 | $Connection = new Connection($dbc); |
| 17 | 17 | $this->db = $Connection->db(); |
| 18 | - if ($this->db === null) die('Error: No DB connection. (MarineLive)'); |
|
| 18 | + if ($this->db === null) { |
|
| 19 | + die('Error: No DB connection. (MarineLive)'); |
|
| 20 | + } |
|
| 19 | 21 | } |
| 20 | 22 | |
| 21 | 23 | |
@@ -37,7 +39,9 @@ discard block |
||
| 37 | 39 | if (isset($filter[0]['source'])) { |
| 38 | 40 | $filters = array_merge($filters,$filter); |
| 39 | 41 | } |
| 40 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 42 | + if (is_array($globalFilter)) { |
|
| 43 | + $filter = array_merge($filter,$globalFilter); |
|
| 44 | + } |
|
| 41 | 45 | $filter_query_join = ''; |
| 42 | 46 | $filter_query_where = ''; |
| 43 | 47 | foreach($filters as $flt) { |
@@ -93,8 +97,11 @@ discard block |
||
| 93 | 97 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 94 | 98 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 95 | 99 | } |
| 96 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 97 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 100 | + if ($filter_query_where == '' && $where) { |
|
| 101 | + $filter_query_where = ' WHERE'; |
|
| 102 | + } elseif ($filter_query_where != '' && $and) { |
|
| 103 | + $filter_query_where .= ' AND'; |
|
| 104 | + } |
|
| 98 | 105 | if ($filter_query_where != '') { |
| 99 | 106 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 100 | 107 | } |
@@ -135,9 +142,13 @@ discard block |
||
| 135 | 142 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
| 136 | 143 | } |
| 137 | 144 | } |
| 138 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
| 145 | + if ($orderby_query == '') { |
|
| 146 | + $orderby_query= ' ORDER BY date DESC'; |
|
| 147 | + } |
|
| 139 | 148 | |
| 140 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 149 | + if (!isset($globalLiveInterval)) { |
|
| 150 | + $globalLiveInterval = '200'; |
|
| 151 | + } |
|
| 141 | 152 | if ($globalDBdriver == 'mysql') { |
| 142 | 153 | //$query = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate"; |
| 143 | 154 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -162,7 +173,9 @@ discard block |
||
| 162 | 173 | |
| 163 | 174 | $filter_query = $this->getFilter($filter,true,true); |
| 164 | 175 | |
| 165 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 176 | + if (!isset($globalLiveInterval)) { |
|
| 177 | + $globalLiveInterval = '200'; |
|
| 178 | + } |
|
| 166 | 179 | if ($globalDBdriver == 'mysql') { |
| 167 | 180 | $query = 'SELECT marine_live.mmsi, marine_live.ident, marine_live.type,marine_live.fammarine_id, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 168 | 181 | FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query." marine_live.latitude <> 0 AND marine_live.longitude <> 0 ORDER BY marine_live.race_rank"; |
@@ -204,58 +217,96 @@ discard block |
||
| 204 | 217 | $id = filter_var($id,FILTER_SANITIZE_STRING); |
| 205 | 218 | $filter_query = $this->getFilter($filter,true,true); |
| 206 | 219 | |
| 207 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 208 | - if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
|
| 220 | + if (!isset($globalLiveInterval)) { |
|
| 221 | + $globalLiveInterval = '200'; |
|
| 222 | + } |
|
| 223 | + if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') { |
|
| 224 | + $globalMap3DMarinesLimit = '300'; |
|
| 225 | + } |
|
| 209 | 226 | if ($globalDBdriver == 'mysql') { |
| 210 | 227 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 211 | 228 | $query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
| 212 | 229 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
| 213 | - if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 214 | - if ($id != '') $query .= "OR marine_archive.fammarine_id = :id "; |
|
| 230 | + if ($usecoord) { |
|
| 231 | + $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 232 | + } |
|
| 233 | + if ($id != '') { |
|
| 234 | + $query .= "OR marine_archive.fammarine_id = :id "; |
|
| 235 | + } |
|
| 215 | 236 | $query .= "UNION |
| 216 | 237 | SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 217 | 238 | FROM marine_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date"; |
| 218 | - if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 219 | - if ($id != '') $query .= "OR marine_live.fammarine_id = :id "; |
|
| 239 | + if ($usecoord) { |
|
| 240 | + $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 241 | + } |
|
| 242 | + if ($id != '') { |
|
| 243 | + $query .= "OR marine_live.fammarine_id = :id "; |
|
| 244 | + } |
|
| 220 | 245 | $query .= ") AS marine |
| 221 | 246 | WHERE latitude <> '0' AND longitude <> '0' |
| 222 | 247 | ORDER BY fammarine_id, date"; |
| 223 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 248 | + if ($limit) { |
|
| 249 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 250 | + } |
|
| 224 | 251 | } else { |
| 225 | 252 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 226 | 253 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date "; |
| 227 | - if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 228 | - if ($id != '') $query .= "OR marine_live.fammarine_id = :id "; |
|
| 254 | + if ($usecoord) { |
|
| 255 | + $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 256 | + } |
|
| 257 | + if ($id != '') { |
|
| 258 | + $query .= "OR marine_live.fammarine_id = :id "; |
|
| 259 | + } |
|
| 229 | 260 | $query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 230 | 261 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 231 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 262 | + if ($limit) { |
|
| 263 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 264 | + } |
|
| 232 | 265 | } |
| 233 | 266 | } else { |
| 234 | 267 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 235 | 268 | $query = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
| 236 | 269 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
| 237 | - if ($usecoord) $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 238 | - if ($id != '') $query .= "OR marine_archive.fammarine_id = :id "; |
|
| 270 | + if ($usecoord) { |
|
| 271 | + $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 272 | + } |
|
| 273 | + if ($id != '') { |
|
| 274 | + $query .= "OR marine_archive.fammarine_id = :id "; |
|
| 275 | + } |
|
| 239 | 276 | $query .= "UNION |
| 240 | 277 | SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 241 | 278 | FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date"; |
| 242 | - if ($usecoord) $query .= " AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 243 | - if ($id != '') $query .= " OR marine_live.fammarine_id = :id"; |
|
| 279 | + if ($usecoord) { |
|
| 280 | + $query .= " AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 281 | + } |
|
| 282 | + if ($id != '') { |
|
| 283 | + $query .= " OR marine_live.fammarine_id = :id"; |
|
| 284 | + } |
|
| 244 | 285 | $query .= ") AS marine WHERE latitude <> '0' AND longitude <> '0' "; |
| 245 | 286 | $query .= "ORDER BY fammarine_id, date"; |
| 246 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 287 | + if ($limit) { |
|
| 288 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 289 | + } |
|
| 247 | 290 | } else { |
| 248 | 291 | $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 249 | 292 | FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date "; |
| 250 | - if ($usecoord) $query .= "AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 251 | - if ($id != '') $query .= "OR marine_live.fammarine_id = :id "; |
|
| 293 | + if ($usecoord) { |
|
| 294 | + $query .= "AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 295 | + } |
|
| 296 | + if ($id != '') { |
|
| 297 | + $query .= "OR marine_live.fammarine_id = :id "; |
|
| 298 | + } |
|
| 252 | 299 | $query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 253 | 300 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 254 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 301 | + if ($limit) { |
|
| 302 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 303 | + } |
|
| 255 | 304 | } |
| 256 | 305 | } |
| 257 | 306 | $query_values = array(); |
| 258 | - if ($id != '') $query_values = array(':id' => $id); |
|
| 307 | + if ($id != '') { |
|
| 308 | + $query_values = array(':id' => $id); |
|
| 309 | + } |
|
| 259 | 310 | try { |
| 260 | 311 | $sth = $this->db->prepare($query); |
| 261 | 312 | $sth->execute($query_values); |
@@ -280,8 +331,12 @@ discard block |
||
| 280 | 331 | $id = filter_var($id,FILTER_SANITIZE_STRING); |
| 281 | 332 | $filter_query = $this->getFilter($filter,true,true); |
| 282 | 333 | |
| 283 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 284 | - if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
|
| 334 | + if (!isset($globalLiveInterval)) { |
|
| 335 | + $globalLiveInterval = '200'; |
|
| 336 | + } |
|
| 337 | + if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') { |
|
| 338 | + $globalMap3DMarinesLimit = '300'; |
|
| 339 | + } |
|
| 285 | 340 | if ($globalDBdriver == 'mysql') { |
| 286 | 341 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 287 | 342 | $query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
@@ -292,13 +347,17 @@ discard block |
||
| 292 | 347 | $query .= ") AS marine |
| 293 | 348 | WHERE latitude <> '0' AND longitude <> '0' |
| 294 | 349 | ORDER BY fammarine_id, date"; |
| 295 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 350 | + if ($limit) { |
|
| 351 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 352 | + } |
|
| 296 | 353 | } else { |
| 297 | 354 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 298 | 355 | FROM marine_live'.$filter_query.' marine_live.fammarine_id = :id '; |
| 299 | 356 | $query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 300 | 357 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 301 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 358 | + if ($limit) { |
|
| 359 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 360 | + } |
|
| 302 | 361 | } |
| 303 | 362 | } else { |
| 304 | 363 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -310,13 +369,17 @@ discard block |
||
| 310 | 369 | $query .= ") AS marine |
| 311 | 370 | WHERE latitude <> '0' AND longitude <> '0' |
| 312 | 371 | ORDER BY fammarine_id, date"; |
| 313 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 372 | + if ($limit) { |
|
| 373 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 374 | + } |
|
| 314 | 375 | } else { |
| 315 | 376 | $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 316 | 377 | FROM marine_live".$filter_query." marine_live.fammarine_id = :id "; |
| 317 | 378 | $query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 318 | 379 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 319 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 380 | + if ($limit) { |
|
| 381 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 382 | + } |
|
| 320 | 383 | } |
| 321 | 384 | } |
| 322 | 385 | $query_values = array(':id' => $id); |
@@ -342,7 +405,9 @@ discard block |
||
| 342 | 405 | global $globalDBdriver, $globalLiveInterval; |
| 343 | 406 | $filter_query = $this->getFilter($filter,true,true); |
| 344 | 407 | |
| 345 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 408 | + if (!isset($globalLiveInterval)) { |
|
| 409 | + $globalLiveInterval = '200'; |
|
| 410 | + } |
|
| 346 | 411 | if ($globalDBdriver == 'mysql') { |
| 347 | 412 | $query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
| 348 | 413 | } else { |
@@ -370,7 +435,9 @@ discard block |
||
| 370 | 435 | { |
| 371 | 436 | global $globalDBdriver, $globalLiveInterval; |
| 372 | 437 | $Marine = new Marine($this->db); |
| 373 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 438 | + if (!isset($globalLiveInterval)) { |
|
| 439 | + $globalLiveInterval = '200'; |
|
| 440 | + } |
|
| 374 | 441 | $filter_query = $this->getFilter($filter); |
| 375 | 442 | |
| 376 | 443 | if (is_array($coord)) { |
@@ -378,7 +445,9 @@ discard block |
||
| 378 | 445 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 379 | 446 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 380 | 447 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 381 | - } else return array(); |
|
| 448 | + } else { |
|
| 449 | + return array(); |
|
| 450 | + } |
|
| 382 | 451 | if ($globalDBdriver == 'mysql') { |
| 383 | 452 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query; |
| 384 | 453 | } else { |
@@ -398,7 +467,9 @@ discard block |
||
| 398 | 467 | { |
| 399 | 468 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 400 | 469 | $Marine = new Marine($this->db); |
| 401 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 470 | + if (!isset($globalLiveInterval)) { |
|
| 471 | + $globalLiveInterval = '200'; |
|
| 472 | + } |
|
| 402 | 473 | $filter_query = $this->getFilter($filter,true,true); |
| 403 | 474 | |
| 404 | 475 | if (is_array($coord)) { |
@@ -406,7 +477,9 @@ discard block |
||
| 406 | 477 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 407 | 478 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 408 | 479 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 409 | - } else return array(); |
|
| 480 | + } else { |
|
| 481 | + return array(); |
|
| 482 | + } |
|
| 410 | 483 | /* |
| 411 | 484 | if ($globalDBdriver == 'mysql') { |
| 412 | 485 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
@@ -629,11 +702,15 @@ discard block |
||
| 629 | 702 | //$query = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date'; |
| 630 | 703 | if ($globalDBdriver == 'mysql') { |
| 631 | 704 | $query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id'; |
| 632 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 705 | + if ($liveinterval) { |
|
| 706 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 707 | + } |
|
| 633 | 708 | $query .= ' ORDER BY date'; |
| 634 | 709 | } else { |
| 635 | 710 | $query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id'; |
| 636 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 711 | + if ($liveinterval) { |
|
| 712 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 713 | + } |
|
| 637 | 714 | $query .= ' ORDER BY date'; |
| 638 | 715 | } |
| 639 | 716 | |
@@ -728,7 +805,9 @@ discard block |
||
| 728 | 805 | $i++; |
| 729 | 806 | $j++; |
| 730 | 807 | if ($j == 30) { |
| 731 | - if ($globalDebug) echo "."; |
|
| 808 | + if ($globalDebug) { |
|
| 809 | + echo "."; |
|
| 810 | + } |
|
| 732 | 811 | try { |
| 733 | 812 | |
| 734 | 813 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -1022,7 +1101,9 @@ discard block |
||
| 1022 | 1101 | { |
| 1023 | 1102 | return false; |
| 1024 | 1103 | } |
| 1025 | - } else return ''; |
|
| 1104 | + } else { |
|
| 1105 | + return ''; |
|
| 1106 | + } |
|
| 1026 | 1107 | |
| 1027 | 1108 | if ($longitude != '') |
| 1028 | 1109 | { |
@@ -1030,7 +1111,9 @@ discard block |
||
| 1030 | 1111 | { |
| 1031 | 1112 | return false; |
| 1032 | 1113 | } |
| 1033 | - } else return ''; |
|
| 1114 | + } else { |
|
| 1115 | + return ''; |
|
| 1116 | + } |
|
| 1034 | 1117 | |
| 1035 | 1118 | |
| 1036 | 1119 | if ($heading != '') |
@@ -1039,7 +1122,9 @@ discard block |
||
| 1039 | 1122 | { |
| 1040 | 1123 | return false; |
| 1041 | 1124 | } |
| 1042 | - } else $heading = 0; |
|
| 1125 | + } else { |
|
| 1126 | + $heading = 0; |
|
| 1127 | + } |
|
| 1043 | 1128 | |
| 1044 | 1129 | if ($groundspeed != '') |
| 1045 | 1130 | { |
@@ -1047,9 +1132,13 @@ discard block |
||
| 1047 | 1132 | { |
| 1048 | 1133 | return false; |
| 1049 | 1134 | } |
| 1050 | - } else $groundspeed = 0; |
|
| 1135 | + } else { |
|
| 1136 | + $groundspeed = 0; |
|
| 1137 | + } |
|
| 1051 | 1138 | date_default_timezone_set('UTC'); |
| 1052 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
| 1139 | + if ($date == '') { |
|
| 1140 | + $date = date("Y-m-d H:i:s", time()); |
|
| 1141 | + } |
|
| 1053 | 1142 | |
| 1054 | 1143 | |
| 1055 | 1144 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -1077,16 +1166,28 @@ discard block |
||
| 1077 | 1166 | $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
| 1078 | 1167 | $race_rank = filter_var($race_rank,FILTER_SANITIZE_NUMBER_INT); |
| 1079 | 1168 | $race_time = filter_var($race_time,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1080 | - if ($typeid == '') $typeid = NULL; |
|
| 1081 | - if ($statusid == '') $statusid = NULL; |
|
| 1082 | - if ($distance == '') $distance = NULL; |
|
| 1169 | + if ($typeid == '') { |
|
| 1170 | + $typeid = NULL; |
|
| 1171 | + } |
|
| 1172 | + if ($statusid == '') { |
|
| 1173 | + $statusid = NULL; |
|
| 1174 | + } |
|
| 1175 | + if ($distance == '') { |
|
| 1176 | + $distance = NULL; |
|
| 1177 | + } |
|
| 1083 | 1178 | |
| 1084 | 1179 | //if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
| 1085 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1086 | - if ($arrival_date == '') $arrival_date = NULL; |
|
| 1180 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
| 1181 | + $heading = 0; |
|
| 1182 | + } |
|
| 1183 | + if ($arrival_date == '') { |
|
| 1184 | + $arrival_date = NULL; |
|
| 1185 | + } |
|
| 1087 | 1186 | $query = ''; |
| 1088 | 1187 | if ($globalArchive) { |
| 1089 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
| 1188 | + if ($globalDebug) { |
|
| 1189 | + echo '-- Delete previous data -- '; |
|
| 1190 | + } |
|
| 1090 | 1191 | $query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;'; |
| 1091 | 1192 | } |
| 1092 | 1193 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name,distance,race_rank,race_time) |
@@ -1101,10 +1202,14 @@ discard block |
||
| 1101 | 1202 | } |
| 1102 | 1203 | |
| 1103 | 1204 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 1104 | - if ($globalDebug) echo '(Add to Marine archive : '; |
|
| 1205 | + if ($globalDebug) { |
|
| 1206 | + echo '(Add to Marine archive : '; |
|
| 1207 | + } |
|
| 1105 | 1208 | $MarineArchive = new MarineArchive($this->db); |
| 1106 | 1209 | $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country,$captain_id,$captain_name,$race_id,$race_name,$distance,$race_rank,$race_time); |
| 1107 | - if ($globalDebug) echo $result.')'; |
|
| 1210 | + if ($globalDebug) { |
|
| 1211 | + echo $result.')'; |
|
| 1212 | + } |
|
| 1108 | 1213 | } |
| 1109 | 1214 | return "success"; |
| 1110 | 1215 | } |
@@ -61,7 +61,9 @@ discard block |
||
| 61 | 61 | public function checkAll() { |
| 62 | 62 | global $globalDebug, $globalNoDB, $globalVM; |
| 63 | 63 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 64 | - if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
| 64 | + if ($globalDebug) { |
|
| 65 | + echo "Update last seen tracked data...\n"; |
|
| 66 | + } |
|
| 65 | 67 | foreach ($this->all_tracked as $key => $flight) { |
| 66 | 68 | if (isset($this->all_tracked[$key]['id'])) { |
| 67 | 69 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
@@ -71,8 +73,11 @@ discard block |
||
| 71 | 73 | $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 72 | 74 | } else { |
| 73 | 75 | $timerace = (strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']); |
| 74 | - if ($timerace > time()) $finaldatetime = NULL; |
|
| 75 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 76 | + if ($timerace > time()) { |
|
| 77 | + $finaldatetime = NULL; |
|
| 78 | + } else { |
|
| 79 | + $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 80 | + } |
|
| 76 | 81 | $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 77 | 82 | } |
| 78 | 83 | } else { |
@@ -86,13 +91,17 @@ discard block |
||
| 86 | 91 | public function del() { |
| 87 | 92 | global $globalDebug, $globalNoDB, $globalNoImport; |
| 88 | 93 | // Delete old infos |
| 89 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
| 94 | + if ($globalDebug) { |
|
| 95 | + echo 'Delete old values and update latest data...'."\n"; |
|
| 96 | + } |
|
| 90 | 97 | foreach ($this->all_tracked as $key => $flight) { |
| 91 | 98 | if (isset($flight['lastupdate'])) { |
| 92 | 99 | if ($flight['lastupdate'] < (time()-3000)) { |
| 93 | 100 | if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
| 94 | 101 | if (isset($this->all_tracked[$key]['id'])) { |
| 95 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 102 | + if ($globalDebug) { |
|
| 103 | + echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 104 | + } |
|
| 96 | 105 | /* |
| 97 | 106 | $MarineLive = new MarineLive(); |
| 98 | 107 | $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']); |
@@ -106,14 +115,19 @@ discard block |
||
| 106 | 115 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 107 | 116 | } else { |
| 108 | 117 | $timerace = strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']; |
| 109 | - if ($timerace > time()) $finaldatetime = NULL; |
|
| 110 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 118 | + if ($timerace > time()) { |
|
| 119 | + $finaldatetime = NULL; |
|
| 120 | + } else { |
|
| 121 | + $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 122 | + } |
|
| 111 | 123 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 112 | 124 | } |
| 113 | 125 | } else { |
| 114 | 126 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 115 | 127 | } |
| 116 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 128 | + if ($globalDebug && $result != 'success') { |
|
| 129 | + echo '!!! ERROR : '.$result."\n"; |
|
| 130 | + } |
|
| 117 | 131 | } |
| 118 | 132 | // Put in archive |
| 119 | 133 | // $Marine->db = null; |
@@ -127,7 +141,9 @@ discard block |
||
| 127 | 141 | |
| 128 | 142 | public function add($line) { |
| 129 | 143 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine, $globalLiveInterval, $globalVM; |
| 130 | - if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
|
| 144 | + if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') { |
|
| 145 | + $globalCoordMinChange = '0.02'; |
|
| 146 | + } |
|
| 131 | 147 | date_default_timezone_set('UTC'); |
| 132 | 148 | $dataFound = false; |
| 133 | 149 | $send = false; |
@@ -141,20 +157,30 @@ discard block |
||
| 141 | 157 | // Increment message number |
| 142 | 158 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
| 143 | 159 | $current_date = date('Y-m-d'); |
| 144 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 145 | - else $source = ''; |
|
| 146 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 160 | + if (isset($line['source_name'])) { |
|
| 161 | + $source = $line['source_name']; |
|
| 162 | + } else { |
|
| 163 | + $source = ''; |
|
| 164 | + } |
|
| 165 | + if ($source == '' || $line['format_source'] == 'aprs') { |
|
| 166 | + $source = $line['format_source']; |
|
| 167 | + } |
|
| 147 | 168 | if (!isset($this->stats[$current_date][$source]['msg'])) { |
| 148 | 169 | $this->stats[$current_date][$source]['msg']['date'] = time(); |
| 149 | 170 | $this->stats[$current_date][$source]['msg']['nb'] = 1; |
| 150 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 171 | + } else { |
|
| 172 | + $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 173 | + } |
|
| 151 | 174 | } |
| 152 | 175 | |
| 153 | 176 | |
| 154 | 177 | $Common = new Common(); |
| 155 | 178 | $AIS = new AIS(); |
| 156 | - if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
| 157 | - else $id = trim($line['id']); |
|
| 179 | + if (!isset($line['id'])) { |
|
| 180 | + $id = trim($line['mmsi']); |
|
| 181 | + } else { |
|
| 182 | + $id = trim($line['id']); |
|
| 183 | + } |
|
| 158 | 184 | |
| 159 | 185 | if (!isset($this->all_tracked[$id])) { |
| 160 | 186 | $this->all_tracked[$id] = array(); |
@@ -162,10 +188,16 @@ discard block |
||
| 162 | 188 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '','captain_id' => '','captain_name' => '','race_id' => '','race_name' => '','distance' => NULL,'race_rank' => NULL,'race_time' => NULL,'race_begin' => '')); |
| 163 | 189 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
| 164 | 190 | if (!isset($line['id'])) { |
| 165 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
| 191 | + if (!isset($globalDaemon)) { |
|
| 192 | + $globalDaemon = TRUE; |
|
| 193 | + } |
|
| 166 | 194 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
| 167 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 168 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
| 195 | + } else { |
|
| 196 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 197 | + } |
|
| 198 | + if ($globalAllTracked !== FALSE) { |
|
| 199 | + $dataFound = true; |
|
| 200 | + } |
|
| 169 | 201 | } |
| 170 | 202 | |
| 171 | 203 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
@@ -222,7 +254,9 @@ discard block |
||
| 222 | 254 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
| 223 | 255 | if (!isset($this->all_tracked[$id]['arrival_code'])) { |
| 224 | 256 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
| 225 | - if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
|
| 257 | + if ($globalDebug) { |
|
| 258 | + echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
|
| 259 | + } |
|
| 226 | 260 | if ($this->all_tracked[$id]['addedMarine'] != 0) { |
| 227 | 261 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 228 | 262 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -235,7 +269,9 @@ discard block |
||
| 235 | 269 | } |
| 236 | 270 | } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) { |
| 237 | 271 | $this->all_tracked[$id]['arrival_code'] = $line['arrival_code']; |
| 238 | - if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
|
| 272 | + if ($globalDebug) { |
|
| 273 | + echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
|
| 274 | + } |
|
| 239 | 275 | if (!isset($line['id'])) { |
| 240 | 276 | $this->all_tracked[$id]['id'] = $id.'-'.date('YmdHi'); |
| 241 | 277 | $this->all_tracked[$id]['forcenew'] = 1; |
@@ -244,7 +280,9 @@ discard block |
||
| 244 | 280 | } |
| 245 | 281 | } |
| 246 | 282 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
| 247 | - if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 283 | + if (strtotime($line['arrival_date']) > time()) { |
|
| 284 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 285 | + } |
|
| 248 | 286 | } |
| 249 | 287 | if (isset($line['captain_id']) && $line['captain_id'] != '') { |
| 250 | 288 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_id' => $line['captain_id'])); |
@@ -289,34 +327,49 @@ discard block |
||
| 289 | 327 | $Marine = new Marine($this->db); |
| 290 | 328 | $fromsource = NULL; |
| 291 | 329 | $result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
| 292 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 330 | + if ($globalDebug && $result != 'success') { |
|
| 331 | + echo '!!! ERROR : '.$result."\n"; |
|
| 332 | + } |
|
| 293 | 333 | $Marine->db = null; |
| 294 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 334 | + if ($globalDebugTimeElapsed) { |
|
| 335 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 336 | + } |
|
| 295 | 337 | } |
| 296 | 338 | } |
| 297 | 339 | } |
| 298 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 340 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
| 341 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 342 | + } |
|
| 299 | 343 | } |
| 300 | 344 | |
| 301 | 345 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) { |
| 302 | 346 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
| 303 | 347 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
| 304 | 348 | } else { |
| 305 | - if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
|
| 306 | - elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 349 | + if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
| 350 | + echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
|
| 351 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
| 352 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 353 | + } |
|
| 307 | 354 | return ''; |
| 308 | 355 | } |
| 309 | 356 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) { |
| 310 | - if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
|
| 357 | + if ($globalDebug) { |
|
| 358 | + echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
|
| 359 | + } |
|
| 311 | 360 | return ''; |
| 312 | 361 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) >= time()+20*60) { |
| 313 | - if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
|
| 362 | + if ($globalDebug) { |
|
| 363 | + echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
|
| 364 | + } |
|
| 314 | 365 | return ''; |
| 315 | 366 | } elseif (!isset($line['datetime'])) { |
| 316 | 367 | date_default_timezone_set('UTC'); |
| 317 | 368 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
| 318 | 369 | } else { |
| 319 | - if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." date: ".$line['datetime']." - format : ".$line['format_source']."!!!\n"; |
|
| 370 | + if ($globalDebug) { |
|
| 371 | + echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." date: ".$line['datetime']." - format : ".$line['format_source']."!!!\n"; |
|
| 372 | + } |
|
| 320 | 373 | return ''; |
| 321 | 374 | } |
| 322 | 375 | |
@@ -329,14 +382,21 @@ discard block |
||
| 329 | 382 | if ($distance > 1000 && $distance < 10000) { |
| 330 | 383 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
| 331 | 384 | $speed = $speed*3.6; |
| 332 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed,2))); |
|
| 333 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
|
| 385 | + if ($speed < 1000) { |
|
| 386 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed,2))); |
|
| 387 | + } |
|
| 388 | + if ($globalDebug) { |
|
| 389 | + echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
|
| 390 | + } |
|
| 334 | 391 | } |
| 335 | 392 | } |
| 336 | 393 | |
| 337 | 394 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
| 338 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 339 | - else unset($timediff); |
|
| 395 | + if (isset($this->all_tracked[$id]['time_last_coord'])) { |
|
| 396 | + $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 397 | + } else { |
|
| 398 | + unset($timediff); |
|
| 399 | + } |
|
| 340 | 400 | if ($this->tmd > 5 || |
| 341 | 401 | !isset($timediff) || |
| 342 | 402 | $timediff > $globalLiveInterval || |
@@ -353,22 +413,32 @@ discard block |
||
| 353 | 413 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 354 | 414 | $this->all_tracked[$id]['putinarchive'] = true; |
| 355 | 415 | |
| 356 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 416 | + if ($globalDebug) { |
|
| 417 | + echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 418 | + } |
|
| 357 | 419 | $timeelapsed = microtime(true); |
| 358 | 420 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 359 | 421 | $Marine = new Marine($this->db); |
| 360 | 422 | $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
| 361 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 423 | + if (!empty($all_country)) { |
|
| 424 | + $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 425 | + } |
|
| 362 | 426 | $Marine->db = null; |
| 363 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 427 | + if ($globalDebugTimeElapsed) { |
|
| 428 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 429 | + } |
|
| 364 | 430 | } |
| 365 | 431 | $this->tmd = 0; |
| 366 | - if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
| 432 | + if ($globalDebug) { |
|
| 433 | + echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
| 434 | + } |
|
| 367 | 435 | } |
| 368 | 436 | } |
| 369 | 437 | |
| 370 | 438 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 371 | - if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
| 439 | + if (!isset($this->all_tracked[$id]['archive_latitude'])) { |
|
| 440 | + $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
| 441 | + } |
|
| 372 | 442 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
| 373 | 443 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
| 374 | 444 | $dataFound = true; |
@@ -377,8 +447,12 @@ discard block |
||
| 377 | 447 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
| 378 | 448 | } |
| 379 | 449 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 380 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 381 | - if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
| 450 | + if ($line['longitude'] > 180) { |
|
| 451 | + $line['longitude'] = $line['longitude'] - 360; |
|
| 452 | + } |
|
| 453 | + if (!isset($this->all_tracked[$id]['archive_longitude'])) { |
|
| 454 | + $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
| 455 | + } |
|
| 382 | 456 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
| 383 | 457 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
| 384 | 458 | $dataFound = true; |
@@ -396,7 +470,9 @@ discard block |
||
| 396 | 470 | } |
| 397 | 471 | } |
| 398 | 472 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 399 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 473 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) { |
|
| 474 | + $dataFound = true; |
|
| 475 | + } |
|
| 400 | 476 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
| 401 | 477 | } |
| 402 | 478 | if (isset($line['format_source']) && $line['format_source'] != '') { |
@@ -410,15 +486,21 @@ discard block |
||
| 410 | 486 | } |
| 411 | 487 | |
| 412 | 488 | if (isset($line['heading']) && $line['heading'] != '') { |
| 413 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 489 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) { |
|
| 490 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
| 491 | + } |
|
| 414 | 492 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
| 415 | 493 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
| 416 | 494 | //$dataFound = true; |
| 417 | 495 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
| 418 | 496 | $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
| 419 | 497 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
| 420 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 421 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 498 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) { |
|
| 499 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
| 500 | + } |
|
| 501 | + if ($globalDebug) { |
|
| 502 | + echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 503 | + } |
|
| 422 | 504 | } |
| 423 | 505 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
| 424 | 506 | |
@@ -430,28 +512,45 @@ discard block |
||
| 430 | 512 | if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
| 431 | 513 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
| 432 | 514 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 433 | - if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
| 515 | + if ($globalDebug) { |
|
| 516 | + echo "Check if vessel is already in DB..."; |
|
| 517 | + } |
|
| 434 | 518 | $timeelapsed = microtime(true); |
| 435 | 519 | $MarineLive = new MarineLive($this->db); |
| 436 | 520 | if (isset($line['id']) && isset($globalVM) && $globalVM) { |
| 437 | 521 | $Marine = new Marine($this->db); |
| 438 | 522 | $recent_ident = $Marine->checkId($line['id']); |
| 439 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkId : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 523 | + if ($globalDebugTimeElapsed) { |
|
| 524 | + echo 'Time elapsed for update checkId : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 525 | + } |
|
| 440 | 526 | $Marine->db=null; |
| 441 | 527 | } elseif (isset($line['id'])) { |
| 442 | 528 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
| 443 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 529 | + if ($globalDebugTimeElapsed) { |
|
| 530 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 531 | + } |
|
| 444 | 532 | } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
| 445 | 533 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
| 446 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 534 | + if ($globalDebugTimeElapsed) { |
|
| 535 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 536 | + } |
|
| 447 | 537 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
| 448 | 538 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
| 449 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 450 | - } else $recent_ident = ''; |
|
| 539 | + if ($globalDebugTimeElapsed) { |
|
| 540 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 541 | + } |
|
| 542 | + } else { |
|
| 543 | + $recent_ident = ''; |
|
| 544 | + } |
|
| 451 | 545 | $MarineLive->db=null; |
| 452 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 453 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 454 | - } else $recent_ident = ''; |
|
| 546 | + if ($globalDebug && $recent_ident == '') { |
|
| 547 | + echo " Not in DB.\n"; |
|
| 548 | + } elseif ($globalDebug && $recent_ident != '') { |
|
| 549 | + echo " Already in DB.\n"; |
|
| 550 | + } |
|
| 551 | + } else { |
|
| 552 | + $recent_ident = ''; |
|
| 553 | + } |
|
| 455 | 554 | } else { |
| 456 | 555 | $recent_ident = ''; |
| 457 | 556 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
@@ -460,12 +559,17 @@ discard block |
||
| 460 | 559 | if($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM))) |
| 461 | 560 | { |
| 462 | 561 | if ($globalDebug) { |
| 463 | - if ($this->all_tracked[$id]['mmsi'] == '') echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
|
| 464 | - else echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
| 562 | + if ($this->all_tracked[$id]['mmsi'] == '') { |
|
| 563 | + echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
|
| 564 | + } else { |
|
| 565 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
| 566 | + } |
|
| 465 | 567 | } |
| 466 | 568 | //adds the spotter data for the archive |
| 467 | 569 | $highlight = ''; |
| 468 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
| 570 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
| 571 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
| 572 | + } |
|
| 469 | 573 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 470 | 574 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 471 | 575 | $timeelapsed = microtime(true); |
@@ -476,20 +580,30 @@ discard block |
||
| 476 | 580 | $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
| 477 | 581 | } |
| 478 | 582 | $Marine->db = null; |
| 479 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 480 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 583 | + if ($globalDebug && isset($result)) { |
|
| 584 | + echo $result."\n"; |
|
| 585 | + } |
|
| 586 | + if ($globalDebugTimeElapsed) { |
|
| 587 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 588 | + } |
|
| 481 | 589 | } |
| 482 | 590 | } |
| 483 | 591 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
| 484 | 592 | // Add source stat in DB |
| 485 | 593 | $Stats = new Stats($this->db); |
| 486 | 594 | if (!empty($this->stats)) { |
| 487 | - if ($globalDebug) echo 'Add source stats : '; |
|
| 595 | + if ($globalDebug) { |
|
| 596 | + echo 'Add source stats : '; |
|
| 597 | + } |
|
| 488 | 598 | foreach($this->stats as $date => $data) { |
| 489 | 599 | foreach($data as $source => $sourced) { |
| 490 | 600 | //print_r($sourced); |
| 491 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
| 492 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
| 601 | + if (isset($sourced['polar'])) { |
|
| 602 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
| 603 | + } |
|
| 604 | + if (isset($sourced['hist'])) { |
|
| 605 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
| 606 | + } |
|
| 493 | 607 | if (isset($sourced['msg'])) { |
| 494 | 608 | if (time() - $sourced['msg']['date'] > 10) { |
| 495 | 609 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
@@ -502,7 +616,9 @@ discard block |
||
| 502 | 616 | unset($this->stats[$date]); |
| 503 | 617 | } |
| 504 | 618 | } |
| 505 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 619 | + if ($globalDebug) { |
|
| 620 | + echo 'Done'."\n"; |
|
| 621 | + } |
|
| 506 | 622 | } |
| 507 | 623 | $Stats->db = null; |
| 508 | 624 | } |
@@ -512,13 +628,17 @@ discard block |
||
| 512 | 628 | $this->all_tracked[$id]['addedMarine'] = 1; |
| 513 | 629 | //print_r($this->all_tracked[$id]); |
| 514 | 630 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 515 | - if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
| 631 | + if ($globalDebug) { |
|
| 632 | + echo "---- Deleting Live Marine data older than 9 hours..."; |
|
| 633 | + } |
|
| 516 | 634 | //MarineLive->deleteLiveMarineDataNotUpdated(); |
| 517 | 635 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 518 | 636 | $MarineLive = new MarineLive($this->db); |
| 519 | 637 | $MarineLive->deleteLiveMarineData(); |
| 520 | 638 | $MarineLive->db=null; |
| 521 | - if ($globalDebug) echo " Done\n"; |
|
| 639 | + if ($globalDebug) { |
|
| 640 | + echo " Done\n"; |
|
| 641 | + } |
|
| 522 | 642 | } |
| 523 | 643 | $this->last_delete = time(); |
| 524 | 644 | } |
@@ -534,8 +654,11 @@ discard block |
||
| 534 | 654 | } else { |
| 535 | 655 | //$finaldatetime = date('Y-m-d H:i:s',strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']); |
| 536 | 656 | $timerace = (strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']); |
| 537 | - if ($timerace > time()) $finaldatetime = NULL; |
|
| 538 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 657 | + if ($timerace > time()) { |
|
| 658 | + $finaldatetime = NULL; |
|
| 659 | + } else { |
|
| 660 | + $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 661 | + } |
|
| 539 | 662 | |
| 540 | 663 | $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$finaldatetime,$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
| 541 | 664 | } |
@@ -554,18 +677,26 @@ discard block |
||
| 554 | 677 | echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n"; |
| 555 | 678 | } |
| 556 | 679 | $ignoreImport = false; |
| 557 | - if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true; |
|
| 680 | + if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] != 'Racing') { |
|
| 681 | + $ignoreImport = true; |
|
| 682 | + } |
|
| 558 | 683 | if (!$ignoreImport) { |
| 559 | 684 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
| 560 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
| 685 | + if ($globalDebug) { |
|
| 686 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
| 687 | + } |
|
| 561 | 688 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 562 | 689 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 563 | 690 | $timeelapsed = microtime(true); |
| 564 | 691 | $MarineLive = new MarineLive($this->db); |
| 565 | 692 | $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
| 566 | 693 | $MarineLive->db = null; |
| 567 | - if ($globalDebug) echo $result."\n"; |
|
| 568 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 694 | + if ($globalDebug) { |
|
| 695 | + echo $result."\n"; |
|
| 696 | + } |
|
| 697 | + if ($globalDebugTimeElapsed) { |
|
| 698 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 699 | + } |
|
| 569 | 700 | } |
| 570 | 701 | } |
| 571 | 702 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
@@ -577,7 +708,9 @@ discard block |
||
| 577 | 708 | |
| 578 | 709 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $line['format_source'] != 'aprs' && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
| 579 | 710 | $source = $this->all_tracked[$id]['source_name']; |
| 580 | - if ($source == '') $source = $this->all_tracked[$id]['format_source']; |
|
| 711 | + if ($source == '') { |
|
| 712 | + $source = $this->all_tracked[$id]['format_source']; |
|
| 713 | + } |
|
| 581 | 714 | if (!isset($this->source_location[$source])) { |
| 582 | 715 | $Location = new Source($this->db); |
| 583 | 716 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -598,7 +731,9 @@ discard block |
||
| 598 | 731 | $stats_heading = round($stats_heading/22.5); |
| 599 | 732 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
| 600 | 733 | $current_date = date('Y-m-d'); |
| 601 | - if ($stats_heading == 16) $stats_heading = 0; |
|
| 734 | + if ($stats_heading == 16) { |
|
| 735 | + $stats_heading = 0; |
|
| 736 | + } |
|
| 602 | 737 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 603 | 738 | for ($i=0;$i<=15;$i++) { |
| 604 | 739 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
@@ -616,7 +751,9 @@ discard block |
||
| 616 | 751 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 617 | 752 | end($this->stats[$current_date][$source]['hist']); |
| 618 | 753 | $mini = key($this->stats[$current_date][$source]['hist'])+10; |
| 619 | - } else $mini = 0; |
|
| 754 | + } else { |
|
| 755 | + $mini = 0; |
|
| 756 | + } |
|
| 620 | 757 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 621 | 758 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 622 | 759 | } |
@@ -628,19 +765,27 @@ discard block |
||
| 628 | 765 | |
| 629 | 766 | |
| 630 | 767 | $this->all_tracked[$id]['lastupdate'] = time(); |
| 631 | - if ($this->all_tracked[$id]['putinarchive']) $send = true; |
|
| 632 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 768 | + if ($this->all_tracked[$id]['putinarchive']) { |
|
| 769 | + $send = true; |
|
| 770 | + } |
|
| 771 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
| 772 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 773 | + } |
|
| 633 | 774 | //$this->del(); |
| 634 | 775 | |
| 635 | 776 | |
| 636 | 777 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 637 | 778 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 638 | - if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
|
| 779 | + if ($globalDebug) { |
|
| 780 | + echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
|
| 781 | + } |
|
| 639 | 782 | $MarineLive = new MarineLive($this->db); |
| 640 | 783 | $MarineLive->deleteLiveMarineDataNotUpdated(); |
| 641 | 784 | $MarineLive->db = null; |
| 642 | 785 | //MarineLive->deleteLiveMarineData(); |
| 643 | - if ($globalDebug) echo " Done\n"; |
|
| 786 | + if ($globalDebug) { |
|
| 787 | + echo " Done\n"; |
|
| 788 | + } |
|
| 644 | 789 | } |
| 645 | 790 | $this->last_delete_hourly = time(); |
| 646 | 791 | } |
@@ -649,7 +794,9 @@ discard block |
||
| 649 | 794 | //$ignoreImport = false; |
| 650 | 795 | } |
| 651 | 796 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 652 | - if ($send) return $this->all_tracked[$id]; |
|
| 797 | + if ($send) { |
|
| 798 | + return $this->all_tracked[$id]; |
|
| 799 | + } |
|
| 653 | 800 | } |
| 654 | 801 | } |
| 655 | 802 | } |
@@ -46,8 +46,10 @@ discard block |
||
| 46 | 46 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
| 47 | 47 | $sql_date = $end_date; |
| 48 | 48 | } |
| 49 | - } else $sql_date = ''; |
|
| 50 | -} |
|
| 49 | + } else { |
|
| 50 | + $sql_date = ''; |
|
| 51 | + } |
|
| 52 | + } |
|
| 51 | 53 | |
| 52 | 54 | if (isset($_GET['highest_altitude'])) { |
| 53 | 55 | //for altitude manipulation |
@@ -61,8 +63,12 @@ discard block |
||
| 61 | 63 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
| 62 | 64 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
| 63 | 65 | $sql_altitude = $start_altitude; |
| 64 | - } else $sql_altitude = ''; |
|
| 65 | -} else $sql_altitude = ''; |
|
| 66 | + } else { |
|
| 67 | + $sql_altitude = ''; |
|
| 68 | + } |
|
| 69 | + } else { |
|
| 70 | + $sql_altitude = ''; |
|
| 71 | +} |
|
| 66 | 72 | |
| 67 | 73 | //calculuation for the pagination |
| 68 | 74 | if(!isset($_GET['limit'])) |
@@ -80,7 +86,7 @@ discard block |
||
| 80 | 86 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 81 | 87 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 82 | 88 | } |
| 83 | -} else { |
|
| 89 | +} else { |
|
| 84 | 90 | $limit_explode = explode(",", $_GET['limit']); |
| 85 | 91 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
| 86 | 92 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -146,10 +152,15 @@ discard block |
||
| 146 | 152 | $dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT); |
| 147 | 153 | $number_results = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 148 | 154 | if ($dist != '') { |
| 149 | - if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934; |
|
| 150 | - elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852; |
|
| 155 | + if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') { |
|
| 156 | + $dist = $dist*1.60934; |
|
| 157 | + } elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') { |
|
| 158 | + $dist = $dist*1.852; |
|
| 159 | + } |
|
| 160 | + } |
|
| 161 | + if (!isset($sql_date)) { |
|
| 162 | + $sql_date = ''; |
|
| 151 | 163 | } |
| 152 | - if (!isset($sql_date)) $sql_date = ''; |
|
| 153 | 164 | if ($archive == 1) { |
| 154 | 165 | if ($type == 'aircraft') { |
| 155 | 166 | $SpotterArchive = new SpotterArchive(); |
@@ -227,7 +238,10 @@ discard block |
||
| 227 | 238 | if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
| 228 | 239 | if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
| 229 | 240 | if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; } |
| 230 | - if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
| 241 | + if (isset($_GET['highlights'])) { |
|
| 242 | + if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; |
|
| 243 | + } |
|
| 244 | + } |
|
| 231 | 245 | if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; } |
| 232 | 246 | if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
| 233 | 247 | if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
@@ -367,7 +381,10 @@ discard block |
||
| 367 | 381 | <div class="form-group"> |
| 368 | 382 | <label class="control-label col-sm-2"><?php echo _("Keywords"); ?></label> |
| 369 | 383 | <div class="col-sm-10"> |
| 370 | - <input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) print $q; ?>" size="10" placeholder="<?php echo _("Keywords"); ?>" /> |
|
| 384 | + <input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) { |
|
| 385 | + print $q; |
|
| 386 | +} |
|
| 387 | +?>" size="10" placeholder="<?php echo _("Keywords"); ?>" /> |
|
| 371 | 388 | </div> |
| 372 | 389 | </div> |
| 373 | 390 | </fieldset> |
@@ -386,7 +403,10 @@ discard block |
||
| 386 | 403 | </select> |
| 387 | 404 | </div> |
| 388 | 405 | </div> |
| 389 | - <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
| 406 | + <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) { |
|
| 407 | + print $manufacturer; |
|
| 408 | +} |
|
| 409 | +?>')</script> |
|
| 390 | 410 | <div class="form-group"> |
| 391 | 411 | <label class="control-label col-sm-2"><?php echo _("Type"); ?></label> |
| 392 | 412 | <div class="col-sm-10"> |
@@ -395,11 +415,17 @@ discard block |
||
| 395 | 415 | </select> |
| 396 | 416 | </div> |
| 397 | 417 | </div> |
| 398 | - <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
| 418 | + <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) { |
|
| 419 | + print $aircraft_icao; |
|
| 420 | +} |
|
| 421 | +?>');</script> |
|
| 399 | 422 | <div class="form-group"> |
| 400 | 423 | <label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> |
| 401 | 424 | <div class="col-sm-10"> |
| 402 | - <input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) print $registration; ?>" size="8" placeholder="<?php echo _("Registration"); ?>" /> |
|
| 425 | + <input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) { |
|
| 426 | + print $registration; |
|
| 427 | +} |
|
| 428 | +?>" size="8" placeholder="<?php echo _("Registration"); ?>" /> |
|
| 403 | 429 | </div> |
| 404 | 430 | </div> |
| 405 | 431 | <?php |
@@ -408,22 +434,31 @@ discard block |
||
| 408 | 434 | <div class="form-group"> |
| 409 | 435 | <label class="control-label col-sm-2"><?php echo _("Pilot id"); ?></label> |
| 410 | 436 | <div class="col-sm-10"> |
| 411 | - <input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) print $pilot_id; ?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" /> |
|
| 437 | + <input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) { |
|
| 438 | + print $pilot_id; |
|
| 439 | +} |
|
| 440 | +?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" /> |
|
| 412 | 441 | </div> |
| 413 | 442 | </div> |
| 414 | 443 | <div class="form-group"> |
| 415 | 444 | <label class="control-label col-sm-2"><?php echo _("Pilot name"); ?></label> |
| 416 | 445 | <div class="col-sm-10"> |
| 417 | - <input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) print $pilot_name; ?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" /> |
|
| 446 | + <input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) { |
|
| 447 | + print $pilot_name; |
|
| 448 | +} |
|
| 449 | +?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" /> |
|
| 418 | 450 | </div> |
| 419 | 451 | </div> |
| 420 | 452 | <?php |
| 421 | - }else { |
|
| 453 | + } else { |
|
| 422 | 454 | ?> |
| 423 | 455 | <div class="form-group"> |
| 424 | 456 | <label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> |
| 425 | 457 | <div class="col-sm-10"> |
| 426 | - <input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) print $owner; ?>" size="15" placeholder="<?php echo _("Owner name"); ?>" /> |
|
| 458 | + <input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) { |
|
| 459 | + print $owner; |
|
| 460 | +} |
|
| 461 | +?>" size="15" placeholder="<?php echo _("Owner name"); ?>" /> |
|
| 427 | 462 | </div> |
| 428 | 463 | </div> |
| 429 | 464 | <?php |
@@ -431,8 +466,14 @@ discard block |
||
| 431 | 466 | ?> |
| 432 | 467 | <div class="form-group"> |
| 433 | 468 | <div class="col-sm-offset-2 col-sm-10"> |
| 434 | - <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
| 435 | - <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
| 469 | + <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) { |
|
| 470 | + if ($_GET['highlights'] == "true"){ print 'checked="checked"'; |
|
| 471 | +} |
|
| 472 | +} ?>> <label for="highlights"><?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
| 473 | + <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) { |
|
| 474 | + if ($_GET['highlights'] == "true"){ print 'checked="checked"'; |
|
| 475 | +} |
|
| 476 | +} ?>> <?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
| 436 | 477 | </div> |
| 437 | 478 | </div> |
| 438 | 479 | </fieldset> |
@@ -446,7 +487,10 @@ discard block |
||
| 446 | 487 | </select> |
| 447 | 488 | </div> |
| 448 | 489 | </div> |
| 449 | - <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script> |
|
| 490 | + <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) { |
|
| 491 | + print $airline; |
|
| 492 | +} |
|
| 493 | +?>');</script> |
|
| 450 | 494 | <div class="form-group"> |
| 451 | 495 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
| 452 | 496 | <div class="col-sm-10"> |
@@ -455,19 +499,34 @@ discard block |
||
| 455 | 499 | </select> |
| 456 | 500 | </div> |
| 457 | 501 | </div> |
| 458 | - <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
| 502 | + <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) { |
|
| 503 | + print $airline_country; |
|
| 504 | +} |
|
| 505 | +?>');</script> |
|
| 459 | 506 | <div class="form-group"> |
| 460 | 507 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
| 461 | 508 | <div class="col-sm-10"> |
| 462 | - <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
| 509 | + <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) { |
|
| 510 | + print $callsign; |
|
| 511 | +} |
|
| 512 | +?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
| 463 | 513 | </div> |
| 464 | 514 | </div> |
| 465 | 515 | <div class="form-group"> |
| 466 | 516 | <div class="col-sm-offset-2 col-sm-10"> |
| 467 | 517 | <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
| 468 | - <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
| 469 | - <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
| 470 | - <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
| 518 | + <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) { |
|
| 519 | + if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; |
|
| 520 | +} |
|
| 521 | +} ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
| 522 | + <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) { |
|
| 523 | + if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; |
|
| 524 | +} |
|
| 525 | +} ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
| 526 | + <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) { |
|
| 527 | + if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; |
|
| 528 | +} |
|
| 529 | +} ?>> <?php echo _("Only Military airlines"); ?></label> |
|
| 471 | 530 | </div> |
| 472 | 531 | </div> |
| 473 | 532 | </fieldset> |
@@ -481,7 +540,10 @@ discard block |
||
| 481 | 540 | </select> |
| 482 | 541 | </div> |
| 483 | 542 | </div> |
| 484 | - <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
| 543 | + <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) { |
|
| 544 | + print $airport_icao; |
|
| 545 | +} |
|
| 546 | +?>');</script> |
|
| 485 | 547 | <div class="form-group"> |
| 486 | 548 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
| 487 | 549 | <div class="col-sm-10"> |
@@ -490,7 +552,10 @@ discard block |
||
| 490 | 552 | </select> |
| 491 | 553 | </div> |
| 492 | 554 | </div> |
| 493 | - <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
| 555 | + <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) { |
|
| 556 | + print $airport_country; |
|
| 557 | +} |
|
| 558 | +?>');</script> |
|
| 494 | 559 | </fieldset> |
| 495 | 560 | <fieldset> |
| 496 | 561 | <legend><?php echo _("Route"); ?></legend> |
@@ -502,7 +567,10 @@ discard block |
||
| 502 | 567 | </select> |
| 503 | 568 | </div> |
| 504 | 569 | </div> |
| 505 | - <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
| 570 | + <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) { |
|
| 571 | + print $departure_airport_route; |
|
| 572 | +} |
|
| 573 | +?>');</script> |
|
| 506 | 574 | <div class="form-group"> |
| 507 | 575 | <label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> |
| 508 | 576 | <div class="col-sm-10"> |
@@ -511,7 +579,10 @@ discard block |
||
| 511 | 579 | </select> |
| 512 | 580 | </div> |
| 513 | 581 | </div> |
| 514 | - <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
| 582 | + <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) { |
|
| 583 | + print $arrival_airport_route; |
|
| 584 | +} |
|
| 585 | +?>');</script> |
|
| 515 | 586 | </fieldset> |
| 516 | 587 | <fieldset> |
| 517 | 588 | <legend>Altitude</legend> |
@@ -561,19 +632,33 @@ discard block |
||
| 561 | 632 | <div class="form-group"> |
| 562 | 633 | <label class="control-label col-sm-2"><?php echo _("Latitude"); ?></label> |
| 563 | 634 | <div class="col-sm-10"> |
| 564 | - <input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) print $origlat; ?>" /> |
|
| 635 | + <input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) { |
|
| 636 | + print $origlat; |
|
| 637 | +} |
|
| 638 | +?>" /> |
|
| 565 | 639 | </div> |
| 566 | 640 | </div> |
| 567 | 641 | <div class="form-group"> |
| 568 | 642 | <label class="control-label col-sm-2"><?php echo _("Longitude"); ?></label> |
| 569 | 643 | <div class="col-sm-10"> |
| 570 | - <input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) print $origlon; ?>" /> |
|
| 644 | + <input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) { |
|
| 645 | + print $origlon; |
|
| 646 | +} |
|
| 647 | +?>" /> |
|
| 571 | 648 | </div> |
| 572 | 649 | </div> |
| 573 | 650 | <div class="form-group"> |
| 574 | - <label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) print $globalDistanceUnit; else print 'km'; print ')'; ?></label> |
|
| 651 | + <label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) { |
|
| 652 | + print $globalDistanceUnit; |
|
| 653 | +} else { |
|
| 654 | + print 'km'; |
|
| 655 | +} |
|
| 656 | +print ')'; ?></label> |
|
| 575 | 657 | <div class="col-sm-10"> |
| 576 | - <input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) print $distance; ?>" /> |
|
| 658 | + <input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) { |
|
| 659 | + print $distance; |
|
| 660 | +} |
|
| 661 | +?>" /> |
|
| 577 | 662 | </div> |
| 578 | 663 | </div> |
| 579 | 664 | </fieldset> |
@@ -584,7 +669,10 @@ discard block |
||
| 584 | 669 | <div class="form-group"> |
| 585 | 670 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
| 586 | 671 | <div class="col-sm-10"> |
| 587 | - <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
| 672 | + <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) { |
|
| 673 | + print $callsign; |
|
| 674 | +} |
|
| 675 | +?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
| 588 | 676 | </div> |
| 589 | 677 | </div> |
| 590 | 678 | </fieldset> |
@@ -595,7 +683,10 @@ discard block |
||
| 595 | 683 | <div class="form-group"> |
| 596 | 684 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
| 597 | 685 | <div class="col-sm-10"> |
| 598 | - <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
| 686 | + <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) { |
|
| 687 | + print $callsign; |
|
| 688 | +} |
|
| 689 | +?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
| 599 | 690 | </div> |
| 600 | 691 | </div> |
| 601 | 692 | </fieldset> |
@@ -606,7 +697,10 @@ discard block |
||
| 606 | 697 | <div class="form-group"> |
| 607 | 698 | <label class="control-label col-sm-2"><?php echo _("Captain id"); ?></label> |
| 608 | 699 | <div class="col-sm-10"> |
| 609 | - <input type="text" name="captain_id" class="form-control" value="<?php if (isset($_GET['captain_id'])) print $captain_id; ?>" size="8" placeholder="<?php echo _("Captain id"); ?>" /> |
|
| 700 | + <input type="text" name="captain_id" class="form-control" value="<?php if (isset($_GET['captain_id'])) { |
|
| 701 | + print $captain_id; |
|
| 702 | +} |
|
| 703 | +?>" size="8" placeholder="<?php echo _("Captain id"); ?>" /> |
|
| 610 | 704 | </div> |
| 611 | 705 | </div> |
| 612 | 706 | </fieldset> |
@@ -614,7 +708,10 @@ discard block |
||
| 614 | 708 | <div class="form-group"> |
| 615 | 709 | <label class="control-label col-sm-2"><?php echo _("Captain name"); ?></label> |
| 616 | 710 | <div class="col-sm-10"> |
| 617 | - <input type="text" name="captain_name" class="form-control" value="<?php if (isset($_GET['captain_name'])) print $captain_name; ?>" size="8" placeholder="<?php echo _("Captain name"); ?>" /> |
|
| 711 | + <input type="text" name="captain_name" class="form-control" value="<?php if (isset($_GET['captain_name'])) { |
|
| 712 | + print $captain_name; |
|
| 713 | +} |
|
| 714 | +?>" size="8" placeholder="<?php echo _("Captain name"); ?>" /> |
|
| 618 | 715 | </div> |
| 619 | 716 | </div> |
| 620 | 717 | </fieldset> |
@@ -622,7 +719,10 @@ discard block |
||
| 622 | 719 | <div class="form-group"> |
| 623 | 720 | <label class="control-label col-sm-2"><?php echo _("Race id"); ?></label> |
| 624 | 721 | <div class="col-sm-10"> |
| 625 | - <input type="text" name="race_id" class="form-control" value="<?php if (isset($_GET['race_id'])) print $race_id; ?>" size="8" placeholder="<?php echo _("Race id"); ?>" /> |
|
| 722 | + <input type="text" name="race_id" class="form-control" value="<?php if (isset($_GET['race_id'])) { |
|
| 723 | + print $race_id; |
|
| 724 | +} |
|
| 725 | +?>" size="8" placeholder="<?php echo _("Race id"); ?>" /> |
|
| 626 | 726 | </div> |
| 627 | 727 | </div> |
| 628 | 728 | </fieldset> |
@@ -630,7 +730,10 @@ discard block |
||
| 630 | 730 | <div class="form-group"> |
| 631 | 731 | <label class="control-label col-sm-2"><?php echo _("Race name"); ?></label> |
| 632 | 732 | <div class="col-sm-10"> |
| 633 | - <input type="text" name="race_name" class="form-control" value="<?php if (isset($_GET['race_name'])) print $race_name; ?>" size="8" placeholder="<?php echo _("Race name"); ?>" /> |
|
| 733 | + <input type="text" name="race_name" class="form-control" value="<?php if (isset($_GET['race_name'])) { |
|
| 734 | + print $race_name; |
|
| 735 | +} |
|
| 736 | +?>" size="8" placeholder="<?php echo _("Race name"); ?>" /> |
|
| 634 | 737 | </div> |
| 635 | 738 | </div> |
| 636 | 739 | </fieldset> |
@@ -641,7 +744,10 @@ discard block |
||
| 641 | 744 | <div class="form-group"> |
| 642 | 745 | <label class="control-label col-sm-2"><?php echo _("MMSI"); ?></label> |
| 643 | 746 | <div class="col-sm-10"> |
| 644 | - <input type="text" name="mmsi" class="form-control" value="<?php if (isset($_GET['mmsi'])) print $mmsi; ?>" size="8" placeholder="<?php echo _("MMSI"); ?>" /> |
|
| 747 | + <input type="text" name="mmsi" class="form-control" value="<?php if (isset($_GET['mmsi'])) { |
|
| 748 | + print $mmsi; |
|
| 749 | +} |
|
| 750 | +?>" size="8" placeholder="<?php echo _("MMSI"); ?>" /> |
|
| 645 | 751 | </div> |
| 646 | 752 | </div> |
| 647 | 753 | </fieldset> |
@@ -649,7 +755,10 @@ discard block |
||
| 649 | 755 | <div class="form-group"> |
| 650 | 756 | <label class="control-label col-sm-2"><?php echo _("IMO"); ?></label> |
| 651 | 757 | <div class="col-sm-10"> |
| 652 | - <input type="text" name="imo" class="form-control" value="<?php if (isset($_GET['imo'])) print $imo; ?>" size="8" placeholder="<?php echo _("IMO"); ?>" /> |
|
| 758 | + <input type="text" name="imo" class="form-control" value="<?php if (isset($_GET['imo'])) { |
|
| 759 | + print $imo; |
|
| 760 | +} |
|
| 761 | +?>" size="8" placeholder="<?php echo _("IMO"); ?>" /> |
|
| 653 | 762 | </div> |
| 654 | 763 | </div> |
| 655 | 764 | </fieldset> |
@@ -663,7 +772,10 @@ discard block |
||
| 663 | 772 | <label class="control-label col-sm-2"><?php echo _("Start Date"); ?></label> |
| 664 | 773 | <div class="col-sm-10"> |
| 665 | 774 | <div class='input-group date' id='datetimepicker1'> |
| 666 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date']) && $_GET['start_date'] != '') print $start_date; ?>" placeholder="<?php echo _("Start Date/Time"); ?>" /> |
|
| 775 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date']) && $_GET['start_date'] != '') { |
|
| 776 | + print $start_date; |
|
| 777 | +} |
|
| 778 | +?>" placeholder="<?php echo _("Start Date/Time"); ?>" /> |
|
| 667 | 779 | <span class="input-group-addon"> |
| 668 | 780 | <span class="glyphicon glyphicon-calendar"></span> |
| 669 | 781 | </span> |
@@ -674,7 +786,10 @@ discard block |
||
| 674 | 786 | <label class="control-label col-sm-2"><?php echo _("End Date"); ?></label> |
| 675 | 787 | <div class="col-sm-10"> |
| 676 | 788 | <div class='input-group date' id='datetimepicker2'> |
| 677 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date']) && $_GET['end_date'] != '') print $end_date; ?>" placeholder="<?php echo _("End Date/Time"); ?>" /> |
|
| 789 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date']) && $_GET['end_date'] != '') { |
|
| 790 | + print $end_date; |
|
| 791 | +} |
|
| 792 | +?>" placeholder="<?php echo _("End Date/Time"); ?>" /> |
|
| 678 | 793 | <span class="input-group-addon"> |
| 679 | 794 | <span class="glyphicon glyphicon-calendar"></span> |
| 680 | 795 | </span> |
@@ -11,7 +11,9 @@ discard block |
||
| 11 | 11 | header('Content-Type: text/javascript'); |
| 12 | 12 | $latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 13 | 13 | $longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 14 | -if ($latitude == '' || $longitude == '') return ''; |
|
| 14 | +if ($latitude == '' || $longitude == '') { |
|
| 15 | + return ''; |
|
| 16 | +} |
|
| 15 | 17 | //echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n"; |
| 16 | 18 | $airports = $Spotter->closestAirports($latitude,$longitude,300); |
| 17 | 19 | //print_r($airports); |
@@ -20,7 +22,9 @@ discard block |
||
| 20 | 22 | $i = 0; |
| 21 | 23 | $ew = true; |
| 22 | 24 | $dtf = false; |
| 23 | -if (empty($airports)) $ew = false; |
|
| 25 | +if (empty($airports)) { |
|
| 26 | + $ew = false; |
|
| 27 | +} |
|
| 24 | 28 | while($ew) { |
| 25 | 29 | $met = $METAR->getMETAR($airports[$i]['icao']); |
| 26 | 30 | //print_r($met); |
@@ -43,8 +47,12 @@ discard block |
||
| 43 | 47 | } |
| 44 | 48 | } |
| 45 | 49 | $i++; |
| 46 | - if ($i >= count($airports)) $ew = false; |
|
| 50 | + if ($i >= count($airports)) { |
|
| 51 | + $ew = false; |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | +if ($dtf === false) { |
|
| 55 | + echo json_encode($Weather->openweathermap($latitude,$longitude)); |
|
| 47 | 56 | } |
| 48 | -if ($dtf === false) echo json_encode($Weather->openweathermap($latitude,$longitude)); |
|
| 49 | 57 | |
| 50 | 58 | ?> |
| 51 | 59 | \ No newline at end of file |