Exemplo n.º 1
0
 /**
  * Gets the aircraft image
  *
  * @param String $aircraft_registration the registration of the aircraft
  * @return Array the aircraft thumbnail, orignal url and copyright
  *
  */
 public function findAircraftImage($aircraft_registration, $aircraft_icao = '', $airline_icao = '')
 {
     global $globalAircraftImageSources, $globalIVAO;
     $Spotter = new Spotter();
     $Image = new Image();
     if (!isset($globalIVAO)) {
         $globalIVAO = FALSE;
     }
     $aircraft_registration = filter_var($aircraft_registration, FILTER_SANITIZE_STRING);
     if ($aircraft_registration != '') {
         if (strpos($aircraft_registration, '/') !== false) {
             return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => '');
         }
         $aircraft_registration = urlencode(trim($aircraft_registration));
         $aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration);
         if (isset($aircraft_info[0]['aircraft_name'])) {
             $aircraft_name = $aircraft_info[0]['aircraft_name'];
         } else {
             $aircraft_name = '';
         }
         if (isset($aircraft_info[0]['aircraft_icao'])) {
             $aircraft_name = $aircraft_info[0]['aircraft_icao'];
         } else {
             $aircraft_icao = '';
         }
         if (isset($aircraft_info[0]['airline_icao'])) {
             $airline_icao = $aircraft_info[0]['airline_icao'];
         } else {
             $airline_icao = '';
         }
     } elseif ($aircraft_icao != '') {
         $aircraft_registration = $aircraft_icao;
         $aircraft_name = '';
     } else {
         return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => '');
     }
     if (!isset($globalAircraftImageSources)) {
         $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters');
     }
     foreach ($globalAircraftImageSources as $source) {
         $source = strtolower($source);
         if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') {
             $images_array = $Image->fromIvaoMtl($aircraft_icao, $airline_icao);
         }
         if ($source == 'planespotters' && !$globalIVAO) {
             $images_array = $Image->fromPlanespotters($aircraft_registration, $aircraft_name);
         }
         if ($source == 'flickr') {
             $images_array = $Image->fromFlickr($aircraft_registration, $aircraft_name);
         }
         if ($source == 'bing') {
             $images_array = $Image->fromBing($aircraft_registration, $aircraft_name);
         }
         if ($source == 'deviantart') {
             $images_array = $Image->fromDeviantart($aircraft_registration, $aircraft_name);
         }
         if ($source == 'wikimedia') {
             $images_array = $Image->fromWikimedia($aircraft_registration, $aircraft_name);
         }
         if ($source == 'jetphotos' && !$globalIVAO) {
             $images_array = $Image->fromJetPhotos($aircraft_registration, $aircraft_name);
         }
         if ($source == 'planepictures' && !$globalIVAO) {
             $images_array = $Image->fromPlanePictures($aircraft_registration, $aircraft_name);
         }
         if ($source == 'airportdata' && !$globalIVAO) {
             $images_array = $Image->fromAirportData($aircraft_registration, $aircraft_name);
         }
         if (isset($images_array) && $images_array['original'] != '') {
             return $images_array;
         }
     }
     return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => '');
 }
<?php

require 'require/class.Connection.php';
require 'require/class.Spotter.php';
$Spotter = new Spotter();
$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
$spotter_array = $Spotter->getSpotterDataByRegistration($_GET['registration'], "0,1", $sort);
$aircraft_array = $Spotter->getAircraftInfoByRegistration($_GET['registration']);
if (!empty($spotter_array)) {
    $title = 'Most Common Routes from aircraft with registration ' . $_GET['registration'];
    require 'header.php';
    print '<div class="info column">';
    print '<h1>' . $_GET['registration'] . ' - ' . $aircraft_array[0]['aircraft_name'] . ' (' . $aircraft_array[0]['aircraft_icao'] . ')</h1>';
    print '<div><span class="label">Name</span><a href="' . $globalURL . '/aircraft/' . $aircraft_array[0]['aircraft_icao'] . '">' . $aircraft_array[0]['aircraft_name'] . '</a></div>';
    print '<div><span class="label">ICAO</span><a href="' . $globalURL . '/aircraft/' . $aircraft_array[0]['aircraft_icao'] . '">' . $aircraft_array[0]['aircraft_icao'] . '</a></div>';
    print '<div><span class="label">Manufacturer</span><a href="' . $globalURL . '/manufacturer/' . strtolower(str_replace(" ", "-", $aircraft_array[0]['aircraft_manufacturer'])) . '">' . $aircraft_array[0]['aircraft_manufacturer'] . '</a></div>';
    print '</div>';
    include 'registration-sub-menu.php';
    print '<div class="column">';
    print '<h2>Most Common Routes</h2>';
    print '<p>The statistic below shows the most common routes of aircraft with registration <strong>' . $_GET['registration'] . '</strong>.</p>';
    $route_array = $Spotter->countAllRoutesByRegistration($_GET['registration']);
    if (!empty($route_array)) {
        print '<div class="table-responsive">';
        print '<table class="common-routes table-striped">';
        print '<thead>';
        print '<th></th>';
        print '<th>Departure Airport</th>';
        print '<th>Arrival Airport</th>';
        print '<th># of Times</th>';
        print '<th></th>';
<?php

require 'require/class.Connection.php';
require 'require/class.Spotter.php';
$Spotter = new Spotter();
$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
if (isset($_GET['registration'])) {
    $registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING);
    $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort);
    $aircraft_array = $Spotter->getAircraftInfoByRegistration($registration);
} else {
    $spotter_array = array();
}
if (!empty($spotter_array)) {
    $title = 'Most Common Departure Airports by Country of aircraft with registration ' . $_GET['registration'];
    require 'header.php';
    print '<div class="info column">';
    print '<h1>' . $_GET['registration'] . ' - ' . $aircraft_array[0]['aircraft_name'] . ' (' . $aircraft_array[0]['aircraft_icao'] . ')</h1>';
    print '<div><span class="label">Name</span><a href="' . $globalURL . '/aircraft/' . $aircraft_array[0]['aircraft_icao'] . '">' . $aircraft_array[0]['aircraft_name'] . '</a></div>';
    print '<div><span class="label">ICAO</span><a href="' . $globalURL . '/aircraft/' . $aircraft_array[0]['aircraft_icao'] . '">' . $aircraft_array[0]['aircraft_icao'] . '</a></div>';
    print '<div><span class="label">Manufacturer</span><a href="' . $globalURL . '/manufacturer/' . strtolower(str_replace(" ", "-", $aircraft_array[0]['aircraft_manufacturer'])) . '">' . $aircraft_array[0]['aircraft_manufacturer'] . '</a></div>';
    print '</div>';
    include 'registration-sub-menu.php';
    print '<div class="column">';
    print '<h2>Most Common Departure Airports by Country</h2>';
    ?>
  	<p>The statistic below shows all departure airports by Country of origin of flights with aircraft registration <strong><?php 
    print $_GET['registration'];
    ?>
</strong>.</p>
	<?php