These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_STRING); |
||
3 | if ($id == "") |
||
4 | { |
||
5 | header('Location: /'); |
||
6 | } |
||
7 | |||
8 | require_once('require/class.Connection.php'); |
||
9 | require_once('require/class.Spotter.php'); |
||
10 | require_once('require/class.Language.php'); |
||
11 | require_once('require/class.SpotterArchive.php'); |
||
12 | $Spotter = new Spotter(); |
||
13 | $SpotterArchive = new SpotterArchive(); |
||
14 | $spotter_array = $Spotter->getSpotterDataByID($id); |
||
15 | |||
16 | |||
17 | if (!empty($spotter_array)) |
||
18 | { |
||
19 | if(isset($spotter_array[0]['flightaware_id'])) { |
||
20 | $flightaware_id = $spotter_array[0]['flightaware_id']; |
||
21 | } |
||
22 | if(isset($spotter_array[0]['last_latitude']) && $spotter_array[0]['last_latitude'] != '') { |
||
23 | $latitude = $spotter_array[0]['last_latitude']; |
||
24 | } elseif(isset($spotter_array[0]['latitude'])) { |
||
25 | $latitude = $spotter_array[0]['latitude']; |
||
26 | } |
||
27 | if(isset($spotter_array[0]['last_longitude']) && $spotter_array[0]['last_longitude'] != '') { |
||
28 | $longitude = $spotter_array[0]['last_longitude']; |
||
29 | } elseif(isset($spotter_array[0]['longitude'])) { |
||
30 | $longitude = $spotter_array[0]['longitude']; |
||
31 | } |
||
32 | |||
33 | if (isset($flightaware_id) && ((!isset($latitude) && !isset($longitude)) || ($latitude == 0 && $longitude == 0))) { |
||
34 | require_once('require/class.SpotterLive.php'); |
||
35 | $SpotterLive = new SpotterLive(); |
||
36 | $live_data = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
||
37 | $latitude = $live_data[0]['latitude']; |
||
38 | $longitude = $live_data[0]['longitude']; |
||
39 | } |
||
40 | |||
41 | $title = ''; |
||
42 | if(isset($spotter_array[0]['ident'])) { |
||
43 | $title .= $spotter_array[0]['ident']; |
||
44 | } |
||
45 | if(isset($spotter_array[0]['airline_name'])) { |
||
46 | $title .= ' - '.$spotter_array[0]['airline_name']; |
||
47 | } |
||
48 | if(isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') { |
||
49 | $title .= ' - '.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')'; |
||
50 | } |
||
51 | if(isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA' && $spotter_array[0]['registration'] != 'N/A') { |
||
52 | $title .= ' - '.$spotter_array[0]['registration']; |
||
53 | } |
||
54 | //$facebook_meta_image = $spotter_array[0]['image']; |
||
55 | require_once('header.php'); |
||
56 | if (isset($globalArchive) && $globalArchive) { |
||
57 | $all_data = $SpotterArchive->getAltitudeSpeedArchiveSpotterDataById($spotter_array[0]['flightaware_id']); |
||
58 | if (isset($globalTimezone)) { |
||
59 | date_default_timezone_set($globalTimezone); |
||
60 | } else date_default_timezone_set('UTC'); |
||
61 | |||
62 | if (is_array($all_data) && count($all_data) > 1) { |
||
63 | print '<br/>'; |
||
64 | print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">'; |
||
65 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
||
66 | print '<script type="text/javascript" src="'.$globalURL.'/js/c3.min.js"></script>'; |
||
67 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
||
68 | $altitude_data = ''; |
||
69 | $hour_data = ''; |
||
70 | $speed_data = ''; |
||
71 | foreach($all_data as $data) |
||
72 | { |
||
73 | $hour_data .= '"'.$data['date'].'",'; |
||
74 | if (isset($data['real_altitude']) && $data['real_altitude'] != '') { |
||
75 | $altitude = $data['real_altitude']; |
||
76 | } else { |
||
77 | $altitude = $data['altitude'].'00'; |
||
78 | } |
||
79 | if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
||
80 | $unit = 'feet'; |
||
81 | } else { |
||
82 | $unit = 'm'; |
||
83 | $altitude = round($altitude*0.3048); |
||
84 | } |
||
85 | $altitude_data .= $altitude.','; |
||
86 | $speed = $data['ground_speed']; |
||
87 | if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
||
88 | $speed = round($speed*1.15078); |
||
89 | $units = 'mph'; |
||
90 | } elseif ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
||
91 | $units = 'knots'; |
||
92 | } else { |
||
93 | $speed = round($speed*1.852); |
||
94 | $units = 'km/h'; |
||
95 | } |
||
96 | $speed_data .= $speed.','; |
||
97 | } |
||
98 | $hour_data = "['x',".substr($hour_data, 0, -1)."]"; |
||
99 | $altitude_data = "['altitude',".substr($altitude_data,0,-1)."]"; |
||
100 | $speed_data = "['speed',".substr($speed_data,0,-1)."]"; |
||
101 | print 'c3.generate({ |
||
102 | bindto: "#chart", |
||
103 | data: { |
||
104 | x: "x", |
||
105 | axes: { |
||
106 | altitude: "y", |
||
107 | speed: "y2" |
||
108 | }, |
||
109 | xFormat: "%Y-%m-%d %H:%M:%S", |
||
110 | columns: ['.$hour_data.','.$altitude_data.','.$speed_data.'], |
||
111 | colors: { |
||
112 | altitude: "#1a3151", |
||
113 | speed: "#aa0000" |
||
114 | } |
||
115 | }, |
||
116 | axis: { |
||
117 | x: { |
||
118 | type: "timeseries", tick: { format: "%H:%M:%S"} |
||
119 | }, |
||
120 | y: { |
||
121 | label: "Altitude ('.$unit.')" |
||
122 | }, |
||
123 | y2: { |
||
124 | label: "Speed ('.$units.')", |
||
125 | show: true |
||
126 | } |
||
127 | }, |
||
128 | legend: { show: false }});'; |
||
129 | print '</script>'; |
||
130 | } |
||
131 | } |
||
132 | |||
133 | |||
134 | print '<div class="info column">'; |
||
135 | print '<br/><br/><br/>'; |
||
136 | print '<h1>'; |
||
137 | if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif')) { |
||
138 | print '<a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'"><img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" class="airline-logo" /></a> '; |
||
139 | } elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) { |
||
140 | print '<a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'"><img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" class="airline-logo" /></a> '; |
||
141 | } else { |
||
142 | if (isset($spotter_array[0]['airline_name']) && $spotter_array[0]['airline_name'] != "") { |
||
143 | print '<a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a> '; |
||
144 | } |
||
145 | } |
||
146 | if(isset($spotter_array[0]['ident'])) { |
||
147 | print $spotter_array[0]['ident']; |
||
148 | } |
||
149 | if(isset($spotter_array[0]['airline_name'])) { |
||
150 | print ' - '.$spotter_array[0]['airline_name']; |
||
151 | } |
||
152 | if(isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') { |
||
153 | print ' - '.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')'; |
||
154 | } |
||
155 | if(isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA') { |
||
156 | print ' - '.$spotter_array[0]['registration']; |
||
157 | } |
||
158 | print '</h1>'; |
||
159 | print '</div>'; |
||
160 | |||
161 | if ($spotter_array[0]['registration'] != "") { |
||
162 | //$highlight = $Spotter->getHighlightByRegistration($spotter_array[0]['registration']); |
||
163 | $highlight = $spotter_array[0]['highlight']; |
||
164 | if ($highlight != "") { |
||
165 | print '<div class="alert alert-warning">'.$highlight.'</div>'; |
||
166 | } |
||
167 | } |
||
168 | |||
169 | include('flightid-sub-menu.php'); |
||
170 | print '<div class="clear column">'; |
||
171 | print '<div class="image">'; |
||
172 | if ($spotter_array[0]['image'] != "") |
||
173 | { |
||
174 | if ($spotter_array[0]['image_source'] == 'planespotters') { |
||
175 | $planespotter_url_array = explode("_", $spotter_array[0]['image']); |
||
176 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
||
177 | print '<a href="http://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id.'" target="_blank"><img src="'.$spotter_array[0]['image_thumbnail'].'" alt="Click image to view on Planespotters.net" title="Click image to view on Planespotters.net" width="100%" /></a>'; |
||
178 | print '<div class="note">Disclaimer: The images are courtesy of Planespotters.net and their respective uploaders. This system may not always 100% accuratly show the actual aircraft.</div>'; |
||
179 | print '<div class="note">Planespotters.net didn\'t allow us to show full size pics here. This pic is copyright '.$spotter_array[0]['image_copyright'].'</div>'; |
||
180 | } else { |
||
181 | if (isset($spotter_array[0]['image_source_website']) && $spotter_array[0]['image_source_website'] != '') { |
||
182 | print '<a href="'.$spotter_array[0]['image_source_website'].'"><img src="'.$spotter_array[0]['image'].'" width="100%" /></a>'; |
||
183 | } else { |
||
184 | print '<img src="'.$spotter_array[0]['image'].'" width="100%" />'; |
||
185 | } |
||
186 | print '<div class="note">Disclaimer: The source of the above image is '.$spotter_array[0]['image_source'].' and is copyright '.$spotter_array[0]['image_copyright'].'. This system may not show the actual aircraft with 100% accuracy.</div>'; |
||
187 | } |
||
188 | } else { |
||
0 ignored issues
–
show
|
|||
189 | //print '<img src="'.$globalURL.'/images/placeholder.png" alt="No image found!" title="No image found!" />'; |
||
190 | } |
||
191 | print '</div>'; |
||
192 | |||
193 | /* print '<div class="col-sm-4 details">'; |
||
194 | |||
195 | foreach($spotter_array as $spotter_item) |
||
196 | { |
||
197 | print '<div class="detail">'; |
||
198 | if (@getimagesize($globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.png')) |
||
199 | { |
||
200 | print '<a href="'.$globalURL.'/airline/'.$spotter_item['airline_icao'].'"><img src="'.$globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.png" /></a>'; |
||
201 | } else { |
||
202 | if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != "") |
||
203 | { |
||
204 | print '<a href="'.$globalURL.'/airline/'.$spotter_item['airline_icao'].'">'.$spotter_item['airline_name'].'</a>'; |
||
205 | } else { |
||
206 | print 'N/A'; |
||
207 | } |
||
208 | } |
||
209 | print '</div>'; |
||
210 | |||
211 | print '<div class="detail">'; |
||
212 | print '<div class="title">Ident/Callsign</div>'; |
||
213 | print '<div>'; |
||
214 | if ($spotter_item['ident'] != "") |
||
215 | { |
||
216 | print '<a href="'.$globalURL.'/ident/'.$spotter_item['ident'].'">'.$spotter_item['ident'].'</a>'; |
||
217 | } else { |
||
218 | print 'N/A'; |
||
219 | } |
||
220 | print '</div>'; |
||
221 | print '</div>'; |
||
222 | |||
223 | print '<div class="detail">'; |
||
224 | print '<div class="title">Aircraft</div>'; |
||
225 | print '<div>'; |
||
226 | if (isset($spotter_item['aircraft_name'])) |
||
227 | { |
||
228 | print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
||
229 | } else { |
||
230 | if ($spotter_item['aircraft_type'] != "") |
||
231 | { |
||
232 | print $spotter_item['aircraft_type']; |
||
233 | } else { |
||
234 | print 'N/A'; |
||
235 | } |
||
236 | } |
||
237 | print '</div>'; |
||
238 | print '</div>'; |
||
239 | |||
240 | print '<div class="detail">'; |
||
241 | print '<div class="title">Registration</div>'; |
||
242 | print '<div>'; |
||
243 | if ($spotter_item['registration'] != "") |
||
244 | { |
||
245 | print '<a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'">'.$spotter_item['registration'].'</a>'; |
||
246 | } else { |
||
247 | print 'N/A'; |
||
248 | } |
||
249 | print '</div>'; |
||
250 | print '</div>'; |
||
251 | |||
252 | print '<div class="detail">'; |
||
253 | print '<div class="title">Coming from</div>'; |
||
254 | print '<div>'; |
||
255 | if ($spotter_item['departure_airport_name'] != "") |
||
256 | { |
||
257 | print '<a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'">'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_name'].', '.$spotter_item['departure_airport_country'].' ('.$spotter_item['departure_airport'].')</a>'; |
||
258 | } else { |
||
259 | print $spotter_item['departure_airport']; |
||
260 | } |
||
261 | print '</div>'; |
||
262 | print '</div>'; |
||
263 | |||
264 | print '<div class="detail">'; |
||
265 | print '<div class="title">Flying to</div>'; |
||
266 | print '<div>'; |
||
267 | if ($spotter_item['arrival_airport_name'] != "") |
||
268 | { |
||
269 | print '<a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_name'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a>'; |
||
270 | } else { |
||
271 | print $spotter_item['arrival_airport']; |
||
272 | } |
||
273 | print '</div>'; |
||
274 | print '</div>'; |
||
275 | |||
276 | print '<div class="detail">'; |
||
277 | print '<div class="title">Date</div>'; |
||
278 | print '<div>'; |
||
279 | |||
280 | print '<a href="'.$globalURL.'/date/'.date("Y-m-d", strtotime($spotter_item['date_iso_8601'])).'">'.date("M j, Y, g:i a", strtotime($spotter_item['date_iso_8601'])).'</a>'; |
||
281 | print '</div>'; |
||
282 | print '</div>'; |
||
283 | } |
||
284 | |||
285 | print '</div>'; |
||
286 | |||
287 | |||
288 | print '<div class="col-sm-7 col-sm-offset-1 image">'; |
||
289 | |||
290 | print '<div class="image">'; |
||
291 | |||
292 | |||
293 | if ($spotter_array[0]['image'] != "") |
||
294 | { |
||
295 | $planespotter_url_array = explode("_", $spotter_array[0]['image']); |
||
296 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
||
297 | print '<a href="http://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id.'" target="_blank"><img src="'.$spotter_array[0]['image'].'" alt="Click image to view on Planespotters.net" title="Click image to view on Planespotters.net" /></a>'; |
||
298 | |||
299 | } else { |
||
300 | print '<img src="'.$globalURL.'/images/placeholder.png" alt="No image found!" title="No image found!" />'; |
||
301 | } |
||
302 | |||
303 | print '</div>'; |
||
304 | print '<div class="note">Disclaimer: The images are courtesy of Planespotters.net and may not always be 100% accurate of the actual aircraft that has flown over.</div>'; |
||
305 | print '</div>'; |
||
306 | print '</div>'; |
||
307 | */ |
||
308 | |||
309 | foreach($spotter_array as $spotter_item) |
||
310 | { |
||
311 | print '<div class="details">'; |
||
312 | print '<h3>'._("Flight Information").'</h3>'; |
||
313 | print '<div class="detail callsign">'; |
||
314 | print '<div class="title">'._("Ident/Callsign").'</div>'; |
||
315 | print '<div>'; |
||
316 | if ($spotter_item['ident'] != "") |
||
317 | { |
||
318 | print '<a href="'.$globalURL.'/ident/'.$spotter_item['ident'].'">'.$spotter_item['ident'].'</a>'; |
||
319 | } else { |
||
320 | print 'N/A'; |
||
321 | } |
||
322 | print '</div>'; |
||
323 | print '</div>'; |
||
324 | |||
325 | if (isset($spotter_item['aircraft_owner']) && $spotter_item['aircraft_owner'] != '') |
||
326 | { |
||
327 | print '<div class="detail fa-user">'; |
||
328 | print '<div class="title">'._("Owner").'</div>'; |
||
329 | print '<div>'; |
||
330 | print $spotter_item['aircraft_owner']; |
||
331 | print '</div>'; |
||
332 | print '</div>'; |
||
333 | } elseif ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
||
334 | print '<div class="detail fa-user">'; |
||
335 | print '<div class="title">'._("Pilot Name").'</div>'; |
||
336 | print '<div>'; |
||
337 | if (isset($spotter_item['pilot_id']) && $spotter_item['pilot_id'] != "") |
||
338 | { |
||
339 | if ($spotter_item['format_source'] == 'whazzup') print '<a href="https://www.ivao.aero/Member.aspx?ID='.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>'; |
||
340 | elseif ($spotter_item['format_source'] == 'vatsimtxt') print '<a href="http://www.vataware.com/pilot/'.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>'; |
||
341 | else print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
||
342 | } else { |
||
343 | if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != "") |
||
344 | { |
||
345 | print $spotter_item['pilot_name']; |
||
346 | } else { |
||
347 | print _("N/A"); |
||
348 | } |
||
349 | } |
||
350 | print '</div>'; |
||
351 | print '</div>'; |
||
352 | } |
||
353 | |||
354 | print '<div class="detail airline">'; |
||
355 | print '<div class="title">'._("Airline").'</div>'; |
||
356 | print '<div>'; |
||
357 | if ($spotter_item['airline_name'] != "") |
||
358 | { |
||
359 | print '<a href="'.$globalURL.'/airline/'.$spotter_item['airline_icao'].'">'.$spotter_item['airline_name'].'</a>'; |
||
360 | } else { |
||
361 | print _("N/A"); |
||
362 | } |
||
363 | print '</div>'; |
||
364 | print '</div>'; |
||
365 | |||
366 | print '<div class="detail aircraft">'; |
||
367 | print '<div class="title">'._("Aircraft").'</div>'; |
||
368 | print '<div>'; |
||
369 | if ($spotter_item['aircraft_name'] != "") |
||
370 | { |
||
371 | print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
||
372 | } else { |
||
373 | if ($spotter_item['aircraft_type'] != "") |
||
374 | { |
||
375 | print $spotter_item['aircraft_type']; |
||
376 | } else { |
||
377 | print _("N/A"); |
||
378 | } |
||
379 | } |
||
380 | print '</div>'; |
||
381 | print '</div>'; |
||
382 | |||
383 | print '<div class="detail registration">'; |
||
384 | print '<div class="title">'._("Registration").'</div>'; |
||
385 | print '<div>'; |
||
386 | if ($spotter_item['registration'] != "") |
||
387 | { |
||
388 | print '<a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'">'.$spotter_item['registration'].'</a>'; |
||
389 | } else { |
||
390 | print 'N/A'; |
||
391 | } |
||
392 | print '</div>'; |
||
393 | print '</div>'; |
||
394 | |||
395 | if ($spotter_item['departure_airport'] != 'NA') { |
||
396 | print '<div class="detail departure">'; |
||
397 | print '<div class="title">'._("Departure Airport").'</div>'; |
||
398 | print '<div>'; |
||
399 | if ($spotter_item['departure_airport_name'] != "") |
||
400 | { |
||
401 | print '<a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'">'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_name'].', '.$spotter_item['departure_airport_country'].' ('.$spotter_item['departure_airport'].')</a>'; |
||
402 | } else { |
||
403 | print $spotter_item['departure_airport']; |
||
404 | } |
||
405 | print '</div>'; |
||
406 | if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != '') { |
||
407 | if ($spotter_item['departure_airport_time'] > 2460) { |
||
408 | print '<div class="time">'; |
||
409 | print 'at '.date('H:m',$spotter_item['departure_airport_time']); |
||
410 | print '</div>'; |
||
411 | } else { |
||
412 | print '<div class="time">'; |
||
413 | print 'at '.$spotter_item['departure_airport_time']; |
||
414 | print '</div>'; |
||
415 | } |
||
416 | } |
||
417 | print '</div>'; |
||
418 | } |
||
419 | |||
420 | if ($spotter_item['arrival_airport'] != 'NA') { |
||
421 | print '<div class="detail arrival">'; |
||
422 | print '<div class="title">'._("Arrival Airport").'</div>'; |
||
423 | print '<div>'; |
||
424 | if ($spotter_item['arrival_airport_name'] != "") |
||
425 | { |
||
426 | print '<a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_name'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a>'; |
||
427 | } else { |
||
428 | print $spotter_item['arrival_airport']; |
||
429 | } |
||
430 | print '</div>'; |
||
431 | if (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != '') { |
||
432 | print '<div class="time">'; |
||
433 | print 'at '.$spotter_item['arrival_airport_time']; |
||
434 | print '</div>'; |
||
435 | } elseif (isset($spotter_item['real_arrival_airport_time']) && $spotter_item['real_arrival_airport_time'] != '') { |
||
436 | print '<div class="time">'; |
||
437 | print 'at '.$spotter_item['real_arrival_airport_time']; |
||
438 | print '</div>'; |
||
439 | } |
||
440 | print '</div>'; |
||
441 | } |
||
442 | |||
443 | if ($spotter_item['waypoints'] != "" || (isset($spotter_item['route_stop']) && $spotter_item['route_stop'] != "")) |
||
444 | { |
||
445 | print '<div class="detail coordinates">'; |
||
446 | print '<div class="title">'._("Route").'</div>'; |
||
447 | print '<div>'; |
||
448 | if ($spotter_item['waypoints'] != "") |
||
449 | { |
||
450 | print $spotter_item['waypoints']; |
||
451 | } elseif ($spotter_item['route_stop'] != "") |
||
452 | { |
||
453 | print $spotter_item['route_stop']; |
||
454 | } |
||
455 | print '</div>'; |
||
456 | print '</div>'; |
||
457 | } |
||
458 | print '</div>'; |
||
459 | |||
460 | print '<div class="details">'; |
||
461 | print '<h3>Additional information as it flew nearby</h3>'; |
||
462 | if ($spotter_item['latitude'] != 0 && $spotter_item['longitude'] != 0) { |
||
463 | print '<div class="detail speed">'; |
||
464 | print '<div class="title">'._("Ground Speed").'</div>'; |
||
465 | print '<div>'; |
||
466 | if (isset($spotter_item['last_ground_speed']) && $spotter_item['last_ground_speed'] != '') { |
||
467 | if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
||
468 | print round($spotter_item['last_ground_speed']*1.15078).' mph'; |
||
469 | } elseif ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
||
470 | print $spotter_item['last_ground_speed'].' knots'; |
||
471 | } else { |
||
472 | print round($spotter_item['last_ground_speed']*1.852).' km/h'; |
||
473 | } |
||
474 | } else { |
||
475 | if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
||
476 | print round($spotter_item['ground_speed']*1.15078).' mph'; |
||
477 | } elseif ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
||
478 | print $spotter_item['ground_speed'].' knots'; |
||
479 | } else { |
||
480 | print round($spotter_item['ground_speed']*1.852).' km/h'; |
||
481 | } |
||
482 | } |
||
483 | print '</div>'; |
||
484 | print '</div>'; |
||
485 | |||
486 | print '<div class="detail heading">'; |
||
487 | print '<div class="title">'._("Heading (degrees)").'</div>'; |
||
488 | print '<div>'; |
||
489 | print $spotter_item['heading'].' ('.$spotter_item['heading_name'].')'; |
||
490 | print '</div>'; |
||
491 | print '</div>'; |
||
492 | |||
493 | print '<div class="detail altitude">'; |
||
494 | print '<div class="title">'._("Altitude").'</div>'; |
||
495 | print '<div>'; |
||
496 | if (isset($spotter_item['last_altitude']) && $spotter_item['last_altitude'] != '') { |
||
497 | if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
||
498 | print number_format($spotter_item['last_altitude'].'00').' feet'; |
||
499 | } else { |
||
500 | print round($spotter_item['last_altitude']*30.48).' m'; |
||
501 | } |
||
502 | } else { |
||
503 | if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
||
504 | print number_format($spotter_item['altitude'].'00').' feet'; |
||
505 | } else { |
||
506 | print round($spotter_item['altitude']*30.48).' m'; |
||
507 | } |
||
508 | } |
||
509 | print '</div>'; |
||
510 | print '</div>'; |
||
511 | |||
512 | print '<div class="detail coordinates">'; |
||
513 | print '<div class="title">'._("Coordinates").'</div>'; |
||
514 | print '<div>'; |
||
515 | //print '<a href="https://www.google.com/maps/place/'.$spotter_item['latitude'].','.$spotter_item['longitude'].'/@'.$spotter_item['latitude'].','.$spotter_item['longitude'].',10z" target="_blank">Lat: '.$spotter_item['latitude'].' Lng: '.$spotter_item['longitude'].'</a>'; |
||
516 | if (isset($spotter_item['last_latitude']) && $spotter_item['last_latitude'] != '') { |
||
517 | print 'Lat: '.$spotter_item['last_latitude'].' Lng: '.$spotter_item['last_longitude']; |
||
518 | } else { |
||
519 | print 'Lat: '.$spotter_item['latitude'].' Lng: '.$spotter_item['longitude']; |
||
520 | } |
||
521 | print '</div>'; |
||
522 | print '</div>'; |
||
523 | } |
||
524 | print '<div class="detail date">'; |
||
525 | print '<div class="title">'._("Date").' ('.$globalTimezone.')</div>'; |
||
526 | print '<div>'; |
||
527 | date_default_timezone_set($globalTimezone); |
||
528 | print '<a href="'.$globalURL.'/date/'.date("Y-m-d", strtotime($spotter_item['date_iso_8601'])).'">'.date("M j, Y g:i a", strtotime($spotter_item['date_iso_8601'])).'</a>'; |
||
529 | print '</div>'; |
||
530 | print '</div>'; |
||
531 | |||
532 | print '<div class="detail date">'; |
||
533 | print '<div class="title">'._("Date").' (UTC)</div>'; |
||
534 | print '<div>'; |
||
535 | date_default_timezone_set('UTC'); |
||
536 | print date("M j, Y G:i", strtotime($spotter_item['date_iso_8601'])); |
||
537 | print '</div>'; |
||
538 | print '</div>'; |
||
539 | |||
540 | if (isset($spotter_item['duration'])) { |
||
541 | print '<div class="detail duration">'; |
||
542 | print '<div class="title">'._("Flight spotted duration").'</div>'; |
||
543 | print '<div>'; |
||
544 | date_default_timezone_set('UTC'); |
||
545 | print date("H:m:s", strtotime($spotter_item['duration'])); |
||
546 | print '</div>'; |
||
547 | print '</div>'; |
||
548 | } |
||
549 | |||
550 | if (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != '' && $spotter_item['departure_airport'] != 'NA' && $spotter_item['latitude'] != 0 && $spotter_item['longitude'] != 0) { |
||
551 | print '<div class="detail distance-departure">'; |
||
552 | print '<div class="title">'._("Distance from Departure Airport").'</div>'; |
||
553 | print '<div>'; |
||
554 | $Common = new Common(); |
||
555 | $departure_airport_info = $Spotter->getAllAirportInfo($spotter_item['departure_airport']); |
||
556 | if (count($departure_airport_info) > 0) { |
||
557 | if (isset($spotter_item['last_latitude']) && $spotter_item['last_latitude'] != '') { |
||
558 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
||
559 | print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'nm').' nm'; |
||
560 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
||
561 | print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'mi').' mi'; |
||
562 | } else { |
||
563 | print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'km').' km'; |
||
564 | } |
||
565 | } else { |
||
566 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
||
567 | print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'nm').' nm'; |
||
568 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
||
569 | print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'mi').' mi'; |
||
570 | } else { |
||
571 | print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'km').' km'; |
||
572 | } |
||
573 | } |
||
574 | } |
||
575 | print '</div>'; |
||
576 | print '</div>'; |
||
577 | } |
||
578 | if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != '' && $spotter_item['arrival_airport'] != 'NA' && $spotter_item['latitude'] != 0 && $spotter_item['longitude'] != 0) { |
||
579 | print '<div class="detail distance-arrival">'; |
||
580 | print '<div class="title">'._("Distance to Arrival Airport").'</div>'; |
||
581 | print '<div>'; |
||
582 | $Common = new Common(); |
||
583 | $arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
||
584 | if (count($arrival_airport_info) > 0) { |
||
585 | if (isset($spotter_item['last_latitude']) && $spotter_item['last_latitude'] != '') { |
||
586 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
||
587 | print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'nm').' nm'; |
||
588 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
||
589 | print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'mi').' mi'; |
||
590 | } else { |
||
591 | print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'km').' km'; |
||
592 | } |
||
593 | } else { |
||
594 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
||
595 | print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'nm').' nm'; |
||
596 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
||
597 | print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'mi').' mi'; |
||
598 | } else { |
||
599 | print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'km').' km'; |
||
600 | } |
||
601 | } |
||
602 | } |
||
603 | print '</div>'; |
||
604 | print '</div>'; |
||
605 | } |
||
606 | print '</div>'; |
||
607 | } |
||
608 | print '</div>'; |
||
609 | |||
610 | print '<div id="archive-map"></div>'; |
||
611 | //print '<div id="live-map"></div>'; |
||
612 | |||
613 | if ($spotter_array[0]['registration'] != "" && $spotter_array[0]['registration'] != "NA" && $spotter_array[0]['registration'] != "N/A") |
||
614 | { |
||
615 | $registration = $spotter_array[0]['registration']; |
||
616 | print '<div class="last-flights">'; |
||
617 | print '<h3>'._("Last 5 Flights of this Aircraft").' ('.$registration.')</h3>'; |
||
618 | $hide_th_links = true; |
||
619 | $spotter_array = $Spotter->getSpotterDataByRegistration($registration,"0,5", ""); |
||
620 | include('table-output.php'); |
||
621 | print '<div class="more">'; |
||
622 | print '<a href="'.$globalURL.'/registration/'.$registration.'" class="btn btn-default btn" role="button">See all Flights»</a>'; |
||
623 | print '</div>'; |
||
624 | print '</div>'; |
||
625 | } |
||
626 | /* ?> |
||
627 | <div class="column"> |
||
628 | |||
629 | <div class="share"> |
||
630 | <span class='st_facebook' displayText='Facebook'></span> |
||
631 | <span class='st_twitter' displayText='Tweet'></span> |
||
632 | <span class='st_googleplus' displayText='Google +'></span> |
||
633 | <span class='st_pinterest' displayText='Pinterest'></span> |
||
634 | <span class='st_email' displayText='Email'></span> |
||
635 | </div> |
||
636 | <script type="text/javascript">var switchTo5x=true;</script> |
||
637 | <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script> |
||
638 | <script type="text/javascript">stLight.options({publisher: "ur-5a9fbd4d-de8a-6441-d567-29163a2526c7", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script> |
||
639 | |||
640 | <?php |
||
641 | print '</div>'; |
||
642 | */ |
||
643 | } else { |
||
644 | $title = "ID"; |
||
645 | require_once('header.php'); |
||
646 | print '<h1>'._("Error").'</h1>'; |
||
647 | print '<p>'._("Sorry, this flight is not in the database. :(").'</p>'; |
||
648 | } |
||
649 | require_once('footer.php'); |
||
650 | ?> |
This check looks for the
else
branches ofif
statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.These
else
branches can be removed.could be turned into
This is much more concise to read.