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 | <!DOCTYPE HTML> |
||
8 | <html> |
||
9 | <head> |
||
10 | <meta charset="UTF-8"> |
||
11 | <title>Spotter TV</title> |
||
12 | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
||
13 | <link rel="shortcut icon" type="image/x-icon" href="<?php print $globalURL; ?>/favicon.ico"> |
||
14 | <link rel="apple-touch-icon" href="<?php print $globalURL; ?>/images/touch-icon.png"> |
||
15 | <link href='http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'> |
||
16 | <!--[if lt IE 9]> |
||
17 | <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> |
||
18 | <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> |
||
19 | <![endif]--> |
||
20 | <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> |
||
21 | <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> |
||
22 | <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script> |
||
23 | <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> |
||
24 | <link type="text/css" rel="stylesheet" href="<?php print $globalURL; ?>/css/style-tv.css?<?php print time(); ?>" /> |
||
25 | </head> |
||
26 | <body> |
||
27 | |||
28 | |||
29 | <?php |
||
30 | if (isset($_GET['q'])) |
||
31 | { |
||
32 | $spotter_array = $Spotter->searchSpotterData($_GET['q'],"","","","","","","","","","","","","","","","","","0,10","",""); |
||
33 | } else { |
||
34 | $spotter_array = $Spotter->getLatestSpotterData("0,10", ""); |
||
35 | } |
||
36 | |||
37 | print '<div class="table-responsive">'; |
||
38 | print '<table id="table-tv">'; |
||
39 | print '<tbody>'; |
||
40 | foreach($spotter_array as $spotter_item) |
||
0 ignored issues
–
show
|
|||
41 | { |
||
42 | if (isset($globalTimezone)) { |
||
43 | date_default_timezone_set($globalTimezone); |
||
44 | } else date_default_timezone_set('UTC'); |
||
45 | print '<tr>'; |
||
46 | if (isset($_GET['image']) && $_GET['image'] == "true") |
||
47 | { |
||
48 | if ($spotter_item['image'] != "") |
||
49 | { |
||
50 | print '<td class="aircraft_image">'; |
||
51 | print '<img src="'.$spotter_item['image'].'" alt="'._("Click to see more information about this flight").'" title="'._("Click to see more information about this flight").'" />'; |
||
52 | print '</td>'; |
||
53 | } else { |
||
54 | print '<td class="aircraft_image">'; |
||
55 | print '<img src="'.$globalURL.'/images/placeholder.png" alt="'._("Click to see more information about this flight").'" title="'._("Click to see more information about this flight").'" />'; |
||
56 | print '</td>'; |
||
57 | } |
||
58 | } |
||
59 | if ($globalIVAO && (@getimagesize('images/airlines/'.$spotter_item['airline_icao'].'.gif') || @getimagesize($globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.gif'))) |
||
60 | { |
||
61 | print '<td class="logo">'; |
||
62 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.gif" />'; |
||
63 | print '</td>'; |
||
64 | } elseif (@getimagesize('images/airlines/'.$spotter_item['airline_icao'].'.png') || @getimagesize($globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.png')) |
||
65 | { |
||
66 | print '<td class="logo">'; |
||
67 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.png" />'; |
||
68 | print '</td>'; |
||
69 | } else { |
||
70 | print '<td class="logo-no-image">'; |
||
71 | if ($spotter_item['airline_name'] != "") |
||
72 | { |
||
73 | print $spotter_item['airline_name']; |
||
74 | } else { |
||
75 | print 'N/A'; |
||
76 | } |
||
77 | print '</td>'; |
||
78 | } |
||
79 | print '<td class="info">'; |
||
80 | print '<div class="flight">'; |
||
81 | print $spotter_item['departure_airport_city'].' ('.$spotter_item['departure_airport'].') <i class="fa fa-arrow-right"></i> '.$spotter_item['arrival_airport_city'].' ('.$spotter_item['arrival_airport'].')'; |
||
82 | print '</div>'; |
||
83 | print '<div class="other1">'; |
||
84 | if ($spotter_item['registration'] != "") |
||
85 | { |
||
86 | print '<span><i class="fa fa-align-justify"></i> '.$spotter_item['registration'].'</span>'; |
||
87 | } |
||
88 | if ($spotter_item['aircraft_name'] != "") |
||
89 | { |
||
90 | print '<span><i class="fa fa-plane"></i> '.$spotter_item['aircraft_name'].'</span>'; |
||
91 | } else { |
||
92 | if ($spotter_item['aircraft_type'] != "") |
||
93 | { |
||
94 | print '<span><i class="fa fa-plane"></i> '.$spotter_item['aircraft_type'].'</span>'; |
||
95 | } |
||
96 | } |
||
97 | print '<span><i class="fa fa-calendar"></i> '.date("r", strtotime($spotter_item['date_iso_8601'])).'</span>'; |
||
98 | print '</div>'; |
||
99 | print '<div class="other2">'; |
||
100 | print '<span><i class="fa fa-arrow-up"></i> '.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_name'].', '.$spotter_item['departure_airport_country']; |
||
101 | if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != '') print ' ('.$spotter_item['departure_airport_time'].')'; |
||
102 | print '</span>'; |
||
103 | print '<span><i class="fa fa-arrow-down"></i> '.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_name'].', '.$spotter_item['arrival_airport_country']; |
||
104 | if (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != '') print ' ('.$spotter_item['arrival_airport_time'].')'; |
||
105 | print '</span>'; |
||
106 | print '</div>'; |
||
107 | print '<div class="other3">'; |
||
108 | if ($spotter_item['ident'] != "") |
||
109 | { |
||
110 | print '<span><i class="fa fa-th-list"></i> '.$spotter_item['ident'].'</span>'; |
||
111 | } |
||
112 | if ($spotter_item['airline_name'] != "") |
||
113 | { |
||
114 | print '<span><i class="fa fa-align-justify"></i> '.$spotter_item['airline_name'].'</span>'; |
||
115 | } |
||
116 | if ($spotter_item['airline_country'] != "") |
||
117 | { |
||
118 | print '<span><i class="fa fa-globe"></i> '.$spotter_item['airline_country'].'</span>'; |
||
119 | } |
||
120 | print '</div>'; |
||
121 | print '</td>'; |
||
122 | print '</tr>'; |
||
123 | } |
||
124 | print '<tbody>'; |
||
125 | print '</table>'; |
||
126 | print '</div>'; |
||
127 | ?> |
||
128 | |||
129 | <script> |
||
130 | $( document ).ready(function() { |
||
131 | |||
132 | //loads the notification system every 16 seconds |
||
133 | setInterval( getNewDataTV, 16000 ); |
||
134 | |||
135 | //changes the information every 10 seconds |
||
136 | setInterval( changeInformation, 10000 ); |
||
137 | |||
138 | }); |
||
139 | function getNewDataTV() |
||
140 | { |
||
141 | |||
142 | <?php |
||
143 | if (isset($_GET['image']) && isset($_GET['q'])) { |
||
144 | ?> |
||
145 | $.getJSON( "<?php print $globalURL; ?>/getLatestData-tv.php?other_i="+other_i+"&image=<?php print $_GET['image']; ?>&q=<?php print $_GET['q']; ?>", function( data ) { |
||
146 | <?php |
||
147 | } elseif (isset($_GET['image'])) { |
||
148 | ?> |
||
149 | $.getJSON( "<?php print $globalURL; ?>/getLatestData-tv.php?other_i="+other_i+"&image=<?php print $_GET['image']; ?>", function( data ) { |
||
150 | <?php |
||
151 | } elseif (isset($_GET['q'])) { |
||
152 | ?> |
||
153 | $.getJSON( "<?php print $globalURL; ?>/getLatestData-tv.php?other_i="+other_i+"&q=<?php print $_GET['q']; ?>", function( data ) { |
||
154 | <?php |
||
155 | } else { |
||
156 | ?> |
||
157 | $.getJSON( "<?php print $globalURL; ?>/getLatestData-tv.php?other_i="+other_i+"", function( data ) { |
||
158 | <?php |
||
159 | } |
||
160 | ?> |
||
161 | $.each(data.flights, function(i, item) { |
||
162 | if (item.html != "") |
||
163 | { |
||
164 | $('#table-tv').prepend(item.html); |
||
165 | $('#table-tr-'+item.flight_id).fadeIn(); |
||
166 | $('#table-tv tr:last').remove(); |
||
167 | } |
||
168 | }); |
||
169 | }); |
||
170 | } |
||
171 | var other_i = 1; |
||
172 | $('.other2').hide(); |
||
173 | $('.other3').hide(); |
||
174 | function changeInformation() |
||
175 | { |
||
176 | if (other_i == 1) |
||
177 | { |
||
178 | $('.other3').hide(); |
||
179 | $('.other1').fadeOut( "slow", function() { |
||
180 | $('.other2').fadeIn(); |
||
181 | }); |
||
182 | other_i = 2; |
||
183 | } else if (other_i == 2) |
||
184 | { |
||
185 | $('.other1').hide(); |
||
186 | $('.other2').fadeOut( "slow", function() { |
||
187 | $('.other3').fadeIn(); |
||
188 | }); |
||
189 | other_i = 3; |
||
190 | } else if (other_i == 3) |
||
191 | { |
||
192 | $('.other2').hide(); |
||
193 | $('.other3').fadeOut( "slow", function() { |
||
194 | $('.other1').fadeIn(); |
||
195 | }); |
||
196 | other_i = 1; |
||
197 | } |
||
198 | } |
||
199 | </script> |
||
200 | |||
201 | </body> |
||
202 | </html> |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.