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 | |||
6 | $Spotter = new Spotter(); |
||
7 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
||
8 | View Code Duplication | if (isset($_GET['date'])) $spotter_array = $Spotter->getSpotterDataByDate($_GET['date'],"0,1", $sort); |
|
1 ignored issue
–
show
|
|||
9 | else $spotter_array = ''; |
||
10 | |||
11 | if (!empty($spotter_array)) |
||
12 | { |
||
13 | $title = sprintf(_("Most Common Airlines on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
||
14 | |||
15 | require_once('header.php'); |
||
16 | print '<div class="select-item">'; |
||
17 | print '<form action="'.$globalURL.'/date" method="post">'; |
||
18 | print '<label for="date">'._("Select a Date").'</label>'; |
||
19 | print '<input type="text" id="date" name="date" value="'.$_GET['date'].'" size="8" readonly="readonly" class="custom" />'; |
||
20 | print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
||
21 | print '</form>'; |
||
22 | print '</div>'; |
||
23 | |||
24 | print '<div class="info column">'; |
||
25 | print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
||
26 | print '</div>'; |
||
27 | |||
28 | include('date-sub-menu.php'); |
||
29 | print '<div class="column">'; |
||
30 | print '<h2>'._("Most Common Airlines").'</h2>'; |
||
31 | print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
||
32 | |||
33 | $airline_array = $Spotter->countAllAirlinesByDate($_GET['date']); |
||
34 | View Code Duplication | if (!empty($airline_array)) |
|
1 ignored issue
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
35 | { |
||
36 | print '<div class="table-responsive">'; |
||
37 | print '<table class="common-airline table-striped">'; |
||
38 | print '<thead>'; |
||
39 | print '<th></th>'; |
||
40 | print '<th></th>'; |
||
41 | print '<th>'._("Airline").'</th>'; |
||
42 | print '<th>'._("Country").'</th>'; |
||
43 | print '<th>'._("# of times").'</th>'; |
||
44 | print '<th></th>'; |
||
45 | print '</thead>'; |
||
46 | print '<tbody>'; |
||
47 | $i = 1; |
||
48 | foreach($airline_array as $airline_item) |
||
49 | { |
||
50 | print '<tr>'; |
||
51 | print '<td><strong>'.$i.'</strong></td>'; |
||
52 | print '<td class="logo">'; |
||
53 | print '<a href="'.$globalURL.'/airline/'.$airline_item['airline_icao'].'"><img src="'; |
||
54 | if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.gif')) |
||
55 | { |
||
56 | print $globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.gif'; |
||
57 | } elseif (@getimagesize($globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.png')) |
||
58 | { |
||
59 | print $globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.png'; |
||
60 | } else { |
||
61 | print $globalURL.'/images/airlines/placeholder.png'; |
||
62 | } |
||
63 | print '" /></a>'; |
||
64 | print '</td>'; |
||
65 | print '<td>'; |
||
66 | print '<a href="'.$globalURL.'/airline/'.$airline_item['airline_icao'].'">'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')</a>'; |
||
67 | print '</td>'; |
||
68 | print '<td>'; |
||
69 | print '<a href="'.$globalURL.'/country/'.strtolower(str_replace(" ", "-", $airline_item['airline_country'])).'">'.$airline_item['airline_country'].'</a>'; |
||
70 | print '</td>'; |
||
71 | print '<td>'; |
||
72 | print $airline_item['airline_count']; |
||
73 | print '</td>'; |
||
74 | print '<td><a href="'.$globalURL.'/search?airline='.$airline_item['airline_icao'].'&start_date='.$_GET['date'].'+00:00&end_date='.$_GET['date'].'+23:59">'._("Search flights").'</a></td>'; |
||
75 | print '</tr>'; |
||
76 | $i++; |
||
77 | } |
||
78 | print '<tbody>'; |
||
79 | print '</table>'; |
||
80 | print '</div>'; |
||
81 | } |
||
82 | print '</div>'; |
||
83 | } else { |
||
84 | $title = _("Unknown Date"); |
||
85 | require_once('header.php'); |
||
86 | print '<h1>'._("Error").'</h1>'; |
||
87 | print '<p>'._("Sorry, this date does not exist in this database. :(").'</p>'; |
||
88 | } |
||
89 | |||
90 | require_once('footer.php'); |
||
91 | ?> |
||
1 ignored issue
–
show
It is not recommended to use PHP's closing tag
?> in files other than templates.
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. ![]() |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.