These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | if ($_GET['departure_airport'] == "" || $_GET['arrival_airport'] == "") |
||
3 | { |
||
4 | header('Location: /'); |
||
5 | } |
||
6 | |||
7 | require_once('require/class.Connection.php'); |
||
8 | require_once('require/class.Spotter.php'); |
||
9 | require_once('require/class.Language.php'); |
||
10 | $Spotter = new Spotter(); |
||
11 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
||
12 | $spotter_array = $Spotter->getSpotterDataByRoute($_GET['departure_airport'], $_GET['arrival_airport'], "0,1", $sort); |
||
13 | |||
14 | if (!empty($spotter_array)) |
||
15 | { |
||
16 | $title = sprintf(_("Most Common Airlines by Country 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']); |
||
17 | require_once('header.php'); |
||
18 | print '<div class="info column">'; |
||
19 | 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>'; |
||
20 | 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>'; |
||
21 | 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>'; |
||
22 | print '</div>'; |
||
23 | |||
24 | include('route-sub-menu.php'); |
||
25 | print '<div class="column">'; |
||
26 | print '<h2>'._("Most Common Airlines by Country").'</h2>'; |
||
27 | print '<p>'.sprintf(_("The statistic below shows the most common airlines by Country of origin of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."),$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']).'</p>'; |
||
28 | |||
29 | $airline_array = $Spotter->countAllAirlineCountriesByRoute($_GET['departure_airport'], $_GET['arrival_airport']); |
||
30 | print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>'; |
||
31 | print '<div id="chartCountry" class="chart" width="100%"></div> |
||
32 | <script> |
||
33 | google.load("visualization", "1", {packages:["geochart"]}); |
||
34 | google.setOnLoadCallback(drawChart); |
||
35 | function drawChart() { |
||
36 | var data = google.visualization.arrayToDataTable([ |
||
37 | ["'._("Country").'", "'._("# of times").'"], '; |
||
38 | $country_data = ''; |
||
39 | foreach($airline_array as $airline_item) |
||
40 | { |
||
41 | $country_data .= '[ "'.$airline_item['airline_country'].'",'.$airline_item['airline_country_count'].'],'; |
||
42 | } |
||
43 | $country_data = substr($country_data, 0, -1); |
||
44 | print $country_data; |
||
45 | print ']); |
||
46 | |||
47 | var options = { |
||
48 | legend: {position: "none"}, |
||
49 | chartArea: {"width": "80%", "height": "60%"}, |
||
50 | height:500, |
||
51 | colors: ["#8BA9D0","#1a3151"] |
||
52 | }; |
||
53 | |||
54 | var chart = new google.visualization.GeoChart(document.getElementById("chartCountry")); |
||
55 | chart.draw(data, options); |
||
56 | } |
||
57 | $(window).resize(function(){ |
||
58 | drawChart(); |
||
59 | }); |
||
60 | </script>'; |
||
61 | |||
62 | if (!empty($airline_array)) |
||
63 | { |
||
64 | print '<div class="table-responsive">'; |
||
65 | print '<table class="common-country table-striped">'; |
||
66 | print '<thead>'; |
||
67 | print '<th></th>'; |
||
68 | print '<th>'._("Country").'</th>'; |
||
69 | print '<th>'._("# of times").'</th>'; |
||
70 | print '</thead>'; |
||
71 | print '<tbody>'; |
||
72 | $i = 1; |
||
73 | foreach($airline_array as $airline_item) |
||
74 | { |
||
75 | print '<tr>'; |
||
76 | print '<td><strong>'.$i.'</strong></td>'; |
||
77 | print '<td>'; |
||
78 | print '<a href="'.$globalURL.'/country/'.strtolower(str_replace(" ", "-", $airline_item['airline_country'])).'">'.$airline_item['airline_country'].'</a>'; |
||
79 | print '</td>'; |
||
80 | print '<td>'; |
||
81 | print $airline_item['airline_country_count']; |
||
82 | print '</td>'; |
||
83 | print '</tr>'; |
||
84 | $i++; |
||
85 | } |
||
86 | print '<tbody>'; |
||
87 | print '</table>'; |
||
88 | print '</div>'; |
||
89 | } |
||
90 | print '</div>'; |
||
91 | } else { |
||
92 | $title = _("Unknown Route"); |
||
93 | require_once('header.php'); |
||
94 | print '<h1>'._("Error").'</h1>'; |
||
95 | print '<p>'._("Sorry, this route does not exist in this database. :(").'</p>'; |
||
96 | } |
||
97 | require_once('footer.php'); |
||
98 | ?> |
||
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.