@@ -48,27 +48,52 @@ 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_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 65 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 66 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 67 | -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_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
| 80 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 81 | +} |
|
| 82 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
| 83 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 84 | +} |
|
| 85 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
| 86 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 87 | +} |
|
| 88 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
| 89 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 90 | +} |
|
| 68 | 91 | |
| 69 | 92 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 70 | 93 | $min = true; |
| 71 | -} else $min = false; |
|
| 94 | +} else { |
|
| 95 | + $min = false; |
|
| 96 | +} |
|
| 72 | 97 | |
| 73 | 98 | if (isset($_GET['ident'])) { |
| 74 | 99 | $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
@@ -157,20 +182,30 @@ discard block |
||
| 157 | 182 | } else { |
| 158 | 183 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
| 159 | 184 | } |
| 160 | - if ($flightcnt == '') $flightcnt = 0; |
|
| 161 | -} else $flightcnt = 0; |
|
| 185 | + if ($flightcnt == '') { |
|
| 186 | + $flightcnt = 0; |
|
| 187 | + } |
|
| 188 | + } else { |
|
| 189 | + $flightcnt = 0; |
|
| 190 | +} |
|
| 162 | 191 | |
| 163 | 192 | $sqltime = round(microtime(true)-$begintime,2); |
| 164 | 193 | |
| 165 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
| 166 | -else $usenextlatlon = true; |
|
| 194 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
| 195 | + $usenextlatlon = false; |
|
| 196 | +} else { |
|
| 197 | + $usenextlatlon = true; |
|
| 198 | +} |
|
| 167 | 199 | $j = 0; |
| 168 | 200 | $prev_flightaware_id = ''; |
| 169 | 201 | $aircrafts_shadow = array(); |
| 170 | 202 | $output = '{'; |
| 171 | 203 | $output .= '"type": "FeatureCollection",'; |
| 172 | - if ($min) $output .= '"minimal": "true",'; |
|
| 173 | - else $output .= '"minimal": "false",'; |
|
| 204 | + if ($min) { |
|
| 205 | + $output .= '"minimal": "true",'; |
|
| 206 | + } else { |
|
| 207 | + $output .= '"minimal": "false",'; |
|
| 208 | + } |
|
| 174 | 209 | //$output .= '"fc": "'.$flightcnt.'",'; |
| 175 | 210 | $output .= '"sqt": "'.$sqltime.'",'; |
| 176 | 211 | |
@@ -214,18 +249,29 @@ discard block |
||
| 214 | 249 | } |
| 215 | 250 | $output .= '"properties": {'; |
| 216 | 251 | if (isset($spotter_item['flightaware_id'])) { |
| 217 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
| 218 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
| 252 | + if ($compress) { |
|
| 253 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
| 254 | + } else { |
|
| 255 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
| 256 | + } |
|
| 219 | 257 | } elseif (isset($spotter_item['famtrackid'])) { |
| 220 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
| 221 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
| 258 | + if ($compress) { |
|
| 259 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
| 260 | + } else { |
|
| 261 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
| 262 | + } |
|
| 222 | 263 | } elseif (isset($spotter_item['fammarine_id'])) { |
| 223 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
| 224 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
| 264 | + if ($compress) { |
|
| 265 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
| 266 | + } else { |
|
| 267 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
| 268 | + } |
|
| 225 | 269 | } |
| 226 | 270 | $output .= '"fc": "'.$flightcnt.'",'; |
| 227 | 271 | $output .= '"sqt": "'.$sqltime.'",'; |
| 228 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 272 | + if (isset($begindate)) { |
|
| 273 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 274 | + } |
|
| 229 | 275 | |
| 230 | 276 | /* |
| 231 | 277 | if ($min) $output .= '"minimal": "true",'; |
@@ -233,14 +279,22 @@ discard block |
||
| 233 | 279 | */ |
| 234 | 280 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
| 235 | 281 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
| 236 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 237 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 282 | + if ($compress) { |
|
| 283 | + $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 284 | + } else { |
|
| 285 | + $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 286 | + } |
|
| 238 | 287 | //" |
| 239 | 288 | } else { |
| 240 | - if ($compress) $output .= '"c": "NA",'; |
|
| 241 | - else $output .= '"callsign": "NA",'; |
|
| 289 | + if ($compress) { |
|
| 290 | + $output .= '"c": "NA",'; |
|
| 291 | + } else { |
|
| 292 | + $output .= '"callsign": "NA",'; |
|
| 293 | + } |
|
| 294 | + } |
|
| 295 | + if (isset($spotter_item['registration'])) { |
|
| 296 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 242 | 297 | } |
| 243 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 244 | 298 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
| 245 | 299 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
| 246 | 300 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -253,16 +307,23 @@ discard block |
||
| 253 | 307 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
| 254 | 308 | } |
| 255 | 309 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker) { |
| 256 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
| 257 | - else { |
|
| 310 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
| 311 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 312 | + } else { |
|
| 258 | 313 | $aircraft_icao = $spotter_item['aircraft_icao']; |
| 259 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
| 260 | - else { |
|
| 314 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
| 315 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
| 316 | + } else { |
|
| 261 | 317 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
| 262 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 263 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 264 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 265 | - else $spotter_item['aircraft_shadow'] = ''; |
|
| 318 | + if (count($aircraft_info) > 0) { |
|
| 319 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 320 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
| 321 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 322 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
| 323 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 324 | + } else { |
|
| 325 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 326 | + } |
|
| 266 | 327 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
| 267 | 328 | } |
| 268 | 329 | } |
@@ -270,73 +331,139 @@ discard block |
||
| 270 | 331 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
| 271 | 332 | if ($tracker) { |
| 272 | 333 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
| 273 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
| 274 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 334 | + if ($compress) { |
|
| 335 | + $output .= '"as": "ambulance.png",'; |
|
| 336 | + } else { |
|
| 337 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 338 | + } |
|
| 275 | 339 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
| 276 | - if ($compress) $output .= '"as": "police.png",'; |
|
| 277 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
| 340 | + if ($compress) { |
|
| 341 | + $output .= '"as": "police.png",'; |
|
| 342 | + } else { |
|
| 343 | + $output .= '"aircraft_shadow": "police.png",'; |
|
| 344 | + } |
|
| 278 | 345 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
| 279 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 280 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 346 | + if ($compress) { |
|
| 347 | + $output .= '"as": "ship.png",'; |
|
| 348 | + } else { |
|
| 349 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 350 | + } |
|
| 281 | 351 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
| 282 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 283 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 352 | + if ($compress) { |
|
| 353 | + $output .= '"as": "ship.png",'; |
|
| 354 | + } else { |
|
| 355 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 356 | + } |
|
| 284 | 357 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
| 285 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 286 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 358 | + if ($compress) { |
|
| 359 | + $output .= '"as": "ship.png",'; |
|
| 360 | + } else { |
|
| 361 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 362 | + } |
|
| 287 | 363 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
| 288 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 289 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 364 | + if ($compress) { |
|
| 365 | + $output .= '"as": "truck.png",'; |
|
| 366 | + } else { |
|
| 367 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 368 | + } |
|
| 290 | 369 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
| 291 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 292 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 370 | + if ($compress) { |
|
| 371 | + $output .= '"as": "truck.png",'; |
|
| 372 | + } else { |
|
| 373 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 374 | + } |
|
| 293 | 375 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
| 294 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 295 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 376 | + if ($compress) { |
|
| 377 | + $output .= '"as": "aircraft.png",'; |
|
| 378 | + } else { |
|
| 379 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 380 | + } |
|
| 296 | 381 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
| 297 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 298 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 382 | + if ($compress) { |
|
| 383 | + $output .= '"as": "aircraft.png",'; |
|
| 384 | + } else { |
|
| 385 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 386 | + } |
|
| 299 | 387 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
| 300 | - if ($compress) $output .= '"as": "helico.png",'; |
|
| 301 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
| 388 | + if ($compress) { |
|
| 389 | + $output .= '"as": "helico.png",'; |
|
| 390 | + } else { |
|
| 391 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
| 392 | + } |
|
| 302 | 393 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
| 303 | - if ($compress) $output .= '"as": "rail.png",'; |
|
| 304 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
| 394 | + if ($compress) { |
|
| 395 | + $output .= '"as": "rail.png",'; |
|
| 396 | + } else { |
|
| 397 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
| 398 | + } |
|
| 305 | 399 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
| 306 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
| 307 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 400 | + if ($compress) { |
|
| 401 | + $output .= '"as": "firetruck.png",'; |
|
| 402 | + } else { |
|
| 403 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 404 | + } |
|
| 308 | 405 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
| 309 | - if ($compress) $output .= '"as": "bus.png",'; |
|
| 310 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
| 406 | + if ($compress) { |
|
| 407 | + $output .= '"as": "bus.png",'; |
|
| 408 | + } else { |
|
| 409 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
| 410 | + } |
|
| 311 | 411 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
| 312 | - if ($compress) $output .= '"as": "phone.png",'; |
|
| 313 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
| 412 | + if ($compress) { |
|
| 413 | + $output .= '"as": "phone.png",'; |
|
| 414 | + } else { |
|
| 415 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
| 416 | + } |
|
| 314 | 417 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
| 315 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
| 316 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 418 | + if ($compress) { |
|
| 419 | + $output .= '"as": "jogger.png",'; |
|
| 420 | + } else { |
|
| 421 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 422 | + } |
|
| 317 | 423 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
| 318 | - if ($compress) $output .= '"as": "bike.png",'; |
|
| 319 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
| 424 | + if ($compress) { |
|
| 425 | + $output .= '"as": "bike.png",'; |
|
| 426 | + } else { |
|
| 427 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
| 428 | + } |
|
| 320 | 429 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
| 321 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
| 322 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 430 | + if ($compress) { |
|
| 431 | + $output .= '"as": "motorcycle.png",'; |
|
| 432 | + } else { |
|
| 433 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 434 | + } |
|
| 323 | 435 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
| 324 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
| 325 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 436 | + if ($compress) { |
|
| 437 | + $output .= '"as": "balloon.png",'; |
|
| 438 | + } else { |
|
| 439 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 440 | + } |
|
| 326 | 441 | } else { |
| 327 | - if ($compress) $output .= '"as": "car.png",'; |
|
| 328 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
| 442 | + if ($compress) { |
|
| 443 | + $output .= '"as": "car.png",'; |
|
| 444 | + } else { |
|
| 445 | + $output .= '"aircraft_shadow": "car.png",'; |
|
| 446 | + } |
|
| 329 | 447 | } |
| 330 | 448 | } elseif ($marine) { |
| 331 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 332 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 449 | + if ($compress) { |
|
| 450 | + $output .= '"as": "ship.png",'; |
|
| 451 | + } else { |
|
| 452 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 453 | + } |
|
| 333 | 454 | } else { |
| 334 | - if ($compress) $output .= '"as": "default.png",'; |
|
| 335 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
| 455 | + if ($compress) { |
|
| 456 | + $output .= '"as": "default.png",'; |
|
| 457 | + } else { |
|
| 458 | + $output .= '"aircraft_shadow": "default.png",'; |
|
| 459 | + } |
|
| 336 | 460 | } |
| 337 | 461 | } else { |
| 338 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 339 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 462 | + if ($compress) { |
|
| 463 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 464 | + } else { |
|
| 465 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 466 | + } |
|
| 340 | 467 | } |
| 341 | 468 | if (isset($spotter_item['airline_name'])) { |
| 342 | 469 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -344,8 +471,11 @@ discard block |
||
| 344 | 471 | $output .= '"airline_name": "NA",'; |
| 345 | 472 | } |
| 346 | 473 | if (isset($spotter_item['departure_airport'])) { |
| 347 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 348 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 474 | + if ($compress) { |
|
| 475 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 476 | + } else { |
|
| 477 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 478 | + } |
|
| 349 | 479 | } |
| 350 | 480 | if (isset($spotter_item['departure_airport_city'])) { |
| 351 | 481 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -357,8 +487,11 @@ discard block |
||
| 357 | 487 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
| 358 | 488 | } |
| 359 | 489 | if (isset($spotter_item['arrival_airport'])) { |
| 360 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 361 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 490 | + if ($compress) { |
|
| 491 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 492 | + } else { |
|
| 493 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 494 | + } |
|
| 362 | 495 | } |
| 363 | 496 | if (isset($spotter_item['arrival_airport_city'])) { |
| 364 | 497 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -377,11 +510,17 @@ discard block |
||
| 377 | 510 | } |
| 378 | 511 | |
| 379 | 512 | if (isset($spotter_item['altitude'])) { |
| 380 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 381 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 513 | + if ($compress) { |
|
| 514 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 515 | + } else { |
|
| 516 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 517 | + } |
|
| 518 | + } |
|
| 519 | + if ($compress) { |
|
| 520 | + $output .= '"h": "'.$spotter_item['heading'].'",'; |
|
| 521 | + } else { |
|
| 522 | + $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
| 382 | 523 | } |
| 383 | - if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
|
| 384 | - else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
| 385 | 524 | |
| 386 | 525 | if (isset($archivespeed)) { |
| 387 | 526 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
@@ -391,7 +530,9 @@ discard block |
||
| 391 | 530 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 392 | 531 | } |
| 393 | 532 | |
| 394 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
| 533 | + if (!$min) { |
|
| 534 | + $output .= '"image": "'.$image.'",'; |
|
| 535 | + } |
|
| 395 | 536 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
| 396 | 537 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
| 397 | 538 | } |
@@ -399,8 +540,11 @@ discard block |
||
| 399 | 540 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
| 400 | 541 | } |
| 401 | 542 | if (isset($spotter_item['squawk'])) { |
| 402 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 403 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 543 | + if ($compress) { |
|
| 544 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 545 | + } else { |
|
| 546 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 547 | + } |
|
| 404 | 548 | } |
| 405 | 549 | if (isset($spotter_item['squawk_usage'])) { |
| 406 | 550 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -419,14 +563,23 @@ discard block |
||
| 419 | 563 | } |
| 420 | 564 | // type when not aircraft ? |
| 421 | 565 | if (isset($spotter_item['type'])) { |
| 422 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
| 423 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
| 566 | + if ($compress) { |
|
| 567 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
| 568 | + } else { |
|
| 569 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
| 570 | + } |
|
| 424 | 571 | } elseif ($marine) { |
| 425 | - if ($compress) $output .= '"t": "ship"'; |
|
| 426 | - else $output .= '"type": "ship"'; |
|
| 572 | + if ($compress) { |
|
| 573 | + $output .= '"t": "ship"'; |
|
| 574 | + } else { |
|
| 575 | + $output .= '"type": "ship"'; |
|
| 576 | + } |
|
| 427 | 577 | } else { |
| 428 | - if ($compress) $output .= '"t": "aircraft"'; |
|
| 429 | - else $output .= '"type": "aircraft"'; |
|
| 578 | + if ($compress) { |
|
| 579 | + $output .= '"t": "aircraft"'; |
|
| 580 | + } else { |
|
| 581 | + $output .= '"type": "aircraft"'; |
|
| 582 | + } |
|
| 430 | 583 | } |
| 431 | 584 | $output .= '},'; |
| 432 | 585 | $output .= '"geometry": {'; |
@@ -494,7 +647,9 @@ discard block |
||
| 494 | 647 | } |
| 495 | 648 | */ |
| 496 | 649 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
| 497 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
| 650 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
| 651 | + $history = $_COOKIE['history']; |
|
| 652 | + } |
|
| 498 | 653 | |
| 499 | 654 | if ( |
| 500 | 655 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -538,8 +693,11 @@ discard block |
||
| 538 | 693 | $output_history .= ']}},'; |
| 539 | 694 | $output .= $output_history; |
| 540 | 695 | } |
| 541 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 542 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 696 | + if ($compress) { |
|
| 697 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 698 | + } else { |
|
| 699 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 700 | + } |
|
| 543 | 701 | } |
| 544 | 702 | $output_history .= '['; |
| 545 | 703 | $output_history .= $spotter_history['longitude'].', '; |
@@ -558,9 +716,14 @@ discard block |
||
| 558 | 716 | $prev_alt = $alt; |
| 559 | 717 | } else { |
| 560 | 718 | if ($d == false) { |
| 561 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 562 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 563 | - } else $d = true; |
|
| 719 | + if ($compress) { |
|
| 720 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 721 | + } else { |
|
| 722 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 723 | + } |
|
| 724 | + } else { |
|
| 725 | + $d = true; |
|
| 726 | + } |
|
| 564 | 727 | $output_history .= '['; |
| 565 | 728 | $output_history .= $spotter_history['longitude'].', '; |
| 566 | 729 | $output_history .= $spotter_history['latitude']; |
@@ -581,7 +744,9 @@ discard block |
||
| 581 | 744 | $output_historyd = '['; |
| 582 | 745 | $output_historyd .= $spotter_item['longitude'].', '; |
| 583 | 746 | $output_historyd .= $spotter_item['latitude']; |
| 584 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 747 | + if (isset($spotter_history['altitude'])) { |
|
| 748 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 749 | + } |
|
| 585 | 750 | $output_historyd .= '],'; |
| 586 | 751 | //$output_history = $output_historyd.$output_history; |
| 587 | 752 | $output_history = $output_history.$output_historyd; |
@@ -603,8 +768,11 @@ discard block |
||
| 603 | 768 | && $spotter_item['arrival_airport'] != 'NA' |
| 604 | 769 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
| 605 | 770 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
| 606 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 607 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 771 | + if ($compress) { |
|
| 772 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 773 | + } else { |
|
| 774 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 775 | + } |
|
| 608 | 776 | if (isset($spotter_item['departure_airport_latitude'])) { |
| 609 | 777 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
| 610 | 778 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -637,8 +805,11 @@ discard block |
||
| 637 | 805 | || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) |
| 638 | 806 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
| 639 | 807 | $havedata = false; |
| 640 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 641 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 808 | + if ($compress) { |
|
| 809 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 810 | + } else { |
|
| 811 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 812 | + } |
|
| 642 | 813 | $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
| 643 | 814 | |
| 644 | 815 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -653,7 +824,9 @@ discard block |
||
| 653 | 824 | } |
| 654 | 825 | //$output_dest = substr($output_dest, 0, -1); |
| 655 | 826 | $output_dest .= ']}},'; |
| 656 | - if ($havedata) $output .= $output_dest; |
|
| 827 | + if ($havedata) { |
|
| 828 | + $output .= $output_dest; |
|
| 829 | + } |
|
| 657 | 830 | unset($output_dest); |
| 658 | 831 | } |
| 659 | 832 | } |
@@ -661,7 +834,9 @@ discard block |
||
| 661 | 834 | $output .= ']'; |
| 662 | 835 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 663 | 836 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
| 664 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 837 | + if (isset($begindate)) { |
|
| 838 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 839 | + } |
|
| 665 | 840 | $output .= '"fc": "'.$j.'"'; |
| 666 | 841 | } else { |
| 667 | 842 | $output .= '"features": '; |