@@ -12,7 +12,9 @@ discard block |
||
| 12 | 12 | $tracker = false; |
| 13 | 13 | $marine = false; |
| 14 | 14 | $usecoord = false; |
| 15 | -if (isset($_GET['test'])) exit(); |
|
| 15 | +if (isset($_GET['test'])) { |
|
| 16 | + exit(); |
|
| 17 | +} |
|
| 16 | 18 | if (isset($_GET['tracker'])) { |
| 17 | 19 | $tracker = true; |
| 18 | 20 | } |
@@ -57,28 +59,55 @@ discard block |
||
| 57 | 59 | } |
| 58 | 60 | header('Content-Type: text/javascript'); |
| 59 | 61 | |
| 60 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 61 | -else $compress = $globalJsonCompress; |
|
| 62 | +if (!isset($globalJsonCompress)) { |
|
| 63 | + $compress = true; |
|
| 64 | +} else { |
|
| 65 | + $compress = $globalJsonCompress; |
|
| 66 | +} |
|
| 62 | 67 | |
| 63 | 68 | $from_archive = false; |
| 64 | 69 | $min = true; |
| 65 | 70 | $allhistory = false; |
| 66 | 71 | $filter['source'] = array(); |
| 67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 69 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 71 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 72 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 73 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 74 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 75 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 76 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 77 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 72 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
| 73 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 74 | +} |
|
| 75 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
| 76 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 77 | +} |
|
| 78 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
| 79 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 80 | +} |
|
| 81 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
| 82 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 83 | +} |
|
| 84 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
| 85 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 86 | +} |
|
| 87 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
| 88 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 89 | +} |
|
| 90 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
| 91 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 92 | +} |
|
| 93 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
| 94 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 95 | +} |
|
| 96 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
| 97 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 98 | +} |
|
| 99 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
| 100 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 101 | +} |
|
| 102 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
| 103 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 104 | +} |
|
| 78 | 105 | |
| 79 | 106 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 80 | 107 | $min = true; |
| 81 | -} else $min = false; |
|
| 108 | +} else { |
|
| 109 | + $min = false; |
|
| 110 | +} |
|
| 82 | 111 | |
| 83 | 112 | $spotter_array = array(); |
| 84 | 113 | |
@@ -189,24 +218,38 @@ discard block |
||
| 189 | 218 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
| 190 | 219 | } |
| 191 | 220 | } |
| 192 | - if ($flightcnt == '') $flightcnt = 0; |
|
| 193 | -} else $flightcnt = 0; |
|
| 221 | + if ($flightcnt == '') { |
|
| 222 | + $flightcnt = 0; |
|
| 223 | + } |
|
| 224 | + } else { |
|
| 225 | + $flightcnt = 0; |
|
| 226 | +} |
|
| 194 | 227 | |
| 195 | 228 | $sqltime = round(microtime(true)-$begintime,2); |
| 196 | 229 | |
| 197 | 230 | $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
| 198 | -if ($currenttime != '') $currenttime = round($currenttime/1000); |
|
| 231 | +if ($currenttime != '') { |
|
| 232 | + $currenttime = round($currenttime/1000); |
|
| 233 | +} |
|
| 199 | 234 | |
| 200 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
| 201 | -else $usenextlatlon = true; |
|
| 202 | -if ($usenextlatlon === false) $currenttime = ''; |
|
| 235 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
| 236 | + $usenextlatlon = false; |
|
| 237 | +} else { |
|
| 238 | + $usenextlatlon = true; |
|
| 239 | +} |
|
| 240 | +if ($usenextlatlon === false) { |
|
| 241 | + $currenttime = ''; |
|
| 242 | +} |
|
| 203 | 243 | $j = 0; |
| 204 | 244 | $prev_flightaware_id = ''; |
| 205 | 245 | $aircrafts_shadow = array(); |
| 206 | 246 | $output = '{'; |
| 207 | 247 | $output .= '"type": "FeatureCollection",'; |
| 208 | - if ($min) $output .= '"minimal": "true",'; |
|
| 209 | - else $output .= '"minimal": "false",'; |
|
| 248 | + if ($min) { |
|
| 249 | + $output .= '"minimal": "true",'; |
|
| 250 | + } else { |
|
| 251 | + $output .= '"minimal": "false",'; |
|
| 252 | + } |
|
| 210 | 253 | //$output .= '"fc": "'.$flightcnt.'",'; |
| 211 | 254 | $output .= '"sqt": "'.$sqltime.'",'; |
| 212 | 255 | |
@@ -251,18 +294,29 @@ discard block |
||
| 251 | 294 | } |
| 252 | 295 | $output .= '"properties": {'; |
| 253 | 296 | if (isset($spotter_item['flightaware_id'])) { |
| 254 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
| 255 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
| 297 | + if ($compress) { |
|
| 298 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
| 299 | + } else { |
|
| 300 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
| 301 | + } |
|
| 256 | 302 | } elseif (isset($spotter_item['famtrackid'])) { |
| 257 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
| 258 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
| 303 | + if ($compress) { |
|
| 304 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
| 305 | + } else { |
|
| 306 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
| 307 | + } |
|
| 259 | 308 | } elseif (isset($spotter_item['fammarine_id'])) { |
| 260 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
| 261 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
| 309 | + if ($compress) { |
|
| 310 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
| 311 | + } else { |
|
| 312 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
| 313 | + } |
|
| 262 | 314 | } |
| 263 | 315 | $output .= '"fc": "'.$flightcnt.'",'; |
| 264 | 316 | $output .= '"sqt": "'.$sqltime.'",'; |
| 265 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 317 | + if (isset($begindate)) { |
|
| 318 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 319 | + } |
|
| 266 | 320 | |
| 267 | 321 | /* |
| 268 | 322 | if ($min) $output .= '"minimal": "true",'; |
@@ -270,14 +324,22 @@ discard block |
||
| 270 | 324 | */ |
| 271 | 325 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
| 272 | 326 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
| 273 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 274 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 327 | + if ($compress) { |
|
| 328 | + $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 329 | + } else { |
|
| 330 | + $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 331 | + } |
|
| 275 | 332 | //" |
| 276 | 333 | } else { |
| 277 | - if ($compress) $output .= '"c": "NA",'; |
|
| 278 | - else $output .= '"callsign": "NA",'; |
|
| 334 | + if ($compress) { |
|
| 335 | + $output .= '"c": "NA",'; |
|
| 336 | + } else { |
|
| 337 | + $output .= '"callsign": "NA",'; |
|
| 338 | + } |
|
| 339 | + } |
|
| 340 | + if (isset($spotter_item['registration'])) { |
|
| 341 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 279 | 342 | } |
| 280 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 281 | 343 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
| 282 | 344 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
| 283 | 345 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -290,16 +352,23 @@ discard block |
||
| 290 | 352 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
| 291 | 353 | } |
| 292 | 354 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) { |
| 293 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
| 294 | - else { |
|
| 355 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
| 356 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 357 | + } else { |
|
| 295 | 358 | $aircraft_icao = $spotter_item['aircraft_icao']; |
| 296 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
| 297 | - else { |
|
| 359 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
| 360 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
| 361 | + } else { |
|
| 298 | 362 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
| 299 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 300 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 301 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 302 | - else $spotter_item['aircraft_shadow'] = ''; |
|
| 363 | + if (count($aircraft_info) > 0) { |
|
| 364 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 365 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
| 366 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 367 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
| 368 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 369 | + } else { |
|
| 370 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 371 | + } |
|
| 303 | 372 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
| 304 | 373 | } |
| 305 | 374 | } |
@@ -307,73 +376,139 @@ discard block |
||
| 307 | 376 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
| 308 | 377 | if ($tracker) { |
| 309 | 378 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
| 310 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
| 311 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 379 | + if ($compress) { |
|
| 380 | + $output .= '"as": "ambulance.png",'; |
|
| 381 | + } else { |
|
| 382 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 383 | + } |
|
| 312 | 384 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
| 313 | - if ($compress) $output .= '"as": "police.png",'; |
|
| 314 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
| 385 | + if ($compress) { |
|
| 386 | + $output .= '"as": "police.png",'; |
|
| 387 | + } else { |
|
| 388 | + $output .= '"aircraft_shadow": "police.png",'; |
|
| 389 | + } |
|
| 315 | 390 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
| 316 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 317 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 391 | + if ($compress) { |
|
| 392 | + $output .= '"as": "ship.png",'; |
|
| 393 | + } else { |
|
| 394 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 395 | + } |
|
| 318 | 396 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
| 319 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 320 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 397 | + if ($compress) { |
|
| 398 | + $output .= '"as": "ship.png",'; |
|
| 399 | + } else { |
|
| 400 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 401 | + } |
|
| 321 | 402 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
| 322 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 323 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 403 | + if ($compress) { |
|
| 404 | + $output .= '"as": "ship.png",'; |
|
| 405 | + } else { |
|
| 406 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 407 | + } |
|
| 324 | 408 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
| 325 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 326 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 409 | + if ($compress) { |
|
| 410 | + $output .= '"as": "truck.png",'; |
|
| 411 | + } else { |
|
| 412 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 413 | + } |
|
| 327 | 414 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
| 328 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 329 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 415 | + if ($compress) { |
|
| 416 | + $output .= '"as": "truck.png",'; |
|
| 417 | + } else { |
|
| 418 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 419 | + } |
|
| 330 | 420 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
| 331 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 332 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 421 | + if ($compress) { |
|
| 422 | + $output .= '"as": "aircraft.png",'; |
|
| 423 | + } else { |
|
| 424 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 425 | + } |
|
| 333 | 426 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
| 334 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 335 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 427 | + if ($compress) { |
|
| 428 | + $output .= '"as": "aircraft.png",'; |
|
| 429 | + } else { |
|
| 430 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 431 | + } |
|
| 336 | 432 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
| 337 | - if ($compress) $output .= '"as": "helico.png",'; |
|
| 338 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
| 433 | + if ($compress) { |
|
| 434 | + $output .= '"as": "helico.png",'; |
|
| 435 | + } else { |
|
| 436 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
| 437 | + } |
|
| 339 | 438 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
| 340 | - if ($compress) $output .= '"as": "rail.png",'; |
|
| 341 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
| 439 | + if ($compress) { |
|
| 440 | + $output .= '"as": "rail.png",'; |
|
| 441 | + } else { |
|
| 442 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
| 443 | + } |
|
| 342 | 444 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
| 343 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
| 344 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 445 | + if ($compress) { |
|
| 446 | + $output .= '"as": "firetruck.png",'; |
|
| 447 | + } else { |
|
| 448 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 449 | + } |
|
| 345 | 450 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
| 346 | - if ($compress) $output .= '"as": "bus.png",'; |
|
| 347 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
| 451 | + if ($compress) { |
|
| 452 | + $output .= '"as": "bus.png",'; |
|
| 453 | + } else { |
|
| 454 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
| 455 | + } |
|
| 348 | 456 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
| 349 | - if ($compress) $output .= '"as": "phone.png",'; |
|
| 350 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
| 457 | + if ($compress) { |
|
| 458 | + $output .= '"as": "phone.png",'; |
|
| 459 | + } else { |
|
| 460 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
| 461 | + } |
|
| 351 | 462 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
| 352 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
| 353 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 463 | + if ($compress) { |
|
| 464 | + $output .= '"as": "jogger.png",'; |
|
| 465 | + } else { |
|
| 466 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 467 | + } |
|
| 354 | 468 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
| 355 | - if ($compress) $output .= '"as": "bike.png",'; |
|
| 356 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
| 469 | + if ($compress) { |
|
| 470 | + $output .= '"as": "bike.png",'; |
|
| 471 | + } else { |
|
| 472 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
| 473 | + } |
|
| 357 | 474 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
| 358 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
| 359 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 475 | + if ($compress) { |
|
| 476 | + $output .= '"as": "motorcycle.png",'; |
|
| 477 | + } else { |
|
| 478 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 479 | + } |
|
| 360 | 480 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
| 361 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
| 362 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 481 | + if ($compress) { |
|
| 482 | + $output .= '"as": "balloon.png",'; |
|
| 483 | + } else { |
|
| 484 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 485 | + } |
|
| 363 | 486 | } else { |
| 364 | - if ($compress) $output .= '"as": "car.png",'; |
|
| 365 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
| 487 | + if ($compress) { |
|
| 488 | + $output .= '"as": "car.png",'; |
|
| 489 | + } else { |
|
| 490 | + $output .= '"aircraft_shadow": "car.png",'; |
|
| 491 | + } |
|
| 366 | 492 | } |
| 367 | 493 | } elseif ($marine) { |
| 368 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 369 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 494 | + if ($compress) { |
|
| 495 | + $output .= '"as": "ship.png",'; |
|
| 496 | + } else { |
|
| 497 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 498 | + } |
|
| 370 | 499 | } else { |
| 371 | - if ($compress) $output .= '"as": "default.png",'; |
|
| 372 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
| 500 | + if ($compress) { |
|
| 501 | + $output .= '"as": "default.png",'; |
|
| 502 | + } else { |
|
| 503 | + $output .= '"aircraft_shadow": "default.png",'; |
|
| 504 | + } |
|
| 373 | 505 | } |
| 374 | 506 | } else { |
| 375 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 376 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 507 | + if ($compress) { |
|
| 508 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 509 | + } else { |
|
| 510 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 511 | + } |
|
| 377 | 512 | } |
| 378 | 513 | if (isset($spotter_item['airline_name'])) { |
| 379 | 514 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -381,8 +516,11 @@ discard block |
||
| 381 | 516 | $output .= '"airline_name": "NA",'; |
| 382 | 517 | } |
| 383 | 518 | if (isset($spotter_item['departure_airport'])) { |
| 384 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 385 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 519 | + if ($compress) { |
|
| 520 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 521 | + } else { |
|
| 522 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 523 | + } |
|
| 386 | 524 | } |
| 387 | 525 | if (isset($spotter_item['departure_airport_city'])) { |
| 388 | 526 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -394,8 +532,11 @@ discard block |
||
| 394 | 532 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
| 395 | 533 | } |
| 396 | 534 | if (isset($spotter_item['arrival_airport'])) { |
| 397 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 398 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 535 | + if ($compress) { |
|
| 536 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 537 | + } else { |
|
| 538 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 539 | + } |
|
| 399 | 540 | } |
| 400 | 541 | if (isset($spotter_item['arrival_airport_city'])) { |
| 401 | 542 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -414,8 +555,11 @@ discard block |
||
| 414 | 555 | } |
| 415 | 556 | |
| 416 | 557 | if (isset($spotter_item['altitude'])) { |
| 417 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 418 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 558 | + if ($compress) { |
|
| 559 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 560 | + } else { |
|
| 561 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 562 | + } |
|
| 419 | 563 | } |
| 420 | 564 | |
| 421 | 565 | $heading = $spotter_item['heading']; |
@@ -439,19 +583,24 @@ discard block |
||
| 439 | 583 | } |
| 440 | 584 | } |
| 441 | 585 | |
| 442 | - if ($compress)$output .= '"h": "'.$heading.'",'; |
|
| 443 | - else $output .= '"heading": "'.$heading.'",'; |
|
| 586 | + if ($compress) { |
|
| 587 | + $output .= '"h": "'.$heading.'",'; |
|
| 588 | + } else { |
|
| 589 | + $output .= '"heading": "'.$heading.'",'; |
|
| 590 | + } |
|
| 444 | 591 | if ($currenttime != '') { |
| 445 | 592 | if (strtotime($spotter_item['date']) < $currenttime) { |
| 446 | 593 | if (isset($archivespeed)) { |
| 447 | 594 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
| 448 | 595 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 449 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 450 | - else { |
|
| 596 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 597 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 598 | + } else { |
|
| 451 | 599 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
| 452 | 600 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 453 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 454 | - else { |
|
| 601 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 602 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 603 | + } else { |
|
| 455 | 604 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
| 456 | 605 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 457 | 606 | } |
@@ -459,12 +608,14 @@ discard block |
||
| 459 | 608 | } elseif ($usenextlatlon) { |
| 460 | 609 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
| 461 | 610 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 462 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 463 | - else { |
|
| 611 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 612 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 613 | + } else { |
|
| 464 | 614 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
| 465 | 615 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 466 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 467 | - else { |
|
| 616 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 617 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 618 | + } else { |
|
| 468 | 619 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
| 469 | 620 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 470 | 621 | } |
@@ -503,7 +654,9 @@ discard block |
||
| 503 | 654 | } |
| 504 | 655 | } |
| 505 | 656 | |
| 506 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
| 657 | + if (!$min) { |
|
| 658 | + $output .= '"image": "'.$image.'",'; |
|
| 659 | + } |
|
| 507 | 660 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
| 508 | 661 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
| 509 | 662 | } |
@@ -511,8 +664,11 @@ discard block |
||
| 511 | 664 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
| 512 | 665 | } |
| 513 | 666 | if (isset($spotter_item['squawk'])) { |
| 514 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 515 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 667 | + if ($compress) { |
|
| 668 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 669 | + } else { |
|
| 670 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 671 | + } |
|
| 516 | 672 | } |
| 517 | 673 | if (isset($spotter_item['squawk_usage'])) { |
| 518 | 674 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -531,14 +687,23 @@ discard block |
||
| 531 | 687 | } |
| 532 | 688 | // type when not aircraft ? |
| 533 | 689 | if (isset($spotter_item['type'])) { |
| 534 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
| 535 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
| 690 | + if ($compress) { |
|
| 691 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
| 692 | + } else { |
|
| 693 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
| 694 | + } |
|
| 536 | 695 | } elseif ($marine) { |
| 537 | - if ($compress) $output .= '"t": "ship"'; |
|
| 538 | - else $output .= '"type": "ship"'; |
|
| 696 | + if ($compress) { |
|
| 697 | + $output .= '"t": "ship"'; |
|
| 698 | + } else { |
|
| 699 | + $output .= '"type": "ship"'; |
|
| 700 | + } |
|
| 539 | 701 | } else { |
| 540 | - if ($compress) $output .= '"t": "aircraft"'; |
|
| 541 | - else $output .= '"type": "aircraft"'; |
|
| 702 | + if ($compress) { |
|
| 703 | + $output .= '"t": "aircraft"'; |
|
| 704 | + } else { |
|
| 705 | + $output .= '"type": "aircraft"'; |
|
| 706 | + } |
|
| 542 | 707 | } |
| 543 | 708 | $output .= '},'; |
| 544 | 709 | $output .= '"geometry": {'; |
@@ -546,15 +711,19 @@ discard block |
||
| 546 | 711 | $output .= '"coordinates": ['; |
| 547 | 712 | if ($currenttime != '') { |
| 548 | 713 | if (strtotime($spotter_item['date']) < $currenttime) { |
| 549 | - if (!isset($archivespeed)) $archivespeed = 1; |
|
| 714 | + if (!isset($archivespeed)) { |
|
| 715 | + $archivespeed = 1; |
|
| 716 | + } |
|
| 550 | 717 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
| 551 | 718 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 552 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
| 553 | - else { |
|
| 719 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 720 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
| 721 | + } else { |
|
| 554 | 722 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
| 555 | 723 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 556 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
| 557 | - else { |
|
| 724 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 725 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
| 726 | + } else { |
|
| 558 | 727 | $output .= $spotter_item['longitude'].', '; |
| 559 | 728 | $output .= $spotter_item['latitude']; |
| 560 | 729 | } |
@@ -632,7 +801,9 @@ discard block |
||
| 632 | 801 | } |
| 633 | 802 | */ |
| 634 | 803 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
| 635 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
| 804 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
| 805 | + $history = $_COOKIE['history']; |
|
| 806 | + } |
|
| 636 | 807 | |
| 637 | 808 | if ( |
| 638 | 809 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -702,8 +873,11 @@ discard block |
||
| 702 | 873 | $output_history .= ']}},'; |
| 703 | 874 | $output .= $output_history; |
| 704 | 875 | } |
| 705 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 706 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 876 | + if ($compress) { |
|
| 877 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 878 | + } else { |
|
| 879 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 880 | + } |
|
| 707 | 881 | } |
| 708 | 882 | $output_history .= '['; |
| 709 | 883 | $output_history .= $spotter_history['longitude'].', '; |
@@ -724,10 +898,15 @@ discard block |
||
| 724 | 898 | if ($d == false) { |
| 725 | 899 | if ($compress) { |
| 726 | 900 | $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",'; |
| 727 | - if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
| 728 | - elseif (isset($spotter_history_array[0]['mapmatching_engine'])) $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
| 901 | + if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') { |
|
| 902 | + $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
| 903 | + } elseif (isset($spotter_history_array[0]['mapmatching_engine'])) { |
|
| 904 | + $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
| 905 | + } |
|
| 729 | 906 | $output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
| 730 | - } else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 907 | + } else { |
|
| 908 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 909 | + } |
|
| 731 | 910 | $d = true; |
| 732 | 911 | } |
| 733 | 912 | $output_history .= '['; |
@@ -750,7 +929,9 @@ discard block |
||
| 750 | 929 | $output_historyd = '['; |
| 751 | 930 | $output_historyd .= $spotter_item['longitude'].', '; |
| 752 | 931 | $output_historyd .= $spotter_item['latitude']; |
| 753 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 932 | + if (isset($spotter_history['altitude'])) { |
|
| 933 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 934 | + } |
|
| 754 | 935 | $output_historyd .= '],'; |
| 755 | 936 | //$output_history = $output_historyd.$output_history; |
| 756 | 937 | $output_history = $output_history.$output_historyd; |
@@ -777,8 +958,11 @@ discard block |
||
| 777 | 958 | && $spotter_item['arrival_airport'] != 'NA' |
| 778 | 959 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
| 779 | 960 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
| 780 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 781 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 961 | + if ($compress) { |
|
| 962 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 963 | + } else { |
|
| 964 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 965 | + } |
|
| 782 | 966 | if (isset($spotter_item['departure_airport_latitude'])) { |
| 783 | 967 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
| 784 | 968 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -811,8 +995,11 @@ discard block |
||
| 811 | 995 | || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) |
| 812 | 996 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
| 813 | 997 | $havedata = false; |
| 814 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 815 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 998 | + if ($compress) { |
|
| 999 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 1000 | + } else { |
|
| 1001 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 1002 | + } |
|
| 816 | 1003 | |
| 817 | 1004 | //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
| 818 | 1005 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -837,7 +1024,9 @@ discard block |
||
| 837 | 1024 | $output_dest = substr($output_dest, 0, -1); |
| 838 | 1025 | } |
| 839 | 1026 | $output_dest .= ']}},'; |
| 840 | - if ($havedata) $output .= $output_dest; |
|
| 1027 | + if ($havedata) { |
|
| 1028 | + $output .= $output_dest; |
|
| 1029 | + } |
|
| 841 | 1030 | unset($output_dest); |
| 842 | 1031 | } |
| 843 | 1032 | } |
@@ -845,7 +1034,9 @@ discard block |
||
| 845 | 1034 | $output .= ']'; |
| 846 | 1035 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 847 | 1036 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
| 848 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 1037 | + if (isset($begindate)) { |
|
| 1038 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 1039 | + } |
|
| 849 | 1040 | $output .= '"fc": "'.$j.'"'; |
| 850 | 1041 | } else { |
| 851 | 1042 | $output .= '"features": '; |
@@ -6,7 +6,9 @@ discard block |
||
| 6 | 6 | public function __construct($dbc = null) { |
| 7 | 7 | $Connection = new Connection($dbc); |
| 8 | 8 | $this->db = $Connection->db; |
| 9 | - if ($this->db === null) die('Error: No DB connection. (SpotterArchive)'); |
|
| 9 | + if ($this->db === null) { |
|
| 10 | + die('Error: No DB connection. (SpotterArchive)'); |
|
| 11 | + } |
|
| 10 | 12 | } |
| 11 | 13 | |
| 12 | 14 | /** |
@@ -27,7 +29,9 @@ discard block |
||
| 27 | 29 | if (isset($filter[0]['source'])) { |
| 28 | 30 | $filters = array_merge($filters,$filter); |
| 29 | 31 | } |
| 30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 32 | + if (is_array($globalFilter)) { |
|
| 33 | + $filter = array_merge($filter,$globalFilter); |
|
| 34 | + } |
|
| 31 | 35 | $filter_query_join = ''; |
| 32 | 36 | $filter_query_where = ''; |
| 33 | 37 | foreach($filters as $flt) { |
@@ -119,8 +123,11 @@ discard block |
||
| 119 | 123 | } |
| 120 | 124 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
| 121 | 125 | } |
| 122 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 123 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 126 | + if ($filter_query_where == '' && $where) { |
|
| 127 | + $filter_query_where = ' WHERE'; |
|
| 128 | + } elseif ($filter_query_where != '' && $and) { |
|
| 129 | + $filter_query_where .= ' AND'; |
|
| 130 | + } |
|
| 124 | 131 | if ($filter_query_where != '') { |
| 125 | 132 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 126 | 133 | } |
@@ -134,10 +141,17 @@ discard block |
||
| 134 | 141 | if ($over_country == '') { |
| 135 | 142 | $Spotter = new Spotter($this->db); |
| 136 | 143 | $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
| 137 | - if (!empty($data_country)) $country = $data_country['iso2']; |
|
| 138 | - else $country = ''; |
|
| 139 | - } else $country = $over_country; |
|
| 140 | - if ($airline_type === NULL) $airline_type =''; |
|
| 144 | + if (!empty($data_country)) { |
|
| 145 | + $country = $data_country['iso2']; |
|
| 146 | + } else { |
|
| 147 | + $country = ''; |
|
| 148 | + } |
|
| 149 | + } else { |
|
| 150 | + $country = $over_country; |
|
| 151 | + } |
|
| 152 | + if ($airline_type === NULL) { |
|
| 153 | + $airline_type =''; |
|
| 154 | + } |
|
| 141 | 155 | |
| 142 | 156 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
| 143 | 157 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
@@ -598,7 +612,9 @@ discard block |
||
| 598 | 612 | $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
| 599 | 613 | $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
| 600 | 614 | $translate = $Translation->ident2icao($q_item); |
| 601 | - if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
| 615 | + if ($translate != $q_item) { |
|
| 616 | + $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
| 617 | + } |
|
| 602 | 618 | $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
| 603 | 619 | $additional_query .= ")"; |
| 604 | 620 | } |
@@ -778,7 +794,9 @@ discard block |
||
| 778 | 794 | date_default_timezone_set($globalTimezone); |
| 779 | 795 | $datetime = new DateTime(); |
| 780 | 796 | $offset = $datetime->format('P'); |
| 781 | - } else $offset = '+00:00'; |
|
| 797 | + } else { |
|
| 798 | + $offset = '+00:00'; |
|
| 799 | + } |
|
| 782 | 800 | if ($date_array[1] != "") { |
| 783 | 801 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
| 784 | 802 | $date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1])); |
@@ -1021,9 +1039,13 @@ discard block |
||
| 1021 | 1039 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 1022 | 1040 | } |
| 1023 | 1041 | } |
| 1024 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 1042 | + if ($sincedate != '') { |
|
| 1043 | + $query .= "AND date > '".$sincedate."' "; |
|
| 1044 | + } |
|
| 1025 | 1045 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
| 1026 | - if ($limit) $query .= " LIMIT 0,10"; |
|
| 1046 | + if ($limit) { |
|
| 1047 | + $query .= " LIMIT 0,10"; |
|
| 1048 | + } |
|
| 1027 | 1049 | |
| 1028 | 1050 | |
| 1029 | 1051 | $sth = $this->db->prepare($query); |
@@ -1065,9 +1087,13 @@ discard block |
||
| 1065 | 1087 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 1066 | 1088 | } |
| 1067 | 1089 | } |
| 1068 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
| 1090 | + if ($sincedate != '') { |
|
| 1091 | + $query .= "AND s.date > '".$sincedate."' "; |
|
| 1092 | + } |
|
| 1069 | 1093 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
| 1070 | - if ($limit) $query .= " LIMIT 0,10"; |
|
| 1094 | + if ($limit) { |
|
| 1095 | + $query .= " LIMIT 0,10"; |
|
| 1096 | + } |
|
| 1071 | 1097 | |
| 1072 | 1098 | |
| 1073 | 1099 | $sth = $this->db->prepare($query); |
@@ -22,12 +22,10 @@ discard block |
||
| 22 | 22 | if ($tracker) { |
| 23 | 23 | require_once('require/class.Tracker.php'); |
| 24 | 24 | require_once('require/class.TrackerArchive.php'); |
| 25 | -} |
|
| 26 | -elseif ($marine) { |
|
| 25 | +} elseif ($marine) { |
|
| 27 | 26 | require_once('require/class.Marine.php'); |
| 28 | 27 | require_once('require/class.MarineArchive.php'); |
| 29 | -} |
|
| 30 | -else { |
|
| 28 | +} else { |
|
| 31 | 29 | require_once('require/class.Spotter.php'); |
| 32 | 30 | require_once('require/class.SpotterArchive.php'); |
| 33 | 31 | } |
@@ -35,12 +33,10 @@ discard block |
||
| 35 | 33 | if ($tracker) { |
| 36 | 34 | $Tracker = new Tracker(); |
| 37 | 35 | $TrackerArchive = new TrackerArchive(); |
| 38 | -} |
|
| 39 | -elseif ($marine) { |
|
| 36 | +} elseif ($marine) { |
|
| 40 | 37 | $Marine = new Marine(); |
| 41 | 38 | $MarineArchive = new MarineArchive(); |
| 42 | -} |
|
| 43 | -else { |
|
| 39 | +} else { |
|
| 44 | 40 | $Spotter = new Spotter(); |
| 45 | 41 | $SpotterArchive = new SpotterArchive(); |
| 46 | 42 | } |
@@ -53,62 +49,86 @@ discard block |
||
| 53 | 49 | } |
| 54 | 50 | header('Content-Type: text/javascript'); |
| 55 | 51 | |
| 56 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 57 | -else $compress = $globalJsonCompress; |
|
| 52 | +if (!isset($globalJsonCompress)) { |
|
| 53 | + $compress = true; |
|
| 54 | +} else { |
|
| 55 | + $compress = $globalJsonCompress; |
|
| 56 | +} |
|
| 58 | 57 | |
| 59 | 58 | $from_archive = false; |
| 60 | 59 | $min = false; |
| 61 | 60 | $allhistory = false; |
| 62 | 61 | $filter['source'] = array(); |
| 63 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 64 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 65 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 66 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 67 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 68 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 69 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 70 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 71 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 72 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 73 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 62 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
| 63 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 64 | +} |
|
| 65 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
| 66 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 67 | +} |
|
| 68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
| 69 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 70 | +} |
|
| 71 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
| 72 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 73 | +} |
|
| 74 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
| 75 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 76 | +} |
|
| 77 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
| 78 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 79 | +} |
|
| 80 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
| 81 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 82 | +} |
|
| 83 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
| 84 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 85 | +} |
|
| 86 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
| 87 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 88 | +} |
|
| 89 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
| 90 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 91 | +} |
|
| 92 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
| 93 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 94 | +} |
|
| 74 | 95 | |
| 75 | 96 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 76 | 97 | $min = true; |
| 77 | -} else $min = false; |
|
| 98 | +} else { |
|
| 99 | + $min = false; |
|
| 100 | +} |
|
| 78 | 101 | |
| 79 | 102 | if (isset($_GET['ident'])) { |
| 80 | 103 | $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
| 81 | 104 | $from_archive = true; |
| 82 | 105 | if ($tracker) { |
| 83 | 106 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident); |
| 84 | - } |
|
| 85 | - elseif ($marine) { |
|
| 107 | + } elseif ($marine) { |
|
| 86 | 108 | $spotter_array = $MarineArchive->getLastArchiveMarineDataByIdent($ident); |
| 87 | - } |
|
| 88 | - else { |
|
| 109 | + } else { |
|
| 89 | 110 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident); |
| 90 | 111 | } |
| 91 | 112 | $allhistory = true; |
| 92 | -} |
|
| 93 | -elseif (isset($_GET['flightaware_id'])) { |
|
| 113 | +} elseif (isset($_GET['flightaware_id'])) { |
|
| 94 | 114 | $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
| 95 | 115 | $from_archive = true; |
| 96 | 116 | if ($tracker) { |
| 97 | 117 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id); |
| 98 | - } |
|
| 99 | - elseif ($marine) { |
|
| 118 | + } elseif ($marine) { |
|
| 100 | 119 | $spotter_array = $MarineArchive->getLastArchiveMarineDataById($flightaware_id); |
| 101 | - } |
|
| 102 | - else { |
|
| 120 | + } else { |
|
| 103 | 121 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
| 104 | 122 | } |
| 105 | 123 | $allhistory = true; |
| 106 | -} |
|
| 107 | -elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
|
| 124 | +} elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
|
| 108 | 125 | $from_archive = true; |
| 109 | 126 | $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
| 110 | - if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate; |
|
| 111 | - else $begindate = $begindate - 3000; |
|
| 127 | + if (isset($globalAircraftMaxUpdate)) { |
|
| 128 | + $begindate = $begindate - $globalAircraftMaxUpdate; |
|
| 129 | + } else { |
|
| 130 | + $begindate = $begindate - 3000; |
|
| 131 | + } |
|
| 112 | 132 | $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
| 113 | 133 | $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
| 114 | 134 | if ($begindate != '' && $enddate != '') { |
@@ -117,11 +137,9 @@ discard block |
||
| 117 | 137 | //$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
| 118 | 138 | if ($tracker) { |
| 119 | 139 | $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
| 120 | - } |
|
| 121 | - elseif ($marine) { |
|
| 140 | + } elseif ($marine) { |
|
| 122 | 141 | $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
| 123 | - } |
|
| 124 | - else { |
|
| 142 | + } else { |
|
| 125 | 143 | $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
| 126 | 144 | } |
| 127 | 145 | } |
@@ -130,8 +148,12 @@ discard block |
||
| 130 | 148 | if (!empty($spotter_array)) { |
| 131 | 149 | //$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
| 132 | 150 | $flightcnt = 0; |
| 133 | - if ($flightcnt == '') $flightcnt = 0; |
|
| 134 | -} else $flightcnt = 0; |
|
| 151 | + if ($flightcnt == '') { |
|
| 152 | + $flightcnt = 0; |
|
| 153 | + } |
|
| 154 | + } else { |
|
| 155 | + $flightcnt = 0; |
|
| 156 | +} |
|
| 135 | 157 | |
| 136 | 158 | $sqltime = round(microtime(true)-$begintime,2); |
| 137 | 159 | |
@@ -141,8 +163,11 @@ discard block |
||
| 141 | 163 | |
| 142 | 164 | $output = '{'; |
| 143 | 165 | $output .= '"type": "FeatureCollection",'; |
| 144 | -if ($min) $output .= '"minimal": "true",'; |
|
| 145 | -else $output .= '"minimal": "false",'; |
|
| 166 | +if ($min) { |
|
| 167 | + $output .= '"minimal": "true",'; |
|
| 168 | +} else { |
|
| 169 | + $output .= '"minimal": "false",'; |
|
| 170 | +} |
|
| 146 | 171 | $output .= '"fc": "'.$flightcnt.'",'; |
| 147 | 172 | $output .= '"sqt": "'.$sqltime.'",'; |
| 148 | 173 | |
@@ -155,19 +180,23 @@ discard block |
||
| 155 | 180 | if ($pfi != $spotter_item['famtrackid']) { |
| 156 | 181 | $spotter_history_array = $TrackerArchive->getCoordArchiveTrackerDataById($spotter_item['famtrackid']); |
| 157 | 182 | $pfi = $spotter_item['famtrackid']; |
| 158 | - } else $spotter_history_array = 0; |
|
| 159 | - } |
|
| 160 | - elseif ($marine) { |
|
| 183 | + } else { |
|
| 184 | + $spotter_history_array = 0; |
|
| 185 | + } |
|
| 186 | + } elseif ($marine) { |
|
| 161 | 187 | if ($pfi != $spotter_item['fammarine_d']) { |
| 162 | 188 | $spotter_history_array = $MarineArchive->getCoordArchiveMarineDataById($spotter_item['fammarine_id']); |
| 163 | 189 | $pfi = $spotter_item['fammarine_id']; |
| 164 | - } else $spotter_history_array = 0; |
|
| 165 | - } |
|
| 166 | - else { |
|
| 190 | + } else { |
|
| 191 | + $spotter_history_array = 0; |
|
| 192 | + } |
|
| 193 | + } else { |
|
| 167 | 194 | if ($pfi != $spotter_item['flightaware_id']) { |
| 168 | 195 | $spotter_history_array = $SpotterArchive->getCoordArchiveSpotterDataById($spotter_item['flightaware_id']); |
| 169 | 196 | $pfi = $spotter_item['flightaware_id']; |
| 170 | - } else $spotter_history_array = 0; |
|
| 197 | + } else { |
|
| 198 | + $spotter_history_array = 0; |
|
| 199 | + } |
|
| 171 | 200 | } |
| 172 | 201 | if (count($spotter_history_array) > 1) { |
| 173 | 202 | //location of aircraft |
@@ -175,20 +204,28 @@ discard block |
||
| 175 | 204 | $output .= '"type": "Feature",'; |
| 176 | 205 | $output .= '"properties": {'; |
| 177 | 206 | $output .= '"fi": "'.$pfi.'",'; |
| 178 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 207 | + if (isset($begindate)) { |
|
| 208 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 209 | + } |
|
| 179 | 210 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
| 180 | 211 | $output .= '"c": "'.$spotter_item['ident'].'",'; |
| 181 | 212 | } else { |
| 182 | 213 | $output .= '"c": "NA",'; |
| 183 | 214 | } |
| 184 | 215 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) { |
| 185 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
| 186 | - else { |
|
| 216 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
| 217 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 218 | + } else { |
|
| 187 | 219 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
| 188 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 189 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 190 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 191 | - else $spotter_item['aircraft_shadow'] = ''; |
|
| 220 | + if (count($aircraft_info) > 0) { |
|
| 221 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 222 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
| 223 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 224 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
| 225 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 226 | + } else { |
|
| 227 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 228 | + } |
|
| 192 | 229 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
| 193 | 230 | } |
| 194 | 231 | } |
@@ -196,93 +233,139 @@ discard block |
||
| 196 | 233 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
| 197 | 234 | if ($tracker) { |
| 198 | 235 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
| 199 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
| 200 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 201 | - } |
|
| 202 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
|
| 203 | - if ($compress) $output .= '"as": "police.png",'; |
|
| 204 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
| 205 | - } |
|
| 206 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
|
| 207 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 208 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 209 | - } |
|
| 210 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
|
| 211 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 212 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 213 | - } |
|
| 214 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
|
| 215 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 216 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 217 | - } |
|
| 218 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
|
| 219 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 220 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 221 | - } |
|
| 222 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
|
| 223 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 224 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 225 | - } |
|
| 226 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
|
| 227 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 228 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 236 | + if ($compress) { |
|
| 237 | + $output .= '"as": "ambulance.png",'; |
|
| 238 | + } else { |
|
| 239 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 240 | + } |
|
| 241 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
|
| 242 | + if ($compress) { |
|
| 243 | + $output .= '"as": "police.png",'; |
|
| 244 | + } else { |
|
| 245 | + $output .= '"aircraft_shadow": "police.png",'; |
|
| 246 | + } |
|
| 247 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
|
| 248 | + if ($compress) { |
|
| 249 | + $output .= '"as": "ship.png",'; |
|
| 250 | + } else { |
|
| 251 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 252 | + } |
|
| 253 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
|
| 254 | + if ($compress) { |
|
| 255 | + $output .= '"as": "ship.png",'; |
|
| 256 | + } else { |
|
| 257 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 258 | + } |
|
| 259 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
|
| 260 | + if ($compress) { |
|
| 261 | + $output .= '"as": "ship.png",'; |
|
| 262 | + } else { |
|
| 263 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 264 | + } |
|
| 265 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
|
| 266 | + if ($compress) { |
|
| 267 | + $output .= '"as": "truck.png",'; |
|
| 268 | + } else { |
|
| 269 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 270 | + } |
|
| 271 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
|
| 272 | + if ($compress) { |
|
| 273 | + $output .= '"as": "truck.png",'; |
|
| 274 | + } else { |
|
| 275 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 276 | + } |
|
| 277 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
|
| 278 | + if ($compress) { |
|
| 279 | + $output .= '"as": "aircraft.png",'; |
|
| 280 | + } else { |
|
| 281 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 282 | + } |
|
| 283 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
|
| 284 | + if ($compress) { |
|
| 285 | + $output .= '"as": "aircraft.png",'; |
|
| 286 | + } else { |
|
| 287 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 288 | + } |
|
| 289 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
|
| 290 | + if ($compress) { |
|
| 291 | + $output .= '"as": "helico.png",'; |
|
| 292 | + } else { |
|
| 293 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
| 294 | + } |
|
| 295 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
|
| 296 | + if ($compress) { |
|
| 297 | + $output .= '"as": "rail.png",'; |
|
| 298 | + } else { |
|
| 299 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
| 300 | + } |
|
| 301 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
|
| 302 | + if ($compress) { |
|
| 303 | + $output .= '"as": "firetruck.png",'; |
|
| 304 | + } else { |
|
| 305 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 306 | + } |
|
| 307 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
|
| 308 | + if ($compress) { |
|
| 309 | + $output .= '"as": "bus.png",'; |
|
| 310 | + } else { |
|
| 311 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
| 312 | + } |
|
| 313 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
|
| 314 | + if ($compress) { |
|
| 315 | + $output .= '"as": "phone.png",'; |
|
| 316 | + } else { |
|
| 317 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
| 318 | + } |
|
| 319 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
|
| 320 | + if ($compress) { |
|
| 321 | + $output .= '"as": "jogger.png",'; |
|
| 322 | + } else { |
|
| 323 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 324 | + } |
|
| 325 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
|
| 326 | + if ($compress) { |
|
| 327 | + $output .= '"as": "bike.png",'; |
|
| 328 | + } else { |
|
| 329 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
| 330 | + } |
|
| 331 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
|
| 332 | + if ($compress) { |
|
| 333 | + $output .= '"as": "motorcycle.png",'; |
|
| 334 | + } else { |
|
| 335 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 336 | + } |
|
| 337 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
|
| 338 | + if ($compress) { |
|
| 339 | + $output .= '"as": "balloon.png",'; |
|
| 340 | + } else { |
|
| 341 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 342 | + } |
|
| 343 | + } else { |
|
| 344 | + if ($compress) { |
|
| 345 | + $output .= '"as": "car.png",'; |
|
| 346 | + } else { |
|
| 347 | + $output .= '"aircraft_shadow": "car.png",'; |
|
| 348 | + } |
|
| 229 | 349 | } |
| 230 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
|
| 231 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 232 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 350 | + } elseif ($marine) { |
|
| 351 | + if ($compress) { |
|
| 352 | + $output .= '"as": "ship.png",'; |
|
| 353 | + } else { |
|
| 354 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 233 | 355 | } |
| 234 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
|
| 235 | - if ($compress) $output .= '"as": "helico.png",'; |
|
| 236 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
| 237 | - } |
|
| 238 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
|
| 239 | - if ($compress) $output .= '"as": "rail.png",'; |
|
| 240 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
| 241 | - } |
|
| 242 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
|
| 243 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
| 244 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 245 | - } |
|
| 246 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
|
| 247 | - if ($compress) $output .= '"as": "bus.png",'; |
|
| 248 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
| 249 | - } |
|
| 250 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
|
| 251 | - if ($compress) $output .= '"as": "phone.png",'; |
|
| 252 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
| 253 | - } |
|
| 254 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
|
| 255 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
| 256 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 257 | - } |
|
| 258 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
|
| 259 | - if ($compress) $output .= '"as": "bike.png",'; |
|
| 260 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
| 261 | - } |
|
| 262 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
|
| 263 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
| 264 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 265 | - } |
|
| 266 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
|
| 267 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
| 268 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 269 | - } |
|
| 270 | - else { |
|
| 271 | - if ($compress) $output .= '"as": "car.png",'; |
|
| 272 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
| 356 | + } else { |
|
| 357 | + if ($compress) { |
|
| 358 | + $output .= '"as": "default.png",'; |
|
| 359 | + } else { |
|
| 360 | + $output .= '"aircraft_shadow": "default.png",'; |
|
| 273 | 361 | } |
| 274 | 362 | } |
| 275 | - elseif ($marine) { |
|
| 276 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 277 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 278 | - } |
|
| 279 | - else { |
|
| 280 | - if ($compress) $output .= '"as": "default.png",'; |
|
| 281 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
| 282 | - } |
|
| 283 | 363 | } else { |
| 284 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 285 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 364 | + if ($compress) { |
|
| 365 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 366 | + } else { |
|
| 367 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 368 | + } |
|
| 286 | 369 | } |
| 287 | 370 | |
| 288 | 371 | if (isset($spotter_item['date_iso_8601'])) { |
@@ -310,9 +393,13 @@ discard block |
||
| 310 | 393 | $k++; |
| 311 | 394 | $output_history .= '['.$spotter_history['longitude'].', '.$spotter_history['latitude'].'],'; |
| 312 | 395 | $output_time .= (strtotime($spotter_history['date'])*1000).','; |
| 313 | - if ($previousts != 0) $output_timediff .= (strtotime($spotter_history['date'])-$previousts).','; |
|
| 396 | + if ($previousts != 0) { |
|
| 397 | + $output_timediff .= (strtotime($spotter_history['date'])-$previousts).','; |
|
| 398 | + } |
|
| 314 | 399 | $previousts = strtotime($spotter_history['date']); |
| 315 | - if ($k > 1 && (strtotime($spotter_history['date'])*1000 > $enddate)) $end = true; |
|
| 400 | + if ($k > 1 && (strtotime($spotter_history['date'])*1000 > $enddate)) { |
|
| 401 | + $end = true; |
|
| 402 | + } |
|
| 316 | 403 | } |
| 317 | 404 | } |
| 318 | 405 | if (isset($output_time)) { |
@@ -324,8 +411,11 @@ discard block |
||
| 324 | 411 | $output .= '"timediff": ['.$output_timediff.'],'; |
| 325 | 412 | } |
| 326 | 413 | // FIXME : type when not aircraft ? |
| 327 | - if ($compress) $output .= '"t": "aircraft"'; |
|
| 328 | - else $output .= '"type": "aircraft"'; |
|
| 414 | + if ($compress) { |
|
| 415 | + $output .= '"t": "aircraft"'; |
|
| 416 | + } else { |
|
| 417 | + $output .= '"type": "aircraft"'; |
|
| 418 | + } |
|
| 329 | 419 | $output .= '},'; |
| 330 | 420 | $output .= '"geometry": {'; |
| 331 | 421 | //$output .= '"type": "MultiPoint",'; |
@@ -345,7 +435,9 @@ discard block |
||
| 345 | 435 | $output .= ']'; |
| 346 | 436 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 347 | 437 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
| 348 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 438 | + if (isset($begindate)) { |
|
| 439 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 440 | + } |
|
| 349 | 441 | $output .= '"fc": "'.$flightcnt.'"'; |
| 350 | 442 | } else { |
| 351 | 443 | $output .= '"features": '; |