2 require_once('require/class.Connection.php');
3 require_once('require/class.Spotter.php');
4 require_once('require/class.Language.php');
6 if (!isset($_GET['departure_airport']) ||
!isset($_GET['arrival_airport'])){
7 header('Location: '.$globalURL.'');
9 $Spotter = new Spotter();
10 //calculuation for the pagination
11 if(!isset($_GET['limit']))
15 $absolute_difference = 25;
17 $limit_explode = explode(",", $_GET['limit']);
18 $limit_start = $limit_explode[0];
19 $limit_end = $limit_explode[1];
20 if (!ctype_digit(strval($limit_start)) ||
!ctype_digit(strval($limit_end))) {
25 $absolute_difference = abs($limit_start - $limit_end);
26 $limit_next = $limit_end +
$absolute_difference;
27 $limit_previous_1 = $limit_start - $absolute_difference;
28 $limit_previous_2 = $limit_end - $absolute_difference;
30 $departure_airport = filter_input(INPUT_GET
,'departure_airport',FILTER_SANITIZE_STRING
);
31 $arrival_airport = filter_input(INPUT_GET
,'arrival_airport',FILTER_SANITIZE_STRING
);
32 $page_url = $globalURL.'/route/'.$departure_airport.'/'.$arrival_airport;
33 $sort = filter_input(INPUT_GET
,'sort',FILTER_SANITIZE_STRING
);
35 $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, $limit_start.",".$absolute_difference, $sort);
37 $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, $limit_start.",".$absolute_difference, '');
40 if (!empty($spotter_array))
42 $title = sprintf(_("Detailed View for flights between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']);
43 require_once('header.php');
44 print '<div class="info column">';
45 print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>';
46 print '<div><span class="label">'._("Coming From").'</span><a href="'.$globalURL.'/airport/'.$spotter_array[0]['departure_airport_icao'].'">'.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].'</a></div>';
47 print '<div><span class="label">'._("Flying To").'</span><a href="'.$globalURL.'/airport/'.$spotter_array[0]['arrival_airport_icao'].'">'.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</a></div>';
50 include('route-sub-menu.php');
51 print '<div class="table column">';
52 print '<p>'.sprintf(_("The table below shows the detailed information of all flights that used the route <strong>%s - %s</strong>."),$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['arrival_airport_icao']).'</p>';
54 include('table-output.php');
55 print '<div class="pagination">';
56 if ($limit_previous_1 >= 0)
58 print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'/'.$sort.'">«'._("Previous Page").'</a>';
60 if ($spotter_array[0]['query_number_rows'] == $absolute_difference)
62 print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'/'.$sort.'">'._("Next Page").'»</a>';
67 $title = _("Unknown Route");
68 require_once('header.php');
69 print '<h1>'._("Error").'</h1>';
70 print '<p>'._("Sorry, this route does not exist in this database. :(").'</p>';
74 require_once('footer.php');