@@ -48,28 +48,55 @@ discard block |
||
48 | 48 | } |
49 | 49 | header('Content-Type: text/javascript'); |
50 | 50 | |
51 | -if (!isset($globalJsonCompress)) $compress = true; |
|
52 | -else $compress = $globalJsonCompress; |
|
51 | +if (!isset($globalJsonCompress)) { |
|
52 | + $compress = true; |
|
53 | +} else { |
|
54 | + $compress = $globalJsonCompress; |
|
55 | +} |
|
53 | 56 | |
54 | 57 | $from_archive = false; |
55 | 58 | $min = true; |
56 | 59 | $allhistory = false; |
57 | 60 | $filter['source'] = array(); |
58 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
59 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
60 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
61 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
62 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
63 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
64 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
65 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
66 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
67 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
68 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
61 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
62 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
63 | +} |
|
64 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
65 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
66 | +} |
|
67 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
68 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
69 | +} |
|
70 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
71 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
72 | +} |
|
73 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
74 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
75 | +} |
|
76 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
77 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
78 | +} |
|
79 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
80 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
81 | +} |
|
82 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
83 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
84 | +} |
|
85 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
86 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
87 | +} |
|
88 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
89 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
90 | +} |
|
91 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
92 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
93 | +} |
|
69 | 94 | |
70 | 95 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
71 | 96 | $min = true; |
72 | -} else $min = false; |
|
97 | +} else { |
|
98 | + $min = false; |
|
99 | +} |
|
73 | 100 | |
74 | 101 | $spotter_array = array(); |
75 | 102 | |
@@ -171,24 +198,38 @@ discard block |
||
171 | 198 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
172 | 199 | } |
173 | 200 | } |
174 | - if ($flightcnt == '') $flightcnt = 0; |
|
175 | -} else $flightcnt = 0; |
|
201 | + if ($flightcnt == '') { |
|
202 | + $flightcnt = 0; |
|
203 | + } |
|
204 | + } else { |
|
205 | + $flightcnt = 0; |
|
206 | +} |
|
176 | 207 | |
177 | 208 | $sqltime = round(microtime(true)-$begintime,2); |
178 | 209 | |
179 | 210 | $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
180 | -if ($currenttime != '') $currenttime = round($currenttime/1000); |
|
211 | +if ($currenttime != '') { |
|
212 | + $currenttime = round($currenttime/1000); |
|
213 | +} |
|
181 | 214 | |
182 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
183 | -else $usenextlatlon = true; |
|
184 | -if ($usenextlatlon === false) $currenttime = ''; |
|
215 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
216 | + $usenextlatlon = false; |
|
217 | +} else { |
|
218 | + $usenextlatlon = true; |
|
219 | +} |
|
220 | +if ($usenextlatlon === false) { |
|
221 | + $currenttime = ''; |
|
222 | +} |
|
185 | 223 | $j = 0; |
186 | 224 | $prev_flightaware_id = ''; |
187 | 225 | $aircrafts_shadow = array(); |
188 | 226 | $output = '{'; |
189 | 227 | $output .= '"type": "FeatureCollection",'; |
190 | - if ($min) $output .= '"minimal": "true",'; |
|
191 | - else $output .= '"minimal": "false",'; |
|
228 | + if ($min) { |
|
229 | + $output .= '"minimal": "true",'; |
|
230 | + } else { |
|
231 | + $output .= '"minimal": "false",'; |
|
232 | + } |
|
192 | 233 | //$output .= '"fc": "'.$flightcnt.'",'; |
193 | 234 | $output .= '"sqt": "'.$sqltime.'",'; |
194 | 235 | |
@@ -232,18 +273,29 @@ discard block |
||
232 | 273 | } |
233 | 274 | $output .= '"properties": {'; |
234 | 275 | if (isset($spotter_item['flightaware_id'])) { |
235 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
236 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
276 | + if ($compress) { |
|
277 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
278 | + } else { |
|
279 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
280 | + } |
|
237 | 281 | } elseif (isset($spotter_item['famtrackid'])) { |
238 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
239 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
282 | + if ($compress) { |
|
283 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
284 | + } else { |
|
285 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
286 | + } |
|
240 | 287 | } elseif (isset($spotter_item['fammarine_id'])) { |
241 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
242 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
288 | + if ($compress) { |
|
289 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
290 | + } else { |
|
291 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
292 | + } |
|
243 | 293 | } |
244 | 294 | $output .= '"fc": "'.$flightcnt.'",'; |
245 | 295 | $output .= '"sqt": "'.$sqltime.'",'; |
246 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
296 | + if (isset($begindate)) { |
|
297 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
298 | + } |
|
247 | 299 | |
248 | 300 | /* |
249 | 301 | if ($min) $output .= '"minimal": "true",'; |
@@ -251,14 +303,22 @@ discard block |
||
251 | 303 | */ |
252 | 304 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
253 | 305 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
254 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
255 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
306 | + if ($compress) { |
|
307 | + $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
308 | + } else { |
|
309 | + $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
310 | + } |
|
256 | 311 | //" |
257 | 312 | } else { |
258 | - if ($compress) $output .= '"c": "NA",'; |
|
259 | - else $output .= '"callsign": "NA",'; |
|
313 | + if ($compress) { |
|
314 | + $output .= '"c": "NA",'; |
|
315 | + } else { |
|
316 | + $output .= '"callsign": "NA",'; |
|
317 | + } |
|
318 | + } |
|
319 | + if (isset($spotter_item['registration'])) { |
|
320 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
260 | 321 | } |
261 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
262 | 322 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
263 | 323 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
264 | 324 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -271,16 +331,23 @@ discard block |
||
271 | 331 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
272 | 332 | } |
273 | 333 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker) { |
274 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
275 | - else { |
|
334 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
335 | + $spotter_item['aircraft_shadow'] = ''; |
|
336 | + } else { |
|
276 | 337 | $aircraft_icao = $spotter_item['aircraft_icao']; |
277 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
278 | - else { |
|
338 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
339 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
340 | + } else { |
|
279 | 341 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
280 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
281 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
282 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
283 | - else $spotter_item['aircraft_shadow'] = ''; |
|
342 | + if (count($aircraft_info) > 0) { |
|
343 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
344 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
345 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
346 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
347 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
348 | + } else { |
|
349 | + $spotter_item['aircraft_shadow'] = ''; |
|
350 | + } |
|
284 | 351 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
285 | 352 | } |
286 | 353 | } |
@@ -288,73 +355,139 @@ discard block |
||
288 | 355 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
289 | 356 | if ($tracker) { |
290 | 357 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
291 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
292 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
358 | + if ($compress) { |
|
359 | + $output .= '"as": "ambulance.png",'; |
|
360 | + } else { |
|
361 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
362 | + } |
|
293 | 363 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
294 | - if ($compress) $output .= '"as": "police.png",'; |
|
295 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
364 | + if ($compress) { |
|
365 | + $output .= '"as": "police.png",'; |
|
366 | + } else { |
|
367 | + $output .= '"aircraft_shadow": "police.png",'; |
|
368 | + } |
|
296 | 369 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
297 | - if ($compress) $output .= '"as": "ship.png",'; |
|
298 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
370 | + if ($compress) { |
|
371 | + $output .= '"as": "ship.png",'; |
|
372 | + } else { |
|
373 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
374 | + } |
|
299 | 375 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
300 | - if ($compress) $output .= '"as": "ship.png",'; |
|
301 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
376 | + if ($compress) { |
|
377 | + $output .= '"as": "ship.png",'; |
|
378 | + } else { |
|
379 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
380 | + } |
|
302 | 381 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
303 | - if ($compress) $output .= '"as": "ship.png",'; |
|
304 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
382 | + if ($compress) { |
|
383 | + $output .= '"as": "ship.png",'; |
|
384 | + } else { |
|
385 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
386 | + } |
|
305 | 387 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
306 | - if ($compress) $output .= '"as": "truck.png",'; |
|
307 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
388 | + if ($compress) { |
|
389 | + $output .= '"as": "truck.png",'; |
|
390 | + } else { |
|
391 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
392 | + } |
|
308 | 393 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
309 | - if ($compress) $output .= '"as": "truck.png",'; |
|
310 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
394 | + if ($compress) { |
|
395 | + $output .= '"as": "truck.png",'; |
|
396 | + } else { |
|
397 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
398 | + } |
|
311 | 399 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
312 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
313 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
400 | + if ($compress) { |
|
401 | + $output .= '"as": "aircraft.png",'; |
|
402 | + } else { |
|
403 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
404 | + } |
|
314 | 405 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
315 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
316 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
406 | + if ($compress) { |
|
407 | + $output .= '"as": "aircraft.png",'; |
|
408 | + } else { |
|
409 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
410 | + } |
|
317 | 411 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
318 | - if ($compress) $output .= '"as": "helico.png",'; |
|
319 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
412 | + if ($compress) { |
|
413 | + $output .= '"as": "helico.png",'; |
|
414 | + } else { |
|
415 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
416 | + } |
|
320 | 417 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
321 | - if ($compress) $output .= '"as": "rail.png",'; |
|
322 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
418 | + if ($compress) { |
|
419 | + $output .= '"as": "rail.png",'; |
|
420 | + } else { |
|
421 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
422 | + } |
|
323 | 423 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
324 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
325 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
424 | + if ($compress) { |
|
425 | + $output .= '"as": "firetruck.png",'; |
|
426 | + } else { |
|
427 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
428 | + } |
|
326 | 429 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
327 | - if ($compress) $output .= '"as": "bus.png",'; |
|
328 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
430 | + if ($compress) { |
|
431 | + $output .= '"as": "bus.png",'; |
|
432 | + } else { |
|
433 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
434 | + } |
|
329 | 435 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
330 | - if ($compress) $output .= '"as": "phone.png",'; |
|
331 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
436 | + if ($compress) { |
|
437 | + $output .= '"as": "phone.png",'; |
|
438 | + } else { |
|
439 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
440 | + } |
|
332 | 441 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
333 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
334 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
442 | + if ($compress) { |
|
443 | + $output .= '"as": "jogger.png",'; |
|
444 | + } else { |
|
445 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
446 | + } |
|
335 | 447 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
336 | - if ($compress) $output .= '"as": "bike.png",'; |
|
337 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
448 | + if ($compress) { |
|
449 | + $output .= '"as": "bike.png",'; |
|
450 | + } else { |
|
451 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
452 | + } |
|
338 | 453 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
339 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
340 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
454 | + if ($compress) { |
|
455 | + $output .= '"as": "motorcycle.png",'; |
|
456 | + } else { |
|
457 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
458 | + } |
|
341 | 459 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
342 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
343 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
460 | + if ($compress) { |
|
461 | + $output .= '"as": "balloon.png",'; |
|
462 | + } else { |
|
463 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
464 | + } |
|
344 | 465 | } else { |
345 | - if ($compress) $output .= '"as": "car.png",'; |
|
346 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
466 | + if ($compress) { |
|
467 | + $output .= '"as": "car.png",'; |
|
468 | + } else { |
|
469 | + $output .= '"aircraft_shadow": "car.png",'; |
|
470 | + } |
|
347 | 471 | } |
348 | 472 | } elseif ($marine) { |
349 | - if ($compress) $output .= '"as": "ship.png",'; |
|
350 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
473 | + if ($compress) { |
|
474 | + $output .= '"as": "ship.png",'; |
|
475 | + } else { |
|
476 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
477 | + } |
|
351 | 478 | } else { |
352 | - if ($compress) $output .= '"as": "default.png",'; |
|
353 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
479 | + if ($compress) { |
|
480 | + $output .= '"as": "default.png",'; |
|
481 | + } else { |
|
482 | + $output .= '"aircraft_shadow": "default.png",'; |
|
483 | + } |
|
354 | 484 | } |
355 | 485 | } else { |
356 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
357 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
486 | + if ($compress) { |
|
487 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
488 | + } else { |
|
489 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
490 | + } |
|
358 | 491 | } |
359 | 492 | if (isset($spotter_item['airline_name'])) { |
360 | 493 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -362,8 +495,11 @@ discard block |
||
362 | 495 | $output .= '"airline_name": "NA",'; |
363 | 496 | } |
364 | 497 | if (isset($spotter_item['departure_airport'])) { |
365 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
366 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
498 | + if ($compress) { |
|
499 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
500 | + } else { |
|
501 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
502 | + } |
|
367 | 503 | } |
368 | 504 | if (isset($spotter_item['departure_airport_city'])) { |
369 | 505 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -375,8 +511,11 @@ discard block |
||
375 | 511 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
376 | 512 | } |
377 | 513 | if (isset($spotter_item['arrival_airport'])) { |
378 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
379 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
514 | + if ($compress) { |
|
515 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
516 | + } else { |
|
517 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
518 | + } |
|
380 | 519 | } |
381 | 520 | if (isset($spotter_item['arrival_airport_city'])) { |
382 | 521 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -395,11 +534,17 @@ discard block |
||
395 | 534 | } |
396 | 535 | |
397 | 536 | if (isset($spotter_item['altitude'])) { |
398 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
399 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
537 | + if ($compress) { |
|
538 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
539 | + } else { |
|
540 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
541 | + } |
|
542 | + } |
|
543 | + if ($compress) { |
|
544 | + $output .= '"h": "'.$spotter_item['heading'].'",'; |
|
545 | + } else { |
|
546 | + $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
400 | 547 | } |
401 | - if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
|
402 | - else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
403 | 548 | |
404 | 549 | if ($currenttime != '') { |
405 | 550 | if (strtotime($spotter_item['date']) < $currenttime) { |
@@ -421,7 +566,9 @@ discard block |
||
421 | 566 | } |
422 | 567 | } |
423 | 568 | |
424 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
569 | + if (!$min) { |
|
570 | + $output .= '"image": "'.$image.'",'; |
|
571 | + } |
|
425 | 572 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
426 | 573 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
427 | 574 | } |
@@ -429,8 +576,11 @@ discard block |
||
429 | 576 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
430 | 577 | } |
431 | 578 | if (isset($spotter_item['squawk'])) { |
432 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
433 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
579 | + if ($compress) { |
|
580 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
581 | + } else { |
|
582 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
583 | + } |
|
434 | 584 | } |
435 | 585 | if (isset($spotter_item['squawk_usage'])) { |
436 | 586 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -449,14 +599,23 @@ discard block |
||
449 | 599 | } |
450 | 600 | // type when not aircraft ? |
451 | 601 | if (isset($spotter_item['type'])) { |
452 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
453 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
602 | + if ($compress) { |
|
603 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
604 | + } else { |
|
605 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
606 | + } |
|
454 | 607 | } elseif ($marine) { |
455 | - if ($compress) $output .= '"t": "ship"'; |
|
456 | - else $output .= '"type": "ship"'; |
|
608 | + if ($compress) { |
|
609 | + $output .= '"t": "ship"'; |
|
610 | + } else { |
|
611 | + $output .= '"type": "ship"'; |
|
612 | + } |
|
457 | 613 | } else { |
458 | - if ($compress) $output .= '"t": "aircraft"'; |
|
459 | - else $output .= '"type": "aircraft"'; |
|
614 | + if ($compress) { |
|
615 | + $output .= '"t": "aircraft"'; |
|
616 | + } else { |
|
617 | + $output .= '"type": "aircraft"'; |
|
618 | + } |
|
460 | 619 | } |
461 | 620 | $output .= '},'; |
462 | 621 | $output .= '"geometry": {'; |
@@ -464,7 +623,9 @@ discard block |
||
464 | 623 | $output .= '"coordinates": ['; |
465 | 624 | if ($currenttime != '') { |
466 | 625 | if (strtotime($spotter_item['date']) < $currenttime) { |
467 | - if (!isset($archivespeed)) $archivespeed = 1; |
|
626 | + if (!isset($archivespeed)) { |
|
627 | + $archivespeed = 1; |
|
628 | + } |
|
468 | 629 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date'])); |
469 | 630 | $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
470 | 631 | } else { |
@@ -535,7 +696,9 @@ discard block |
||
535 | 696 | } |
536 | 697 | */ |
537 | 698 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
538 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
699 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
700 | + $history = $_COOKIE['history']; |
|
701 | + } |
|
539 | 702 | |
540 | 703 | if ( |
541 | 704 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -579,8 +742,11 @@ discard block |
||
579 | 742 | $output_history .= ']}},'; |
580 | 743 | $output .= $output_history; |
581 | 744 | } |
582 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
583 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
745 | + if ($compress) { |
|
746 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
747 | + } else { |
|
748 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
749 | + } |
|
584 | 750 | } |
585 | 751 | $output_history .= '['; |
586 | 752 | $output_history .= $spotter_history['longitude'].', '; |
@@ -599,9 +765,14 @@ discard block |
||
599 | 765 | $prev_alt = $alt; |
600 | 766 | } else { |
601 | 767 | if ($d == false) { |
602 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
603 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
604 | - } else $d = true; |
|
768 | + if ($compress) { |
|
769 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
770 | + } else { |
|
771 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
772 | + } |
|
773 | + } else { |
|
774 | + $d = true; |
|
775 | + } |
|
605 | 776 | $output_history .= '['; |
606 | 777 | $output_history .= $spotter_history['longitude'].', '; |
607 | 778 | $output_history .= $spotter_history['latitude']; |
@@ -622,7 +793,9 @@ discard block |
||
622 | 793 | $output_historyd = '['; |
623 | 794 | $output_historyd .= $spotter_item['longitude'].', '; |
624 | 795 | $output_historyd .= $spotter_item['latitude']; |
625 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
796 | + if (isset($spotter_history['altitude'])) { |
|
797 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
798 | + } |
|
626 | 799 | $output_historyd .= '],'; |
627 | 800 | //$output_history = $output_historyd.$output_history; |
628 | 801 | $output_history = $output_history.$output_historyd; |
@@ -644,8 +817,11 @@ discard block |
||
644 | 817 | && $spotter_item['arrival_airport'] != 'NA' |
645 | 818 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
646 | 819 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
647 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
648 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
820 | + if ($compress) { |
|
821 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
822 | + } else { |
|
823 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
824 | + } |
|
649 | 825 | if (isset($spotter_item['departure_airport_latitude'])) { |
650 | 826 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
651 | 827 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -678,8 +854,11 @@ discard block |
||
678 | 854 | || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) |
679 | 855 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
680 | 856 | $havedata = false; |
681 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
682 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
857 | + if ($compress) { |
|
858 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
859 | + } else { |
|
860 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
861 | + } |
|
683 | 862 | $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
684 | 863 | |
685 | 864 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -694,7 +873,9 @@ discard block |
||
694 | 873 | } |
695 | 874 | //$output_dest = substr($output_dest, 0, -1); |
696 | 875 | $output_dest .= ']}},'; |
697 | - if ($havedata) $output .= $output_dest; |
|
876 | + if ($havedata) { |
|
877 | + $output .= $output_dest; |
|
878 | + } |
|
698 | 879 | unset($output_dest); |
699 | 880 | } |
700 | 881 | } |
@@ -702,7 +883,9 @@ discard block |
||
702 | 883 | $output .= ']'; |
703 | 884 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
704 | 885 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
705 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
886 | + if (isset($begindate)) { |
|
887 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
888 | + } |
|
706 | 889 | $output .= '"fc": "'.$j.'"'; |
707 | 890 | } else { |
708 | 891 | $output .= '"features": '; |