These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | require_once('require/class.Connection.php'); |
||
3 | require_once('require/class.Spotter.php'); |
||
4 | require_once('require/class.Language.php'); |
||
5 | $Spotter = new Spotter(); |
||
6 | |||
7 | if (!isset($_GET['aircraft_type'])){ |
||
8 | header('Location: '.$globalURL.'/aircraft'); |
||
9 | } else { |
||
10 | //calculuation for the pagination |
||
11 | if(!isset($_GET['limit']) || count(explode(",", $_GET['limit'])) < 2) |
||
12 | { |
||
13 | $limit_start = 0; |
||
14 | $limit_end = 25; |
||
15 | $absolute_difference = 25; |
||
16 | } else { |
||
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))) { |
||
21 | $limit_start = 0; |
||
22 | $limit_end = 25; |
||
23 | } |
||
24 | } |
||
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; |
||
29 | |||
30 | $aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING); |
||
31 | $page_url = $globalURL.'/aircraft/'.$aircraft_type; |
||
32 | |||
33 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
||
34 | $spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,$limit_start.",".$absolute_difference, $sort); |
||
35 | |||
36 | if (!empty($spotter_array)) |
||
37 | { |
||
38 | $title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']); |
||
39 | require_once('header.php'); |
||
40 | |||
41 | print '<div class="select-item">'; |
||
42 | print '<form action="'.$globalURL.'/aircraft" method="post">'; |
||
43 | print '<select name="aircraft_type" class="selectpicker" data-live-search="true">'; |
||
44 | print '<option></option>'; |
||
45 | $aircraft_types = $Spotter->getAllAircraftTypes(); |
||
46 | foreach($aircraft_types as $aircrafttype) |
||
47 | { |
||
48 | if($aircraft_type == $aircrafttype['aircraft_icao']) |
||
49 | { |
||
50 | print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_manufacturer'].' '.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
||
51 | } else { |
||
52 | print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_manufacturer'].' '.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
||
53 | } |
||
54 | } |
||
55 | print '</select>'; |
||
56 | print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
||
57 | print '</form>'; |
||
58 | print '</div>'; |
||
59 | |||
60 | if ($aircraft_type != "NA") |
||
61 | { |
||
62 | print '<div class="info column">'; |
||
63 | print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>'; |
||
64 | print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>'; |
||
65 | print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; |
||
66 | if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>'; |
||
67 | print '</div>'; |
||
68 | } else { |
||
69 | print '<div class="alert alert-warning">'._("This special aircraft profile shows all flights in where the aircraft type is unknown.").'</div>'; |
||
70 | } |
||
71 | |||
72 | include('aircraft-sub-menu.php'); |
||
73 | |||
74 | print '<div class="table column">'; |
||
75 | print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>'; |
||
76 | |||
77 | include('table-output.php'); |
||
78 | |||
79 | print '<div class="pagination">'; |
||
80 | if ($limit_previous_1 >= 0) |
||
81 | { |
||
82 | print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'/'.$sort.'">«'._("Previous Page").'</a>'; |
||
83 | } |
||
84 | if ($spotter_array[0]['query_number_rows'] == $absolute_difference) |
||
85 | { |
||
86 | print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'/'.$sort.'">'._("Next Page").'»</a>'; |
||
87 | } |
||
88 | print '</div>'; |
||
89 | print '</div>'; |
||
90 | |||
91 | } else { |
||
92 | $title = "Aircraft"; |
||
93 | require_once('header.php'); |
||
94 | print '<h1>'._("Errors").'</h1>'; |
||
95 | print '<p>'._("Sorry, the aircraft type does not exist in this database. :(").'</p>'; |
||
96 | } |
||
97 | } |
||
98 | require_once('footer.php'); |
||
99 | ?> |
||
1 ignored issue
–
show
|
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.