@@ -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)); |
@@ -162,24 +187,38 @@ discard block |
||
| 162 | 187 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
| 163 | 188 | } |
| 164 | 189 | } |
| 165 | - if ($flightcnt == '') $flightcnt = 0; |
|
| 166 | -} else $flightcnt = 0; |
|
| 190 | + if ($flightcnt == '') { |
|
| 191 | + $flightcnt = 0; |
|
| 192 | + } |
|
| 193 | + } else { |
|
| 194 | + $flightcnt = 0; |
|
| 195 | +} |
|
| 167 | 196 | |
| 168 | 197 | $sqltime = round(microtime(true)-$begintime,2); |
| 169 | 198 | |
| 170 | 199 | $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
| 171 | -if ($currenttime != '') $currenttime = round($currenttime/1000); |
|
| 200 | +if ($currenttime != '') { |
|
| 201 | + $currenttime = round($currenttime/1000); |
|
| 202 | +} |
|
| 172 | 203 | |
| 173 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
| 174 | -else $usenextlatlon = true; |
|
| 175 | -if ($usenextlatlon === false) $currenttime = ''; |
|
| 204 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
| 205 | + $usenextlatlon = false; |
|
| 206 | +} else { |
|
| 207 | + $usenextlatlon = true; |
|
| 208 | +} |
|
| 209 | +if ($usenextlatlon === false) { |
|
| 210 | + $currenttime = ''; |
|
| 211 | +} |
|
| 176 | 212 | $j = 0; |
| 177 | 213 | $prev_flightaware_id = ''; |
| 178 | 214 | $aircrafts_shadow = array(); |
| 179 | 215 | $output = '{'; |
| 180 | 216 | $output .= '"type": "FeatureCollection",'; |
| 181 | - if ($min) $output .= '"minimal": "true",'; |
|
| 182 | - else $output .= '"minimal": "false",'; |
|
| 217 | + if ($min) { |
|
| 218 | + $output .= '"minimal": "true",'; |
|
| 219 | + } else { |
|
| 220 | + $output .= '"minimal": "false",'; |
|
| 221 | + } |
|
| 183 | 222 | //$output .= '"fc": "'.$flightcnt.'",'; |
| 184 | 223 | $output .= '"sqt": "'.$sqltime.'",'; |
| 185 | 224 | |
@@ -223,18 +262,29 @@ discard block |
||
| 223 | 262 | } |
| 224 | 263 | $output .= '"properties": {'; |
| 225 | 264 | if (isset($spotter_item['flightaware_id'])) { |
| 226 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
| 227 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
| 265 | + if ($compress) { |
|
| 266 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
| 267 | + } else { |
|
| 268 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
| 269 | + } |
|
| 228 | 270 | } elseif (isset($spotter_item['famtrackid'])) { |
| 229 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
| 230 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
| 271 | + if ($compress) { |
|
| 272 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
| 273 | + } else { |
|
| 274 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
| 275 | + } |
|
| 231 | 276 | } elseif (isset($spotter_item['fammarine_id'])) { |
| 232 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
| 233 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
| 277 | + if ($compress) { |
|
| 278 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
| 279 | + } else { |
|
| 280 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
| 281 | + } |
|
| 234 | 282 | } |
| 235 | 283 | $output .= '"fc": "'.$flightcnt.'",'; |
| 236 | 284 | $output .= '"sqt": "'.$sqltime.'",'; |
| 237 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 285 | + if (isset($begindate)) { |
|
| 286 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 287 | + } |
|
| 238 | 288 | |
| 239 | 289 | /* |
| 240 | 290 | if ($min) $output .= '"minimal": "true",'; |
@@ -242,14 +292,22 @@ discard block |
||
| 242 | 292 | */ |
| 243 | 293 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
| 244 | 294 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
| 245 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 246 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 295 | + if ($compress) { |
|
| 296 | + $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 297 | + } else { |
|
| 298 | + $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 299 | + } |
|
| 247 | 300 | //" |
| 248 | 301 | } else { |
| 249 | - if ($compress) $output .= '"c": "NA",'; |
|
| 250 | - else $output .= '"callsign": "NA",'; |
|
| 302 | + if ($compress) { |
|
| 303 | + $output .= '"c": "NA",'; |
|
| 304 | + } else { |
|
| 305 | + $output .= '"callsign": "NA",'; |
|
| 306 | + } |
|
| 307 | + } |
|
| 308 | + if (isset($spotter_item['registration'])) { |
|
| 309 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 251 | 310 | } |
| 252 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 253 | 311 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
| 254 | 312 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
| 255 | 313 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -262,16 +320,23 @@ discard block |
||
| 262 | 320 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
| 263 | 321 | } |
| 264 | 322 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker) { |
| 265 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
| 266 | - else { |
|
| 323 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
| 324 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 325 | + } else { |
|
| 267 | 326 | $aircraft_icao = $spotter_item['aircraft_icao']; |
| 268 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
| 269 | - else { |
|
| 327 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
| 328 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
| 329 | + } else { |
|
| 270 | 330 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
| 271 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 272 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 273 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 274 | - else $spotter_item['aircraft_shadow'] = ''; |
|
| 331 | + if (count($aircraft_info) > 0) { |
|
| 332 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 333 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
| 334 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 335 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
| 336 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 337 | + } else { |
|
| 338 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 339 | + } |
|
| 275 | 340 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
| 276 | 341 | } |
| 277 | 342 | } |
@@ -279,73 +344,139 @@ discard block |
||
| 279 | 344 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
| 280 | 345 | if ($tracker) { |
| 281 | 346 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
| 282 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
| 283 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 347 | + if ($compress) { |
|
| 348 | + $output .= '"as": "ambulance.png",'; |
|
| 349 | + } else { |
|
| 350 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 351 | + } |
|
| 284 | 352 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
| 285 | - if ($compress) $output .= '"as": "police.png",'; |
|
| 286 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
| 353 | + if ($compress) { |
|
| 354 | + $output .= '"as": "police.png",'; |
|
| 355 | + } else { |
|
| 356 | + $output .= '"aircraft_shadow": "police.png",'; |
|
| 357 | + } |
|
| 287 | 358 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
| 288 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 289 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 359 | + if ($compress) { |
|
| 360 | + $output .= '"as": "ship.png",'; |
|
| 361 | + } else { |
|
| 362 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 363 | + } |
|
| 290 | 364 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
| 291 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 292 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 365 | + if ($compress) { |
|
| 366 | + $output .= '"as": "ship.png",'; |
|
| 367 | + } else { |
|
| 368 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 369 | + } |
|
| 293 | 370 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
| 294 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 295 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 371 | + if ($compress) { |
|
| 372 | + $output .= '"as": "ship.png",'; |
|
| 373 | + } else { |
|
| 374 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 375 | + } |
|
| 296 | 376 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
| 297 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 298 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 377 | + if ($compress) { |
|
| 378 | + $output .= '"as": "truck.png",'; |
|
| 379 | + } else { |
|
| 380 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 381 | + } |
|
| 299 | 382 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
| 300 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 301 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 383 | + if ($compress) { |
|
| 384 | + $output .= '"as": "truck.png",'; |
|
| 385 | + } else { |
|
| 386 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 387 | + } |
|
| 302 | 388 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
| 303 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 304 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 389 | + if ($compress) { |
|
| 390 | + $output .= '"as": "aircraft.png",'; |
|
| 391 | + } else { |
|
| 392 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 393 | + } |
|
| 305 | 394 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
| 306 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 307 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 395 | + if ($compress) { |
|
| 396 | + $output .= '"as": "aircraft.png",'; |
|
| 397 | + } else { |
|
| 398 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 399 | + } |
|
| 308 | 400 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
| 309 | - if ($compress) $output .= '"as": "helico.png",'; |
|
| 310 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
| 401 | + if ($compress) { |
|
| 402 | + $output .= '"as": "helico.png",'; |
|
| 403 | + } else { |
|
| 404 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
| 405 | + } |
|
| 311 | 406 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
| 312 | - if ($compress) $output .= '"as": "rail.png",'; |
|
| 313 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
| 407 | + if ($compress) { |
|
| 408 | + $output .= '"as": "rail.png",'; |
|
| 409 | + } else { |
|
| 410 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
| 411 | + } |
|
| 314 | 412 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
| 315 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
| 316 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 413 | + if ($compress) { |
|
| 414 | + $output .= '"as": "firetruck.png",'; |
|
| 415 | + } else { |
|
| 416 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 417 | + } |
|
| 317 | 418 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
| 318 | - if ($compress) $output .= '"as": "bus.png",'; |
|
| 319 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
| 419 | + if ($compress) { |
|
| 420 | + $output .= '"as": "bus.png",'; |
|
| 421 | + } else { |
|
| 422 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
| 423 | + } |
|
| 320 | 424 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
| 321 | - if ($compress) $output .= '"as": "phone.png",'; |
|
| 322 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
| 425 | + if ($compress) { |
|
| 426 | + $output .= '"as": "phone.png",'; |
|
| 427 | + } else { |
|
| 428 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
| 429 | + } |
|
| 323 | 430 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
| 324 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
| 325 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 431 | + if ($compress) { |
|
| 432 | + $output .= '"as": "jogger.png",'; |
|
| 433 | + } else { |
|
| 434 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 435 | + } |
|
| 326 | 436 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
| 327 | - if ($compress) $output .= '"as": "bike.png",'; |
|
| 328 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
| 437 | + if ($compress) { |
|
| 438 | + $output .= '"as": "bike.png",'; |
|
| 439 | + } else { |
|
| 440 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
| 441 | + } |
|
| 329 | 442 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
| 330 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
| 331 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 443 | + if ($compress) { |
|
| 444 | + $output .= '"as": "motorcycle.png",'; |
|
| 445 | + } else { |
|
| 446 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 447 | + } |
|
| 332 | 448 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
| 333 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
| 334 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 449 | + if ($compress) { |
|
| 450 | + $output .= '"as": "balloon.png",'; |
|
| 451 | + } else { |
|
| 452 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 453 | + } |
|
| 335 | 454 | } else { |
| 336 | - if ($compress) $output .= '"as": "car.png",'; |
|
| 337 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
| 455 | + if ($compress) { |
|
| 456 | + $output .= '"as": "car.png",'; |
|
| 457 | + } else { |
|
| 458 | + $output .= '"aircraft_shadow": "car.png",'; |
|
| 459 | + } |
|
| 338 | 460 | } |
| 339 | 461 | } elseif ($marine) { |
| 340 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 341 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 462 | + if ($compress) { |
|
| 463 | + $output .= '"as": "ship.png",'; |
|
| 464 | + } else { |
|
| 465 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 466 | + } |
|
| 342 | 467 | } else { |
| 343 | - if ($compress) $output .= '"as": "default.png",'; |
|
| 344 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
| 468 | + if ($compress) { |
|
| 469 | + $output .= '"as": "default.png",'; |
|
| 470 | + } else { |
|
| 471 | + $output .= '"aircraft_shadow": "default.png",'; |
|
| 472 | + } |
|
| 345 | 473 | } |
| 346 | 474 | } else { |
| 347 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 348 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 475 | + if ($compress) { |
|
| 476 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 477 | + } else { |
|
| 478 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 479 | + } |
|
| 349 | 480 | } |
| 350 | 481 | if (isset($spotter_item['airline_name'])) { |
| 351 | 482 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -353,8 +484,11 @@ discard block |
||
| 353 | 484 | $output .= '"airline_name": "NA",'; |
| 354 | 485 | } |
| 355 | 486 | if (isset($spotter_item['departure_airport'])) { |
| 356 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 357 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 487 | + if ($compress) { |
|
| 488 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 489 | + } else { |
|
| 490 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 491 | + } |
|
| 358 | 492 | } |
| 359 | 493 | if (isset($spotter_item['departure_airport_city'])) { |
| 360 | 494 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -366,8 +500,11 @@ discard block |
||
| 366 | 500 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
| 367 | 501 | } |
| 368 | 502 | if (isset($spotter_item['arrival_airport'])) { |
| 369 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 370 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 503 | + if ($compress) { |
|
| 504 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 505 | + } else { |
|
| 506 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 507 | + } |
|
| 371 | 508 | } |
| 372 | 509 | if (isset($spotter_item['arrival_airport_city'])) { |
| 373 | 510 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -386,11 +523,17 @@ discard block |
||
| 386 | 523 | } |
| 387 | 524 | |
| 388 | 525 | if (isset($spotter_item['altitude'])) { |
| 389 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 390 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 526 | + if ($compress) { |
|
| 527 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 528 | + } else { |
|
| 529 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 530 | + } |
|
| 531 | + } |
|
| 532 | + if ($compress) { |
|
| 533 | + $output .= '"h": "'.$spotter_item['heading'].'",'; |
|
| 534 | + } else { |
|
| 535 | + $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
| 391 | 536 | } |
| 392 | - if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
|
| 393 | - else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
| 394 | 537 | |
| 395 | 538 | if ($currenttime != '') { |
| 396 | 539 | if (strtotime($spotter_item['date']) < $currenttime) { |
@@ -412,7 +555,9 @@ discard block |
||
| 412 | 555 | } |
| 413 | 556 | } |
| 414 | 557 | |
| 415 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
| 558 | + if (!$min) { |
|
| 559 | + $output .= '"image": "'.$image.'",'; |
|
| 560 | + } |
|
| 416 | 561 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
| 417 | 562 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
| 418 | 563 | } |
@@ -420,8 +565,11 @@ discard block |
||
| 420 | 565 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
| 421 | 566 | } |
| 422 | 567 | if (isset($spotter_item['squawk'])) { |
| 423 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 424 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 568 | + if ($compress) { |
|
| 569 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 570 | + } else { |
|
| 571 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 572 | + } |
|
| 425 | 573 | } |
| 426 | 574 | if (isset($spotter_item['squawk_usage'])) { |
| 427 | 575 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -440,14 +588,23 @@ discard block |
||
| 440 | 588 | } |
| 441 | 589 | // type when not aircraft ? |
| 442 | 590 | if (isset($spotter_item['type'])) { |
| 443 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
| 444 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
| 591 | + if ($compress) { |
|
| 592 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
| 593 | + } else { |
|
| 594 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
| 595 | + } |
|
| 445 | 596 | } elseif ($marine) { |
| 446 | - if ($compress) $output .= '"t": "ship"'; |
|
| 447 | - else $output .= '"type": "ship"'; |
|
| 597 | + if ($compress) { |
|
| 598 | + $output .= '"t": "ship"'; |
|
| 599 | + } else { |
|
| 600 | + $output .= '"type": "ship"'; |
|
| 601 | + } |
|
| 448 | 602 | } else { |
| 449 | - if ($compress) $output .= '"t": "aircraft"'; |
|
| 450 | - else $output .= '"type": "aircraft"'; |
|
| 603 | + if ($compress) { |
|
| 604 | + $output .= '"t": "aircraft"'; |
|
| 605 | + } else { |
|
| 606 | + $output .= '"type": "aircraft"'; |
|
| 607 | + } |
|
| 451 | 608 | } |
| 452 | 609 | $output .= '},'; |
| 453 | 610 | $output .= '"geometry": {'; |
@@ -455,7 +612,9 @@ discard block |
||
| 455 | 612 | $output .= '"coordinates": ['; |
| 456 | 613 | if ($currenttime != '') { |
| 457 | 614 | if (strtotime($spotter_item['date']) < $currenttime) { |
| 458 | - if (!isset($archivespeed)) $archivespeed = 1; |
|
| 615 | + if (!isset($archivespeed)) { |
|
| 616 | + $archivespeed = 1; |
|
| 617 | + } |
|
| 459 | 618 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date'])); |
| 460 | 619 | $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
| 461 | 620 | } else { |
@@ -526,7 +685,9 @@ discard block |
||
| 526 | 685 | } |
| 527 | 686 | */ |
| 528 | 687 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
| 529 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
| 688 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
| 689 | + $history = $_COOKIE['history']; |
|
| 690 | + } |
|
| 530 | 691 | |
| 531 | 692 | if ( |
| 532 | 693 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -570,8 +731,11 @@ discard block |
||
| 570 | 731 | $output_history .= ']}},'; |
| 571 | 732 | $output .= $output_history; |
| 572 | 733 | } |
| 573 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 574 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 734 | + if ($compress) { |
|
| 735 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 736 | + } else { |
|
| 737 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 738 | + } |
|
| 575 | 739 | } |
| 576 | 740 | $output_history .= '['; |
| 577 | 741 | $output_history .= $spotter_history['longitude'].', '; |
@@ -590,9 +754,14 @@ discard block |
||
| 590 | 754 | $prev_alt = $alt; |
| 591 | 755 | } else { |
| 592 | 756 | if ($d == false) { |
| 593 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 594 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 595 | - } else $d = true; |
|
| 757 | + if ($compress) { |
|
| 758 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 759 | + } else { |
|
| 760 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 761 | + } |
|
| 762 | + } else { |
|
| 763 | + $d = true; |
|
| 764 | + } |
|
| 596 | 765 | $output_history .= '['; |
| 597 | 766 | $output_history .= $spotter_history['longitude'].', '; |
| 598 | 767 | $output_history .= $spotter_history['latitude']; |
@@ -613,7 +782,9 @@ discard block |
||
| 613 | 782 | $output_historyd = '['; |
| 614 | 783 | $output_historyd .= $spotter_item['longitude'].', '; |
| 615 | 784 | $output_historyd .= $spotter_item['latitude']; |
| 616 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 785 | + if (isset($spotter_history['altitude'])) { |
|
| 786 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 787 | + } |
|
| 617 | 788 | $output_historyd .= '],'; |
| 618 | 789 | //$output_history = $output_historyd.$output_history; |
| 619 | 790 | $output_history = $output_history.$output_historyd; |
@@ -635,8 +806,11 @@ discard block |
||
| 635 | 806 | && $spotter_item['arrival_airport'] != 'NA' |
| 636 | 807 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
| 637 | 808 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
| 638 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 639 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 809 | + if ($compress) { |
|
| 810 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 811 | + } else { |
|
| 812 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 813 | + } |
|
| 640 | 814 | if (isset($spotter_item['departure_airport_latitude'])) { |
| 641 | 815 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
| 642 | 816 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -669,8 +843,11 @@ discard block |
||
| 669 | 843 | || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) |
| 670 | 844 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
| 671 | 845 | $havedata = false; |
| 672 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 673 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 846 | + if ($compress) { |
|
| 847 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 848 | + } else { |
|
| 849 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 850 | + } |
|
| 674 | 851 | $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
| 675 | 852 | |
| 676 | 853 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -685,7 +862,9 @@ discard block |
||
| 685 | 862 | } |
| 686 | 863 | //$output_dest = substr($output_dest, 0, -1); |
| 687 | 864 | $output_dest .= ']}},'; |
| 688 | - if ($havedata) $output .= $output_dest; |
|
| 865 | + if ($havedata) { |
|
| 866 | + $output .= $output_dest; |
|
| 867 | + } |
|
| 689 | 868 | unset($output_dest); |
| 690 | 869 | } |
| 691 | 870 | } |
@@ -693,7 +872,9 @@ discard block |
||
| 693 | 872 | $output .= ']'; |
| 694 | 873 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 695 | 874 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
| 696 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 875 | + if (isset($begindate)) { |
|
| 876 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 877 | + } |
|
| 697 | 878 | $output .= '"fc": "'.$j.'"'; |
| 698 | 879 | } else { |
| 699 | 880 | $output .= '"features": '; |