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 | $title = _("Special Highlights"); |
||
7 | require_once('header.php'); |
||
8 | |||
9 | //calculuation for the pagination |
||
10 | View Code Duplication | if(!isset($_GET['limit'])) |
|
1 ignored issue
–
show
|
|||
11 | { |
||
12 | $limit_start = 0; |
||
13 | $limit_end = 28; |
||
14 | $absolute_difference = 28; |
||
15 | } else { |
||
16 | $limit_explode = explode(",", $_GET['limit']); |
||
17 | $limit_start = $limit_explode[0]; |
||
18 | $limit_end = $limit_explode[1]; |
||
19 | if (!ctype_digit(strval($limit_start)) || !ctype_digit(strval($limit_end))) { |
||
20 | $limit_start = 0; |
||
21 | $limit_end = 25; |
||
22 | } |
||
23 | } |
||
24 | $absolute_difference = abs($limit_start - $limit_end); |
||
25 | $limit_next = $limit_end + $absolute_difference; |
||
26 | $limit_previous_1 = $limit_start - $absolute_difference; |
||
27 | $limit_previous_2 = $limit_end - $absolute_difference; |
||
28 | |||
29 | $page_url = $globalURL.'/highlights'; |
||
30 | |||
31 | print '<div class="info column">'; |
||
32 | print '<div class="view-type">'; |
||
33 | print '<a href="'.$globalURL.'/highlights" class="active" alt="Display View" title="Display View"><i class="fa fa-th"></i></a>'; |
||
34 | print '<a href="'.$globalURL.'/highlights/table" alt="Table View" title="Table View"><i class="fa fa-table"></i></a>'; |
||
35 | print '</div>'; |
||
36 | print '<h1>'._("Special Highlights").'</h1>'; |
||
37 | print '</div>'; |
||
38 | |||
39 | print '<div class="column">'; |
||
40 | print '<p>'._("The view below shows all aircrafts that have been selected to have some sort of special characteristic about them, such as unique liveries, destinations etc.").'</p>'; |
||
41 | |||
42 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
||
43 | if (isset($_GET['sort'])) { |
||
44 | $spotter_array = $Spotter->getSpotterDataByHighlight($limit_start.",".$absolute_difference, $sort); |
||
45 | } else { |
||
46 | $spotter_array = $Spotter->getSpotterDataByHighlight($limit_start.",".$absolute_difference, ''); |
||
47 | } |
||
48 | if (!empty($spotter_array)) |
||
49 | { |
||
50 | print '<div class="dispay-view">'; |
||
51 | foreach($spotter_array as $spotter_item) |
||
52 | { |
||
53 | if (isset($spotter_item['image']) && $spotter_item['image'] != "") |
||
54 | { |
||
55 | print '<div>'; |
||
56 | //print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$spotter_item['image'].'" alt="'.$spotter_item['highlight'].'" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_name'].' ('.$spotter_item['airline_name'].')" data-toggle="popover" data-content="'.$spotter_item['highlight'].'" /></a>'; |
||
1 ignored issue
–
show
Unused Code
Comprehensibility
introduced
by
71% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
57 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$spotter_item['image_thumbnail'].'" alt="'.$spotter_item['highlight'].'" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_name'].' ('.$spotter_item['airline_name'].')" data-toggle="popover" data-content="'.$spotter_item['highlight'].'" /></a>'; |
||
58 | print '</div>'; |
||
59 | } elseif (isset($spotter_item['aircraft_name'])) { |
||
60 | print '<div>'; |
||
61 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="'.$spotter_item['highlight'].'" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_name'].' ('.$spotter_item['airline_name'].')" data-toggle="popover" data-content="'.$spotter_item['highlight'].'" /></a>'; |
||
62 | print '</div>'; |
||
63 | } else { |
||
64 | print '<div>'; |
||
65 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="'.$spotter_item['highlight'].'" title="'.$spotter_item['registration'].' ('.$spotter_item['airline_name'].')" data-toggle="popover" data-content="'.$spotter_item['highlight'].'" /></a>'; |
||
66 | print '</div>'; |
||
67 | } |
||
68 | } |
||
69 | print '</div>'; |
||
70 | print '<div class="pagination">'; |
||
71 | if ($limit_previous_1 >= 0) |
||
72 | { |
||
73 | print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'/'.$_GET['sort'].'">«'._("Previous Page").'</a>'; |
||
74 | } |
||
75 | if ($spotter_array[0]['query_number_rows'] == $absolute_difference) |
||
76 | { |
||
77 | print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'/'.$_GET['sort'].'">'._("Next Page").'»</a>'; |
||
78 | } |
||
79 | print '</div>'; |
||
80 | print '</div>'; |
||
81 | } |
||
82 | |||
83 | require_once('footer.php'); |
||
84 | ?> |
||
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.