@@ -40,22 +40,43 @@ discard block |
||
40 | 40 | } |
41 | 41 | header('Content-Type: text/javascript'); |
42 | 42 | |
43 | -if (!isset($globalJsonCompress)) $compress = true; |
|
44 | -else $compress = $globalJsonCompress; |
|
43 | +if (!isset($globalJsonCompress)) { |
|
44 | + $compress = true; |
|
45 | +} else { |
|
46 | + $compress = $globalJsonCompress; |
|
47 | +} |
|
45 | 48 | |
46 | 49 | $from_archive = false; |
47 | 50 | $min = false; |
48 | 51 | $allhistory = false; |
49 | 52 | $filter['source'] = array(); |
50 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
51 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
52 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
53 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
54 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
55 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
56 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
57 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
58 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
53 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
54 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
55 | +} |
|
56 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
57 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
58 | +} |
|
59 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
60 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
61 | +} |
|
62 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
63 | + $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
64 | +} |
|
65 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
66 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
67 | +} |
|
68 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
69 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
70 | +} |
|
71 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
72 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
73 | +} |
|
74 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
75 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
76 | +} |
|
77 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
78 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
79 | +} |
|
59 | 80 | /* |
60 | 81 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
61 | 82 | $min = true; |
@@ -132,8 +153,12 @@ discard block |
||
132 | 153 | } else { |
133 | 154 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
134 | 155 | } |
135 | - if ($flightcnt == '') $flightcnt = 0; |
|
136 | -} else $flightcnt = 0; |
|
156 | + if ($flightcnt == '') { |
|
157 | + $flightcnt = 0; |
|
158 | + } |
|
159 | + } else { |
|
160 | + $flightcnt = 0; |
|
161 | +} |
|
137 | 162 | |
138 | 163 | $sqltime = round(microtime(true)-$begintime,2); |
139 | 164 | $minitime = time(); |
@@ -155,7 +180,9 @@ discard block |
||
155 | 180 | $j = 0; |
156 | 181 | $prev_flightaware_id = ''; |
157 | 182 | $speed = 1; |
158 | -if (isset($archivespeed)) $speed = $archivespeed; |
|
183 | +if (isset($archivespeed)) { |
|
184 | + $speed = $archivespeed; |
|
185 | +} |
|
159 | 186 | $output = '['; |
160 | 187 | $output .= '{"id" : "document", "name" : "fam","version" : "1.0"'; |
161 | 188 | // $output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "LOOP_STOP","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
@@ -223,8 +250,11 @@ discard block |
||
223 | 250 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
224 | 251 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
225 | 252 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
226 | - } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $aircraft_shadow = 'PA18.png'; |
|
227 | - else $aircraft_shadow = ''; |
|
253 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
254 | + $aircraft_shadow = 'PA18.png'; |
|
255 | + } else { |
|
256 | + $aircraft_shadow = ''; |
|
257 | + } |
|
228 | 258 | if ($aircraft_shadow != '') { |
229 | 259 | if (isset($modelsdb[$aircraft_shadow])) { |
230 | 260 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20 },'; |
@@ -313,20 +343,26 @@ discard block |
||
313 | 343 | } else { |
314 | 344 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },'; |
315 | 345 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
316 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
346 | + if ($spotter_item['aircraft_icao'] != '') { |
|
347 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
348 | + } |
|
317 | 349 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
318 | 350 | } |
319 | 351 | } else { |
320 | 352 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },'; |
321 | 353 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
322 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
354 | + if ($spotter_item['aircraft_icao'] != '') { |
|
355 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
356 | + } |
|
323 | 357 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
324 | 358 | } |
325 | 359 | |
326 | 360 | } else { |
327 | 361 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },'; |
328 | 362 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
329 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
363 | + if ($spotter_item['aircraft_icao'] != '') { |
|
364 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
365 | + } |
|
330 | 366 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
331 | 367 | } |
332 | 368 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
@@ -338,8 +374,12 @@ discard block |
||
338 | 374 | // $output .= '"interpolationDegree" : 5,'; |
339 | 375 | // $output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; |
340 | 376 | $output .= '"cartographicDegrees": ['; |
341 | - if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
|
342 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
377 | + if ($minitime > strtotime($spotter_item['date'])) { |
|
378 | + $minitime = strtotime($spotter_item['date']); |
|
379 | + } |
|
380 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
381 | + $maxitime = strtotime($spotter_item['date']); |
|
382 | + } |
|
343 | 383 | $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
344 | 384 | $output .= $spotter_item['longitude'].', '; |
345 | 385 | $output .= $spotter_item['latitude'].', '; |
@@ -353,7 +393,9 @@ discard block |
||
353 | 393 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
354 | 394 | } else { |
355 | 395 | $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
356 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
396 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
397 | + $maxitime = strtotime($spotter_item['date']); |
|
398 | + } |
|
357 | 399 | if ($spotter_item['ground_speed'] == 0) { |
358 | 400 | $output .= $prevlong.', '; |
359 | 401 | $output .= $prevlat.', '; |
@@ -18,26 +18,49 @@ discard block |
||
18 | 18 | } |
19 | 19 | header('Content-Type: text/javascript'); |
20 | 20 | |
21 | -if (!isset($globalJsonCompress)) $compress = true; |
|
22 | -else $compress = $globalJsonCompress; |
|
21 | +if (!isset($globalJsonCompress)) { |
|
22 | + $compress = true; |
|
23 | +} else { |
|
24 | + $compress = $globalJsonCompress; |
|
25 | +} |
|
23 | 26 | |
24 | 27 | $from_archive = false; |
25 | 28 | $min = true; |
26 | 29 | $allhistory = false; |
27 | 30 | $filter['source'] = array(); |
28 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
29 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
30 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
31 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
32 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
33 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
34 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
35 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
36 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
31 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
32 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
33 | +} |
|
34 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
35 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
36 | +} |
|
37 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
38 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
39 | +} |
|
40 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
41 | + $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
42 | +} |
|
43 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
44 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
45 | +} |
|
46 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
47 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
48 | +} |
|
49 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
50 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
51 | +} |
|
52 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
53 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
54 | +} |
|
55 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
56 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
57 | +} |
|
37 | 58 | |
38 | 59 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
39 | 60 | $min = true; |
40 | -} else $min = false; |
|
61 | +} else { |
|
62 | + $min = false; |
|
63 | +} |
|
41 | 64 | |
42 | 65 | if (isset($_GET['ident'])) { |
43 | 66 | $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
@@ -87,20 +110,30 @@ discard block |
||
87 | 110 | } |
88 | 111 | */ |
89 | 112 | $flightcnt = count($spotter_array); |
90 | - if ($flightcnt == '') $flightcnt = 0; |
|
91 | -} else $flightcnt = 0; |
|
113 | + if ($flightcnt == '') { |
|
114 | + $flightcnt = 0; |
|
115 | + } |
|
116 | + } else { |
|
117 | + $flightcnt = 0; |
|
118 | +} |
|
92 | 119 | |
93 | 120 | $sqltime = round(microtime(true)-$begintime,2); |
94 | 121 | |
95 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
96 | -else $usenextlatlon = true; |
|
122 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
123 | + $usenextlatlon = false; |
|
124 | +} else { |
|
125 | + $usenextlatlon = true; |
|
126 | +} |
|
97 | 127 | $j = 0; |
98 | 128 | $prev_flightaware_id = ''; |
99 | 129 | $aircrafts_shadow = array(); |
100 | 130 | $output = '{'; |
101 | 131 | $output .= '"type": "FeatureCollection",'; |
102 | - if ($min) $output .= '"minimal": "true",'; |
|
103 | - else $output .= '"minimal": "false",'; |
|
132 | + if ($min) { |
|
133 | + $output .= '"minimal": "true",'; |
|
134 | + } else { |
|
135 | + $output .= '"minimal": "false",'; |
|
136 | + } |
|
104 | 137 | $output .= '"fc": "'.$flightcnt.'",'; |
105 | 138 | $output .= '"sqt": "'.$sqltime.'",'; |
106 | 139 | |
@@ -137,11 +170,16 @@ discard block |
||
137 | 170 | //$output .= '"sqt": "'.$sqltime.'",'; |
138 | 171 | $output .= '"id": "'.$spotter_item['flightaware_id'].'",'; |
139 | 172 | $output .= '"properties": {'; |
140 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
141 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
173 | + if ($compress) { |
|
174 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
175 | + } else { |
|
176 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
177 | + } |
|
142 | 178 | $output .= '"fc": "'.$flightcnt.'",'; |
143 | 179 | $output .= '"sqt": "'.$sqltime.'",'; |
144 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
180 | + if (isset($begindate)) { |
|
181 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
182 | + } |
|
145 | 183 | |
146 | 184 | /* |
147 | 185 | if ($min) $output .= '"minimal": "true",'; |
@@ -149,13 +187,21 @@ discard block |
||
149 | 187 | */ |
150 | 188 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
151 | 189 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
152 | - if ($compress) $output .= '"c": "'.$spotter_item['ident'].'",'; |
|
153 | - else $output .= '"callsign": "'.$spotter_item['ident'].'",'; |
|
190 | + if ($compress) { |
|
191 | + $output .= '"c": "'.$spotter_item['ident'].'",'; |
|
192 | + } else { |
|
193 | + $output .= '"callsign": "'.$spotter_item['ident'].'",'; |
|
194 | + } |
|
154 | 195 | } else { |
155 | - if ($compress) $output .= '"c": "NA",'; |
|
156 | - else $output .= '"callsign": "NA",'; |
|
196 | + if ($compress) { |
|
197 | + $output .= '"c": "NA",'; |
|
198 | + } else { |
|
199 | + $output .= '"callsign": "NA",'; |
|
200 | + } |
|
201 | + } |
|
202 | + if (isset($spotter_item['registration'])) { |
|
203 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
157 | 204 | } |
158 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
159 | 205 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
160 | 206 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
161 | 207 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -168,25 +214,37 @@ discard block |
||
168 | 214 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
169 | 215 | } |
170 | 216 | if (!isset($spotter_item['aircraft_shadow'])) { |
171 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
172 | - else { |
|
217 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
218 | + $spotter_item['aircraft_shadow'] = ''; |
|
219 | + } else { |
|
173 | 220 | $aircraft_icao = $spotter_item['aircraft_icao']; |
174 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
175 | - else { |
|
221 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
222 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
223 | + } else { |
|
176 | 224 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
177 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
178 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
179 | - else $spotter_item['aircraft_shadow'] = ''; |
|
225 | + if (count($aircraft_info) > 0) { |
|
226 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
227 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
228 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
229 | + } else { |
|
230 | + $spotter_item['aircraft_shadow'] = ''; |
|
231 | + } |
|
180 | 232 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
181 | 233 | } |
182 | 234 | } |
183 | 235 | } |
184 | 236 | if ($spotter_item['aircraft_shadow'] == '') { |
185 | - if ($compress) $output .= '"as": "default.png",'; |
|
186 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
237 | + if ($compress) { |
|
238 | + $output .= '"as": "default.png",'; |
|
239 | + } else { |
|
240 | + $output .= '"aircraft_shadow": "default.png",'; |
|
241 | + } |
|
187 | 242 | } else { |
188 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
189 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
243 | + if ($compress) { |
|
244 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
245 | + } else { |
|
246 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
247 | + } |
|
190 | 248 | } |
191 | 249 | if (isset($spotter_item['airline_name'])) { |
192 | 250 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -194,8 +252,11 @@ discard block |
||
194 | 252 | $output .= '"airline_name": "NA",'; |
195 | 253 | } |
196 | 254 | if (isset($spotter_item['departure_airport'])) { |
197 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
198 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
255 | + if ($compress) { |
|
256 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
257 | + } else { |
|
258 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
259 | + } |
|
199 | 260 | } |
200 | 261 | if (isset($spotter_item['departure_airport_city'])) { |
201 | 262 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -207,8 +268,11 @@ discard block |
||
207 | 268 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
208 | 269 | } |
209 | 270 | if (isset($spotter_item['arrival_airport'])) { |
210 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
211 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
271 | + if ($compress) { |
|
272 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
273 | + } else { |
|
274 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
275 | + } |
|
212 | 276 | } |
213 | 277 | if (isset($spotter_item['arrival_airport_city'])) { |
214 | 278 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -226,10 +290,16 @@ discard block |
||
226 | 290 | $output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",'; |
227 | 291 | } |
228 | 292 | |
229 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
230 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
231 | - if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
|
232 | - else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
293 | + if ($compress) { |
|
294 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
295 | + } else { |
|
296 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
297 | + } |
|
298 | + if ($compress) { |
|
299 | + $output .= '"h": "'.$spotter_item['heading'].'",'; |
|
300 | + } else { |
|
301 | + $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
302 | + } |
|
233 | 303 | |
234 | 304 | if (isset($archivespeed)) { |
235 | 305 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
@@ -239,7 +309,9 @@ discard block |
||
239 | 309 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
240 | 310 | } |
241 | 311 | |
242 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
312 | + if (!$min) { |
|
313 | + $output .= '"image": "'.$image.'",'; |
|
314 | + } |
|
243 | 315 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
244 | 316 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
245 | 317 | } |
@@ -247,8 +319,11 @@ discard block |
||
247 | 319 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
248 | 320 | } |
249 | 321 | if (isset($spotter_item['squawk'])) { |
250 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
251 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
322 | + if ($compress) { |
|
323 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
324 | + } else { |
|
325 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
326 | + } |
|
252 | 327 | } |
253 | 328 | if (isset($spotter_item['squawk_usage'])) { |
254 | 329 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -266,8 +341,11 @@ discard block |
||
266 | 341 | $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
267 | 342 | } |
268 | 343 | // type when not aircraft ? |
269 | - if ($compress) $output .= '"t": "aircraft"'; |
|
270 | - else $output .= '"type": "aircraft"'; |
|
344 | + if ($compress) { |
|
345 | + $output .= '"t": "aircraft"'; |
|
346 | + } else { |
|
347 | + $output .= '"type": "aircraft"'; |
|
348 | + } |
|
271 | 349 | $output .= '},'; |
272 | 350 | $output .= '"geometry": {'; |
273 | 351 | $output .= '"type": "Point",'; |
@@ -334,7 +412,9 @@ discard block |
||
334 | 412 | } |
335 | 413 | */ |
336 | 414 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
337 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
415 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
416 | + $history = $_COOKIE['history']; |
|
417 | + } |
|
338 | 418 | |
339 | 419 | if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
340 | 420 | || (!isset($_COOKIE['flightpath']) |
@@ -356,8 +436,11 @@ discard block |
||
356 | 436 | $output_history .= ']}},'; |
357 | 437 | $output .= $output_history; |
358 | 438 | } |
359 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
360 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
439 | + if ($compress) { |
|
440 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
441 | + } else { |
|
442 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
443 | + } |
|
361 | 444 | } |
362 | 445 | $output_history .= '['; |
363 | 446 | $output_history .= $spotter_history['longitude'].', '; |
@@ -403,7 +486,9 @@ discard block |
||
403 | 486 | $output .= ']'; |
404 | 487 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
405 | 488 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
406 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
489 | + if (isset($begindate)) { |
|
490 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
491 | + } |
|
407 | 492 | $output .= '"fc": "'.$j.'"'; |
408 | 493 | } else { |
409 | 494 | $output .= '"features": '; |