@@ -57,28 +57,55 @@ discard block |
||
57 | 57 | } |
58 | 58 | header('Content-Type: text/javascript'); |
59 | 59 | |
60 | -if (!isset($globalJsonCompress)) $compress = true; |
|
61 | -else $compress = $globalJsonCompress; |
|
60 | +if (!isset($globalJsonCompress)) { |
|
61 | + $compress = true; |
|
62 | +} else { |
|
63 | + $compress = $globalJsonCompress; |
|
64 | +} |
|
62 | 65 | |
63 | 66 | $from_archive = false; |
64 | 67 | $min = true; |
65 | 68 | $allhistory = false; |
66 | 69 | $filter['source'] = array(); |
67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
69 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
71 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
72 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
77 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
70 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
71 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
72 | +} |
|
73 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
74 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
75 | +} |
|
76 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
77 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
78 | +} |
|
79 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
80 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
81 | +} |
|
82 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
83 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
84 | +} |
|
85 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
86 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
87 | +} |
|
88 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
89 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
90 | +} |
|
91 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
92 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
93 | +} |
|
94 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
95 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
96 | +} |
|
97 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
98 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
99 | +} |
|
100 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
101 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
102 | +} |
|
78 | 103 | |
79 | 104 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
80 | 105 | $min = true; |
81 | -} else $min = false; |
|
106 | +} else { |
|
107 | + $min = false; |
|
108 | +} |
|
82 | 109 | |
83 | 110 | $spotter_array = array(); |
84 | 111 | |
@@ -188,24 +215,38 @@ discard block |
||
188 | 215 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
189 | 216 | } |
190 | 217 | } |
191 | - if ($flightcnt == '') $flightcnt = 0; |
|
192 | -} else $flightcnt = 0; |
|
218 | + if ($flightcnt == '') { |
|
219 | + $flightcnt = 0; |
|
220 | + } |
|
221 | + } else { |
|
222 | + $flightcnt = 0; |
|
223 | +} |
|
193 | 224 | |
194 | 225 | $sqltime = round(microtime(true)-$begintime,2); |
195 | 226 | |
196 | 227 | $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
197 | -if ($currenttime != '') $currenttime = round($currenttime/1000); |
|
228 | +if ($currenttime != '') { |
|
229 | + $currenttime = round($currenttime/1000); |
|
230 | +} |
|
198 | 231 | |
199 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
200 | -else $usenextlatlon = true; |
|
201 | -if ($usenextlatlon === false) $currenttime = ''; |
|
232 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
233 | + $usenextlatlon = false; |
|
234 | +} else { |
|
235 | + $usenextlatlon = true; |
|
236 | +} |
|
237 | +if ($usenextlatlon === false) { |
|
238 | + $currenttime = ''; |
|
239 | +} |
|
202 | 240 | $j = 0; |
203 | 241 | $prev_flightaware_id = ''; |
204 | 242 | $aircrafts_shadow = array(); |
205 | 243 | $output = '{'; |
206 | 244 | $output .= '"type": "FeatureCollection",'; |
207 | - if ($min) $output .= '"minimal": "true",'; |
|
208 | - else $output .= '"minimal": "false",'; |
|
245 | + if ($min) { |
|
246 | + $output .= '"minimal": "true",'; |
|
247 | + } else { |
|
248 | + $output .= '"minimal": "false",'; |
|
249 | + } |
|
209 | 250 | //$output .= '"fc": "'.$flightcnt.'",'; |
210 | 251 | $output .= '"sqt": "'.$sqltime.'",'; |
211 | 252 | |
@@ -250,18 +291,29 @@ discard block |
||
250 | 291 | } |
251 | 292 | $output .= '"properties": {'; |
252 | 293 | if (isset($spotter_item['flightaware_id'])) { |
253 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
254 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
294 | + if ($compress) { |
|
295 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
296 | + } else { |
|
297 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
298 | + } |
|
255 | 299 | } elseif (isset($spotter_item['famtrackid'])) { |
256 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
257 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
300 | + if ($compress) { |
|
301 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
302 | + } else { |
|
303 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
304 | + } |
|
258 | 305 | } elseif (isset($spotter_item['fammarine_id'])) { |
259 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
260 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
306 | + if ($compress) { |
|
307 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
308 | + } else { |
|
309 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
310 | + } |
|
261 | 311 | } |
262 | 312 | $output .= '"fc": "'.$flightcnt.'",'; |
263 | 313 | $output .= '"sqt": "'.$sqltime.'",'; |
264 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
314 | + if (isset($begindate)) { |
|
315 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
316 | + } |
|
265 | 317 | |
266 | 318 | /* |
267 | 319 | if ($min) $output .= '"minimal": "true",'; |
@@ -269,14 +321,22 @@ discard block |
||
269 | 321 | */ |
270 | 322 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
271 | 323 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
272 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
273 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
324 | + if ($compress) { |
|
325 | + $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
326 | + } else { |
|
327 | + $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
328 | + } |
|
274 | 329 | //" |
275 | 330 | } else { |
276 | - if ($compress) $output .= '"c": "NA",'; |
|
277 | - else $output .= '"callsign": "NA",'; |
|
331 | + if ($compress) { |
|
332 | + $output .= '"c": "NA",'; |
|
333 | + } else { |
|
334 | + $output .= '"callsign": "NA",'; |
|
335 | + } |
|
336 | + } |
|
337 | + if (isset($spotter_item['registration'])) { |
|
338 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
278 | 339 | } |
279 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
280 | 340 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
281 | 341 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
282 | 342 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -289,16 +349,23 @@ discard block |
||
289 | 349 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
290 | 350 | } |
291 | 351 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker) { |
292 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
293 | - else { |
|
352 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
353 | + $spotter_item['aircraft_shadow'] = ''; |
|
354 | + } else { |
|
294 | 355 | $aircraft_icao = $spotter_item['aircraft_icao']; |
295 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
296 | - else { |
|
356 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
357 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
358 | + } else { |
|
297 | 359 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
298 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
299 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
300 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
301 | - else $spotter_item['aircraft_shadow'] = ''; |
|
360 | + if (count($aircraft_info) > 0) { |
|
361 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
362 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
363 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
364 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
365 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
366 | + } else { |
|
367 | + $spotter_item['aircraft_shadow'] = ''; |
|
368 | + } |
|
302 | 369 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
303 | 370 | } |
304 | 371 | } |
@@ -306,73 +373,139 @@ discard block |
||
306 | 373 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
307 | 374 | if ($tracker) { |
308 | 375 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
309 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
310 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
376 | + if ($compress) { |
|
377 | + $output .= '"as": "ambulance.png",'; |
|
378 | + } else { |
|
379 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
380 | + } |
|
311 | 381 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
312 | - if ($compress) $output .= '"as": "police.png",'; |
|
313 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
382 | + if ($compress) { |
|
383 | + $output .= '"as": "police.png",'; |
|
384 | + } else { |
|
385 | + $output .= '"aircraft_shadow": "police.png",'; |
|
386 | + } |
|
314 | 387 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
315 | - if ($compress) $output .= '"as": "ship.png",'; |
|
316 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
388 | + if ($compress) { |
|
389 | + $output .= '"as": "ship.png",'; |
|
390 | + } else { |
|
391 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
392 | + } |
|
317 | 393 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
318 | - if ($compress) $output .= '"as": "ship.png",'; |
|
319 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
394 | + if ($compress) { |
|
395 | + $output .= '"as": "ship.png",'; |
|
396 | + } else { |
|
397 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
398 | + } |
|
320 | 399 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
321 | - if ($compress) $output .= '"as": "ship.png",'; |
|
322 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
400 | + if ($compress) { |
|
401 | + $output .= '"as": "ship.png",'; |
|
402 | + } else { |
|
403 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
404 | + } |
|
323 | 405 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
324 | - if ($compress) $output .= '"as": "truck.png",'; |
|
325 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
406 | + if ($compress) { |
|
407 | + $output .= '"as": "truck.png",'; |
|
408 | + } else { |
|
409 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
410 | + } |
|
326 | 411 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
327 | - if ($compress) $output .= '"as": "truck.png",'; |
|
328 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
412 | + if ($compress) { |
|
413 | + $output .= '"as": "truck.png",'; |
|
414 | + } else { |
|
415 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
416 | + } |
|
329 | 417 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
330 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
331 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
418 | + if ($compress) { |
|
419 | + $output .= '"as": "aircraft.png",'; |
|
420 | + } else { |
|
421 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
422 | + } |
|
332 | 423 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
333 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
334 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
424 | + if ($compress) { |
|
425 | + $output .= '"as": "aircraft.png",'; |
|
426 | + } else { |
|
427 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
428 | + } |
|
335 | 429 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
336 | - if ($compress) $output .= '"as": "helico.png",'; |
|
337 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
430 | + if ($compress) { |
|
431 | + $output .= '"as": "helico.png",'; |
|
432 | + } else { |
|
433 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
434 | + } |
|
338 | 435 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
339 | - if ($compress) $output .= '"as": "rail.png",'; |
|
340 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
436 | + if ($compress) { |
|
437 | + $output .= '"as": "rail.png",'; |
|
438 | + } else { |
|
439 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
440 | + } |
|
341 | 441 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
342 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
343 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
442 | + if ($compress) { |
|
443 | + $output .= '"as": "firetruck.png",'; |
|
444 | + } else { |
|
445 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
446 | + } |
|
344 | 447 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
345 | - if ($compress) $output .= '"as": "bus.png",'; |
|
346 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
448 | + if ($compress) { |
|
449 | + $output .= '"as": "bus.png",'; |
|
450 | + } else { |
|
451 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
452 | + } |
|
347 | 453 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
348 | - if ($compress) $output .= '"as": "phone.png",'; |
|
349 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
454 | + if ($compress) { |
|
455 | + $output .= '"as": "phone.png",'; |
|
456 | + } else { |
|
457 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
458 | + } |
|
350 | 459 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
351 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
352 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
460 | + if ($compress) { |
|
461 | + $output .= '"as": "jogger.png",'; |
|
462 | + } else { |
|
463 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
464 | + } |
|
353 | 465 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
354 | - if ($compress) $output .= '"as": "bike.png",'; |
|
355 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
466 | + if ($compress) { |
|
467 | + $output .= '"as": "bike.png",'; |
|
468 | + } else { |
|
469 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
470 | + } |
|
356 | 471 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
357 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
358 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
472 | + if ($compress) { |
|
473 | + $output .= '"as": "motorcycle.png",'; |
|
474 | + } else { |
|
475 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
476 | + } |
|
359 | 477 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
360 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
361 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
478 | + if ($compress) { |
|
479 | + $output .= '"as": "balloon.png",'; |
|
480 | + } else { |
|
481 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
482 | + } |
|
362 | 483 | } else { |
363 | - if ($compress) $output .= '"as": "car.png",'; |
|
364 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
484 | + if ($compress) { |
|
485 | + $output .= '"as": "car.png",'; |
|
486 | + } else { |
|
487 | + $output .= '"aircraft_shadow": "car.png",'; |
|
488 | + } |
|
365 | 489 | } |
366 | 490 | } elseif ($marine) { |
367 | - if ($compress) $output .= '"as": "ship.png",'; |
|
368 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
491 | + if ($compress) { |
|
492 | + $output .= '"as": "ship.png",'; |
|
493 | + } else { |
|
494 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
495 | + } |
|
369 | 496 | } else { |
370 | - if ($compress) $output .= '"as": "default.png",'; |
|
371 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
497 | + if ($compress) { |
|
498 | + $output .= '"as": "default.png",'; |
|
499 | + } else { |
|
500 | + $output .= '"aircraft_shadow": "default.png",'; |
|
501 | + } |
|
372 | 502 | } |
373 | 503 | } else { |
374 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
375 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
504 | + if ($compress) { |
|
505 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
506 | + } else { |
|
507 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
508 | + } |
|
376 | 509 | } |
377 | 510 | if (isset($spotter_item['airline_name'])) { |
378 | 511 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -380,8 +513,11 @@ discard block |
||
380 | 513 | $output .= '"airline_name": "NA",'; |
381 | 514 | } |
382 | 515 | if (isset($spotter_item['departure_airport'])) { |
383 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
384 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
516 | + if ($compress) { |
|
517 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
518 | + } else { |
|
519 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
520 | + } |
|
385 | 521 | } |
386 | 522 | if (isset($spotter_item['departure_airport_city'])) { |
387 | 523 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -393,8 +529,11 @@ discard block |
||
393 | 529 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
394 | 530 | } |
395 | 531 | if (isset($spotter_item['arrival_airport'])) { |
396 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
397 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
532 | + if ($compress) { |
|
533 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
534 | + } else { |
|
535 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
536 | + } |
|
398 | 537 | } |
399 | 538 | if (isset($spotter_item['arrival_airport_city'])) { |
400 | 539 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -413,8 +552,11 @@ discard block |
||
413 | 552 | } |
414 | 553 | |
415 | 554 | if (isset($spotter_item['altitude'])) { |
416 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
417 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
555 | + if ($compress) { |
|
556 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
557 | + } else { |
|
558 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
559 | + } |
|
418 | 560 | } |
419 | 561 | |
420 | 562 | $heading = $spotter_item['heading']; |
@@ -438,19 +580,24 @@ discard block |
||
438 | 580 | } |
439 | 581 | } |
440 | 582 | |
441 | - if ($compress)$output .= '"h": "'.$heading.'",'; |
|
442 | - else $output .= '"heading": "'.$heading.'",'; |
|
583 | + if ($compress) { |
|
584 | + $output .= '"h": "'.$heading.'",'; |
|
585 | + } else { |
|
586 | + $output .= '"heading": "'.$heading.'",'; |
|
587 | + } |
|
443 | 588 | if ($currenttime != '') { |
444 | 589 | if (strtotime($spotter_item['date']) < $currenttime) { |
445 | 590 | if (isset($archivespeed)) { |
446 | 591 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
447 | 592 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
448 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
449 | - else { |
|
593 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
594 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
595 | + } else { |
|
450 | 596 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
451 | 597 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
452 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
453 | - else { |
|
598 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
599 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
600 | + } else { |
|
454 | 601 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
455 | 602 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
456 | 603 | } |
@@ -458,12 +605,14 @@ discard block |
||
458 | 605 | } elseif ($usenextlatlon) { |
459 | 606 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
460 | 607 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
461 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
462 | - else { |
|
608 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
609 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
610 | + } else { |
|
463 | 611 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
464 | 612 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
465 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
466 | - else { |
|
613 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
614 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
615 | + } else { |
|
467 | 616 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
468 | 617 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
469 | 618 | } |
@@ -502,7 +651,9 @@ discard block |
||
502 | 651 | } |
503 | 652 | } |
504 | 653 | |
505 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
654 | + if (!$min) { |
|
655 | + $output .= '"image": "'.$image.'",'; |
|
656 | + } |
|
506 | 657 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
507 | 658 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
508 | 659 | } |
@@ -510,8 +661,11 @@ discard block |
||
510 | 661 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
511 | 662 | } |
512 | 663 | if (isset($spotter_item['squawk'])) { |
513 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
514 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
664 | + if ($compress) { |
|
665 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
666 | + } else { |
|
667 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
668 | + } |
|
515 | 669 | } |
516 | 670 | if (isset($spotter_item['squawk_usage'])) { |
517 | 671 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -530,14 +684,23 @@ discard block |
||
530 | 684 | } |
531 | 685 | // type when not aircraft ? |
532 | 686 | if (isset($spotter_item['type'])) { |
533 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
534 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
687 | + if ($compress) { |
|
688 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
689 | + } else { |
|
690 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
691 | + } |
|
535 | 692 | } elseif ($marine) { |
536 | - if ($compress) $output .= '"t": "ship"'; |
|
537 | - else $output .= '"type": "ship"'; |
|
693 | + if ($compress) { |
|
694 | + $output .= '"t": "ship"'; |
|
695 | + } else { |
|
696 | + $output .= '"type": "ship"'; |
|
697 | + } |
|
538 | 698 | } else { |
539 | - if ($compress) $output .= '"t": "aircraft"'; |
|
540 | - else $output .= '"type": "aircraft"'; |
|
699 | + if ($compress) { |
|
700 | + $output .= '"t": "aircraft"'; |
|
701 | + } else { |
|
702 | + $output .= '"type": "aircraft"'; |
|
703 | + } |
|
541 | 704 | } |
542 | 705 | $output .= '},'; |
543 | 706 | $output .= '"geometry": {'; |
@@ -545,15 +708,19 @@ discard block |
||
545 | 708 | $output .= '"coordinates": ['; |
546 | 709 | if ($currenttime != '') { |
547 | 710 | if (strtotime($spotter_item['date']) < $currenttime) { |
548 | - if (!isset($archivespeed)) $archivespeed = 1; |
|
711 | + if (!isset($archivespeed)) { |
|
712 | + $archivespeed = 1; |
|
713 | + } |
|
549 | 714 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
550 | 715 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
551 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
552 | - else { |
|
716 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
717 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
718 | + } else { |
|
553 | 719 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
554 | 720 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
555 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
556 | - else { |
|
721 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
722 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
723 | + } else { |
|
557 | 724 | $output .= $spotter_item['longitude'].', '; |
558 | 725 | $output .= $spotter_item['latitude']; |
559 | 726 | } |
@@ -631,7 +798,9 @@ discard block |
||
631 | 798 | } |
632 | 799 | */ |
633 | 800 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
634 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
801 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
802 | + $history = $_COOKIE['history']; |
|
803 | + } |
|
635 | 804 | |
636 | 805 | if ( |
637 | 806 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -675,8 +844,11 @@ discard block |
||
675 | 844 | $output_history .= ']}},'; |
676 | 845 | $output .= $output_history; |
677 | 846 | } |
678 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
679 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
847 | + if ($compress) { |
|
848 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
849 | + } else { |
|
850 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
851 | + } |
|
680 | 852 | } |
681 | 853 | $output_history .= '['; |
682 | 854 | $output_history .= $spotter_history['longitude'].', '; |
@@ -695,9 +867,14 @@ discard block |
||
695 | 867 | $prev_alt = $alt; |
696 | 868 | } else { |
697 | 869 | if ($d == false) { |
698 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
699 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
700 | - } else $d = true; |
|
870 | + if ($compress) { |
|
871 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
872 | + } else { |
|
873 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
874 | + } |
|
875 | + } else { |
|
876 | + $d = true; |
|
877 | + } |
|
701 | 878 | $output_history .= '['; |
702 | 879 | $output_history .= $spotter_history['longitude'].', '; |
703 | 880 | $output_history .= $spotter_history['latitude']; |
@@ -718,7 +895,9 @@ discard block |
||
718 | 895 | $output_historyd = '['; |
719 | 896 | $output_historyd .= $spotter_item['longitude'].', '; |
720 | 897 | $output_historyd .= $spotter_item['latitude']; |
721 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
898 | + if (isset($spotter_history['altitude'])) { |
|
899 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
900 | + } |
|
722 | 901 | $output_historyd .= '],'; |
723 | 902 | //$output_history = $output_historyd.$output_history; |
724 | 903 | $output_history = $output_history.$output_historyd; |
@@ -740,8 +919,11 @@ discard block |
||
740 | 919 | && $spotter_item['arrival_airport'] != 'NA' |
741 | 920 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
742 | 921 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
743 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
744 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
922 | + if ($compress) { |
|
923 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
924 | + } else { |
|
925 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
926 | + } |
|
745 | 927 | if (isset($spotter_item['departure_airport_latitude'])) { |
746 | 928 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
747 | 929 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -774,8 +956,11 @@ discard block |
||
774 | 956 | || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) |
775 | 957 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
776 | 958 | $havedata = false; |
777 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
778 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
959 | + if ($compress) { |
|
960 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
961 | + } else { |
|
962 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
963 | + } |
|
779 | 964 | $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
780 | 965 | |
781 | 966 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -790,7 +975,9 @@ discard block |
||
790 | 975 | } |
791 | 976 | //$output_dest = substr($output_dest, 0, -1); |
792 | 977 | $output_dest .= ']}},'; |
793 | - if ($havedata) $output .= $output_dest; |
|
978 | + if ($havedata) { |
|
979 | + $output .= $output_dest; |
|
980 | + } |
|
794 | 981 | unset($output_dest); |
795 | 982 | } |
796 | 983 | } |
@@ -798,7 +985,9 @@ discard block |
||
798 | 985 | $output .= ']'; |
799 | 986 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
800 | 987 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
801 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
988 | + if (isset($begindate)) { |
|
989 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
990 | + } |
|
802 | 991 | $output .= '"fc": "'.$j.'"'; |
803 | 992 | } else { |
804 | 993 | $output .= '"features": '; |