@@ -19,8 +19,12 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | $tracker = false; |
| 21 | 21 | $marine = false; |
| 22 | -if (isset($_GET['tracker'])) $tracker = true; |
|
| 23 | -if (isset($_GET['marine'])) $marine = true; |
|
| 22 | +if (isset($_GET['tracker'])) { |
|
| 23 | + $tracker = true; |
|
| 24 | +} |
|
| 25 | +if (isset($_GET['marine'])) { |
|
| 26 | + $marine = true; |
|
| 27 | +} |
|
| 24 | 28 | if ($tracker) { |
| 25 | 29 | require_once('require/class.Tracker.php'); |
| 26 | 30 | require_once('require/class.TrackerLive.php'); |
@@ -77,24 +81,49 @@ discard block |
||
| 77 | 81 | } |
| 78 | 82 | header('Content-Type: text/javascript'); |
| 79 | 83 | |
| 80 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 81 | -else $compress = $globalJsonCompress; |
|
| 84 | +if (!isset($globalJsonCompress)) { |
|
| 85 | + $compress = true; |
|
| 86 | +} else { |
|
| 87 | + $compress = $globalJsonCompress; |
|
| 88 | +} |
|
| 82 | 89 | |
| 83 | 90 | $from_archive = false; |
| 84 | 91 | $min = false; |
| 85 | 92 | $allhistory = false; |
| 86 | 93 | $filter['source'] = array(); |
| 87 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 88 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 89 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 90 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 91 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 92 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 93 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 94 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 95 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 96 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 97 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 94 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
| 95 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 96 | +} |
|
| 97 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
| 98 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 99 | +} |
|
| 100 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
| 101 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 102 | +} |
|
| 103 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
| 104 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 105 | +} |
|
| 106 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
| 107 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 108 | +} |
|
| 109 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
| 110 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 111 | +} |
|
| 112 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
| 113 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 114 | +} |
|
| 115 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
| 116 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 117 | +} |
|
| 118 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
| 119 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 120 | +} |
|
| 121 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
| 122 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 123 | +} |
|
| 124 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
| 125 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 126 | +} |
|
| 98 | 127 | /* |
| 99 | 128 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 100 | 129 | $min = true; |
@@ -268,8 +297,12 @@ discard block |
||
| 268 | 297 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
| 269 | 298 | } |
| 270 | 299 | } |
| 271 | - if ($flightcnt == '') $flightcnt = 0; |
|
| 272 | -} else $flightcnt = 0; |
|
| 300 | + if ($flightcnt == '') { |
|
| 301 | + $flightcnt = 0; |
|
| 302 | + } |
|
| 303 | + } else { |
|
| 304 | + $flightcnt = 0; |
|
| 305 | +} |
|
| 273 | 306 | |
| 274 | 307 | $sqltime = round(microtime(true)-$begintime,2); |
| 275 | 308 | $minitime = time(); |
@@ -315,7 +348,9 @@ discard block |
||
| 315 | 348 | $gltf2 = false; |
| 316 | 349 | $scale = 1.0; |
| 317 | 350 | $minimumpixelsize = 20; |
| 318 | -if (isset($archivespeed)) $speed = $archivespeed; |
|
| 351 | +if (isset($archivespeed)) { |
|
| 352 | + $speed = $archivespeed; |
|
| 353 | +} |
|
| 319 | 354 | $output = '['; |
| 320 | 355 | if ($tracker) { |
| 321 | 356 | $output .= '{"id" : "document", "name" : "tracker","version" : "1.0"'; |
@@ -351,9 +386,13 @@ discard block |
||
| 351 | 386 | $image = "images/placeholder_thumb.png"; |
| 352 | 387 | } |
| 353 | 388 | |
| 354 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
| 355 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
| 356 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
| 389 | + if (isset($spotter_item['flightaware_id'])) { |
|
| 390 | + $id = $spotter_item['flightaware_id']; |
|
| 391 | + } elseif (isset($spotter_item['famtrackid'])) { |
|
| 392 | + $id = $spotter_item['famtrackid']; |
|
| 393 | + } elseif (isset($spotter_item['fammarine_id'])) { |
|
| 394 | + $id = $spotter_item['fammarine_id']; |
|
| 395 | + } |
|
| 357 | 396 | if ($prev_flightaware_id != $id) { |
| 358 | 397 | if ($prev_flightaware_id != '') { |
| 359 | 398 | /* |
@@ -391,14 +430,24 @@ discard block |
||
| 391 | 430 | if (isset($spotter_item['squawk'])) { |
| 392 | 431 | $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
| 393 | 432 | } |
| 394 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 395 | - if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",'; |
|
| 396 | - if (isset($spotter_item['ident'])) $output.= '"ident": "'.$spotter_item['ident'].'",'; |
|
| 433 | + if (isset($spotter_item['registration'])) { |
|
| 434 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 435 | + } |
|
| 436 | + if (isset($spotter_item['format_source'])) { |
|
| 437 | + $output .= '"format": "'.$spotter_item['format_source'].'",'; |
|
| 438 | + } |
|
| 439 | + if (isset($spotter_item['ident'])) { |
|
| 440 | + $output.= '"ident": "'.$spotter_item['ident'].'",'; |
|
| 441 | + } |
|
| 397 | 442 | if ($tracker) { |
| 398 | - if (isset($spotter_item['type'])) $output .= '"tracker_type": "'.$spotter_item['type'].'",'; |
|
| 443 | + if (isset($spotter_item['type'])) { |
|
| 444 | + $output .= '"tracker_type": "'.$spotter_item['type'].'",'; |
|
| 445 | + } |
|
| 399 | 446 | $output.= '"type": "tracker"'; |
| 400 | 447 | } elseif ($marine) { |
| 401 | - if (isset($spotter_item['type'])) $output .= '"marine_type": "'.$spotter_item['type'].'",'; |
|
| 448 | + if (isset($spotter_item['type'])) { |
|
| 449 | + $output .= '"marine_type": "'.$spotter_item['type'].'",'; |
|
| 450 | + } |
|
| 402 | 451 | $output.= '"type": "marine"'; |
| 403 | 452 | } else { |
| 404 | 453 | if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) { |
@@ -449,7 +498,9 @@ discard block |
||
| 449 | 498 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
| 450 | 499 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
| 451 | 500 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
| 452 | - } else $aircraft_shadow = ''; |
|
| 501 | + } else { |
|
| 502 | + $aircraft_shadow = ''; |
|
| 503 | + } |
|
| 453 | 504 | $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
| 454 | 505 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
| 455 | 506 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
@@ -457,7 +508,9 @@ discard block |
||
| 457 | 508 | } |
| 458 | 509 | $output .= '},'; |
| 459 | 510 | } |
| 460 | - } else $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},'; |
|
| 511 | + } else { |
|
| 512 | + $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},'; |
|
| 513 | + } |
|
| 461 | 514 | } elseif ($one3dmodel) { |
| 462 | 515 | if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') { |
| 463 | 516 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
@@ -497,7 +550,9 @@ discard block |
||
| 497 | 550 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
| 498 | 551 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
| 499 | 552 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
| 500 | - } else $aircraft_shadow = ''; |
|
| 553 | + } else { |
|
| 554 | + $aircraft_shadow = ''; |
|
| 555 | + } |
|
| 501 | 556 | if ($aircraft_shadow != '') { |
| 502 | 557 | if (isset($modelsdb2[$aircraft_shadow])) { |
| 503 | 558 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/gltf2/'.$modelsdb2[$aircraft_shadow]['glb'].'","scale" : '.$scale.',"minimumPixelSize": '.$modelsdb2[$aircraft_shadow]['size']; |
@@ -652,7 +707,9 @@ discard block |
||
| 652 | 707 | } |
| 653 | 708 | $output .= '},'; |
| 654 | 709 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
| 655 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
| 710 | + if ($spotter_item['aircraft_icao'] != '') { |
|
| 711 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
| 712 | + } |
|
| 656 | 713 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
| 657 | 714 | } |
| 658 | 715 | } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
@@ -674,7 +731,9 @@ discard block |
||
| 674 | 731 | } |
| 675 | 732 | $output .= '},'; |
| 676 | 733 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
| 677 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
| 734 | + if ($spotter_item['aircraft_icao'] != '') { |
|
| 735 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
| 736 | + } |
|
| 678 | 737 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
| 679 | 738 | } |
| 680 | 739 | } else { |
@@ -687,7 +746,9 @@ discard block |
||
| 687 | 746 | } |
| 688 | 747 | $output .= '},'; |
| 689 | 748 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
| 690 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
| 749 | + if ($spotter_item['aircraft_icao'] != '') { |
|
| 750 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
| 751 | + } |
|
| 691 | 752 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
| 692 | 753 | } |
| 693 | 754 | } elseif ($tracker && isset($spotter_item['type'])) { |
@@ -791,8 +852,11 @@ discard block |
||
| 791 | 852 | $output .= '},'; |
| 792 | 853 | } |
| 793 | 854 | } |
| 794 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
| 795 | - else $output = str_replace('%onground%','false',$output); |
|
| 855 | + if (isset($onground) && $onground) { |
|
| 856 | + $output = str_replace('%onground%','true',$output); |
|
| 857 | + } else { |
|
| 858 | + $output = str_replace('%onground%','false',$output); |
|
| 859 | + } |
|
| 796 | 860 | |
| 797 | 861 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
| 798 | 862 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -805,9 +869,15 @@ discard block |
||
| 805 | 869 | // $output .= '"interpolationDegree" : 5,'; |
| 806 | 870 | // $output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; |
| 807 | 871 | $output .= '"cartographicDegrees": ['; |
| 808 | - if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
|
| 809 | - if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']); |
|
| 810 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
| 872 | + if ($minitime > strtotime($spotter_item['date'])) { |
|
| 873 | + $minitime = strtotime($spotter_item['date']); |
|
| 874 | + } |
|
| 875 | + if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) { |
|
| 876 | + $minitracktime = strtotime($spotter_item['date']); |
|
| 877 | + } |
|
| 878 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
| 879 | + $maxitime = strtotime($spotter_item['date']); |
|
| 880 | + } |
|
| 811 | 881 | $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
| 812 | 882 | $output .= $spotter_item['longitude'].', '; |
| 813 | 883 | $output .= $spotter_item['latitude']; |
@@ -830,7 +900,9 @@ discard block |
||
| 830 | 900 | $output .= ', '.round($spotter_item['altitude']*30.48); |
| 831 | 901 | $prevalt = round($spotter_item['altitude']*30.48); |
| 832 | 902 | } |
| 833 | - } else $output .= ', 0'; |
|
| 903 | + } else { |
|
| 904 | + $output .= ', 0'; |
|
| 905 | + } |
|
| 834 | 906 | //$orientation = '"orientation" : { '; |
| 835 | 907 | //$orientation .= '"unitQuaternion": ['; |
| 836 | 908 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
@@ -838,13 +910,18 @@ discard block |
||
| 838 | 910 | } else { |
| 839 | 911 | $nblatlong = $nblatlong+1; |
| 840 | 912 | $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
| 841 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
| 913 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
| 914 | + $maxitime = strtotime($spotter_item['date']); |
|
| 915 | + } |
|
| 842 | 916 | if ($spotter_item['ground_speed'] == 0) { |
| 843 | 917 | $output .= $prevlong.', '; |
| 844 | 918 | $output .= $prevlat; |
| 845 | 919 | //if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt; |
| 846 | - if (!$marine) $output .= ', '.$prevalt; |
|
| 847 | - else $output .= ', 0'; |
|
| 920 | + if (!$marine) { |
|
| 921 | + $output .= ', '.$prevalt; |
|
| 922 | + } else { |
|
| 923 | + $output .= ', 0'; |
|
| 924 | + } |
|
| 848 | 925 | } else { |
| 849 | 926 | $output .= $spotter_item['longitude'].', '; |
| 850 | 927 | $output .= $spotter_item['latitude']; |
@@ -857,14 +934,17 @@ discard block |
||
| 857 | 934 | $output .= ', 0'; |
| 858 | 935 | } |
| 859 | 936 | } else { |
| 860 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
|
| 861 | - elseif ($tracker) { |
|
| 937 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
| 938 | + $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
|
| 939 | + } elseif ($tracker) { |
|
| 862 | 940 | $output .= ', '.round($spotter_item['altitude']*0.3048); |
| 863 | 941 | } else { |
| 864 | 942 | $output .= ', '.round($spotter_item['altitude']*30.48); |
| 865 | 943 | } |
| 866 | 944 | } |
| 867 | - } else $output .= ', 0'; |
|
| 945 | + } else { |
|
| 946 | + $output .= ', 0'; |
|
| 947 | + } |
|
| 868 | 948 | } |
| 869 | 949 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
| 870 | 950 | //$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
@@ -885,9 +965,10 @@ discard block |
||
| 885 | 965 | } else { |
| 886 | 966 | $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
| 887 | 967 | } |
| 968 | + } else { |
|
| 969 | + $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
| 888 | 970 | } |
| 889 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
| 890 | -} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
|
| 971 | + } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
|
| 891 | 972 | $output = str_replace('%minitime%',date("c",$minitracktime),$output); |
| 892 | 973 | } else { |
| 893 | 974 | $output = str_replace('%minitime%',date("c",$minitime),$output); |
@@ -897,7 +978,10 @@ discard block |
||
| 897 | 978 | } else { |
| 898 | 979 | $output = str_replace('%maxitime%',date("c",$maxitime),$output); |
| 899 | 980 | } |
| 900 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
| 901 | -else $output = str_replace('%gltf2%','false',$output); |
|
| 981 | +if ($gltf2) { |
|
| 982 | + $output = str_replace('%gltf2%','true',$output); |
|
| 983 | +} else { |
|
| 984 | + $output = str_replace('%gltf2%','false',$output); |
|
| 985 | +} |
|
| 902 | 986 | print $output; |
| 903 | 987 | ?> |
@@ -8,7 +8,9 @@ discard block |
||
| 8 | 8 | public function __construct($dbc = null) { |
| 9 | 9 | $Connection = new Connection($dbc); |
| 10 | 10 | $this->db = $Connection->db(); |
| 11 | - if ($this->db === null) die('Error: No DB connection. (SpotterLive)'); |
|
| 11 | + if ($this->db === null) { |
|
| 12 | + die('Error: No DB connection. (SpotterLive)'); |
|
| 13 | + } |
|
| 12 | 14 | } |
| 13 | 15 | |
| 14 | 16 | |
@@ -30,7 +32,9 @@ discard block |
||
| 30 | 32 | if (isset($filter[0]['source'])) { |
| 31 | 33 | $filters = array_merge($filters,$filter); |
| 32 | 34 | } |
| 33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 35 | + if (is_array($globalFilter)) { |
|
| 36 | + $filter = array_merge($filter,$globalFilter); |
|
| 37 | + } |
|
| 34 | 38 | $filter_query_join = ''; |
| 35 | 39 | $filter_query_where = ''; |
| 36 | 40 | foreach($filters as $flt) { |
@@ -126,8 +130,11 @@ discard block |
||
| 126 | 130 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 127 | 131 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 128 | 132 | } |
| 129 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 130 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 133 | + if ($filter_query_where == '' && $where) { |
|
| 134 | + $filter_query_where = ' WHERE'; |
|
| 135 | + } elseif ($filter_query_where != '' && $and) { |
|
| 136 | + $filter_query_where .= ' AND'; |
|
| 137 | + } |
|
| 131 | 138 | if ($filter_query_where != '') { |
| 132 | 139 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 133 | 140 | } |
@@ -168,9 +175,13 @@ discard block |
||
| 168 | 175 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
| 169 | 176 | } |
| 170 | 177 | } |
| 171 | - if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
| 178 | + if ($orderby_query == '') { |
|
| 179 | + $orderby_query = ' ORDER BY date DESC'; |
|
| 180 | + } |
|
| 172 | 181 | |
| 173 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 182 | + if (!isset($globalLiveInterval)) { |
|
| 183 | + $globalLiveInterval = '200'; |
|
| 184 | + } |
|
| 174 | 185 | if ($globalDBdriver == 'mysql') { |
| 175 | 186 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
| 176 | 187 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -193,7 +204,9 @@ discard block |
||
| 193 | 204 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 194 | 205 | date_default_timezone_set('UTC'); |
| 195 | 206 | $filter_query = $this->getFilter($filter,true,true); |
| 196 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 207 | + if (!isset($globalLiveInterval)) { |
|
| 208 | + $globalLiveInterval = '200'; |
|
| 209 | + } |
|
| 197 | 210 | if ($globalDBdriver == 'mysql') { |
| 198 | 211 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 199 | 212 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
@@ -244,8 +257,12 @@ discard block |
||
| 244 | 257 | $id = filter_var($id,FILTER_SANITIZE_STRING); |
| 245 | 258 | $filter_query = $this->getFilter($filter,true,true); |
| 246 | 259 | |
| 247 | - if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
|
| 248 | - if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
|
| 260 | + if (!isset($globalLiveInterval) || $globalLiveInterval == '') { |
|
| 261 | + $globalLiveInterval = '200'; |
|
| 262 | + } |
|
| 263 | + if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') { |
|
| 264 | + $globalMap3DAircraftsLimit = '300'; |
|
| 265 | + } |
|
| 249 | 266 | if ($globalDBdriver == 'mysql') { |
| 250 | 267 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 251 | 268 | /* |
@@ -256,25 +273,41 @@ discard block |
||
| 256 | 273 | */ |
| 257 | 274 | $query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration |
| 258 | 275 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id "; |
| 259 | - if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 260 | - if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id "; |
|
| 276 | + if ($usecoord) { |
|
| 277 | + $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 278 | + } |
|
| 279 | + if ($id != '') { |
|
| 280 | + $query .= "OR spotter_archive.flightaware_id = :id "; |
|
| 281 | + } |
|
| 261 | 282 | $query .= "UNION |
| 262 | 283 | SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 263 | 284 | FROM spotter_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date"; |
| 264 | - if ($usecoord) $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 265 | - if ($id != '') $query .= " OR spotter_live.flightaware_id = :id"; |
|
| 285 | + if ($usecoord) { |
|
| 286 | + $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 287 | + } |
|
| 288 | + if ($id != '') { |
|
| 289 | + $query .= " OR spotter_live.flightaware_id = :id"; |
|
| 290 | + } |
|
| 266 | 291 | $query .= ") AS spotter |
| 267 | 292 | WHERE latitude <> '0' AND longitude <> '0' |
| 268 | 293 | ORDER BY flightaware_id, date"; |
| 269 | - if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
| 294 | + if ($limit) { |
|
| 295 | + $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
| 296 | + } |
|
| 270 | 297 | } else { |
| 271 | 298 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 272 | 299 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date "; |
| 273 | - if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 274 | - if ($id != '') $query .= "OR spotter_live.flightaware_id = :id "; |
|
| 300 | + if ($usecoord) { |
|
| 301 | + $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 302 | + } |
|
| 303 | + if ($id != '') { |
|
| 304 | + $query .= "OR spotter_live.flightaware_id = :id "; |
|
| 305 | + } |
|
| 275 | 306 | $query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 276 | 307 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 277 | - if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
| 308 | + if ($limit) { |
|
| 309 | + $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
| 310 | + } |
|
| 278 | 311 | } |
| 279 | 312 | } else { |
| 280 | 313 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -286,28 +319,46 @@ discard block |
||
| 286 | 319 | */ |
| 287 | 320 | $query = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration |
| 288 | 321 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id "; |
| 289 | - if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 290 | - if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id "; |
|
| 322 | + if ($usecoord) { |
|
| 323 | + $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 324 | + } |
|
| 325 | + if ($id != '') { |
|
| 326 | + $query .= "OR spotter_archive.flightaware_id = :id "; |
|
| 327 | + } |
|
| 291 | 328 | $query .= "UNION |
| 292 | 329 | SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 293 | 330 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date"; |
| 294 | - if ($usecoord) $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 295 | - if ($id != '') $query .= " OR spotter_live.flightaware_id = :id"; |
|
| 331 | + if ($usecoord) { |
|
| 332 | + $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 333 | + } |
|
| 334 | + if ($id != '') { |
|
| 335 | + $query .= " OR spotter_live.flightaware_id = :id"; |
|
| 336 | + } |
|
| 296 | 337 | $query .= ") AS spotter WHERE latitude <> '0' AND longitude <> '0' "; |
| 297 | 338 | $query .= "ORDER BY flightaware_id, date"; |
| 298 | - if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
| 339 | + if ($limit) { |
|
| 340 | + $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
| 341 | + } |
|
| 299 | 342 | } else { |
| 300 | 343 | $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 301 | 344 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date "; |
| 302 | - if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 303 | - if ($id != '') $query .= "OR spotter_live.flightaware_id = :id "; |
|
| 345 | + if ($usecoord) { |
|
| 346 | + $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 347 | + } |
|
| 348 | + if ($id != '') { |
|
| 349 | + $query .= "OR spotter_live.flightaware_id = :id "; |
|
| 350 | + } |
|
| 304 | 351 | $query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 305 | 352 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 306 | - if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
| 353 | + if ($limit) { |
|
| 354 | + $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
| 355 | + } |
|
| 307 | 356 | } |
| 308 | 357 | } |
| 309 | 358 | $query_values = array(); |
| 310 | - if ($id != '') $query_values = array(':id' => $id); |
|
| 359 | + if ($id != '') { |
|
| 360 | + $query_values = array(':id' => $id); |
|
| 361 | + } |
|
| 311 | 362 | try { |
| 312 | 363 | $sth = $this->db->prepare($query); |
| 313 | 364 | $sth->execute($query_values); |
@@ -330,7 +381,9 @@ discard block |
||
| 330 | 381 | global $globalDBdriver, $globalLiveInterval; |
| 331 | 382 | $filter_query = $this->getFilter($filter,true,true); |
| 332 | 383 | |
| 333 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 384 | + if (!isset($globalLiveInterval)) { |
|
| 385 | + $globalLiveInterval = '200'; |
|
| 386 | + } |
|
| 334 | 387 | if ($globalDBdriver == 'mysql') { |
| 335 | 388 | //$query = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query; |
| 336 | 389 | $query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
@@ -360,7 +413,9 @@ discard block |
||
| 360 | 413 | { |
| 361 | 414 | global $globalDBdriver, $globalLiveInterval; |
| 362 | 415 | $Spotter = new Spotter($this->db); |
| 363 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 416 | + if (!isset($globalLiveInterval)) { |
|
| 417 | + $globalLiveInterval = '200'; |
|
| 418 | + } |
|
| 364 | 419 | $filter_query = $this->getFilter($filter); |
| 365 | 420 | |
| 366 | 421 | if (is_array($coord)) { |
@@ -368,7 +423,9 @@ discard block |
||
| 368 | 423 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 369 | 424 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 370 | 425 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 371 | - } else return array(); |
|
| 426 | + } else { |
|
| 427 | + return array(); |
|
| 428 | + } |
|
| 372 | 429 | if ($globalDBdriver == 'mysql') { |
| 373 | 430 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
| 374 | 431 | } else { |
@@ -389,7 +446,9 @@ discard block |
||
| 389 | 446 | { |
| 390 | 447 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 391 | 448 | $Spotter = new Spotter($this->db); |
| 392 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 449 | + if (!isset($globalLiveInterval)) { |
|
| 450 | + $globalLiveInterval = '200'; |
|
| 451 | + } |
|
| 393 | 452 | $filter_query = $this->getFilter($filter,true,true); |
| 394 | 453 | |
| 395 | 454 | if (is_array($coord)) { |
@@ -397,7 +456,9 @@ discard block |
||
| 397 | 456 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 398 | 457 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 399 | 458 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 400 | - } else return array(); |
|
| 459 | + } else { |
|
| 460 | + return array(); |
|
| 461 | + } |
|
| 401 | 462 | if ($globalDBdriver == 'mysql') { |
| 402 | 463 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 403 | 464 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
@@ -624,11 +685,15 @@ discard block |
||
| 624 | 685 | //$query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
| 625 | 686 | if ($globalDBdriver == 'mysql') { |
| 626 | 687 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
| 627 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 688 | + if ($liveinterval) { |
|
| 689 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 690 | + } |
|
| 628 | 691 | $query .= ' ORDER BY date'; |
| 629 | 692 | } else { |
| 630 | 693 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
| 631 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 694 | + if ($liveinterval) { |
|
| 695 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 696 | + } |
|
| 632 | 697 | $query .= ' ORDER BY date'; |
| 633 | 698 | } |
| 634 | 699 | |
@@ -723,7 +788,9 @@ discard block |
||
| 723 | 788 | $i++; |
| 724 | 789 | $j++; |
| 725 | 790 | if ($j == 30) { |
| 726 | - if ($globalDebug) echo "."; |
|
| 791 | + if ($globalDebug) { |
|
| 792 | + echo "."; |
|
| 793 | + } |
|
| 727 | 794 | try { |
| 728 | 795 | |
| 729 | 796 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -1076,7 +1143,9 @@ discard block |
||
| 1076 | 1143 | { |
| 1077 | 1144 | return false; |
| 1078 | 1145 | } |
| 1079 | - } else return ''; |
|
| 1146 | + } else { |
|
| 1147 | + return ''; |
|
| 1148 | + } |
|
| 1080 | 1149 | |
| 1081 | 1150 | if ($longitude != '') |
| 1082 | 1151 | { |
@@ -1084,7 +1153,9 @@ discard block |
||
| 1084 | 1153 | { |
| 1085 | 1154 | return false; |
| 1086 | 1155 | } |
| 1087 | - } else return ''; |
|
| 1156 | + } else { |
|
| 1157 | + return ''; |
|
| 1158 | + } |
|
| 1088 | 1159 | |
| 1089 | 1160 | if ($waypoints != '') |
| 1090 | 1161 | { |
@@ -1100,14 +1171,18 @@ discard block |
||
| 1100 | 1171 | { |
| 1101 | 1172 | return false; |
| 1102 | 1173 | } |
| 1103 | - } else $altitude = 0; |
|
| 1174 | + } else { |
|
| 1175 | + $altitude = 0; |
|
| 1176 | + } |
|
| 1104 | 1177 | if ($altitude_real != '') |
| 1105 | 1178 | { |
| 1106 | 1179 | if (!is_numeric($altitude_real)) |
| 1107 | 1180 | { |
| 1108 | 1181 | return false; |
| 1109 | 1182 | } |
| 1110 | - } else $altitude_real = 0; |
|
| 1183 | + } else { |
|
| 1184 | + $altitude_real = 0; |
|
| 1185 | + } |
|
| 1111 | 1186 | |
| 1112 | 1187 | if ($heading != '') |
| 1113 | 1188 | { |
@@ -1115,7 +1190,9 @@ discard block |
||
| 1115 | 1190 | { |
| 1116 | 1191 | return false; |
| 1117 | 1192 | } |
| 1118 | - } else $heading = 0; |
|
| 1193 | + } else { |
|
| 1194 | + $heading = 0; |
|
| 1195 | + } |
|
| 1119 | 1196 | |
| 1120 | 1197 | if ($groundspeed != '') |
| 1121 | 1198 | { |
@@ -1123,9 +1200,13 @@ discard block |
||
| 1123 | 1200 | { |
| 1124 | 1201 | return false; |
| 1125 | 1202 | } |
| 1126 | - } else $groundspeed = 0; |
|
| 1203 | + } else { |
|
| 1204 | + $groundspeed = 0; |
|
| 1205 | + } |
|
| 1127 | 1206 | date_default_timezone_set('UTC'); |
| 1128 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
| 1207 | + if ($date == '') { |
|
| 1208 | + $date = date("Y-m-d H:i:s", time()); |
|
| 1209 | + } |
|
| 1129 | 1210 | |
| 1130 | 1211 | |
| 1131 | 1212 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -1170,14 +1251,24 @@ discard block |
||
| 1170 | 1251 | $arrival_airport_country = ''; |
| 1171 | 1252 | |
| 1172 | 1253 | |
| 1173 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 1174 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 1175 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 1176 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1254 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) { |
|
| 1255 | + $squawk = NULL; |
|
| 1256 | + } |
|
| 1257 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) { |
|
| 1258 | + $verticalrate = NULL; |
|
| 1259 | + } |
|
| 1260 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
| 1261 | + $groundspeed = 0; |
|
| 1262 | + } |
|
| 1263 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
| 1264 | + $heading = 0; |
|
| 1265 | + } |
|
| 1177 | 1266 | |
| 1178 | 1267 | $query = ''; |
| 1179 | 1268 | if ($globalArchive) { |
| 1180 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
| 1269 | + if ($globalDebug) { |
|
| 1270 | + echo '-- Delete previous data -- '; |
|
| 1271 | + } |
|
| 1181 | 1272 | $query .= 'DELETE FROM spotter_live WHERE flightaware_id = :flightaware_id;'; |
| 1182 | 1273 | } |
| 1183 | 1274 | |
@@ -1194,10 +1285,14 @@ discard block |
||
| 1194 | 1285 | return "error : ".$e->getMessage(); |
| 1195 | 1286 | } |
| 1196 | 1287 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 1197 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
| 1288 | + if ($globalDebug) { |
|
| 1289 | + echo '(Add to SBS archive : '; |
|
| 1290 | + } |
|
| 1198 | 1291 | $SpotterArchive = new SpotterArchive($this->db); |
| 1199 | 1292 | $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
| 1200 | - if ($globalDebug) echo $result.')'; |
|
| 1293 | + if ($globalDebug) { |
|
| 1294 | + echo $result.')'; |
|
| 1295 | + } |
|
| 1201 | 1296 | } elseif ($globalDebug && $putinarchive !== true) { |
| 1202 | 1297 | echo '(Not adding to archive)'; |
| 1203 | 1298 | } elseif ($globalDebug && $noarchive === true) { |
@@ -8,7 +8,9 @@ discard block |
||
| 8 | 8 | public function __construct($dbc = null) { |
| 9 | 9 | $Connection = new Connection($dbc); |
| 10 | 10 | $this->db = $Connection->db(); |
| 11 | - if ($this->db === null) die('Error: No DB connection. (MarineLive)'); |
|
| 11 | + if ($this->db === null) { |
|
| 12 | + die('Error: No DB connection. (MarineLive)'); |
|
| 13 | + } |
|
| 12 | 14 | } |
| 13 | 15 | |
| 14 | 16 | |
@@ -30,7 +32,9 @@ discard block |
||
| 30 | 32 | if (isset($filter[0]['source'])) { |
| 31 | 33 | $filters = array_merge($filters,$filter); |
| 32 | 34 | } |
| 33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 35 | + if (is_array($globalFilter)) { |
|
| 36 | + $filter = array_merge($filter,$globalFilter); |
|
| 37 | + } |
|
| 34 | 38 | $filter_query_join = ''; |
| 35 | 39 | $filter_query_where = ''; |
| 36 | 40 | foreach($filters as $flt) { |
@@ -83,8 +87,11 @@ discard block |
||
| 83 | 87 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 84 | 88 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 85 | 89 | } |
| 86 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 87 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 90 | + if ($filter_query_where == '' && $where) { |
|
| 91 | + $filter_query_where = ' WHERE'; |
|
| 92 | + } elseif ($filter_query_where != '' && $and) { |
|
| 93 | + $filter_query_where .= ' AND'; |
|
| 94 | + } |
|
| 88 | 95 | if ($filter_query_where != '') { |
| 89 | 96 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 90 | 97 | } |
@@ -125,9 +132,13 @@ discard block |
||
| 125 | 132 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
| 126 | 133 | } |
| 127 | 134 | } |
| 128 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
| 135 | + if ($orderby_query == '') { |
|
| 136 | + $orderby_query= ' ORDER BY date DESC'; |
|
| 137 | + } |
|
| 129 | 138 | |
| 130 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 139 | + if (!isset($globalLiveInterval)) { |
|
| 140 | + $globalLiveInterval = '200'; |
|
| 141 | + } |
|
| 131 | 142 | if ($globalDBdriver == 'mysql') { |
| 132 | 143 | //$query = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate"; |
| 133 | 144 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -152,7 +163,9 @@ discard block |
||
| 152 | 163 | |
| 153 | 164 | $filter_query = $this->getFilter($filter,true,true); |
| 154 | 165 | |
| 155 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 166 | + if (!isset($globalLiveInterval)) { |
|
| 167 | + $globalLiveInterval = '200'; |
|
| 168 | + } |
|
| 156 | 169 | if ($globalDBdriver == 'mysql') { |
| 157 | 170 | $query = 'SELECT marine_live.mmsi, marine_live.ident, marine_live.type,marine_live.fammarine_id, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
| 158 | 171 | FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query." marine_live.latitude <> 0 AND marine_live.longitude <> 0"; |
@@ -193,48 +206,72 @@ discard block |
||
| 193 | 206 | } |
| 194 | 207 | $filter_query = $this->getFilter($filter,true,true); |
| 195 | 208 | |
| 196 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 197 | - if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
|
| 209 | + if (!isset($globalLiveInterval)) { |
|
| 210 | + $globalLiveInterval = '200'; |
|
| 211 | + } |
|
| 212 | + if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') { |
|
| 213 | + $globalMap3DMarinesLimit = '300'; |
|
| 214 | + } |
|
| 198 | 215 | if ($globalDBdriver == 'mysql') { |
| 199 | 216 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 200 | 217 | $query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source |
| 201 | 218 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
| 202 | - if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 219 | + if ($usecoord) { |
|
| 220 | + $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 221 | + } |
|
| 203 | 222 | $query .= "UNION |
| 204 | 223 | SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
| 205 | 224 | FROM marine_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date"; |
| 206 | - if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 225 | + if ($usecoord) { |
|
| 226 | + $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 227 | + } |
|
| 207 | 228 | $query .= ") AS marine |
| 208 | 229 | WHERE latitude <> '0' AND longitude <> '0' |
| 209 | 230 | ORDER BY fammarine_id, date"; |
| 210 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 231 | + if ($limit) { |
|
| 232 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 233 | + } |
|
| 211 | 234 | } else { |
| 212 | 235 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
| 213 | 236 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date "; |
| 214 | - if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 237 | + if ($usecoord) { |
|
| 238 | + $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 239 | + } |
|
| 215 | 240 | $query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 216 | 241 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 217 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 242 | + if ($limit) { |
|
| 243 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 244 | + } |
|
| 218 | 245 | } |
| 219 | 246 | } else { |
| 220 | 247 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 221 | 248 | $query = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source |
| 222 | 249 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
| 223 | - if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 250 | + if ($usecoord) { |
|
| 251 | + $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 252 | + } |
|
| 224 | 253 | $query .= "UNION |
| 225 | 254 | SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
| 226 | 255 | FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date"; |
| 227 | - if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 256 | + if ($usecoord) { |
|
| 257 | + $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 258 | + } |
|
| 228 | 259 | $query .= ") AS marine WHERE latitude <> '0' AND longitude <> '0' "; |
| 229 | 260 | $query .= "ORDER BY fammarine_id, date"; |
| 230 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 261 | + if ($limit) { |
|
| 262 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 263 | + } |
|
| 231 | 264 | } else { |
| 232 | 265 | $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
| 233 | 266 | FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date "; |
| 234 | - if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 267 | + if ($usecoord) { |
|
| 268 | + $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 269 | + } |
|
| 235 | 270 | $query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 236 | 271 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 237 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 272 | + if ($limit) { |
|
| 273 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 274 | + } |
|
| 238 | 275 | } |
| 239 | 276 | } |
| 240 | 277 | try { |
@@ -259,7 +296,9 @@ discard block |
||
| 259 | 296 | global $globalDBdriver, $globalLiveInterval; |
| 260 | 297 | $filter_query = $this->getFilter($filter,true,true); |
| 261 | 298 | |
| 262 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 299 | + if (!isset($globalLiveInterval)) { |
|
| 300 | + $globalLiveInterval = '200'; |
|
| 301 | + } |
|
| 263 | 302 | if ($globalDBdriver == 'mysql') { |
| 264 | 303 | $query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
| 265 | 304 | } else { |
@@ -287,7 +326,9 @@ discard block |
||
| 287 | 326 | { |
| 288 | 327 | global $globalDBdriver, $globalLiveInterval; |
| 289 | 328 | $Marine = new Marine($this->db); |
| 290 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 329 | + if (!isset($globalLiveInterval)) { |
|
| 330 | + $globalLiveInterval = '200'; |
|
| 331 | + } |
|
| 291 | 332 | $filter_query = $this->getFilter($filter); |
| 292 | 333 | |
| 293 | 334 | if (is_array($coord)) { |
@@ -295,7 +336,9 @@ discard block |
||
| 295 | 336 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 296 | 337 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 297 | 338 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 298 | - } else return array(); |
|
| 339 | + } else { |
|
| 340 | + return array(); |
|
| 341 | + } |
|
| 299 | 342 | if ($globalDBdriver == 'mysql') { |
| 300 | 343 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query; |
| 301 | 344 | } else { |
@@ -315,7 +358,9 @@ discard block |
||
| 315 | 358 | { |
| 316 | 359 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 317 | 360 | $Marine = new Marine($this->db); |
| 318 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 361 | + if (!isset($globalLiveInterval)) { |
|
| 362 | + $globalLiveInterval = '200'; |
|
| 363 | + } |
|
| 319 | 364 | $filter_query = $this->getFilter($filter,true,true); |
| 320 | 365 | |
| 321 | 366 | if (is_array($coord)) { |
@@ -323,7 +368,9 @@ discard block |
||
| 323 | 368 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 324 | 369 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 325 | 370 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 326 | - } else return array(); |
|
| 371 | + } else { |
|
| 372 | + return array(); |
|
| 373 | + } |
|
| 327 | 374 | /* |
| 328 | 375 | if ($globalDBdriver == 'mysql') { |
| 329 | 376 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
@@ -546,11 +593,15 @@ discard block |
||
| 546 | 593 | //$query = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date'; |
| 547 | 594 | if ($globalDBdriver == 'mysql') { |
| 548 | 595 | $query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id'; |
| 549 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 596 | + if ($liveinterval) { |
|
| 597 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 598 | + } |
|
| 550 | 599 | $query .= ' ORDER BY date'; |
| 551 | 600 | } else { |
| 552 | 601 | $query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id'; |
| 553 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 602 | + if ($liveinterval) { |
|
| 603 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 604 | + } |
|
| 554 | 605 | $query .= ' ORDER BY date'; |
| 555 | 606 | } |
| 556 | 607 | |
@@ -645,7 +696,9 @@ discard block |
||
| 645 | 696 | $i++; |
| 646 | 697 | $j++; |
| 647 | 698 | if ($j == 30) { |
| 648 | - if ($globalDebug) echo "."; |
|
| 699 | + if ($globalDebug) { |
|
| 700 | + echo "."; |
|
| 701 | + } |
|
| 649 | 702 | try { |
| 650 | 703 | |
| 651 | 704 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -925,7 +978,9 @@ discard block |
||
| 925 | 978 | { |
| 926 | 979 | return false; |
| 927 | 980 | } |
| 928 | - } else return ''; |
|
| 981 | + } else { |
|
| 982 | + return ''; |
|
| 983 | + } |
|
| 929 | 984 | |
| 930 | 985 | if ($longitude != '') |
| 931 | 986 | { |
@@ -933,7 +988,9 @@ discard block |
||
| 933 | 988 | { |
| 934 | 989 | return false; |
| 935 | 990 | } |
| 936 | - } else return ''; |
|
| 991 | + } else { |
|
| 992 | + return ''; |
|
| 993 | + } |
|
| 937 | 994 | |
| 938 | 995 | |
| 939 | 996 | if ($heading != '') |
@@ -942,7 +999,9 @@ discard block |
||
| 942 | 999 | { |
| 943 | 1000 | return false; |
| 944 | 1001 | } |
| 945 | - } else $heading = 0; |
|
| 1002 | + } else { |
|
| 1003 | + $heading = 0; |
|
| 1004 | + } |
|
| 946 | 1005 | |
| 947 | 1006 | if ($groundspeed != '') |
| 948 | 1007 | { |
@@ -950,9 +1009,13 @@ discard block |
||
| 950 | 1009 | { |
| 951 | 1010 | return false; |
| 952 | 1011 | } |
| 953 | - } else $groundspeed = 0; |
|
| 1012 | + } else { |
|
| 1013 | + $groundspeed = 0; |
|
| 1014 | + } |
|
| 954 | 1015 | date_default_timezone_set('UTC'); |
| 955 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
| 1016 | + if ($date == '') { |
|
| 1017 | + $date = date("Y-m-d H:i:s", time()); |
|
| 1018 | + } |
|
| 956 | 1019 | |
| 957 | 1020 | |
| 958 | 1021 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -973,15 +1036,27 @@ discard block |
||
| 973 | 1036 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 974 | 1037 | $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
| 975 | 1038 | $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
| 976 | - if ($typeid == '') $typeid = NULL; |
|
| 977 | - if ($statusid == '') $statusid = NULL; |
|
| 1039 | + if ($typeid == '') { |
|
| 1040 | + $typeid = NULL; |
|
| 1041 | + } |
|
| 1042 | + if ($statusid == '') { |
|
| 1043 | + $statusid = NULL; |
|
| 1044 | + } |
|
| 978 | 1045 | |
| 979 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 980 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 981 | - if ($arrival_date == '') $arrival_date = NULL; |
|
| 1046 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
| 1047 | + $groundspeed = 0; |
|
| 1048 | + } |
|
| 1049 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
| 1050 | + $heading = 0; |
|
| 1051 | + } |
|
| 1052 | + if ($arrival_date == '') { |
|
| 1053 | + $arrival_date = NULL; |
|
| 1054 | + } |
|
| 982 | 1055 | $query = ''; |
| 983 | 1056 | if ($globalArchive) { |
| 984 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
| 1057 | + if ($globalDebug) { |
|
| 1058 | + echo '-- Delete previous data -- '; |
|
| 1059 | + } |
|
| 985 | 1060 | $query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;'; |
| 986 | 1061 | } |
| 987 | 1062 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date) |
@@ -996,10 +1071,14 @@ discard block |
||
| 996 | 1071 | } |
| 997 | 1072 | |
| 998 | 1073 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 999 | - if ($globalDebug) echo '(Add to Marine archive : '; |
|
| 1074 | + if ($globalDebug) { |
|
| 1075 | + echo '(Add to Marine archive : '; |
|
| 1076 | + } |
|
| 1000 | 1077 | $MarineArchive = new MarineArchive($this->db); |
| 1001 | 1078 | $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country); |
| 1002 | - if ($globalDebug) echo $result.')'; |
|
| 1079 | + if ($globalDebug) { |
|
| 1080 | + echo $result.')'; |
|
| 1081 | + } |
|
| 1003 | 1082 | } |
| 1004 | 1083 | return "success"; |
| 1005 | 1084 | } |
@@ -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,16 +324,25 @@ 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": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
| 274 | - else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
| 327 | + if ($compress) { |
|
| 328 | + $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
| 329 | + } else { |
|
| 330 | + $output .= '"callsign": '.json_encode(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 | + } |
|
| 279 | 339 | } |
| 280 | 340 | if (isset($spotter_item['registration'])) { |
| 281 | - if ($compress) $output .= '"reg": '.json_encode($spotter_item['registration']).','; |
|
| 282 | - else $output .= '"registration": '.json_encode($spotter_item['registration']).','; |
|
| 341 | + if ($compress) { |
|
| 342 | + $output .= '"reg": '.json_encode($spotter_item['registration']).','; |
|
| 343 | + } else { |
|
| 344 | + $output .= '"registration": '.json_encode($spotter_item['registration']).','; |
|
| 345 | + } |
|
| 283 | 346 | } |
| 284 | 347 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
| 285 | 348 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
@@ -290,20 +353,30 @@ discard block |
||
| 290 | 353 | $output .= '"aircraft_name": "NA",'; |
| 291 | 354 | } |
| 292 | 355 | if (isset($spotter_item['aircraft_icao'])) { |
| 293 | - if ($compress) $output .= '"ai": "'.$spotter_item['aircraft_icao'].'",'; |
|
| 294 | - else $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
| 356 | + if ($compress) { |
|
| 357 | + $output .= '"ai": "'.$spotter_item['aircraft_icao'].'",'; |
|
| 358 | + } else { |
|
| 359 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
| 360 | + } |
|
| 295 | 361 | } |
| 296 | 362 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) { |
| 297 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
| 298 | - else { |
|
| 363 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
| 364 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 365 | + } else { |
|
| 299 | 366 | $aircraft_icao = $spotter_item['aircraft_icao']; |
| 300 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
| 301 | - else { |
|
| 367 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
| 368 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
| 369 | + } else { |
|
| 302 | 370 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
| 303 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 304 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 305 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 306 | - else $spotter_item['aircraft_shadow'] = ''; |
|
| 371 | + if (count($aircraft_info) > 0) { |
|
| 372 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 373 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
| 374 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 375 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
| 376 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 377 | + } else { |
|
| 378 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 379 | + } |
|
| 307 | 380 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
| 308 | 381 | } |
| 309 | 382 | } |
@@ -311,73 +384,139 @@ discard block |
||
| 311 | 384 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
| 312 | 385 | if ($tracker) { |
| 313 | 386 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
| 314 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
| 315 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 387 | + if ($compress) { |
|
| 388 | + $output .= '"as": "ambulance.png",'; |
|
| 389 | + } else { |
|
| 390 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 391 | + } |
|
| 316 | 392 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
| 317 | - if ($compress) $output .= '"as": "police.png",'; |
|
| 318 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
| 393 | + if ($compress) { |
|
| 394 | + $output .= '"as": "police.png",'; |
|
| 395 | + } else { |
|
| 396 | + $output .= '"aircraft_shadow": "police.png",'; |
|
| 397 | + } |
|
| 319 | 398 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
| 320 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 321 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 399 | + if ($compress) { |
|
| 400 | + $output .= '"as": "ship.png",'; |
|
| 401 | + } else { |
|
| 402 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 403 | + } |
|
| 322 | 404 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
| 323 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 324 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 405 | + if ($compress) { |
|
| 406 | + $output .= '"as": "ship.png",'; |
|
| 407 | + } else { |
|
| 408 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 409 | + } |
|
| 325 | 410 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
| 326 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 327 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 411 | + if ($compress) { |
|
| 412 | + $output .= '"as": "ship.png",'; |
|
| 413 | + } else { |
|
| 414 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 415 | + } |
|
| 328 | 416 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
| 329 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 330 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 417 | + if ($compress) { |
|
| 418 | + $output .= '"as": "truck.png",'; |
|
| 419 | + } else { |
|
| 420 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 421 | + } |
|
| 331 | 422 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
| 332 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 333 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 423 | + if ($compress) { |
|
| 424 | + $output .= '"as": "truck.png",'; |
|
| 425 | + } else { |
|
| 426 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 427 | + } |
|
| 334 | 428 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
| 335 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 336 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 429 | + if ($compress) { |
|
| 430 | + $output .= '"as": "aircraft.png",'; |
|
| 431 | + } else { |
|
| 432 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 433 | + } |
|
| 337 | 434 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
| 338 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 339 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 435 | + if ($compress) { |
|
| 436 | + $output .= '"as": "aircraft.png",'; |
|
| 437 | + } else { |
|
| 438 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 439 | + } |
|
| 340 | 440 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
| 341 | - if ($compress) $output .= '"as": "helico.png",'; |
|
| 342 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
| 441 | + if ($compress) { |
|
| 442 | + $output .= '"as": "helico.png",'; |
|
| 443 | + } else { |
|
| 444 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
| 445 | + } |
|
| 343 | 446 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
| 344 | - if ($compress) $output .= '"as": "rail.png",'; |
|
| 345 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
| 447 | + if ($compress) { |
|
| 448 | + $output .= '"as": "rail.png",'; |
|
| 449 | + } else { |
|
| 450 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
| 451 | + } |
|
| 346 | 452 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
| 347 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
| 348 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 453 | + if ($compress) { |
|
| 454 | + $output .= '"as": "firetruck.png",'; |
|
| 455 | + } else { |
|
| 456 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 457 | + } |
|
| 349 | 458 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
| 350 | - if ($compress) $output .= '"as": "bus.png",'; |
|
| 351 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
| 459 | + if ($compress) { |
|
| 460 | + $output .= '"as": "bus.png",'; |
|
| 461 | + } else { |
|
| 462 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
| 463 | + } |
|
| 352 | 464 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
| 353 | - if ($compress) $output .= '"as": "phone.png",'; |
|
| 354 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
| 465 | + if ($compress) { |
|
| 466 | + $output .= '"as": "phone.png",'; |
|
| 467 | + } else { |
|
| 468 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
| 469 | + } |
|
| 355 | 470 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
| 356 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
| 357 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 471 | + if ($compress) { |
|
| 472 | + $output .= '"as": "jogger.png",'; |
|
| 473 | + } else { |
|
| 474 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 475 | + } |
|
| 358 | 476 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
| 359 | - if ($compress) $output .= '"as": "bike.png",'; |
|
| 360 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
| 477 | + if ($compress) { |
|
| 478 | + $output .= '"as": "bike.png",'; |
|
| 479 | + } else { |
|
| 480 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
| 481 | + } |
|
| 361 | 482 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
| 362 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
| 363 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 483 | + if ($compress) { |
|
| 484 | + $output .= '"as": "motorcycle.png",'; |
|
| 485 | + } else { |
|
| 486 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 487 | + } |
|
| 364 | 488 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
| 365 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
| 366 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 489 | + if ($compress) { |
|
| 490 | + $output .= '"as": "balloon.png",'; |
|
| 491 | + } else { |
|
| 492 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 493 | + } |
|
| 367 | 494 | } else { |
| 368 | - if ($compress) $output .= '"as": "car.png",'; |
|
| 369 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
| 495 | + if ($compress) { |
|
| 496 | + $output .= '"as": "car.png",'; |
|
| 497 | + } else { |
|
| 498 | + $output .= '"aircraft_shadow": "car.png",'; |
|
| 499 | + } |
|
| 370 | 500 | } |
| 371 | 501 | } elseif ($marine) { |
| 372 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 373 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 502 | + if ($compress) { |
|
| 503 | + $output .= '"as": "ship.png",'; |
|
| 504 | + } else { |
|
| 505 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 506 | + } |
|
| 374 | 507 | } else { |
| 375 | - if ($compress) $output .= '"as": "default.png",'; |
|
| 376 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
| 508 | + if ($compress) { |
|
| 509 | + $output .= '"as": "default.png",'; |
|
| 510 | + } else { |
|
| 511 | + $output .= '"aircraft_shadow": "default.png",'; |
|
| 512 | + } |
|
| 377 | 513 | } |
| 378 | 514 | } else { |
| 379 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 380 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 515 | + if ($compress) { |
|
| 516 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 517 | + } else { |
|
| 518 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 519 | + } |
|
| 381 | 520 | } |
| 382 | 521 | if (isset($spotter_item['airline_name'])) { |
| 383 | 522 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -385,8 +524,11 @@ discard block |
||
| 385 | 524 | $output .= '"airline_name": "NA",'; |
| 386 | 525 | } |
| 387 | 526 | if (isset($spotter_item['departure_airport'])) { |
| 388 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 389 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 527 | + if ($compress) { |
|
| 528 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 529 | + } else { |
|
| 530 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 531 | + } |
|
| 390 | 532 | } |
| 391 | 533 | if (isset($spotter_item['departure_airport_city'])) { |
| 392 | 534 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -398,8 +540,11 @@ discard block |
||
| 398 | 540 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
| 399 | 541 | } |
| 400 | 542 | if (isset($spotter_item['arrival_airport'])) { |
| 401 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 402 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 543 | + if ($compress) { |
|
| 544 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 545 | + } else { |
|
| 546 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 547 | + } |
|
| 403 | 548 | } |
| 404 | 549 | if (isset($spotter_item['arrival_airport_city'])) { |
| 405 | 550 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -418,11 +563,17 @@ discard block |
||
| 418 | 563 | } |
| 419 | 564 | |
| 420 | 565 | if (isset($spotter_item['real_altitude'])) { |
| 421 | - if ($compress) $output .= '"a": "'.($spotter_item['real_altitude']/100).'",'; |
|
| 422 | - else $output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",'; |
|
| 566 | + if ($compress) { |
|
| 567 | + $output .= '"a": "'.($spotter_item['real_altitude']/100).'",'; |
|
| 568 | + } else { |
|
| 569 | + $output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",'; |
|
| 570 | + } |
|
| 423 | 571 | } elseif (isset($spotter_item['altitude'])) { |
| 424 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 425 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 572 | + if ($compress) { |
|
| 573 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 574 | + } else { |
|
| 575 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 576 | + } |
|
| 426 | 577 | } |
| 427 | 578 | |
| 428 | 579 | $heading = $spotter_item['heading']; |
@@ -446,19 +597,24 @@ discard block |
||
| 446 | 597 | } |
| 447 | 598 | } |
| 448 | 599 | |
| 449 | - if ($compress)$output .= '"h": "'.$heading.'",'; |
|
| 450 | - else $output .= '"heading": "'.$heading.'",'; |
|
| 600 | + if ($compress) { |
|
| 601 | + $output .= '"h": "'.$heading.'",'; |
|
| 602 | + } else { |
|
| 603 | + $output .= '"heading": "'.$heading.'",'; |
|
| 604 | + } |
|
| 451 | 605 | if ($currenttime != '') { |
| 452 | 606 | if (strtotime($spotter_item['date']) < $currenttime) { |
| 453 | 607 | if (isset($archivespeed)) { |
| 454 | 608 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
| 455 | 609 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 456 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 457 | - else { |
|
| 610 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 611 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 612 | + } else { |
|
| 458 | 613 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
| 459 | 614 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 460 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 461 | - else { |
|
| 615 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 616 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 617 | + } else { |
|
| 462 | 618 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
| 463 | 619 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 464 | 620 | } |
@@ -466,12 +622,14 @@ discard block |
||
| 466 | 622 | } elseif ($usenextlatlon) { |
| 467 | 623 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
| 468 | 624 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 469 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 470 | - else { |
|
| 625 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 626 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 627 | + } else { |
|
| 471 | 628 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
| 472 | 629 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 473 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 474 | - else { |
|
| 630 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 631 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 632 | + } else { |
|
| 475 | 633 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
| 476 | 634 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 477 | 635 | } |
@@ -510,7 +668,9 @@ discard block |
||
| 510 | 668 | } |
| 511 | 669 | } |
| 512 | 670 | |
| 513 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
| 671 | + if (!$min) { |
|
| 672 | + $output .= '"image": "'.$image.'",'; |
|
| 673 | + } |
|
| 514 | 674 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
| 515 | 675 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
| 516 | 676 | } |
@@ -518,8 +678,11 @@ discard block |
||
| 518 | 678 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
| 519 | 679 | } |
| 520 | 680 | if (isset($spotter_item['squawk'])) { |
| 521 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 522 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 681 | + if ($compress) { |
|
| 682 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 683 | + } else { |
|
| 684 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 685 | + } |
|
| 523 | 686 | } |
| 524 | 687 | if (isset($spotter_item['squawk_usage'])) { |
| 525 | 688 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -538,14 +701,23 @@ discard block |
||
| 538 | 701 | } |
| 539 | 702 | // type when not aircraft ? |
| 540 | 703 | if (isset($spotter_item['type'])) { |
| 541 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
| 542 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
| 704 | + if ($compress) { |
|
| 705 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
| 706 | + } else { |
|
| 707 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
| 708 | + } |
|
| 543 | 709 | } elseif ($marine) { |
| 544 | - if ($compress) $output .= '"t": "ship"'; |
|
| 545 | - else $output .= '"type": "ship"'; |
|
| 710 | + if ($compress) { |
|
| 711 | + $output .= '"t": "ship"'; |
|
| 712 | + } else { |
|
| 713 | + $output .= '"type": "ship"'; |
|
| 714 | + } |
|
| 546 | 715 | } else { |
| 547 | - if ($compress) $output .= '"t": "aircraft"'; |
|
| 548 | - else $output .= '"type": "aircraft"'; |
|
| 716 | + if ($compress) { |
|
| 717 | + $output .= '"t": "aircraft"'; |
|
| 718 | + } else { |
|
| 719 | + $output .= '"type": "aircraft"'; |
|
| 720 | + } |
|
| 549 | 721 | } |
| 550 | 722 | $output .= '},'; |
| 551 | 723 | $output .= '"geometry": {'; |
@@ -553,15 +725,19 @@ discard block |
||
| 553 | 725 | $output .= '"coordinates": ['; |
| 554 | 726 | if ($currenttime != '') { |
| 555 | 727 | if (strtotime($spotter_item['date']) < $currenttime) { |
| 556 | - if (!isset($archivespeed)) $archivespeed = 1; |
|
| 728 | + if (!isset($archivespeed)) { |
|
| 729 | + $archivespeed = 1; |
|
| 730 | + } |
|
| 557 | 731 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
| 558 | 732 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 559 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
| 560 | - else { |
|
| 733 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 734 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
| 735 | + } else { |
|
| 561 | 736 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
| 562 | 737 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 563 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
| 564 | - else { |
|
| 738 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 739 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
| 740 | + } else { |
|
| 565 | 741 | $output .= $spotter_item['longitude'].', '; |
| 566 | 742 | $output .= $spotter_item['latitude']; |
| 567 | 743 | } |
@@ -639,7 +815,9 @@ discard block |
||
| 639 | 815 | } |
| 640 | 816 | */ |
| 641 | 817 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
| 642 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
| 818 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
| 819 | + $history = $_COOKIE['history']; |
|
| 820 | + } |
|
| 643 | 821 | |
| 644 | 822 | if ( |
| 645 | 823 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -709,8 +887,11 @@ discard block |
||
| 709 | 887 | $output_history .= ']}},'; |
| 710 | 888 | $output .= $output_history; |
| 711 | 889 | } |
| 712 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 713 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 890 | + if ($compress) { |
|
| 891 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 892 | + } else { |
|
| 893 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 894 | + } |
|
| 714 | 895 | } |
| 715 | 896 | $output_history .= '['; |
| 716 | 897 | $output_history .= $spotter_history['longitude'].', '; |
@@ -731,10 +912,15 @@ discard block |
||
| 731 | 912 | if ($d == false) { |
| 732 | 913 | if ($compress) { |
| 733 | 914 | $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",'; |
| 734 | - 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>",'; |
|
| 735 | - 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>",'; |
|
| 915 | + if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') { |
|
| 916 | + $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>",'; |
|
| 917 | + } elseif (isset($spotter_history_array[0]['mapmatching_engine'])) { |
|
| 918 | + $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
| 919 | + } |
|
| 736 | 920 | $output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
| 737 | - } else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 921 | + } else { |
|
| 922 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 923 | + } |
|
| 738 | 924 | $d = true; |
| 739 | 925 | } |
| 740 | 926 | $output_history .= '['; |
@@ -757,7 +943,9 @@ discard block |
||
| 757 | 943 | $output_historyd = '['; |
| 758 | 944 | $output_historyd .= $spotter_item['longitude'].', '; |
| 759 | 945 | $output_historyd .= $spotter_item['latitude']; |
| 760 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 946 | + if (isset($spotter_history['altitude'])) { |
|
| 947 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 948 | + } |
|
| 761 | 949 | $output_historyd .= '],'; |
| 762 | 950 | //$output_history = $output_historyd.$output_history; |
| 763 | 951 | $output_history = $output_history.$output_historyd; |
@@ -784,8 +972,11 @@ discard block |
||
| 784 | 972 | && $spotter_item['arrival_airport'] != 'NA' |
| 785 | 973 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
| 786 | 974 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
| 787 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 788 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 975 | + if ($compress) { |
|
| 976 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 977 | + } else { |
|
| 978 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 979 | + } |
|
| 789 | 980 | if (isset($spotter_item['departure_airport_latitude'])) { |
| 790 | 981 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
| 791 | 982 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -818,8 +1009,11 @@ discard block |
||
| 818 | 1009 | || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) |
| 819 | 1010 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
| 820 | 1011 | $havedata = false; |
| 821 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 822 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 1012 | + if ($compress) { |
|
| 1013 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 1014 | + } else { |
|
| 1015 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 1016 | + } |
|
| 823 | 1017 | |
| 824 | 1018 | //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
| 825 | 1019 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -844,7 +1038,9 @@ discard block |
||
| 844 | 1038 | $output_dest = substr($output_dest, 0, -1); |
| 845 | 1039 | } |
| 846 | 1040 | $output_dest .= ']}},'; |
| 847 | - if ($havedata) $output .= $output_dest; |
|
| 1041 | + if ($havedata) { |
|
| 1042 | + $output .= $output_dest; |
|
| 1043 | + } |
|
| 848 | 1044 | unset($output_dest); |
| 849 | 1045 | } |
| 850 | 1046 | } |
@@ -852,7 +1048,9 @@ discard block |
||
| 852 | 1048 | $output .= ']'; |
| 853 | 1049 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 854 | 1050 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
| 855 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 1051 | + if (isset($begindate)) { |
|
| 1052 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 1053 | + } |
|
| 856 | 1054 | $output .= '"fc": "'.$j.'"'; |
| 857 | 1055 | } else { |
| 858 | 1056 | $output .= '"features": '; |
@@ -14,13 +14,17 @@ discard block |
||
| 14 | 14 | require_once(dirname(__FILE__).'/../require/class.Source.php'); |
| 15 | 15 | require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
| 16 | 16 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
| 17 | -if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 17 | +if (isset($globalTracker) && $globalTracker) { |
|
| 18 | + require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 19 | +} |
|
| 18 | 20 | if (isset($globalMarine) && $globalMarine) { |
| 19 | 21 | require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
| 20 | 22 | require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
| 21 | 23 | } |
| 22 | 24 | |
| 23 | -if (!isset($globalDebug)) $globalDebug = FALSE; |
|
| 25 | +if (!isset($globalDebug)) { |
|
| 26 | + $globalDebug = FALSE; |
|
| 27 | +} |
|
| 24 | 28 | |
| 25 | 29 | // Check if schema is at latest version |
| 26 | 30 | $Connection = new Connection(); |
@@ -59,66 +63,107 @@ discard block |
||
| 59 | 63 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
| 60 | 64 | if (isset($options['s'])) { |
| 61 | 65 | $globalSources = array(); |
| 62 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
| 63 | - else $globalSources[] = array('host' => $options['s']); |
|
| 64 | -} elseif (isset($options['source'])) { |
|
| 66 | + if (isset($options['format'])) { |
|
| 67 | + $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
| 68 | + } else { |
|
| 69 | + $globalSources[] = array('host' => $options['s']); |
|
| 70 | + } |
|
| 71 | + } elseif (isset($options['source'])) { |
|
| 65 | 72 | $globalSources = array(); |
| 66 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
| 67 | - else $globalSources[] = array('host' => $options['source']); |
|
| 68 | -} |
|
| 73 | + if (isset($options['format'])) { |
|
| 74 | + $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
| 75 | + } else { |
|
| 76 | + $globalSources[] = array('host' => $options['source']); |
|
| 77 | + } |
|
| 78 | + } |
|
| 69 | 79 | if (isset($options['aprsserverhost'])) { |
| 70 | 80 | $globalServerAPRS = TRUE; |
| 71 | 81 | $globalServerAPRShost = $options['aprsserverhost']; |
| 72 | 82 | } |
| 73 | -if (isset($options['aprsserverport'])) $globalServerAPRSport = $options['aprsserverport']; |
|
| 74 | -if (isset($options['aprsserverssid'])) $globalServerAPRSssid = $options['aprsserverssid']; |
|
| 75 | -if (isset($options['aprsserverpass'])) $globalServerAPRSpass = $options['aprsserverpass']; |
|
| 76 | -if (isset($options['noaprsserver'])) $globalServerAPRS = FALSE; |
|
| 83 | +if (isset($options['aprsserverport'])) { |
|
| 84 | + $globalServerAPRSport = $options['aprsserverport']; |
|
| 85 | +} |
|
| 86 | +if (isset($options['aprsserverssid'])) { |
|
| 87 | + $globalServerAPRSssid = $options['aprsserverssid']; |
|
| 88 | +} |
|
| 89 | +if (isset($options['aprsserverpass'])) { |
|
| 90 | + $globalServerAPRSpass = $options['aprsserverpass']; |
|
| 91 | +} |
|
| 92 | +if (isset($options['noaprsserver'])) { |
|
| 93 | + $globalServerAPRS = FALSE; |
|
| 94 | +} |
|
| 77 | 95 | if (isset($options['enable-aircraft'])) { |
| 78 | - if ($globalDebug) echo 'Enable Aircraft mode'."\n"; |
|
| 96 | + if ($globalDebug) { |
|
| 97 | + echo 'Enable Aircraft mode'."\n"; |
|
| 98 | + } |
|
| 79 | 99 | $globalAircraft = TRUE; |
| 80 | 100 | } |
| 81 | 101 | if (isset($options['disable-aircraft'])) { |
| 82 | - if ($globalDebug) echo 'Disable Aircraft mode'."\n"; |
|
| 102 | + if ($globalDebug) { |
|
| 103 | + echo 'Disable Aircraft mode'."\n"; |
|
| 104 | + } |
|
| 83 | 105 | $globalAircraft = FALSE; |
| 84 | 106 | } |
| 85 | 107 | if (isset($options['enable-tracker'])) { |
| 86 | - if ($globalDebug) echo 'Enable Tracker mode'."\n"; |
|
| 108 | + if ($globalDebug) { |
|
| 109 | + echo 'Enable Tracker mode'."\n"; |
|
| 110 | + } |
|
| 87 | 111 | $globalTracker = TRUE; |
| 88 | 112 | } |
| 89 | 113 | if (isset($options['disable-tracker'])) { |
| 90 | - if ($globalDebug) echo 'Disable Tracker mode'."\n"; |
|
| 114 | + if ($globalDebug) { |
|
| 115 | + echo 'Disable Tracker mode'."\n"; |
|
| 116 | + } |
|
| 91 | 117 | $globalTracker = FALSE; |
| 92 | 118 | } |
| 93 | 119 | if (isset($options['enable-marine'])) { |
| 94 | - if ($globalDebug) echo 'Enable Marine mode'."\n"; |
|
| 120 | + if ($globalDebug) { |
|
| 121 | + echo 'Enable Marine mode'."\n"; |
|
| 122 | + } |
|
| 95 | 123 | $globalMarine = TRUE; |
| 96 | 124 | } |
| 97 | 125 | if (isset($options['disable-marine'])) { |
| 98 | - if ($globalDebug) echo 'Disable Marine mode'."\n"; |
|
| 126 | + if ($globalDebug) { |
|
| 127 | + echo 'Disable Marine mode'."\n"; |
|
| 128 | + } |
|
| 99 | 129 | $globalMarine = FALSE; |
| 100 | 130 | } |
| 101 | -if (isset($options['nodaemon'])) $globalDaemon = FALSE; |
|
| 102 | -if (isset($options['server'])) $globalServer = TRUE; |
|
| 103 | -if (isset($options['idsource'])) $id_source = $options['idsource']; |
|
| 104 | -else $id_source = 1; |
|
| 131 | +if (isset($options['nodaemon'])) { |
|
| 132 | + $globalDaemon = FALSE; |
|
| 133 | +} |
|
| 134 | +if (isset($options['server'])) { |
|
| 135 | + $globalServer = TRUE; |
|
| 136 | +} |
|
| 137 | +if (isset($options['idsource'])) { |
|
| 138 | + $id_source = $options['idsource']; |
|
| 139 | +} else { |
|
| 140 | + $id_source = 1; |
|
| 141 | +} |
|
| 105 | 142 | if (isset($globalServer) && $globalServer) { |
| 106 | - if ($globalDebug) echo "Using Server Mode\n"; |
|
| 143 | + if ($globalDebug) { |
|
| 144 | + echo "Using Server Mode\n"; |
|
| 145 | + } |
|
| 107 | 146 | $SI=new SpotterServer(); |
| 108 | 147 | /* |
| 109 | 148 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
| 110 | 149 | $SI = new adsb2aprs(); |
| 111 | 150 | $SI->connect(); |
| 112 | 151 | */ |
| 113 | -} else $SI=new SpotterImport($Connection->db); |
|
| 152 | +} else { |
|
| 153 | + $SI=new SpotterImport($Connection->db); |
|
| 154 | +} |
|
| 114 | 155 | |
| 115 | -if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 156 | +if (isset($globalTracker) && $globalTracker) { |
|
| 157 | + require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 158 | +} |
|
| 116 | 159 | if (isset($globalMarine) && $globalMarine) { |
| 117 | 160 | require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
| 118 | 161 | require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
| 119 | 162 | } |
| 120 | 163 | |
| 121 | -if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); |
|
| 164 | +if (isset($globalTracker) && $globalTracker) { |
|
| 165 | + $TI = new TrackerImport($Connection->db); |
|
| 166 | +} |
|
| 122 | 167 | if (isset($globalMarine) && $globalMarine) { |
| 123 | 168 | $AIS = new AIS(); |
| 124 | 169 | $MI = new MarineImport($Connection->db); |
@@ -143,7 +188,9 @@ discard block |
||
| 143 | 188 | } |
| 144 | 189 | |
| 145 | 190 | // let's try and connect |
| 146 | -if ($globalDebug) echo "Connecting...\n"; |
|
| 191 | +if ($globalDebug) { |
|
| 192 | + echo "Connecting...\n"; |
|
| 193 | +} |
|
| 147 | 194 | $use_aprs = false; |
| 148 | 195 | $aprs_full = false; |
| 149 | 196 | $reset = 0; |
@@ -152,7 +199,9 @@ discard block |
||
| 152 | 199 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
| 153 | 200 | global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
| 154 | 201 | $reset++; |
| 155 | - if ($globalDebug) echo 'Connect to all...'."\n"; |
|
| 202 | + if ($globalDebug) { |
|
| 203 | + echo 'Connect to all...'."\n"; |
|
| 204 | + } |
|
| 156 | 205 | foreach ($hosts as $id => $value) { |
| 157 | 206 | $host = $value['host']; |
| 158 | 207 | $globalSources[$id]['last_exec'] = 0; |
@@ -162,32 +211,44 @@ discard block |
||
| 162 | 211 | //$formats[$id] = 'deltadbtxt'; |
| 163 | 212 | $globalSources[$id]['format'] = 'deltadbtxt'; |
| 164 | 213 | //$last_exec['deltadbtxt'] = 0; |
| 165 | - if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
| 214 | + if ($globalDebug) { |
|
| 215 | + echo "Connect to deltadb source (".$host.")...\n"; |
|
| 216 | + } |
|
| 166 | 217 | } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
| 167 | 218 | //$formats[$id] = 'vatsimtxt'; |
| 168 | 219 | $globalSources[$id]['format'] = 'vatsimtxt'; |
| 169 | 220 | //$last_exec['vatsimtxt'] = 0; |
| 170 | - if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
| 221 | + if ($globalDebug) { |
|
| 222 | + echo "Connect to vatsim source (".$host.")...\n"; |
|
| 223 | + } |
|
| 171 | 224 | } else if (preg_match('/aircraftlist.json$/i',$host)) { |
| 172 | 225 | //$formats[$id] = 'aircraftlistjson'; |
| 173 | 226 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
| 174 | 227 | //$last_exec['aircraftlistjson'] = 0; |
| 175 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 228 | + if ($globalDebug) { |
|
| 229 | + echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 230 | + } |
|
| 176 | 231 | } else if (preg_match('/aircraft.json$/i',$host)) { |
| 177 | 232 | //$formats[$id] = 'aircraftjson'; |
| 178 | 233 | $globalSources[$id]['format'] = 'aircraftjson'; |
| 179 | 234 | //$last_exec['aircraftlistjson'] = 0; |
| 180 | - if ($globalDebug) echo "Connect to aircraft.json source (".$host.")...\n"; |
|
| 235 | + if ($globalDebug) { |
|
| 236 | + echo "Connect to aircraft.json source (".$host.")...\n"; |
|
| 237 | + } |
|
| 181 | 238 | } else if (preg_match('/aircraft$/i',$host)) { |
| 182 | 239 | //$formats[$id] = 'planefinderclient'; |
| 183 | 240 | $globalSources[$id]['format'] = 'planefinderclient'; |
| 184 | 241 | //$last_exec['aircraftlistjson'] = 0; |
| 185 | - if ($globalDebug) echo "Connect to planefinderclient source (".$host.")...\n"; |
|
| 242 | + if ($globalDebug) { |
|
| 243 | + echo "Connect to planefinderclient source (".$host.")...\n"; |
|
| 244 | + } |
|
| 186 | 245 | } else if (preg_match('/opensky/i',$host)) { |
| 187 | 246 | //$formats[$id] = 'aircraftlistjson'; |
| 188 | 247 | $globalSources[$id]['format'] = 'opensky'; |
| 189 | 248 | //$last_exec['aircraftlistjson'] = 0; |
| 190 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 249 | + if ($globalDebug) { |
|
| 250 | + echo "Connect to opensky source (".$host.")...\n"; |
|
| 251 | + } |
|
| 191 | 252 | /* |
| 192 | 253 | // Disabled for now, site change source format |
| 193 | 254 | } else if (preg_match('/radarvirtuel.com\/list_aircrafts$/i',$host)) { |
@@ -204,7 +265,9 @@ discard block |
||
| 204 | 265 | //$formats[$id] = 'planeupdatefaa'; |
| 205 | 266 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
| 206 | 267 | //$last_exec['planeupdatefaa'] = 0; |
| 207 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 268 | + if ($globalDebug) { |
|
| 269 | + echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 270 | + } |
|
| 208 | 271 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 209 | 272 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 210 | 273 | exit(0); |
@@ -213,37 +276,53 @@ discard block |
||
| 213 | 276 | //$formats[$id] = 'phpvmacars'; |
| 214 | 277 | $globalSources[$id]['format'] = 'phpvmacars'; |
| 215 | 278 | //$last_exec['phpvmacars'] = 0; |
| 216 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 279 | + if ($globalDebug) { |
|
| 280 | + echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 281 | + } |
|
| 217 | 282 | } else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) { |
| 218 | 283 | //$formats[$id] = 'phpvmacars'; |
| 219 | 284 | $globalSources[$id]['format'] = 'vaos'; |
| 220 | 285 | //$last_exec['phpvmacars'] = 0; |
| 221 | - if ($globalDebug) echo "Connect to vaos source (".$host.")...\n"; |
|
| 286 | + if ($globalDebug) { |
|
| 287 | + echo "Connect to vaos source (".$host.")...\n"; |
|
| 288 | + } |
|
| 222 | 289 | } else if (preg_match('/VAM-json.php$/i',$host)) { |
| 223 | 290 | //$formats[$id] = 'phpvmacars'; |
| 224 | 291 | $globalSources[$id]['format'] = 'vam'; |
| 225 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 292 | + if ($globalDebug) { |
|
| 293 | + echo "Connect to Vam source (".$host.")...\n"; |
|
| 294 | + } |
|
| 226 | 295 | } else if (preg_match('/whazzup/i',$host)) { |
| 227 | 296 | //$formats[$id] = 'whazzup'; |
| 228 | 297 | $globalSources[$id]['format'] = 'whazzup'; |
| 229 | 298 | //$last_exec['whazzup'] = 0; |
| 230 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 299 | + if ($globalDebug) { |
|
| 300 | + echo "Connect to whazzup source (".$host.")...\n"; |
|
| 301 | + } |
|
| 231 | 302 | } else if (preg_match('/blitzortung/i',$host)) { |
| 232 | 303 | $globalSources[$id]['format'] = 'blitzortung'; |
| 233 | - if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
|
| 304 | + if ($globalDebug) { |
|
| 305 | + echo "Connect to blitzortung source (".$host.")...\n"; |
|
| 306 | + } |
|
| 234 | 307 | } else if (preg_match('/airwhere/i',$host)) { |
| 235 | 308 | $globalSources[$id]['format'] = 'airwhere'; |
| 236 | - if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
|
| 309 | + if ($globalDebug) { |
|
| 310 | + echo "Connect to airwhere source (".$host.")...\n"; |
|
| 311 | + } |
|
| 237 | 312 | } else if (preg_match('/recentpireps/i',$host)) { |
| 238 | 313 | //$formats[$id] = 'pirepsjson'; |
| 239 | 314 | $globalSources[$id]['format'] = 'pirepsjson'; |
| 240 | 315 | //$last_exec['pirepsjson'] = 0; |
| 241 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 316 | + if ($globalDebug) { |
|
| 317 | + echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 318 | + } |
|
| 242 | 319 | } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
| 243 | 320 | //$formats[$id] = 'fr24json'; |
| 244 | 321 | $globalSources[$id]['format'] = 'fr24json'; |
| 245 | 322 | //$last_exec['fr24json'] = 0; |
| 246 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 323 | + if ($globalDebug) { |
|
| 324 | + echo "Connect to fr24 source (".$host.")...\n"; |
|
| 325 | + } |
|
| 247 | 326 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 248 | 327 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 249 | 328 | exit(0); |
@@ -252,7 +331,9 @@ discard block |
||
| 252 | 331 | //$formats[$id] = 'fr24json'; |
| 253 | 332 | $globalSources[$id]['format'] = 'myshiptracking'; |
| 254 | 333 | //$last_exec['fr24json'] = 0; |
| 255 | - if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n"; |
|
| 334 | + if ($globalDebug) { |
|
| 335 | + echo "Connect to myshiptracking source (".$host.")...\n"; |
|
| 336 | + } |
|
| 256 | 337 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 257 | 338 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 258 | 339 | exit(0); |
@@ -261,16 +342,24 @@ discard block |
||
| 261 | 342 | } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
| 262 | 343 | //$formats[$id] = 'tsv'; |
| 263 | 344 | $globalSources[$id]['format'] = 'tsv'; |
| 264 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 345 | + if ($globalDebug) { |
|
| 346 | + echo "Connect to tsv source (".$host.")...\n"; |
|
| 347 | + } |
|
| 265 | 348 | } |
| 266 | 349 | } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
| 267 | 350 | if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
| 268 | 351 | $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
| 269 | 352 | if ($idf !== false) { |
| 270 | 353 | $httpfeeds[$id] = $idf; |
| 271 | - if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 272 | - } elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 273 | - } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 354 | + if ($globalDebug) { |
|
| 355 | + echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 356 | + } |
|
| 357 | + } elseif ($globalDebug) { |
|
| 358 | + echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 359 | + } |
|
| 360 | + } elseif ($globalDebug) { |
|
| 361 | + echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 362 | + } |
|
| 274 | 363 | } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
| 275 | 364 | $hostport = explode(':',$host); |
| 276 | 365 | if (isset($hostport[1])) { |
@@ -310,19 +399,27 @@ discard block |
||
| 310 | 399 | //$formats[$id] = 'beast'; |
| 311 | 400 | $globalSources[$id]['format'] = 'beast'; |
| 312 | 401 | //} else $formats[$id] = 'sbs'; |
| 313 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
| 402 | + } else { |
|
| 403 | + $globalSources[$id]['format'] = 'sbs'; |
|
| 404 | + } |
|
| 314 | 405 | //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
| 315 | 406 | } |
| 316 | - if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
| 407 | + if ($globalDebug) { |
|
| 408 | + echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
| 409 | + } |
|
| 317 | 410 | } else { |
| 318 | - if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
| 411 | + if ($globalDebug) { |
|
| 412 | + echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
| 413 | + } |
|
| 319 | 414 | sleep(10); |
| 320 | 415 | connect_all($hosts); |
| 321 | 416 | } |
| 322 | 417 | } |
| 323 | 418 | } |
| 324 | 419 | } |
| 325 | -if (!isset($globalMinFetch)) $globalMinFetch = 15; |
|
| 420 | +if (!isset($globalMinFetch)) { |
|
| 421 | + $globalMinFetch = 15; |
|
| 422 | +} |
|
| 326 | 423 | |
| 327 | 424 | // Initialize all |
| 328 | 425 | $status = array(); |
@@ -331,13 +428,19 @@ discard block |
||
| 331 | 428 | $formats = array(); |
| 332 | 429 | $last_exec = array(); |
| 333 | 430 | $time = time(); |
| 334 | -if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut; |
|
| 335 | -else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
|
| 336 | -else $timeout = 20; |
|
| 431 | +if (isset($globalSourcesTimeout)) { |
|
| 432 | + $timeout = $globalSourcesTimeOut; |
|
| 433 | +} else if (isset($globalSBS1TimeOut)) { |
|
| 434 | + $timeout = $globalSBS1TimeOut; |
|
| 435 | +} else { |
|
| 436 | + $timeout = 20; |
|
| 437 | +} |
|
| 337 | 438 | $errno = ''; |
| 338 | 439 | $errstr=''; |
| 339 | 440 | |
| 340 | -if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
| 441 | +if (!isset($globalDaemon)) { |
|
| 442 | + $globalDaemon = TRUE; |
|
| 443 | +} |
|
| 341 | 444 | /* Initiate connections to all the hosts simultaneously */ |
| 342 | 445 | //connect_all($hosts); |
| 343 | 446 | //connect_all($globalSources); |
@@ -366,7 +469,9 @@ discard block |
||
| 366 | 469 | if (isset($source['format']) && $source['format'] == 'aprs') { |
| 367 | 470 | $aprs_connect = 0; |
| 368 | 471 | $use_aprs = true; |
| 369 | - if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
|
| 472 | + if (isset($source['port']) && $source['port'] == '10152') { |
|
| 473 | + $aprs_full = true; |
|
| 474 | + } |
|
| 370 | 475 | break; |
| 371 | 476 | } |
| 372 | 477 | } |
@@ -377,25 +482,46 @@ discard block |
||
| 377 | 482 | $aprs_connect = 0; |
| 378 | 483 | $aprs_keep = 120; |
| 379 | 484 | $aprs_last_tx = time(); |
| 380 | - if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
|
| 381 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 382 | - if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
|
| 383 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 384 | - if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
|
| 385 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 386 | - if ($aprs_full) $aprs_filter = ''; |
|
| 387 | - if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
|
| 388 | - else $aprs_pass = '-1'; |
|
| 485 | + if (isset($globalAPRSversion)) { |
|
| 486 | + $aprs_version = $globalAPRSversion; |
|
| 487 | + } else { |
|
| 488 | + $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 489 | + } |
|
| 490 | + if (isset($globalAPRSssid)) { |
|
| 491 | + $aprs_ssid = $globalAPRSssid; |
|
| 492 | + } else { |
|
| 493 | + $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 494 | + } |
|
| 495 | + if (isset($globalAPRSfilter)) { |
|
| 496 | + $aprs_filter = $globalAPRSfilter; |
|
| 497 | + } else { |
|
| 498 | + $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 499 | + } |
|
| 500 | + if ($aprs_full) { |
|
| 501 | + $aprs_filter = ''; |
|
| 502 | + } |
|
| 503 | + if (isset($globalAPRSpass)) { |
|
| 504 | + $aprs_pass = $globalAPRSpass; |
|
| 505 | + } else { |
|
| 506 | + $aprs_pass = '-1'; |
|
| 507 | + } |
|
| 389 | 508 | |
| 390 | - if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
| 391 | - else $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
| 392 | -} |
|
| 509 | + if ($aprs_filter != '') { |
|
| 510 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
| 511 | + } else { |
|
| 512 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
| 513 | + } |
|
| 514 | + } |
|
| 393 | 515 | |
| 394 | 516 | // connected - lets do some work |
| 395 | 517 | //if ($globalDebug) echo "Connected!\n"; |
| 396 | 518 | sleep(1); |
| 397 | -if ($globalDebug) echo "SCAN MODE \n\n"; |
|
| 398 | -if (!isset($globalCronEnd)) $globalCronEnd = 60; |
|
| 519 | +if ($globalDebug) { |
|
| 520 | + echo "SCAN MODE \n\n"; |
|
| 521 | +} |
|
| 522 | +if (!isset($globalCronEnd)) { |
|
| 523 | + $globalCronEnd = 60; |
|
| 524 | +} |
|
| 399 | 525 | $endtime = time()+$globalCronEnd; |
| 400 | 526 | $i = 1; |
| 401 | 527 | $tt = array(); |
@@ -409,22 +535,32 @@ discard block |
||
| 409 | 535 | |
| 410 | 536 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
| 411 | 537 | while ($i > 0) { |
| 412 | - if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 538 | + if (function_exists('pcntl_fork')) { |
|
| 539 | + pcntl_signal_dispatch(); |
|
| 540 | + } |
|
| 413 | 541 | |
| 414 | - if (!$globalDaemon) $i = $endtime-time(); |
|
| 542 | + if (!$globalDaemon) { |
|
| 543 | + $i = $endtime-time(); |
|
| 544 | + } |
|
| 415 | 545 | // Delete old ATC |
| 416 | 546 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
| 417 | - if ($globalDebug) echo 'Delete old ATC...'."\n"; |
|
| 547 | + if ($globalDebug) { |
|
| 548 | + echo 'Delete old ATC...'."\n"; |
|
| 549 | + } |
|
| 418 | 550 | $ATC->deleteOldATC(); |
| 419 | 551 | } |
| 420 | 552 | |
| 421 | 553 | if (count($last_exec) == count($globalSources)) { |
| 422 | 554 | $max = $globalMinFetch; |
| 423 | 555 | foreach ($last_exec as $last) { |
| 424 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 556 | + if ((time() - $last['last']) < $max) { |
|
| 557 | + $max = time() - $last['last']; |
|
| 558 | + } |
|
| 425 | 559 | } |
| 426 | 560 | if ($max < $globalMinFetch) { |
| 427 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 561 | + if ($globalDebug) { |
|
| 562 | + echo 'Sleeping...'."\n"; |
|
| 563 | + } |
|
| 428 | 564 | sleep($globalMinFetch-$max+2); |
| 429 | 565 | } |
| 430 | 566 | } |
@@ -434,7 +570,9 @@ discard block |
||
| 434 | 570 | foreach ($globalSources as $id => $value) { |
| 435 | 571 | date_default_timezone_set('UTC'); |
| 436 | 572 | //if ($globalDebug) echo 'Source host : '.$value['host'].' - Source format: '.$value['format']."\n"; |
| 437 | - if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; |
|
| 573 | + if (!isset($last_exec[$id]['last'])) { |
|
| 574 | + $last_exec[$id]['last'] = 0; |
|
| 575 | + } |
|
| 438 | 576 | if ($value['format'] === 'deltadbtxt' && |
| 439 | 577 | ( |
| 440 | 578 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
@@ -443,7 +581,9 @@ discard block |
||
| 443 | 581 | ) { |
| 444 | 582 | //$buffer = $Common->getData($hosts[$id]); |
| 445 | 583 | $buffer = $Common->getData($value['host']); |
| 446 | - if ($buffer != '') $reset = 0; |
|
| 584 | + if ($buffer != '') { |
|
| 585 | + $reset = 0; |
|
| 586 | + } |
|
| 447 | 587 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 448 | 588 | $buffer = explode('\n',$buffer); |
| 449 | 589 | foreach ($buffer as $line) { |
@@ -452,20 +592,41 @@ discard block |
||
| 452 | 592 | $data = array(); |
| 453 | 593 | $data['hex'] = $line[1]; // hex |
| 454 | 594 | $data['ident'] = $line[2]; // ident |
| 455 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
| 456 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
| 457 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
| 458 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
| 459 | - if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
| 595 | + if (isset($line[3])) { |
|
| 596 | + $data['altitude'] = $line[3]; |
|
| 597 | + } |
|
| 598 | + // altitude |
|
| 599 | + if (isset($line[4])) { |
|
| 600 | + $data['speed'] = $line[4]; |
|
| 601 | + } |
|
| 602 | + // speed |
|
| 603 | + if (isset($line[5])) { |
|
| 604 | + $data['heading'] = $line[5]; |
|
| 605 | + } |
|
| 606 | + // heading |
|
| 607 | + if (isset($line[6])) { |
|
| 608 | + $data['latitude'] = $line[6]; |
|
| 609 | + } |
|
| 610 | + // lat |
|
| 611 | + if (isset($line[7])) { |
|
| 612 | + $data['longitude'] = $line[7]; |
|
| 613 | + } |
|
| 614 | + // long |
|
| 460 | 615 | $data['verticalrate'] = ''; // vertical rate |
| 461 | 616 | //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
| 462 | 617 | $data['emergency'] = ''; // emergency |
| 463 | 618 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 464 | 619 | $data['format_source'] = 'deltadbtxt'; |
| 465 | 620 | $data['id_source'] = $id_source; |
| 466 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 467 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 468 | - if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
| 621 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 622 | + $data['source_name'] = $value['name']; |
|
| 623 | + } |
|
| 624 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 625 | + $data['noarchive'] = true; |
|
| 626 | + } |
|
| 627 | + if (isset($value['sourcestats'])) { |
|
| 628 | + $data['sourcestats'] = $value['sourcestats']; |
|
| 629 | + } |
|
| 469 | 630 | $SI->add($data); |
| 470 | 631 | unset($data); |
| 471 | 632 | } |
@@ -480,7 +641,9 @@ discard block |
||
| 480 | 641 | date_default_timezone_set('CET'); |
| 481 | 642 | $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
| 482 | 643 | date_default_timezone_set('UTC'); |
| 483 | - if ($buffer != '') $reset = 0; |
|
| 644 | + if ($buffer != '') { |
|
| 645 | + $reset = 0; |
|
| 646 | + } |
|
| 484 | 647 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 485 | 648 | $buffer = explode('\n',$buffer); |
| 486 | 649 | foreach ($buffer as $line) { |
@@ -489,18 +652,42 @@ discard block |
||
| 489 | 652 | $add = false; |
| 490 | 653 | $ais_data = $AIS->parse_line(trim($line)); |
| 491 | 654 | $data = array(); |
| 492 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 493 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 494 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 495 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 496 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 497 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 498 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 499 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 500 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 501 | - if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid']; |
|
| 502 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 503 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 655 | + if (isset($ais_data['ident'])) { |
|
| 656 | + $data['ident'] = $ais_data['ident']; |
|
| 657 | + } |
|
| 658 | + if (isset($ais_data['mmsi'])) { |
|
| 659 | + $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 660 | + } |
|
| 661 | + if (isset($ais_data['speed'])) { |
|
| 662 | + $data['speed'] = $ais_data['speed']; |
|
| 663 | + } |
|
| 664 | + if (isset($ais_data['heading'])) { |
|
| 665 | + $data['heading'] = $ais_data['heading']; |
|
| 666 | + } |
|
| 667 | + if (isset($ais_data['latitude'])) { |
|
| 668 | + $data['latitude'] = $ais_data['latitude']; |
|
| 669 | + } |
|
| 670 | + if (isset($ais_data['longitude'])) { |
|
| 671 | + $data['longitude'] = $ais_data['longitude']; |
|
| 672 | + } |
|
| 673 | + if (isset($ais_data['status'])) { |
|
| 674 | + $data['status'] = $ais_data['status']; |
|
| 675 | + } |
|
| 676 | + if (isset($ais_data['statusid'])) { |
|
| 677 | + $data['status_id'] = $ais_data['statusid']; |
|
| 678 | + } |
|
| 679 | + if (isset($ais_data['type'])) { |
|
| 680 | + $data['type'] = $ais_data['type']; |
|
| 681 | + } |
|
| 682 | + if (isset($ais_data['typeid'])) { |
|
| 683 | + $data['type_id'] = $ais_data['typeid']; |
|
| 684 | + } |
|
| 685 | + if (isset($ais_data['imo'])) { |
|
| 686 | + $data['imo'] = $ais_data['imo']; |
|
| 687 | + } |
|
| 688 | + if (isset($ais_data['callsign'])) { |
|
| 689 | + $data['callsign'] = $ais_data['callsign']; |
|
| 690 | + } |
|
| 504 | 691 | if (isset($ais_data['timestamp'])) { |
| 505 | 692 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 506 | 693 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
@@ -514,8 +701,12 @@ discard block |
||
| 514 | 701 | $data['format_source'] = 'aisnmeatxt'; |
| 515 | 702 | $data['id_source'] = $id_source; |
| 516 | 703 | //print_r($data); |
| 517 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 518 | - if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
|
| 704 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 705 | + $data['noarchive'] = true; |
|
| 706 | + } |
|
| 707 | + if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') { |
|
| 708 | + $MI->add($data); |
|
| 709 | + } |
|
| 519 | 710 | unset($data); |
| 520 | 711 | } |
| 521 | 712 | } |
@@ -538,20 +729,48 @@ discard block |
||
| 538 | 729 | if ($line != '') { |
| 539 | 730 | $ais_data = $AIS->parse_line(trim($line)); |
| 540 | 731 | $data = array(); |
| 541 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 542 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 543 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 544 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 545 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 546 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 547 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 548 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 549 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 550 | - if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid']; |
|
| 551 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 552 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 553 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
| 554 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 732 | + if (isset($ais_data['ident'])) { |
|
| 733 | + $data['ident'] = $ais_data['ident']; |
|
| 734 | + } |
|
| 735 | + if (isset($ais_data['mmsi'])) { |
|
| 736 | + $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 737 | + } |
|
| 738 | + if (isset($ais_data['speed'])) { |
|
| 739 | + $data['speed'] = $ais_data['speed']; |
|
| 740 | + } |
|
| 741 | + if (isset($ais_data['heading'])) { |
|
| 742 | + $data['heading'] = $ais_data['heading']; |
|
| 743 | + } |
|
| 744 | + if (isset($ais_data['latitude'])) { |
|
| 745 | + $data['latitude'] = $ais_data['latitude']; |
|
| 746 | + } |
|
| 747 | + if (isset($ais_data['longitude'])) { |
|
| 748 | + $data['longitude'] = $ais_data['longitude']; |
|
| 749 | + } |
|
| 750 | + if (isset($ais_data['status'])) { |
|
| 751 | + $data['status'] = $ais_data['status']; |
|
| 752 | + } |
|
| 753 | + if (isset($ais_data['statusid'])) { |
|
| 754 | + $data['status_id'] = $ais_data['statusid']; |
|
| 755 | + } |
|
| 756 | + if (isset($ais_data['type'])) { |
|
| 757 | + $data['type'] = $ais_data['type']; |
|
| 758 | + } |
|
| 759 | + if (isset($ais_data['typeid'])) { |
|
| 760 | + $data['type_id'] = $ais_data['typeid']; |
|
| 761 | + } |
|
| 762 | + if (isset($ais_data['imo'])) { |
|
| 763 | + $data['imo'] = $ais_data['imo']; |
|
| 764 | + } |
|
| 765 | + if (isset($ais_data['callsign'])) { |
|
| 766 | + $data['callsign'] = $ais_data['callsign']; |
|
| 767 | + } |
|
| 768 | + if (isset($ais_data['destination'])) { |
|
| 769 | + $data['arrival_code'] = $ais_data['destination']; |
|
| 770 | + } |
|
| 771 | + if (isset($ais_data['eta_ts'])) { |
|
| 772 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 773 | + } |
|
| 555 | 774 | if (isset($ais_data['timestamp'])) { |
| 556 | 775 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 557 | 776 | } else { |
@@ -559,18 +778,27 @@ discard block |
||
| 559 | 778 | } |
| 560 | 779 | $data['format_source'] = 'aisnmeahttp'; |
| 561 | 780 | $data['id_source'] = $id_source; |
| 562 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 563 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
|
| 781 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 782 | + $data['noarchive'] = true; |
|
| 783 | + } |
|
| 784 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') { |
|
| 785 | + $MI->add($data); |
|
| 786 | + } |
|
| 564 | 787 | unset($data); |
| 565 | 788 | } |
| 566 | 789 | } |
| 567 | 790 | } |
| 568 | 791 | } else { |
| 569 | 792 | $format = $value['format']; |
| 570 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 571 | - else $tt[$format] = 0; |
|
| 793 | + if (isset($tt[$format])) { |
|
| 794 | + $tt[$format]++; |
|
| 795 | + } else { |
|
| 796 | + $tt[$format] = 0; |
|
| 797 | + } |
|
| 572 | 798 | if ($tt[$format] > 30) { |
| 573 | - if ($globalDebug) echo 'Reconnect...'."\n"; |
|
| 799 | + if ($globalDebug) { |
|
| 800 | + echo 'Reconnect...'."\n"; |
|
| 801 | + } |
|
| 574 | 802 | sleep(2); |
| 575 | 803 | //$sourceeen[] = $value; |
| 576 | 804 | //connect_all($sourceeen); |
@@ -606,12 +834,18 @@ discard block |
||
| 606 | 834 | // if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
| 607 | 835 | //$data['type_id'] = $line['TYPE']; |
| 608 | 836 | $data['imo'] = $line['IMO']; |
| 609 | - if ($line['DEST'] != '') $data['arrival_code'] = $line['DEST']; |
|
| 610 | - if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV'])); |
|
| 837 | + if ($line['DEST'] != '') { |
|
| 838 | + $data['arrival_code'] = $line['DEST']; |
|
| 839 | + } |
|
| 840 | + if ($line['ARV'] != '') { |
|
| 841 | + $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV'])); |
|
| 842 | + } |
|
| 611 | 843 | $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
| 612 | 844 | $data['format_source'] = 'myshiptracking'; |
| 613 | 845 | $data['id_source'] = $id_source; |
| 614 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 846 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 847 | + $data['noarchive'] = true; |
|
| 848 | + } |
|
| 615 | 849 | $MI->add($data); |
| 616 | 850 | unset($data); |
| 617 | 851 | } |
@@ -636,7 +870,9 @@ discard block |
||
| 636 | 870 | $data['callsign'] = $line['callsign']; |
| 637 | 871 | $data['mmsi'] = substr($line['mmsi'],-9); |
| 638 | 872 | $data['speed'] = $line['sog']; |
| 639 | - if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
|
| 873 | + if ($line['heading'] != '511') { |
|
| 874 | + $data['heading'] = $line['heading']; |
|
| 875 | + } |
|
| 640 | 876 | $data['latitude'] = $line['latitude']; |
| 641 | 877 | $data['longitude'] = $line['longitude']; |
| 642 | 878 | $data['type_id'] = $line['shiptype']; |
@@ -644,7 +880,9 @@ discard block |
||
| 644 | 880 | $data['datetime'] = $line['time']; |
| 645 | 881 | $data['format_source'] = 'boatbeaconapp'; |
| 646 | 882 | $data['id_source'] = $id_source; |
| 647 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 883 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 884 | + $data['noarchive'] = true; |
|
| 885 | + } |
|
| 648 | 886 | $MI->add($data); |
| 649 | 887 | unset($data); |
| 650 | 888 | } |
@@ -666,22 +904,44 @@ discard block |
||
| 666 | 904 | foreach ($all_data['features'] as $line) { |
| 667 | 905 | print_r($line); |
| 668 | 906 | $data = array(); |
| 669 | - if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; |
|
| 670 | - if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign']; |
|
| 671 | - if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'],-9); |
|
| 672 | - if (isset($line['properties']['imo'])) $data['imo'] = $line['properties']['imo']; |
|
| 673 | - if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed']; |
|
| 674 | - if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) $data['heading'] = $line['properties']['heading']; |
|
| 907 | + if (isset($line['properties']['name'])) { |
|
| 908 | + $data['ident'] = $line['properties']['name']; |
|
| 909 | + } |
|
| 910 | + if (isset($line['properties']['callsign'])) { |
|
| 911 | + $data['callsign'] = $line['properties']['callsign']; |
|
| 912 | + } |
|
| 913 | + if (isset($line['properties']['mmsi'])) { |
|
| 914 | + $data['mmsi'] = substr($line['properties']['mmsi'],-9); |
|
| 915 | + } |
|
| 916 | + if (isset($line['properties']['imo'])) { |
|
| 917 | + $data['imo'] = $line['properties']['imo']; |
|
| 918 | + } |
|
| 919 | + if (isset($line['properties']['speed'])) { |
|
| 920 | + $data['speed'] = $line['properties']['speed']; |
|
| 921 | + } |
|
| 922 | + if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) { |
|
| 923 | + $data['heading'] = $line['properties']['heading']; |
|
| 924 | + } |
|
| 675 | 925 | $data['latitude'] = $line['geometry']['coordinates'][1]; |
| 676 | 926 | $data['longitude'] = $line['geometry']['coordinates'][0]; |
| 677 | - if (isset($line['properties']['vesselType'])) $data['type'] = $line['properties']['vesselType']; |
|
| 678 | - if (isset($line['properties']['destination'])) $data['arrival_code'] = $line['properties']['destination']; |
|
| 679 | - if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') $data['arrival_date'] = $line['properties']['eta']; |
|
| 927 | + if (isset($line['properties']['vesselType'])) { |
|
| 928 | + $data['type'] = $line['properties']['vesselType']; |
|
| 929 | + } |
|
| 930 | + if (isset($line['properties']['destination'])) { |
|
| 931 | + $data['arrival_code'] = $line['properties']['destination']; |
|
| 932 | + } |
|
| 933 | + if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') { |
|
| 934 | + $data['arrival_date'] = $line['properties']['eta']; |
|
| 935 | + } |
|
| 680 | 936 | $data['format_source'] = 'boatnerd'; |
| 681 | 937 | $data['id_source'] = $id_source; |
| 682 | 938 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 683 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 684 | - if ($line['properties']['vesselType'] != 'Navigation Aid') $MI->add($data); |
|
| 939 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 940 | + $data['noarchive'] = true; |
|
| 941 | + } |
|
| 942 | + if ($line['properties']['vesselType'] != 'Navigation Aid') { |
|
| 943 | + $MI->add($data); |
|
| 944 | + } |
|
| 685 | 945 | unset($data); |
| 686 | 946 | } |
| 687 | 947 | } |
@@ -698,7 +958,9 @@ discard block |
||
| 698 | 958 | $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
| 699 | 959 | echo 'done !'."\n"; |
| 700 | 960 | // FIXME: Need more work |
| 701 | - if ($buffer != '') $reset = 0; |
|
| 961 | + if ($buffer != '') { |
|
| 962 | + $reset = 0; |
|
| 963 | + } |
|
| 702 | 964 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 703 | 965 | $buffer = explode('\n',$buffer); |
| 704 | 966 | foreach ($buffer as $line) { |
@@ -724,7 +986,9 @@ discard block |
||
| 724 | 986 | //$data['etaTime'] = substr($line,135,5); |
| 725 | 987 | $data['format_source'] = 'shipplotter'; |
| 726 | 988 | $data['id_source'] = $id_source; |
| 727 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 989 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 990 | + $data['noarchive'] = true; |
|
| 991 | + } |
|
| 728 | 992 | //print_r($data); |
| 729 | 993 | echo 'Add...'."\n"; |
| 730 | 994 | $MI->add($data); |
@@ -758,16 +1022,28 @@ discard block |
||
| 758 | 1022 | $line = explode(':', $line); |
| 759 | 1023 | if (count($line) > 30 && $line[0] != 'callsign') { |
| 760 | 1024 | $data = array(); |
| 761 | - if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
| 762 | - else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
| 1025 | + if (isset($line[37]) && $line[37] != '') { |
|
| 1026 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
| 1027 | + } else { |
|
| 1028 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
| 1029 | + } |
|
| 763 | 1030 | $data['pilot_id'] = $line[1]; |
| 764 | 1031 | $data['pilot_name'] = $line[2]; |
| 765 | 1032 | $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
| 766 | 1033 | $data['ident'] = $line[0]; // ident |
| 767 | - if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
|
| 1034 | + if ($line[7] != '' && $line[7] != 0) { |
|
| 1035 | + $data['altitude'] = $line[7]; |
|
| 1036 | + } |
|
| 1037 | + // altitude |
|
| 768 | 1038 | $data['speed'] = $line[8]; // speed |
| 769 | - if (isset($line[45])) $data['heading'] = $line[45]; // heading |
|
| 770 | - elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
|
| 1039 | + if (isset($line[45])) { |
|
| 1040 | + $data['heading'] = $line[45]; |
|
| 1041 | + } |
|
| 1042 | + // heading |
|
| 1043 | + elseif (isset($line[38])) { |
|
| 1044 | + $data['heading'] = $line[38]; |
|
| 1045 | + } |
|
| 1046 | + // heading |
|
| 771 | 1047 | $data['latitude'] = $line[5]; // lat |
| 772 | 1048 | $data['longitude'] = $line[6]; // long |
| 773 | 1049 | $data['verticalrate'] = ''; // vertical rate |
@@ -783,7 +1059,9 @@ discard block |
||
| 783 | 1059 | $data['frequency'] = $line[4]; |
| 784 | 1060 | $data['type'] = $line[18]; |
| 785 | 1061 | $data['range'] = $line[19]; |
| 786 | - if (isset($line[35])) $data['info'] = $line[35]; |
|
| 1062 | + if (isset($line[35])) { |
|
| 1063 | + $data['info'] = $line[35]; |
|
| 1064 | + } |
|
| 787 | 1065 | $data['id_source'] = $id_source; |
| 788 | 1066 | //$data['arrival_airport_time'] = ; |
| 789 | 1067 | if ($line[9] != '') { |
@@ -797,27 +1075,47 @@ discard block |
||
| 797 | 1075 | elseif ($value === 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
| 798 | 1076 | */ |
| 799 | 1077 | $data['format_source'] = $value['format']; |
| 800 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 801 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 802 | - if ($line[3] === 'PILOT') $SI->add($data); |
|
| 803 | - elseif ($line[3] === 'ATC') { |
|
| 1078 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1079 | + $data['noarchive'] = true; |
|
| 1080 | + } |
|
| 1081 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1082 | + $data['source_name'] = $value['name']; |
|
| 1083 | + } |
|
| 1084 | + if ($line[3] === 'PILOT') { |
|
| 1085 | + $SI->add($data); |
|
| 1086 | + } elseif ($line[3] === 'ATC') { |
|
| 804 | 1087 | //print_r($data); |
| 805 | 1088 | $data['info'] = str_replace('^§','<br />',$data['info']); |
| 806 | 1089 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 807 | 1090 | $typec = substr($data['ident'],-3); |
| 808 | - if ($typec === 'APP') $data['type'] = 'Approach'; |
|
| 809 | - elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
|
| 810 | - elseif ($typec === 'OBS') $data['type'] = 'Observer'; |
|
| 811 | - elseif ($typec === 'GND') $data['type'] = 'Ground'; |
|
| 812 | - elseif ($typec === 'DEL') $data['type'] = 'Delivery'; |
|
| 813 | - elseif ($typec === 'DEP') $data['type'] = 'Departure'; |
|
| 814 | - elseif ($typec === 'FSS') $data['type'] = 'Flight Service Station'; |
|
| 815 | - elseif ($typec === 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
| 816 | - elseif ($data['type'] === '') $data['type'] = 'Observer'; |
|
| 817 | - if (!isset($data['source_name'])) $data['source_name'] = ''; |
|
| 1091 | + if ($typec === 'APP') { |
|
| 1092 | + $data['type'] = 'Approach'; |
|
| 1093 | + } elseif ($typec === 'TWR') { |
|
| 1094 | + $data['type'] = 'Tower'; |
|
| 1095 | + } elseif ($typec === 'OBS') { |
|
| 1096 | + $data['type'] = 'Observer'; |
|
| 1097 | + } elseif ($typec === 'GND') { |
|
| 1098 | + $data['type'] = 'Ground'; |
|
| 1099 | + } elseif ($typec === 'DEL') { |
|
| 1100 | + $data['type'] = 'Delivery'; |
|
| 1101 | + } elseif ($typec === 'DEP') { |
|
| 1102 | + $data['type'] = 'Departure'; |
|
| 1103 | + } elseif ($typec === 'FSS') { |
|
| 1104 | + $data['type'] = 'Flight Service Station'; |
|
| 1105 | + } elseif ($typec === 'CTR') { |
|
| 1106 | + $data['type'] = 'Control Radar or Centre'; |
|
| 1107 | + } elseif ($data['type'] === '') { |
|
| 1108 | + $data['type'] = 'Observer'; |
|
| 1109 | + } |
|
| 1110 | + if (!isset($data['source_name'])) { |
|
| 1111 | + $data['source_name'] = ''; |
|
| 1112 | + } |
|
| 818 | 1113 | if (isset($ATC)) { |
| 819 | - if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
| 820 | - else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
| 1114 | + if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) { |
|
| 1115 | + echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
| 1116 | + } else { |
|
| 1117 | + echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
| 1118 | + } |
|
| 821 | 1119 | } |
| 822 | 1120 | } |
| 823 | 1121 | unset($data); |
@@ -844,14 +1142,20 @@ discard block |
||
| 844 | 1142 | $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
| 845 | 1143 | $data['latitude'] = (float)$line['pktLatitude']; |
| 846 | 1144 | $data['longitude'] = (float)$line['pktLongitude']; |
| 847 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
| 848 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
| 1145 | + if ((float)$line['pktTrack'] != 0) { |
|
| 1146 | + $data['heading'] = (float)$line['pktTrack']; |
|
| 1147 | + } |
|
| 1148 | + if ((int)$line['pktSpeed'] != 0) { |
|
| 1149 | + $data['speed'] = (int)$line['pktSpeed']; |
|
| 1150 | + } |
|
| 849 | 1151 | $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
| 850 | 1152 | $data['altitude_relative'] = 'AMSL'; |
| 851 | 1153 | $data['pilot_id'] = (int)$line['pktPilotID']; |
| 852 | 1154 | $data['aircraft_icao'] = 'PARAGLIDER'; |
| 853 | 1155 | $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
| 854 | - if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
|
| 1156 | + if (isset($pilot_data[4])) { |
|
| 1157 | + $data['pilot_name'] = $pilot_data[4]; |
|
| 1158 | + } |
|
| 855 | 1159 | $data['format_source'] = $value['format']; |
| 856 | 1160 | $SI->add($data); |
| 857 | 1161 | unset($data); |
@@ -899,25 +1203,59 @@ discard block |
||
| 899 | 1203 | foreach ($all_data['acList'] as $line) { |
| 900 | 1204 | $data = array(); |
| 901 | 1205 | $data['hex'] = $line['Icao']; // hex |
| 902 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 903 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 904 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 905 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 906 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 907 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 1206 | + if (isset($line['Call'])) { |
|
| 1207 | + $data['ident'] = $line['Call']; |
|
| 1208 | + } |
|
| 1209 | + // ident |
|
| 1210 | + if (isset($line['Alt'])) { |
|
| 1211 | + $data['altitude'] = $line['Alt']; |
|
| 1212 | + } |
|
| 1213 | + // altitude |
|
| 1214 | + if (isset($line['Spd'])) { |
|
| 1215 | + $data['speed'] = $line['Spd']; |
|
| 1216 | + } |
|
| 1217 | + // speed |
|
| 1218 | + if (isset($line['Trak'])) { |
|
| 1219 | + $data['heading'] = $line['Trak']; |
|
| 1220 | + } |
|
| 1221 | + // heading |
|
| 1222 | + if (isset($line['Lat'])) { |
|
| 1223 | + $data['latitude'] = $line['Lat']; |
|
| 1224 | + } |
|
| 1225 | + // lat |
|
| 1226 | + if (isset($line['Long'])) { |
|
| 1227 | + $data['longitude'] = $line['Long']; |
|
| 1228 | + } |
|
| 1229 | + // long |
|
| 908 | 1230 | //$data['verticalrate'] = $line['']; // verticale rate |
| 909 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 1231 | + if (isset($line['Sqk'])) { |
|
| 1232 | + $data['squawk'] = $line['Sqk']; |
|
| 1233 | + } |
|
| 1234 | + // squawk |
|
| 910 | 1235 | $data['emergency'] = ''; // emergency |
| 911 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 912 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 913 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1236 | + if (isset($line['Reg'])) { |
|
| 1237 | + $data['registration'] = $line['Reg']; |
|
| 1238 | + } |
|
| 1239 | + if (isset($line['PosTime'])) { |
|
| 1240 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1241 | + } else { |
|
| 1242 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1243 | + } |
|
| 914 | 1244 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 915 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 1245 | + if (isset($line['Type'])) { |
|
| 1246 | + $data['aircraft_icao'] = $line['Type']; |
|
| 1247 | + } |
|
| 916 | 1248 | $data['format_source'] = 'aircraftlistjson'; |
| 917 | 1249 | $data['id_source'] = $id_source; |
| 918 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 919 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 920 | - if (isset($data['latitude'])) $SI->add($data); |
|
| 1250 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1251 | + $data['source_name'] = $value['name']; |
|
| 1252 | + } |
|
| 1253 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1254 | + $data['noarchive'] = true; |
|
| 1255 | + } |
|
| 1256 | + if (isset($data['latitude'])) { |
|
| 1257 | + $SI->add($data); |
|
| 1258 | + } |
|
| 921 | 1259 | unset($data); |
| 922 | 1260 | } |
| 923 | 1261 | } elseif (is_array($all_data)) { |
@@ -934,17 +1272,26 @@ discard block |
||
| 934 | 1272 | $data['verticalrate'] = $line['vrt']; // verticale rate |
| 935 | 1273 | $data['squawk'] = $line['squawk']; // squawk |
| 936 | 1274 | $data['emergency'] = ''; // emergency |
| 937 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 938 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1275 | + if (isset($line['PosTime'])) { |
|
| 1276 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1277 | + } else { |
|
| 1278 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1279 | + } |
|
| 939 | 1280 | $data['format_source'] = 'aircraftlistjson'; |
| 940 | 1281 | $data['id_source'] = $id_source; |
| 941 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 942 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1282 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1283 | + $data['noarchive'] = true; |
|
| 1284 | + } |
|
| 1285 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1286 | + $data['source_name'] = $value['name']; |
|
| 1287 | + } |
|
| 943 | 1288 | $SI->add($data); |
| 944 | 1289 | unset($data); |
| 945 | 1290 | } |
| 946 | 1291 | } |
| 947 | - } elseif ($globalDebug) echo 'No data'."\n"; |
|
| 1292 | + } elseif ($globalDebug) { |
|
| 1293 | + echo 'No data'."\n"; |
|
| 1294 | + } |
|
| 948 | 1295 | //$last_exec['aircraftlistjson'] = time(); |
| 949 | 1296 | $last_exec[$id]['last'] = time(); |
| 950 | 1297 | //} elseif ($value === 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
@@ -980,8 +1327,12 @@ discard block |
||
| 980 | 1327 | $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
| 981 | 1328 | $data['format_source'] = 'planeupdatefaa'; |
| 982 | 1329 | $data['id_source'] = $id_source; |
| 983 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 984 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1330 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1331 | + $data['noarchive'] = true; |
|
| 1332 | + } |
|
| 1333 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1334 | + $data['source_name'] = $value['name']; |
|
| 1335 | + } |
|
| 985 | 1336 | $SI->add($data); |
| 986 | 1337 | unset($data); |
| 987 | 1338 | } |
@@ -1015,7 +1366,9 @@ discard block |
||
| 1015 | 1366 | $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
| 1016 | 1367 | $data['format_source'] = 'opensky'; |
| 1017 | 1368 | $data['id_source'] = $id_source; |
| 1018 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1369 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1370 | + $data['noarchive'] = true; |
|
| 1371 | + } |
|
| 1019 | 1372 | $SI->add($data); |
| 1020 | 1373 | unset($data); |
| 1021 | 1374 | } |
@@ -1035,15 +1388,42 @@ discard block |
||
| 1035 | 1388 | foreach ($all_data['aircraft'] as $key => $line) { |
| 1036 | 1389 | $data = array(); |
| 1037 | 1390 | // add support for ground vehicule with ~ in front of hex |
| 1038 | - if (isset($line['hex'])) $data['hex'] = $line['hex']; // hex |
|
| 1039 | - if (isset($line['flight'])) $data['ident'] = trim($line['flight']); // ident |
|
| 1040 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; // altitude |
|
| 1041 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; // speed |
|
| 1042 | - if (isset($line['track'])) $data['heading'] = $line['track']; // heading |
|
| 1043 | - if (isset($line['lat'])) $data['latitude'] = $line['lat']; // lat |
|
| 1044 | - if (isset($line['lon'])) $data['longitude'] = $line['lon']; // long |
|
| 1045 | - if (isset($line['vert_rate'])) $data['verticalrate'] = $line['vert_rate']; // verticale rate |
|
| 1046 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; // squawk |
|
| 1391 | + if (isset($line['hex'])) { |
|
| 1392 | + $data['hex'] = $line['hex']; |
|
| 1393 | + } |
|
| 1394 | + // hex |
|
| 1395 | + if (isset($line['flight'])) { |
|
| 1396 | + $data['ident'] = trim($line['flight']); |
|
| 1397 | + } |
|
| 1398 | + // ident |
|
| 1399 | + if (isset($line['altitude'])) { |
|
| 1400 | + $data['altitude'] = $line['altitude']; |
|
| 1401 | + } |
|
| 1402 | + // altitude |
|
| 1403 | + if (isset($line['speed'])) { |
|
| 1404 | + $data['speed'] = $line['speed']; |
|
| 1405 | + } |
|
| 1406 | + // speed |
|
| 1407 | + if (isset($line['track'])) { |
|
| 1408 | + $data['heading'] = $line['track']; |
|
| 1409 | + } |
|
| 1410 | + // heading |
|
| 1411 | + if (isset($line['lat'])) { |
|
| 1412 | + $data['latitude'] = $line['lat']; |
|
| 1413 | + } |
|
| 1414 | + // lat |
|
| 1415 | + if (isset($line['lon'])) { |
|
| 1416 | + $data['longitude'] = $line['lon']; |
|
| 1417 | + } |
|
| 1418 | + // long |
|
| 1419 | + if (isset($line['vert_rate'])) { |
|
| 1420 | + $data['verticalrate'] = $line['vert_rate']; |
|
| 1421 | + } |
|
| 1422 | + // verticale rate |
|
| 1423 | + if (isset($line['squawk'])) { |
|
| 1424 | + $data['squawk'] = $line['squawk']; |
|
| 1425 | + } |
|
| 1426 | + // squawk |
|
| 1047 | 1427 | //$data['emergency'] = ''; // emergency |
| 1048 | 1428 | //$data['registration'] = $line[2]; |
| 1049 | 1429 | //$data['aircraft_icao'] = $line[0]; |
@@ -1051,10 +1431,17 @@ discard block |
||
| 1051 | 1431 | $data['format_source'] = 'aircraftjson'; |
| 1052 | 1432 | $data['id_source'] = $id_source; |
| 1053 | 1433 | if (isset($value['name']) && $value['name'] != '') { |
| 1054 | - if (isset($line['mlat']) && !empty($line['mlat'])) $data['source_name'] = $value['name'].'_MLAT'; |
|
| 1055 | - else $data['source_name'] = $value['name']; |
|
| 1056 | - } elseif (isset($line['mlat']) && !empty($line['mlat'])) $data['source_name'] = 'MLAT'; |
|
| 1057 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1434 | + if (isset($line['mlat']) && !empty($line['mlat'])) { |
|
| 1435 | + $data['source_name'] = $value['name'].'_MLAT'; |
|
| 1436 | + } else { |
|
| 1437 | + $data['source_name'] = $value['name']; |
|
| 1438 | + } |
|
| 1439 | + } elseif (isset($line['mlat']) && !empty($line['mlat'])) { |
|
| 1440 | + $data['source_name'] = 'MLAT'; |
|
| 1441 | + } |
|
| 1442 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1443 | + $data['noarchive'] = true; |
|
| 1444 | + } |
|
| 1058 | 1445 | $SI->add($data); |
| 1059 | 1446 | unset($data); |
| 1060 | 1447 | } |
@@ -1074,22 +1461,54 @@ discard block |
||
| 1074 | 1461 | foreach ($all_data['aircraft'] as $key => $line) { |
| 1075 | 1462 | $data = array(); |
| 1076 | 1463 | $data['hex'] = $key; // hex |
| 1077 | - if (isset($line['callsign'])) $data['ident'] = trim($line['callsign']); // ident |
|
| 1078 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; // altitude |
|
| 1079 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; // speed |
|
| 1080 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 1081 | - if (isset($line['lat'])) $data['latitude'] = $line['lat']; // lat |
|
| 1082 | - if (isset($line['lon'])) $data['longitude'] = $line['lon']; // long |
|
| 1083 | - if (isset($line['vert_rate'])) $data['verticalrate'] = $line['vert_rate']; // verticale rate |
|
| 1084 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; // squawk |
|
| 1464 | + if (isset($line['callsign'])) { |
|
| 1465 | + $data['ident'] = trim($line['callsign']); |
|
| 1466 | + } |
|
| 1467 | + // ident |
|
| 1468 | + if (isset($line['altitude'])) { |
|
| 1469 | + $data['altitude'] = $line['altitude']; |
|
| 1470 | + } |
|
| 1471 | + // altitude |
|
| 1472 | + if (isset($line['speed'])) { |
|
| 1473 | + $data['speed'] = $line['speed']; |
|
| 1474 | + } |
|
| 1475 | + // speed |
|
| 1476 | + if (isset($line['heading'])) { |
|
| 1477 | + $data['heading'] = $line['heading']; |
|
| 1478 | + } |
|
| 1479 | + // heading |
|
| 1480 | + if (isset($line['lat'])) { |
|
| 1481 | + $data['latitude'] = $line['lat']; |
|
| 1482 | + } |
|
| 1483 | + // lat |
|
| 1484 | + if (isset($line['lon'])) { |
|
| 1485 | + $data['longitude'] = $line['lon']; |
|
| 1486 | + } |
|
| 1487 | + // long |
|
| 1488 | + if (isset($line['vert_rate'])) { |
|
| 1489 | + $data['verticalrate'] = $line['vert_rate']; |
|
| 1490 | + } |
|
| 1491 | + // verticale rate |
|
| 1492 | + if (isset($line['squawk'])) { |
|
| 1493 | + $data['squawk'] = $line['squawk']; |
|
| 1494 | + } |
|
| 1495 | + // squawk |
|
| 1085 | 1496 | //$data['emergency'] = ''; // emergency |
| 1086 | - if (isset($line['reg'])) $data['registration'] = $line['reg']; |
|
| 1087 | - if (isset($line['type'])) $data['aircraft_icao'] = $line['type']; |
|
| 1497 | + if (isset($line['reg'])) { |
|
| 1498 | + $data['registration'] = $line['reg']; |
|
| 1499 | + } |
|
| 1500 | + if (isset($line['type'])) { |
|
| 1501 | + $data['aircraft_icao'] = $line['type']; |
|
| 1502 | + } |
|
| 1088 | 1503 | $data['datetime'] = date('Y-m-d H:i:s',$line['pos_update_time']); |
| 1089 | 1504 | $data['format_source'] = 'planefinderclient'; |
| 1090 | 1505 | $data['id_source'] = $id_source; |
| 1091 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1092 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1506 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1507 | + $data['source_name'] = $value['name']; |
|
| 1508 | + } |
|
| 1509 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1510 | + $data['noarchive'] = true; |
|
| 1511 | + } |
|
| 1093 | 1512 | $SI->add($data); |
| 1094 | 1513 | unset($data); |
| 1095 | 1514 | } |
@@ -1105,7 +1524,9 @@ discard block |
||
| 1105 | 1524 | //$buffer = $Common->getData($hosts[$id]); |
| 1106 | 1525 | $buffer = $Common->getData($value['host']); |
| 1107 | 1526 | $all_data = json_decode($buffer,true); |
| 1108 | - if (!empty($all_data)) $reset = 0; |
|
| 1527 | + if (!empty($all_data)) { |
|
| 1528 | + $reset = 0; |
|
| 1529 | + } |
|
| 1109 | 1530 | foreach ($all_data as $key => $line) { |
| 1110 | 1531 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
| 1111 | 1532 | $data = array(); |
@@ -1126,8 +1547,12 @@ discard block |
||
| 1126 | 1547 | $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
| 1127 | 1548 | $data['format_source'] = 'fr24json'; |
| 1128 | 1549 | $data['id_source'] = $id_source; |
| 1129 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1130 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1550 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1551 | + $data['noarchive'] = true; |
|
| 1552 | + } |
|
| 1553 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1554 | + $data['source_name'] = $value['name']; |
|
| 1555 | + } |
|
| 1131 | 1556 | $SI->add($data); |
| 1132 | 1557 | unset($data); |
| 1133 | 1558 | } |
@@ -1156,24 +1581,42 @@ discard block |
||
| 1156 | 1581 | if (isset($line['inf'])) { |
| 1157 | 1582 | $data = array(); |
| 1158 | 1583 | $data['hex'] = $line['inf']['ia']; |
| 1159 | - if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
|
| 1584 | + if (isset($line['inf']['cs'])) { |
|
| 1585 | + $data['ident'] = $line['inf']['cs']; |
|
| 1586 | + } |
|
| 1587 | + //$line[13] |
|
| 1160 | 1588 | $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
| 1161 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
| 1162 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
| 1589 | + if (isset($line['inf']['gs'])) { |
|
| 1590 | + $data['speed'] = round($line['inf']['gs']*0.539957); |
|
| 1591 | + } |
|
| 1592 | + // speed |
|
| 1593 | + if (isset($line['inf']['tr'])) { |
|
| 1594 | + $data['heading'] = $line['inf']['tr']; |
|
| 1595 | + } |
|
| 1596 | + // heading |
|
| 1163 | 1597 | $data['latitude'] = $line['pt'][0]; // lat |
| 1164 | 1598 | $data['longitude'] = $line['pt'][1]; // long |
| 1165 | 1599 | //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
| 1166 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 1600 | + if (isset($line['inf']['sq'])) { |
|
| 1601 | + $data['squawk'] = $line['inf']['sq']; |
|
| 1602 | + } |
|
| 1603 | + // squawk |
|
| 1167 | 1604 | //$data['aircraft_icao'] = $line[8]; |
| 1168 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 1605 | + if (isset($line['inf']['rc'])) { |
|
| 1606 | + $data['registration'] = $line['inf']['rc']; |
|
| 1607 | + } |
|
| 1169 | 1608 | //$data['departure_airport_iata'] = $line[11]; |
| 1170 | 1609 | //$data['arrival_airport_iata'] = $line[12]; |
| 1171 | 1610 | //$data['emergency'] = ''; // emergency |
| 1172 | 1611 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
| 1173 | 1612 | $data['format_source'] = 'radarvirtueljson'; |
| 1174 | 1613 | $data['id_source'] = $id_source; |
| 1175 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1176 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1614 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1615 | + $data['noarchive'] = true; |
|
| 1616 | + } |
|
| 1617 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1618 | + $data['source_name'] = $value['name']; |
|
| 1619 | + } |
|
| 1177 | 1620 | $SI->add($data); |
| 1178 | 1621 | unset($data); |
| 1179 | 1622 | } |
@@ -1199,30 +1642,65 @@ discard block |
||
| 1199 | 1642 | $data['id'] = $line['id']; |
| 1200 | 1643 | $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
| 1201 | 1644 | $data['ident'] = $line['callsign']; // ident |
| 1202 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
| 1203 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
| 1204 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
| 1205 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
| 1206 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 1207 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1645 | + if (isset($line['pilotid'])) { |
|
| 1646 | + $data['pilot_id'] = $line['pilotid']; |
|
| 1647 | + } |
|
| 1648 | + // pilot id |
|
| 1649 | + if (isset($line['name'])) { |
|
| 1650 | + $data['pilot_name'] = $line['name']; |
|
| 1651 | + } |
|
| 1652 | + // pilot name |
|
| 1653 | + if (isset($line['alt'])) { |
|
| 1654 | + $data['altitude'] = $line['alt']; |
|
| 1655 | + } |
|
| 1656 | + // altitude |
|
| 1657 | + if (isset($line['gs'])) { |
|
| 1658 | + $data['speed'] = $line['gs']; |
|
| 1659 | + } |
|
| 1660 | + // speed |
|
| 1661 | + if (isset($line['heading'])) { |
|
| 1662 | + $data['heading'] = $line['heading']; |
|
| 1663 | + } |
|
| 1664 | + // heading |
|
| 1665 | + if (isset($line['route'])) { |
|
| 1666 | + $data['waypoints'] = $line['route']; |
|
| 1667 | + } |
|
| 1668 | + // route |
|
| 1208 | 1669 | $data['latitude'] = $line['lat']; // lat |
| 1209 | 1670 | $data['longitude'] = $line['lon']; // long |
| 1210 | 1671 | //$data['verticalrate'] = $line['vrt']; // verticale rate |
| 1211 | 1672 | //$data['squawk'] = $line['squawk']; // squawk |
| 1212 | 1673 | //$data['emergency'] = ''; // emergency |
| 1213 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
| 1214 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
| 1215 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1674 | + if (isset($line['depicao'])) { |
|
| 1675 | + $data['departure_airport_icao'] = $line['depicao']; |
|
| 1676 | + } |
|
| 1677 | + if (isset($line['deptime'])) { |
|
| 1678 | + $data['departure_airport_time'] = $line['deptime']; |
|
| 1679 | + } |
|
| 1680 | + if (isset($line['arricao'])) { |
|
| 1681 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1682 | + } |
|
| 1216 | 1683 | //$data['arrival_airport_time'] = $line['arrtime']; |
| 1217 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
| 1218 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
| 1219 | - if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
| 1220 | - else $data['info'] = ''; |
|
| 1684 | + if (isset($line['aircraft'])) { |
|
| 1685 | + $data['aircraft_icao'] = $line['aircraft']; |
|
| 1686 | + } |
|
| 1687 | + if (isset($line['transponder'])) { |
|
| 1688 | + $data['squawk'] = $line['transponder']; |
|
| 1689 | + } |
|
| 1690 | + if (isset($line['atis'])) { |
|
| 1691 | + $data['info'] = $line['atis']; |
|
| 1692 | + } else { |
|
| 1693 | + $data['info'] = ''; |
|
| 1694 | + } |
|
| 1221 | 1695 | $data['format_source'] = 'pireps'; |
| 1222 | 1696 | $data['id_source'] = $id_source; |
| 1223 | 1697 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1224 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1225 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1698 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1699 | + $data['noarchive'] = true; |
|
| 1700 | + } |
|
| 1701 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1702 | + $data['source_name'] = $value['name']; |
|
| 1703 | + } |
|
| 1226 | 1704 | if ($line['icon'] === 'plane') { |
| 1227 | 1705 | $SI->add($data); |
| 1228 | 1706 | // print_r($data); |
@@ -1231,16 +1709,28 @@ discard block |
||
| 1231 | 1709 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 1232 | 1710 | $typec = substr($data['ident'],-3); |
| 1233 | 1711 | $data['type'] = ''; |
| 1234 | - if ($typec === 'APP') $data['type'] = 'Approach'; |
|
| 1235 | - elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
|
| 1236 | - elseif ($typec === 'OBS') $data['type'] = 'Observer'; |
|
| 1237 | - elseif ($typec === 'GND') $data['type'] = 'Ground'; |
|
| 1238 | - elseif ($typec === 'DEL') $data['type'] = 'Delivery'; |
|
| 1239 | - elseif ($typec === 'DEP') $data['type'] = 'Departure'; |
|
| 1240 | - elseif ($typec === 'FSS') $data['type'] = 'Flight Service Station'; |
|
| 1241 | - elseif ($typec === 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
| 1242 | - else $data['type'] = 'Observer'; |
|
| 1243 | - if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
| 1712 | + if ($typec === 'APP') { |
|
| 1713 | + $data['type'] = 'Approach'; |
|
| 1714 | + } elseif ($typec === 'TWR') { |
|
| 1715 | + $data['type'] = 'Tower'; |
|
| 1716 | + } elseif ($typec === 'OBS') { |
|
| 1717 | + $data['type'] = 'Observer'; |
|
| 1718 | + } elseif ($typec === 'GND') { |
|
| 1719 | + $data['type'] = 'Ground'; |
|
| 1720 | + } elseif ($typec === 'DEL') { |
|
| 1721 | + $data['type'] = 'Delivery'; |
|
| 1722 | + } elseif ($typec === 'DEP') { |
|
| 1723 | + $data['type'] = 'Departure'; |
|
| 1724 | + } elseif ($typec === 'FSS') { |
|
| 1725 | + $data['type'] = 'Flight Service Station'; |
|
| 1726 | + } elseif ($typec === 'CTR') { |
|
| 1727 | + $data['type'] = 'Control Radar or Centre'; |
|
| 1728 | + } else { |
|
| 1729 | + $data['type'] = 'Observer'; |
|
| 1730 | + } |
|
| 1731 | + if (isset($ATC)) { |
|
| 1732 | + echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
| 1733 | + } |
|
| 1244 | 1734 | } |
| 1245 | 1735 | unset($data); |
| 1246 | 1736 | } |
@@ -1255,7 +1745,9 @@ discard block |
||
| 1255 | 1745 | ) |
| 1256 | 1746 | ) { |
| 1257 | 1747 | //$buffer = $Common->getData($hosts[$id]); |
| 1258 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1748 | + if ($globalDebug) { |
|
| 1749 | + echo 'Get Data...'."\n"; |
|
| 1750 | + } |
|
| 1259 | 1751 | $buffer = $Common->getData($value['host']); |
| 1260 | 1752 | $all_data = json_decode($buffer,true); |
| 1261 | 1753 | if ($buffer != '' && is_array($all_data)) { |
@@ -1263,10 +1755,16 @@ discard block |
||
| 1263 | 1755 | foreach ($all_data as $line) { |
| 1264 | 1756 | $data = array(); |
| 1265 | 1757 | //$data['id'] = $line['id']; // id not usable |
| 1266 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 1758 | + if (isset($line['pilotid'])) { |
|
| 1759 | + $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 1760 | + } |
|
| 1267 | 1761 | $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
| 1268 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
| 1269 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
| 1762 | + if (isset($line['pilotname'])) { |
|
| 1763 | + $data['pilot_name'] = $line['pilotname']; |
|
| 1764 | + } |
|
| 1765 | + if (isset($line['pilotid'])) { |
|
| 1766 | + $data['pilot_id'] = $line['pilotid']; |
|
| 1767 | + } |
|
| 1270 | 1768 | $data['ident'] = $line['flightnum']; // ident |
| 1271 | 1769 | $data['altitude'] = $line['alt']; // altitude |
| 1272 | 1770 | $data['speed'] = $line['gs']; // speed |
@@ -1282,7 +1780,9 @@ discard block |
||
| 1282 | 1780 | $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
| 1283 | 1781 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
| 1284 | 1782 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1285 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1783 | + } else { |
|
| 1784 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1785 | + } |
|
| 1286 | 1786 | $data['departure_airport_icao'] = $line['depicao']; |
| 1287 | 1787 | $data['departure_airport_time'] = $line['deptime']; |
| 1288 | 1788 | $data['arrival_airport_icao'] = $line['arricao']; |
@@ -1290,29 +1790,47 @@ discard block |
||
| 1290 | 1790 | if (isset($line['registration'])) { |
| 1291 | 1791 | $data['registration'] = $line['registration']; |
| 1292 | 1792 | //if (isset($line['aircraft'])) $data['id'] = $line['aircraft']; |
| 1293 | - } else $data['registration'] = $line['aircraft']; |
|
| 1294 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1295 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1793 | + } else { |
|
| 1794 | + $data['registration'] = $line['aircraft']; |
|
| 1795 | + } |
|
| 1796 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1797 | + $data['noarchive'] = true; |
|
| 1798 | + } |
|
| 1799 | + if (isset($line['route'])) { |
|
| 1800 | + $data['waypoints'] = $line['route']; |
|
| 1801 | + } |
|
| 1802 | + // route |
|
| 1296 | 1803 | if (isset($line['aircraftname'])) { |
| 1297 | 1804 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
| 1298 | 1805 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
| 1299 | 1806 | $aircraft_data = explode('-',$line['aircraftname']); |
| 1300 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 1301 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 1302 | - else { |
|
| 1807 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) { |
|
| 1808 | + $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 1809 | + } elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) { |
|
| 1810 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 1811 | + } else { |
|
| 1303 | 1812 | $aircraft_data = explode(' ',$line['aircraftname']); |
| 1304 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1305 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1813 | + if (isset($aircraft_data[1])) { |
|
| 1814 | + $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1815 | + } else { |
|
| 1816 | + $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1817 | + } |
|
| 1306 | 1818 | } |
| 1307 | 1819 | } |
| 1308 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 1820 | + if (isset($line['route'])) { |
|
| 1821 | + $data['waypoints'] = $line['route']; |
|
| 1822 | + } |
|
| 1309 | 1823 | $data['id_source'] = $id_source; |
| 1310 | 1824 | $data['format_source'] = 'phpvmacars'; |
| 1311 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1825 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1826 | + $data['source_name'] = $value['name']; |
|
| 1827 | + } |
|
| 1312 | 1828 | $SI->add($data); |
| 1313 | 1829 | unset($data); |
| 1314 | 1830 | } |
| 1315 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1831 | + if ($globalDebug) { |
|
| 1832 | + echo 'No more data...'."\n"; |
|
| 1833 | + } |
|
| 1316 | 1834 | unset($buffer); |
| 1317 | 1835 | unset($all_data); |
| 1318 | 1836 | } |
@@ -1325,7 +1843,9 @@ discard block |
||
| 1325 | 1843 | ) |
| 1326 | 1844 | ) { |
| 1327 | 1845 | //$buffer = $Common->getData($hosts[$id]); |
| 1328 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1846 | + if ($globalDebug) { |
|
| 1847 | + echo 'Get Data...'."\n"; |
|
| 1848 | + } |
|
| 1329 | 1849 | $buffer = $Common->getData($value['host']); |
| 1330 | 1850 | $all_data = json_decode($buffer,true); |
| 1331 | 1851 | if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) { |
@@ -1336,10 +1856,16 @@ discard block |
||
| 1336 | 1856 | //$data['id'] = $line['id']; // id not usable |
| 1337 | 1857 | $data['id'] = $line['id']; |
| 1338 | 1858 | //$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
| 1339 | - if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username']; |
|
| 1340 | - if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id']; |
|
| 1859 | + if (isset($line['user']['username'])) { |
|
| 1860 | + $data['pilot_name'] = $line['user']['username']; |
|
| 1861 | + } |
|
| 1862 | + if (isset($line['user_id'])) { |
|
| 1863 | + $data['pilot_id'] = $line['user_id']; |
|
| 1864 | + } |
|
| 1341 | 1865 | $data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident |
| 1342 | - if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
|
| 1866 | + if (is_numeric($data['ident'])) { |
|
| 1867 | + $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
|
| 1868 | + } |
|
| 1343 | 1869 | $data['altitude'] = $line['altitude']; // altitude |
| 1344 | 1870 | $data['speed'] = $line['groundspeed']; // speed |
| 1345 | 1871 | $data['heading'] = $line['heading']; // heading |
@@ -1352,7 +1878,9 @@ discard block |
||
| 1352 | 1878 | $datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone'])); |
| 1353 | 1879 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
| 1354 | 1880 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1355 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1881 | + } else { |
|
| 1882 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1883 | + } |
|
| 1356 | 1884 | |
| 1357 | 1885 | $data['departure_airport_icao'] = $line['bid']['depapt']['icao']; |
| 1358 | 1886 | $data['departure_airport_time'] = $line['bid']['deptime']; |
@@ -1360,17 +1888,26 @@ discard block |
||
| 1360 | 1888 | $data['arrival_airport_time'] = $line['bid']['arrtime']; |
| 1361 | 1889 | $data['registration'] = $line['bid']['aircraft']['registration']; |
| 1362 | 1890 | |
| 1363 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1364 | - if (isset($line['bid']['route']) && $line['bid']['route'] != '') $data['waypoints'] = $line['bid']['route']; // route |
|
| 1891 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1892 | + $data['noarchive'] = true; |
|
| 1893 | + } |
|
| 1894 | + if (isset($line['bid']['route']) && $line['bid']['route'] != '') { |
|
| 1895 | + $data['waypoints'] = $line['bid']['route']; |
|
| 1896 | + } |
|
| 1897 | + // route |
|
| 1365 | 1898 | $data['aircraft_icao'] = $line['bid']['aircraft']['icao']; |
| 1366 | 1899 | |
| 1367 | 1900 | $data['id_source'] = $id_source; |
| 1368 | 1901 | $data['format_source'] = 'vaos'; |
| 1369 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1902 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1903 | + $data['source_name'] = $value['name']; |
|
| 1904 | + } |
|
| 1370 | 1905 | $SI->add($data); |
| 1371 | 1906 | unset($data); |
| 1372 | 1907 | } |
| 1373 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1908 | + if ($globalDebug) { |
|
| 1909 | + echo 'No more data...'."\n"; |
|
| 1910 | + } |
|
| 1374 | 1911 | unset($buffer); |
| 1375 | 1912 | unset($all_data); |
| 1376 | 1913 | } |
@@ -1383,7 +1920,9 @@ discard block |
||
| 1383 | 1920 | ) |
| 1384 | 1921 | ) { |
| 1385 | 1922 | //$buffer = $Common->getData($hosts[$id]); |
| 1386 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1923 | + if ($globalDebug) { |
|
| 1924 | + echo 'Get Data...'."\n"; |
|
| 1925 | + } |
|
| 1387 | 1926 | $buffer = $Common->getData($value['host']); |
| 1388 | 1927 | $all_data = json_decode($buffer,true); |
| 1389 | 1928 | if ($buffer != '' && is_array($all_data)) { |
@@ -1412,16 +1951,25 @@ discard block |
||
| 1412 | 1951 | $data['arrival_airport_icao'] = $line['arrival']; |
| 1413 | 1952 | //$data['arrival_airport_time'] = $line['arrival_time']; |
| 1414 | 1953 | //$data['registration'] = $line['aircraft']; |
| 1415 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1954 | + if (isset($line['route'])) { |
|
| 1955 | + $data['waypoints'] = $line['route']; |
|
| 1956 | + } |
|
| 1957 | + // route |
|
| 1416 | 1958 | $data['aircraft_icao'] = $line['plane_type']; |
| 1417 | 1959 | $data['id_source'] = $id_source; |
| 1418 | 1960 | $data['format_source'] = 'vam'; |
| 1419 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1420 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1961 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1962 | + $data['noarchive'] = true; |
|
| 1963 | + } |
|
| 1964 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1965 | + $data['source_name'] = $value['name']; |
|
| 1966 | + } |
|
| 1421 | 1967 | $SI->add($data); |
| 1422 | 1968 | unset($data); |
| 1423 | 1969 | } |
| 1424 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1970 | + if ($globalDebug) { |
|
| 1971 | + echo 'No more data...'."\n"; |
|
| 1972 | + } |
|
| 1425 | 1973 | unset($buffer); |
| 1426 | 1974 | unset($all_data); |
| 1427 | 1975 | } |
@@ -1434,7 +1982,9 @@ discard block |
||
| 1434 | 1982 | ) |
| 1435 | 1983 | ) { |
| 1436 | 1984 | //$buffer = $Common->getData($hosts[$id]); |
| 1437 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1985 | + if ($globalDebug) { |
|
| 1986 | + echo 'Get Data...'."\n"; |
|
| 1987 | + } |
|
| 1438 | 1988 | $buffer = $Common->getData($value['host']); |
| 1439 | 1989 | $all_data = json_decode($buffer,true); |
| 1440 | 1990 | if ($buffer != '') { |
@@ -1452,12 +2002,16 @@ discard block |
||
| 1452 | 2002 | $data['id_source'] = $id_source; |
| 1453 | 2003 | $data['format_source'] = 'blitzortung'; |
| 1454 | 2004 | $SI->add($data); |
| 1455 | - if ($globalDebug) echo '☈ Lightning added'."\n"; |
|
| 2005 | + if ($globalDebug) { |
|
| 2006 | + echo '☈ Lightning added'."\n"; |
|
| 2007 | + } |
|
| 1456 | 2008 | $Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']); |
| 1457 | 2009 | unset($data); |
| 1458 | 2010 | } |
| 1459 | 2011 | } |
| 1460 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 2012 | + if ($globalDebug) { |
|
| 2013 | + echo 'No more data...'."\n"; |
|
| 2014 | + } |
|
| 1461 | 2015 | unset($buffer); |
| 1462 | 2016 | } |
| 1463 | 2017 | $last_exec[$id]['last'] = time(); |
@@ -1469,7 +2023,9 @@ discard block |
||
| 1469 | 2023 | $write = NULL; |
| 1470 | 2024 | $e = NULL; |
| 1471 | 2025 | $n = socket_select($read, $write, $e, $timeout); |
| 1472 | - if ($e != NULL) var_dump($e); |
|
| 2026 | + if ($e != NULL) { |
|
| 2027 | + var_dump($e); |
|
| 2028 | + } |
|
| 1473 | 2029 | if ($n > 0) { |
| 1474 | 2030 | $reset = 0; |
| 1475 | 2031 | foreach ($read as $nb => $r) { |
@@ -1491,13 +2047,17 @@ discard block |
||
| 1491 | 2047 | if ($buffer !== FALSE) { |
| 1492 | 2048 | if ($format === 'vrstcp') { |
| 1493 | 2049 | $buffer = explode('},{',$buffer); |
| 1494 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 2050 | + } else { |
|
| 2051 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 2052 | + } |
|
| 1495 | 2053 | } |
| 1496 | 2054 | // SBS format is CSV format |
| 1497 | 2055 | if ($buffer !== FALSE && $buffer !== '') { |
| 1498 | 2056 | $tt[$format] = 0; |
| 1499 | 2057 | if ($format === 'acarssbs3') { |
| 1500 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 2058 | + if ($globalDebug) { |
|
| 2059 | + echo 'ACARS : '.$buffer."\n"; |
|
| 2060 | + } |
|
| 1501 | 2061 | $ACARS->add(trim($buffer)); |
| 1502 | 2062 | $ACARS->deleteLiveAcarsData(); |
| 1503 | 2063 | } elseif ($format === 'raw') { |
@@ -1506,30 +2066,70 @@ discard block |
||
| 1506 | 2066 | if (is_array($data)) { |
| 1507 | 2067 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1508 | 2068 | $data['format_source'] = 'raw'; |
| 1509 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1510 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1511 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1512 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2069 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2070 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2071 | + } |
|
| 2072 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2073 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2074 | + } |
|
| 2075 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2076 | + $data['noarchive'] = true; |
|
| 2077 | + } |
|
| 2078 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2079 | + $SI->add($data); |
|
| 2080 | + } |
|
| 1513 | 2081 | } |
| 1514 | 2082 | } elseif ($format === 'ais') { |
| 1515 | 2083 | $ais_data = $AIS->parse_line(trim($buffer)); |
| 1516 | 2084 | $data = array(); |
| 1517 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 1518 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 1519 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 1520 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 1521 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 1522 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 1523 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 1524 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 1525 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 1526 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 1527 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 1528 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
| 1529 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 1530 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1531 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1532 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2085 | + if (isset($ais_data['ident'])) { |
|
| 2086 | + $data['ident'] = $ais_data['ident']; |
|
| 2087 | + } |
|
| 2088 | + if (isset($ais_data['mmsi'])) { |
|
| 2089 | + $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 2090 | + } |
|
| 2091 | + if (isset($ais_data['speed'])) { |
|
| 2092 | + $data['speed'] = $ais_data['speed']; |
|
| 2093 | + } |
|
| 2094 | + if (isset($ais_data['heading'])) { |
|
| 2095 | + $data['heading'] = $ais_data['heading']; |
|
| 2096 | + } |
|
| 2097 | + if (isset($ais_data['latitude'])) { |
|
| 2098 | + $data['latitude'] = $ais_data['latitude']; |
|
| 2099 | + } |
|
| 2100 | + if (isset($ais_data['longitude'])) { |
|
| 2101 | + $data['longitude'] = $ais_data['longitude']; |
|
| 2102 | + } |
|
| 2103 | + if (isset($ais_data['status'])) { |
|
| 2104 | + $data['status'] = $ais_data['status']; |
|
| 2105 | + } |
|
| 2106 | + if (isset($ais_data['statusid'])) { |
|
| 2107 | + $data['status_id'] = $ais_data['statusid']; |
|
| 2108 | + } |
|
| 2109 | + if (isset($ais_data['type'])) { |
|
| 2110 | + $data['type'] = $ais_data['type']; |
|
| 2111 | + } |
|
| 2112 | + if (isset($ais_data['imo'])) { |
|
| 2113 | + $data['imo'] = $ais_data['imo']; |
|
| 2114 | + } |
|
| 2115 | + if (isset($ais_data['callsign'])) { |
|
| 2116 | + $data['callsign'] = $ais_data['callsign']; |
|
| 2117 | + } |
|
| 2118 | + if (isset($ais_data['destination'])) { |
|
| 2119 | + $data['arrival_code'] = $ais_data['destination']; |
|
| 2120 | + } |
|
| 2121 | + if (isset($ais_data['eta_ts'])) { |
|
| 2122 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 2123 | + } |
|
| 2124 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2125 | + $data['noarchive'] = true; |
|
| 2126 | + } |
|
| 2127 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2128 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2129 | + } |
|
| 2130 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2131 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2132 | + } |
|
| 1533 | 2133 | |
| 1534 | 2134 | if (isset($ais_data['timestamp'])) { |
| 1535 | 2135 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
@@ -1538,7 +2138,9 @@ discard block |
||
| 1538 | 2138 | } |
| 1539 | 2139 | $data['format_source'] = 'aisnmea'; |
| 1540 | 2140 | $data['id_source'] = $id_source; |
| 1541 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
|
| 2141 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') { |
|
| 2142 | + $MI->add($data); |
|
| 2143 | + } |
|
| 1542 | 2144 | unset($data); |
| 1543 | 2145 | } elseif ($format === 'flightgearsp') { |
| 1544 | 2146 | //echo $buffer."\n"; |
@@ -1556,12 +2158,18 @@ discard block |
||
| 1556 | 2158 | $data['speed'] = round($line[5]*1.94384); |
| 1557 | 2159 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1558 | 2160 | $data['format_source'] = 'flightgearsp'; |
| 1559 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1560 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2161 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2162 | + $data['noarchive'] = true; |
|
| 2163 | + } |
|
| 2164 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2165 | + $SI->add($data); |
|
| 2166 | + } |
|
| 1561 | 2167 | //$send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 1562 | 2168 | } |
| 1563 | 2169 | } elseif ($format === 'acars') { |
| 1564 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 2170 | + if ($globalDebug) { |
|
| 2171 | + echo 'ACARS : '.$buffer."\n"; |
|
| 2172 | + } |
|
| 1565 | 2173 | $ACARS->add(trim($buffer)); |
| 1566 | 2174 | socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
| 1567 | 2175 | $ACARS->deleteLiveAcarsData(); |
@@ -1582,8 +2190,12 @@ discard block |
||
| 1582 | 2190 | $aircraft_type = $line[10]; |
| 1583 | 2191 | $aircraft_type = preg_split(':/:',$aircraft_type); |
| 1584 | 2192 | $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
| 1585 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1586 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2193 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2194 | + $data['noarchive'] = true; |
|
| 2195 | + } |
|
| 2196 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2197 | + $SI->add($data); |
|
| 2198 | + } |
|
| 1587 | 2199 | } |
| 1588 | 2200 | } |
| 1589 | 2201 | } elseif ($format === 'beast') { |
@@ -1593,28 +2205,62 @@ discard block |
||
| 1593 | 2205 | foreach($buffer as $all_data) { |
| 1594 | 2206 | $line = json_decode('{'.$all_data.'}',true); |
| 1595 | 2207 | $data = array(); |
| 1596 | - if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
|
| 1597 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 1598 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 1599 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 1600 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 1601 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 1602 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 2208 | + if (isset($line['Icao'])) { |
|
| 2209 | + $data['hex'] = $line['Icao']; |
|
| 2210 | + } |
|
| 2211 | + // hex |
|
| 2212 | + if (isset($line['Call'])) { |
|
| 2213 | + $data['ident'] = $line['Call']; |
|
| 2214 | + } |
|
| 2215 | + // ident |
|
| 2216 | + if (isset($line['Alt'])) { |
|
| 2217 | + $data['altitude'] = $line['Alt']; |
|
| 2218 | + } |
|
| 2219 | + // altitude |
|
| 2220 | + if (isset($line['Spd'])) { |
|
| 2221 | + $data['speed'] = $line['Spd']; |
|
| 2222 | + } |
|
| 2223 | + // speed |
|
| 2224 | + if (isset($line['Trak'])) { |
|
| 2225 | + $data['heading'] = $line['Trak']; |
|
| 2226 | + } |
|
| 2227 | + // heading |
|
| 2228 | + if (isset($line['Lat'])) { |
|
| 2229 | + $data['latitude'] = $line['Lat']; |
|
| 2230 | + } |
|
| 2231 | + // lat |
|
| 2232 | + if (isset($line['Long'])) { |
|
| 2233 | + $data['longitude'] = $line['Long']; |
|
| 2234 | + } |
|
| 2235 | + // long |
|
| 1603 | 2236 | //$data['verticalrate'] = $line['']; // verticale rate |
| 1604 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 2237 | + if (isset($line['Sqk'])) { |
|
| 2238 | + $data['squawk'] = $line['Sqk']; |
|
| 2239 | + } |
|
| 2240 | + // squawk |
|
| 1605 | 2241 | $data['emergency'] = ''; // emergency |
| 1606 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 2242 | + if (isset($line['Reg'])) { |
|
| 2243 | + $data['registration'] = $line['Reg']; |
|
| 2244 | + } |
|
| 1607 | 2245 | /* |
| 1608 | 2246 | if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000); |
| 1609 | 2247 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 1610 | 2248 | */ |
| 1611 | 2249 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1612 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 2250 | + if (isset($line['Type'])) { |
|
| 2251 | + $data['aircraft_icao'] = $line['Type']; |
|
| 2252 | + } |
|
| 1613 | 2253 | $data['format_source'] = 'vrstcp'; |
| 1614 | 2254 | $data['id_source'] = $id_source; |
| 1615 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1616 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1617 | - if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
|
| 2255 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2256 | + $data['noarchive'] = true; |
|
| 2257 | + } |
|
| 2258 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 2259 | + $data['source_name'] = $value['name']; |
|
| 2260 | + } |
|
| 2261 | + if (isset($data['latitude']) && isset($data['hex'])) { |
|
| 2262 | + $SI->add($data); |
|
| 2263 | + } |
|
| 1618 | 2264 | unset($data); |
| 1619 | 2265 | } |
| 1620 | 2266 | } elseif ($format === 'tsv' || substr($buffer,0,4) === 'clock') { |
@@ -1627,22 +2273,46 @@ discard block |
||
| 1627 | 2273 | $data['hex'] = $lined['hexid']; |
| 1628 | 2274 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
| 1629 | 2275 | $data['datetime'] = date('Y-m-d H:i:s');; |
| 1630 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
| 1631 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
| 1632 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
| 1633 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
| 1634 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
| 1635 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
| 1636 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
| 2276 | + if (isset($lined['ident'])) { |
|
| 2277 | + $data['ident'] = $lined['ident']; |
|
| 2278 | + } |
|
| 2279 | + if (isset($lined['lat'])) { |
|
| 2280 | + $data['latitude'] = $lined['lat']; |
|
| 2281 | + } |
|
| 2282 | + if (isset($lined['lon'])) { |
|
| 2283 | + $data['longitude'] = $lined['lon']; |
|
| 2284 | + } |
|
| 2285 | + if (isset($lined['speed'])) { |
|
| 2286 | + $data['speed'] = $lined['speed']; |
|
| 2287 | + } |
|
| 2288 | + if (isset($lined['squawk'])) { |
|
| 2289 | + $data['squawk'] = $lined['squawk']; |
|
| 2290 | + } |
|
| 2291 | + if (isset($lined['alt'])) { |
|
| 2292 | + $data['altitude'] = $lined['alt']; |
|
| 2293 | + } |
|
| 2294 | + if (isset($lined['heading'])) { |
|
| 2295 | + $data['heading'] = $lined['heading']; |
|
| 2296 | + } |
|
| 1637 | 2297 | $data['id_source'] = $id_source; |
| 1638 | 2298 | $data['format_source'] = 'tsv'; |
| 1639 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1640 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1641 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1642 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2299 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2300 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2301 | + } |
|
| 2302 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2303 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2304 | + } |
|
| 2305 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2306 | + $data['noarchive'] = true; |
|
| 2307 | + } |
|
| 2308 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2309 | + $SI->add($data); |
|
| 2310 | + } |
|
| 1643 | 2311 | unset($lined); |
| 1644 | 2312 | unset($data); |
| 1645 | - } else $error = true; |
|
| 2313 | + } else { |
|
| 2314 | + $error = true; |
|
| 2315 | + } |
|
| 1646 | 2316 | } elseif ($format === 'aprs' && $use_aprs) { |
| 1647 | 2317 | if ($aprs_connect === 0) { |
| 1648 | 2318 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
@@ -1668,47 +2338,96 @@ discard block |
||
| 1668 | 2338 | $aprs_last_tx = time(); |
| 1669 | 2339 | $data = array(); |
| 1670 | 2340 | //print_r($line); |
| 1671 | - if (isset($line['address'])) $data['hex'] = $line['address']; |
|
| 1672 | - if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi']; |
|
| 1673 | - if (isset($line['imo'])) $data['imo'] = $line['imo']; |
|
| 1674 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; |
|
| 1675 | - if (isset($line['arrival_code'])) $data['arrival_code'] = $line['arrival_code']; |
|
| 1676 | - if (isset($line['arrival_date'])) $data['arrival_date'] = $line['arrival_date']; |
|
| 1677 | - if (isset($line['typeid'])) $data['type_id'] = $line['typeid']; |
|
| 1678 | - if (isset($line['statusid'])) $data['status_id'] = $line['statusid']; |
|
| 1679 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 1680 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2341 | + if (isset($line['address'])) { |
|
| 2342 | + $data['hex'] = $line['address']; |
|
| 2343 | + } |
|
| 2344 | + if (isset($line['mmsi'])) { |
|
| 2345 | + $data['mmsi'] = $line['mmsi']; |
|
| 2346 | + } |
|
| 2347 | + if (isset($line['imo'])) { |
|
| 2348 | + $data['imo'] = $line['imo']; |
|
| 2349 | + } |
|
| 2350 | + if (isset($line['squawk'])) { |
|
| 2351 | + $data['squawk'] = $line['squawk']; |
|
| 2352 | + } |
|
| 2353 | + if (isset($line['arrival_code'])) { |
|
| 2354 | + $data['arrival_code'] = $line['arrival_code']; |
|
| 2355 | + } |
|
| 2356 | + if (isset($line['arrival_date'])) { |
|
| 2357 | + $data['arrival_date'] = $line['arrival_date']; |
|
| 2358 | + } |
|
| 2359 | + if (isset($line['typeid'])) { |
|
| 2360 | + $data['type_id'] = $line['typeid']; |
|
| 2361 | + } |
|
| 2362 | + if (isset($line['statusid'])) { |
|
| 2363 | + $data['status_id'] = $line['statusid']; |
|
| 2364 | + } |
|
| 2365 | + if (isset($line['timestamp'])) { |
|
| 2366 | + $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 2367 | + } else { |
|
| 2368 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2369 | + } |
|
| 1681 | 2370 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 1682 | - if (isset($line['ident'])) $data['ident'] = $line['ident']; |
|
| 2371 | + if (isset($line['ident'])) { |
|
| 2372 | + $data['ident'] = $line['ident']; |
|
| 2373 | + } |
|
| 1683 | 2374 | $data['latitude'] = $line['latitude']; |
| 1684 | 2375 | $data['longitude'] = $line['longitude']; |
| 1685 | 2376 | //$data['verticalrate'] = $line[16]; |
| 1686 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 2377 | + if (isset($line['speed'])) { |
|
| 2378 | + $data['speed'] = $line['speed']; |
|
| 2379 | + } |
|
| 1687 | 2380 | //else $data['speed'] = 0; |
| 1688 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; |
|
| 1689 | - if (isset($line['comment'])) $data['comment'] = $line['comment']; |
|
| 1690 | - if (isset($line['symbol'])) $data['type'] = $line['symbol']; |
|
| 2381 | + if (isset($line['altitude'])) { |
|
| 2382 | + $data['altitude'] = $line['altitude']; |
|
| 2383 | + } |
|
| 2384 | + if (isset($line['comment'])) { |
|
| 2385 | + $data['comment'] = $line['comment']; |
|
| 2386 | + } |
|
| 2387 | + if (isset($line['symbol'])) { |
|
| 2388 | + $data['type'] = $line['symbol']; |
|
| 2389 | + } |
|
| 1691 | 2390 | //if (isset($line['heading'])) $data['heading'] = $line['heading']; |
| 1692 | 2391 | |
| 1693 | - if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading']; |
|
| 2392 | + if (isset($line['heading']) && isset($line['format_source'])) { |
|
| 2393 | + $data['heading'] = $line['heading']; |
|
| 2394 | + } |
|
| 1694 | 2395 | //else echo 'No heading...'."\n"; |
| 1695 | 2396 | //else $data['heading'] = 0; |
| 1696 | - if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth']; |
|
| 2397 | + if (isset($line['stealth'])) { |
|
| 2398 | + $data['aircraft_type'] = $line['stealth']; |
|
| 2399 | + } |
|
| 1697 | 2400 | //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true; |
| 1698 | - if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true; |
|
| 1699 | - elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false; |
|
| 1700 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1701 | - elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false; |
|
| 2401 | + if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) { |
|
| 2402 | + $data['noarchive'] = true; |
|
| 2403 | + } elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) { |
|
| 2404 | + $data['noarchive'] = false; |
|
| 2405 | + } |
|
| 2406 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2407 | + $data['noarchive'] = true; |
|
| 2408 | + } elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) { |
|
| 2409 | + $data['noarchive'] = false; |
|
| 2410 | + } |
|
| 1702 | 2411 | $data['id_source'] = $id_source; |
| 1703 | - if (isset($line['format_source'])) $data['format_source'] = $line['format_source']; |
|
| 1704 | - else $data['format_source'] = 'aprs'; |
|
| 2412 | + if (isset($line['format_source'])) { |
|
| 2413 | + $data['format_source'] = $line['format_source']; |
|
| 2414 | + } else { |
|
| 2415 | + $data['format_source'] = 'aprs'; |
|
| 2416 | + } |
|
| 1705 | 2417 | $data['source_name'] = $line['source']; |
| 1706 | - if (isset($line['source_type'])) $data['source_type'] = $line['source_type']; |
|
| 1707 | - else $data['source_type'] = 'flarm'; |
|
| 1708 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2418 | + if (isset($line['source_type'])) { |
|
| 2419 | + $data['source_type'] = $line['source_type']; |
|
| 2420 | + } else { |
|
| 2421 | + $data['source_type'] = 'flarm'; |
|
| 2422 | + } |
|
| 2423 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2424 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2425 | + } |
|
| 1709 | 2426 | $currentdate = date('Y-m-d H:i:s'); |
| 1710 | 2427 | $aprsdate = strtotime($data['datetime']); |
| 1711 | - if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL'; |
|
| 2428 | + if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') { |
|
| 2429 | + $data['altitude_relative'] = 'AMSL'; |
|
| 2430 | + } |
|
| 1712 | 2431 | // Accept data if time <= system time + 20s |
| 1713 | 2432 | //if (($data['source_type'] === 'modes') || isset($line['stealth']) && ($line['stealth'] === 0 || $line['stealth'] === '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
| 1714 | 2433 | if ( |
@@ -1720,7 +2439,9 @@ discard block |
||
| 1720 | 2439 | $send = $SI->add($data); |
| 1721 | 2440 | } elseif ($data['source_type'] === 'ais') { |
| 1722 | 2441 | $data['type'] = ''; |
| 1723 | - if (isset($globalMarine) && $globalMarine) $send = $MI->add($data); |
|
| 2442 | + if (isset($globalMarine) && $globalMarine) { |
|
| 2443 | + $send = $MI->add($data); |
|
| 2444 | + } |
|
| 1724 | 2445 | } elseif (isset($line['stealth']) && $line['stealth'] != 0) { |
| 1725 | 2446 | echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
| 1726 | 2447 | } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
@@ -1728,8 +2449,12 @@ discard block |
||
| 1728 | 2449 | $line['symbol'] === 'Glider' || |
| 1729 | 2450 | $line['symbol'] === 'No. Plane' || |
| 1730 | 2451 | $line['symbol'] === 'Aircraft (small)' || $line['symbol'] === 'Helicopter')) { |
| 1731 | - if ($line['symbol'] === 'Ballon') $data['aircraft_icao'] = 'BALL'; |
|
| 1732 | - if ($line['symbol'] === 'Glider') $data['aircraft_icao'] = 'PARAGLIDER'; |
|
| 2452 | + if ($line['symbol'] === 'Ballon') { |
|
| 2453 | + $data['aircraft_icao'] = 'BALL'; |
|
| 2454 | + } |
|
| 2455 | + if ($line['symbol'] === 'Glider') { |
|
| 2456 | + $data['aircraft_icao'] = 'PARAGLIDER'; |
|
| 2457 | + } |
|
| 1733 | 2458 | $send = $SI->add($data); |
| 1734 | 2459 | } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
| 1735 | 2460 | $line['symbol'] === 'Yacht (Sail)' || |
@@ -1760,9 +2485,13 @@ discard block |
||
| 1760 | 2485 | //} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && isset($line['speed']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') { |
| 1761 | 2486 | // } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') { |
| 1762 | 2487 | //echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n"; |
| 1763 | - if (isset($globalTracker) && $globalTracker) $send = $TI->add($data); |
|
| 2488 | + if (isset($globalTracker) && $globalTracker) { |
|
| 2489 | + $send = $TI->add($data); |
|
| 2490 | + } |
|
| 1764 | 2491 | } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
| 1765 | - if (!isset($data['altitude'])) $data['altitude'] = 0; |
|
| 2492 | + if (!isset($data['altitude'])) { |
|
| 2493 | + $data['altitude'] = 0; |
|
| 2494 | + } |
|
| 1766 | 2495 | $Source->deleteOldLocationByType('gs'); |
| 1767 | 2496 | if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { |
| 1768 | 2497 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
@@ -1771,7 +2500,9 @@ discard block |
||
| 1771 | 2500 | } |
| 1772 | 2501 | } elseif (isset($line['symbol']) && $line['symbol'] === 'Weather Station') { |
| 1773 | 2502 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1774 | - if ($globalDebug) echo '# Weather Station added'."\n"; |
|
| 2503 | + if ($globalDebug) { |
|
| 2504 | + echo '# Weather Station added'."\n"; |
|
| 2505 | + } |
|
| 1775 | 2506 | $Source->deleteOldLocationByType('wx'); |
| 1776 | 2507 | $weather_data = json_encode($line); |
| 1777 | 2508 | if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) { |
@@ -1781,7 +2512,9 @@ discard block |
||
| 1781 | 2512 | } |
| 1782 | 2513 | } elseif (isset($line['symbol']) && ($line['symbol'] === 'Lightning' || $line['symbol'] === 'Thunderstorm')) { |
| 1783 | 2514 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1784 | - if ($globalDebug) echo '☈ Lightning added'."\n"; |
|
| 2515 | + if ($globalDebug) { |
|
| 2516 | + echo '☈ Lightning added'."\n"; |
|
| 2517 | + } |
|
| 1785 | 2518 | $Source->deleteOldLocationByType('lightning'); |
| 1786 | 2519 | if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) { |
| 1787 | 2520 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
@@ -1793,8 +2526,7 @@ discard block |
||
| 1793 | 2526 | print_r($line); |
| 1794 | 2527 | } |
| 1795 | 2528 | unset($data); |
| 1796 | - } |
|
| 1797 | - elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
| 2529 | + } elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
| 1798 | 2530 | $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
| 1799 | 2531 | } |
| 1800 | 2532 | /* |
@@ -1803,7 +2535,9 @@ discard block |
||
| 1803 | 2535 | } |
| 1804 | 2536 | */ |
| 1805 | 2537 | //elseif ($line === false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
| 1806 | - elseif ($line === true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
|
| 2538 | + elseif ($line === true && $globalDebug) { |
|
| 2539 | + echo '!! Failed : '.$buffer."!!\n"; |
|
| 2540 | + } |
|
| 1807 | 2541 | if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) { |
| 1808 | 2542 | $Source->deleteOldLocationByType('lightning'); |
| 1809 | 2543 | $Source->deleteOldLocationByType('wx'); |
@@ -1839,27 +2573,47 @@ discard block |
||
| 1839 | 2573 | $data['ground'] = $line[21]; |
| 1840 | 2574 | $data['emergency'] = $line[19]; |
| 1841 | 2575 | $data['format_source'] = 'sbs'; |
| 1842 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1843 | - elseif ($line[0] == 'MLAT') $data['source_name'] = 'MLAT'; |
|
| 1844 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1845 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 2576 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2577 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2578 | + } elseif ($line[0] == 'MLAT') { |
|
| 2579 | + $data['source_name'] = 'MLAT'; |
|
| 2580 | + } |
|
| 2581 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2582 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2583 | + } |
|
| 2584 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2585 | + $data['noarchive'] = true; |
|
| 2586 | + } |
|
| 1846 | 2587 | $data['id_source'] = $id_source; |
| 1847 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
| 1848 | - else $error = true; |
|
| 2588 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2589 | + $send = $SI->add($data); |
|
| 2590 | + } else { |
|
| 2591 | + $error = true; |
|
| 2592 | + } |
|
| 1849 | 2593 | unset($data); |
| 1850 | - } else $error = true; |
|
| 2594 | + } else { |
|
| 2595 | + $error = true; |
|
| 2596 | + } |
|
| 1851 | 2597 | if ($error) { |
| 1852 | 2598 | if (count($line) > 1 && ($line[0] === 'STA' || $line[0] === 'AIR' || $line[0] === 'SEL' || $line[0] === 'ID' || $line[0] === 'CLK')) { |
| 1853 | - if ($globalDebug) echo "Not a message. Ignoring... \n"; |
|
| 2599 | + if ($globalDebug) { |
|
| 2600 | + echo "Not a message. Ignoring... \n"; |
|
| 2601 | + } |
|
| 1854 | 2602 | } else { |
| 1855 | - if ($globalDebug) echo "Wrong line format. Ignoring... \n"; |
|
| 2603 | + if ($globalDebug) { |
|
| 2604 | + echo "Wrong line format. Ignoring... \n"; |
|
| 2605 | + } |
|
| 1856 | 2606 | if ($globalDebug) { |
| 1857 | 2607 | echo $buffer; |
| 1858 | 2608 | //print_r($line); |
| 1859 | 2609 | } |
| 1860 | 2610 | //socket_close($r); |
| 1861 | - if ($globalDebug) echo "Reconnect after an error...\n"; |
|
| 1862 | - if ($format === 'aprs') $aprs_connect = 0; |
|
| 2611 | + if ($globalDebug) { |
|
| 2612 | + echo "Reconnect after an error...\n"; |
|
| 2613 | + } |
|
| 2614 | + if ($format === 'aprs') { |
|
| 2615 | + $aprs_connect = 0; |
|
| 2616 | + } |
|
| 1863 | 2617 | $sourceer[$nb] = $globalSources[$nb]; |
| 1864 | 2618 | connect_all($sourceer); |
| 1865 | 2619 | $sourceer = array(); |
@@ -1867,10 +2621,14 @@ discard block |
||
| 1867 | 2621 | } |
| 1868 | 2622 | } |
| 1869 | 2623 | // Sleep for xxx microseconds |
| 1870 | - if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
|
| 2624 | + if (isset($globalSBSSleep)) { |
|
| 2625 | + usleep($globalSBSSleep); |
|
| 2626 | + } |
|
| 1871 | 2627 | } else { |
| 1872 | 2628 | if ($format === 'flightgearmp') { |
| 1873 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 2629 | + if ($globalDebug) { |
|
| 2630 | + echo "Reconnect FlightGear MP..."; |
|
| 2631 | + } |
|
| 1874 | 2632 | //@socket_close($r); |
| 1875 | 2633 | sleep($globalMinFetch); |
| 1876 | 2634 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -1879,10 +2637,15 @@ discard block |
||
| 1879 | 2637 | break; |
| 1880 | 2638 | |
| 1881 | 2639 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
| 1882 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 1883 | - else $tt[$format] = 0; |
|
| 2640 | + if (isset($tt[$format])) { |
|
| 2641 | + $tt[$format]++; |
|
| 2642 | + } else { |
|
| 2643 | + $tt[$format] = 0; |
|
| 2644 | + } |
|
| 1884 | 2645 | if ($tt[$format] > 30 || $buffer === FALSE) { |
| 1885 | - if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
|
| 2646 | + if ($globalDebug) { |
|
| 2647 | + echo "ERROR : Reconnect ".$format."..."; |
|
| 2648 | + } |
|
| 1886 | 2649 | //@socket_close($r); |
| 1887 | 2650 | sleep(2); |
| 1888 | 2651 | $aprs_connect = 0; |
@@ -1900,11 +2663,17 @@ discard block |
||
| 1900 | 2663 | } else { |
| 1901 | 2664 | $error = socket_strerror(socket_last_error()); |
| 1902 | 2665 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
| 1903 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
| 1904 | - if (isset($globalDebug)) echo "Restarting...\n"; |
|
| 2666 | + if ($globalDebug) { |
|
| 2667 | + echo "ERROR : socket_select give this error ".$error . "\n"; |
|
| 2668 | + } |
|
| 2669 | + if (isset($globalDebug)) { |
|
| 2670 | + echo "Restarting...\n"; |
|
| 2671 | + } |
|
| 1905 | 2672 | // Restart the script if possible |
| 1906 | 2673 | if (is_array($sockets)) { |
| 1907 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 2674 | + if ($globalDebug) { |
|
| 2675 | + echo "Shutdown all sockets..."; |
|
| 2676 | + } |
|
| 1908 | 2677 | |
| 1909 | 2678 | foreach ($sockets as $sock) { |
| 1910 | 2679 | @socket_shutdown($sock,2); |
@@ -1912,25 +2681,45 @@ discard block |
||
| 1912 | 2681 | } |
| 1913 | 2682 | |
| 1914 | 2683 | } |
| 1915 | - if ($globalDebug) echo "Waiting..."; |
|
| 2684 | + if ($globalDebug) { |
|
| 2685 | + echo "Waiting..."; |
|
| 2686 | + } |
|
| 1916 | 2687 | sleep(2); |
| 1917 | 2688 | $time = time(); |
| 1918 | 2689 | //connect_all($hosts); |
| 1919 | 2690 | $aprs_connect = 0; |
| 1920 | - if ($reset%5 === 0) sleep(20); |
|
| 1921 | - if ($reset%10 === 0) sleep(100); |
|
| 1922 | - if ($reset%20 === 0) sleep(200); |
|
| 1923 | - if ($reset > 100) exit('Too many attempts...'); |
|
| 1924 | - if ($globalDebug) echo "Restart all connections..."; |
|
| 2691 | + if ($reset%5 === 0) { |
|
| 2692 | + sleep(20); |
|
| 2693 | + } |
|
| 2694 | + if ($reset%10 === 0) { |
|
| 2695 | + sleep(100); |
|
| 2696 | + } |
|
| 2697 | + if ($reset%20 === 0) { |
|
| 2698 | + sleep(200); |
|
| 2699 | + } |
|
| 2700 | + if ($reset > 100) { |
|
| 2701 | + exit('Too many attempts...'); |
|
| 2702 | + } |
|
| 2703 | + if ($globalDebug) { |
|
| 2704 | + echo "Restart all connections..."; |
|
| 2705 | + } |
|
| 1925 | 2706 | connect_all($globalSources); |
| 1926 | 2707 | } |
| 1927 | 2708 | } |
| 1928 | 2709 | } |
| 1929 | 2710 | if ($globalDaemon === false) { |
| 1930 | - if ($globalDebug) echo 'Check all...'."\n"; |
|
| 1931 | - if (isset($SI)) $SI->checkAll(); |
|
| 1932 | - if (isset($TI)) $TI->checkAll(); |
|
| 1933 | - if (isset($MI)) $MI->checkAll(); |
|
| 2711 | + if ($globalDebug) { |
|
| 2712 | + echo 'Check all...'."\n"; |
|
| 2713 | + } |
|
| 2714 | + if (isset($SI)) { |
|
| 2715 | + $SI->checkAll(); |
|
| 2716 | + } |
|
| 2717 | + if (isset($TI)) { |
|
| 2718 | + $TI->checkAll(); |
|
| 2719 | + } |
|
| 2720 | + if (isset($MI)) { |
|
| 2721 | + $MI->checkAll(); |
|
| 2722 | + } |
|
| 1934 | 2723 | } |
| 1935 | 2724 | } |
| 1936 | 2725 | } |
@@ -58,7 +58,9 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
| 60 | 60 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 61 | - } else $image = $spotter_item['image_thumbnail']; |
|
| 61 | + } else { |
|
| 62 | + $image = $spotter_item['image_thumbnail']; |
|
| 63 | + } |
|
| 62 | 64 | } |
| 63 | 65 | /* else { |
| 64 | 66 | $image = "images/placeholder_thumb.png"; |
@@ -75,10 +77,14 @@ discard block |
||
| 75 | 77 | print '<div class="callsign-details">'; |
| 76 | 78 | if ($spotter_item['ident'] != 'Not Available') { |
| 77 | 79 | print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a>'; |
| 78 | - if (isset($spotter_item['blocked']) && $spotter_item['blocked'] === true) print '<img src="'.$globalURL.'/images/forbidden.png" title="'._("Callsign is in blocked FAA list").'" class="blocked" />'; |
|
| 80 | + if (isset($spotter_item['blocked']) && $spotter_item['blocked'] === true) { |
|
| 81 | + print '<img src="'.$globalURL.'/images/forbidden.png" title="'._("Callsign is in blocked FAA list").'" class="blocked" />'; |
|
| 82 | + } |
|
| 79 | 83 | print '</div>'; |
| 80 | 84 | } |
| 81 | - if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
| 85 | + if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') { |
|
| 86 | + print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
| 87 | + } |
|
| 82 | 88 | print '</div>'; |
| 83 | 89 | if ($spotter_item['departure_airport'] != 'NA' && $spotter_item['arrival_airport'] != 'NA') { |
| 84 | 90 | print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country']; |
@@ -110,15 +116,25 @@ discard block |
||
| 110 | 116 | print '</div>'; |
| 111 | 117 | print '<div id="aircraft">'; |
| 112 | 118 | print '<span>'._("Aircraft").'</span>'; |
| 113 | - if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
| 119 | + if (isset($spotter_item['aircraft_wiki'])) { |
|
| 120 | + print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
| 121 | + } |
|
| 114 | 122 | if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') { |
| 115 | 123 | $aircraft_names = explode('/',$spotter_item['aircraft_name']); |
| 116 | - if (count($aircraft_names) == 1) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
| 117 | - else print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
| 118 | - } elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
|
| 119 | - else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
| 124 | + if (count($aircraft_names) == 1) { |
|
| 125 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
| 126 | + } else { |
|
| 127 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
| 128 | + } |
|
| 129 | + } elseif (isset($spotter_item['aircraft_type'])) { |
|
| 130 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
|
| 131 | + } else { |
|
| 132 | + print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
| 133 | + } |
|
| 120 | 134 | print '</div>'; |
| 121 | - if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
| 135 | + if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') { |
|
| 136 | + print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
| 137 | + } |
|
| 122 | 138 | |
| 123 | 139 | print '<div id="altitude"><span>'._("Altitude").'</span>'; |
| 124 | 140 | if (isset($globalGroundAltitude) && $globalGroundAltitude) { |
@@ -131,11 +147,17 @@ discard block |
||
| 131 | 147 | |
| 132 | 148 | print '<span class="altitude">'; |
| 133 | 149 | if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
| 134 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')'; |
|
| 135 | - else print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')'; |
|
| 150 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
| 151 | + print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')'; |
|
| 152 | + } else { |
|
| 153 | + print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')'; |
|
| 154 | + } |
|
| 136 | 155 | } else { |
| 137 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')'; |
|
| 138 | - else print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
|
| 156 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
| 157 | + print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')'; |
|
| 158 | + } else { |
|
| 159 | + print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
|
| 160 | + } |
|
| 139 | 161 | } |
| 140 | 162 | print '</span>'; |
| 141 | 163 | |
@@ -200,8 +222,11 @@ discard block |
||
| 200 | 222 | } |
| 201 | 223 | if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') { |
| 202 | 224 | print '<div id="pilot"><span>'._("Pilot").'</span>'; |
| 203 | - if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
| 204 | - else print $spotter_item['pilot_name']; |
|
| 225 | + if (isset($spotter_item['pilot_id'])) { |
|
| 226 | + print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
| 227 | + } else { |
|
| 228 | + print $spotter_item['pilot_name']; |
|
| 229 | + } |
|
| 205 | 230 | print '</div>'; |
| 206 | 231 | } |
| 207 | 232 | if (isset($spotter_item['aircraft_owner']) && $spotter_item['aircraft_owner'] != '') { |
@@ -227,10 +252,18 @@ discard block |
||
| 227 | 252 | } |
| 228 | 253 | print '</div>'; |
| 229 | 254 | print '</div>'; |
| 230 | - if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
| 231 | - if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
| 232 | - if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
| 233 | - if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
| 255 | + if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') { |
|
| 256 | + print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
| 257 | + } |
|
| 258 | + if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') { |
|
| 259 | + print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
| 260 | + } |
|
| 261 | + if (isset($spotter_item['acars']['message'])) { |
|
| 262 | + print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
| 263 | + } |
|
| 264 | + if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) { |
|
| 265 | + print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
| 266 | + } |
|
| 234 | 267 | print '</div>'; |
| 235 | 268 | } |
| 236 | 269 | ?> |
@@ -27,21 +27,30 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | document.cookie = 'MapFormat=3d; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' |
| 29 | 29 | <?php |
| 30 | - if (isset($_COOKIE['MapType3D'])) $MapType = $_COOKIE['MapType3D']; |
|
| 31 | - else $MapType = $globalMapProvider; |
|
| 32 | -// unset($_COOKIE['MapType']); |
|
| 30 | + if (isset($_COOKIE['MapType3D'])) { |
|
| 31 | + $MapType = $_COOKIE['MapType3D']; |
|
| 32 | + } else { |
|
| 33 | + $MapType = $globalMapProvider; |
|
| 34 | + } |
|
| 35 | + // unset($_COOKIE['MapType']); |
|
| 33 | 36 | |
| 34 | 37 | if ($MapType != 'Mapbox' && $MapType != 'OpenStreetMap' && $MapType != 'Bing-Aerial' && $MapType != 'Bing-Hybrid' && $MapType != 'Bing-Road' && $MapType != 'offline' && $MapType != 'ArcGIS-Streetmap' && $MapType != 'ArcGIS-Satellite' && $MapType != 'NatGeo-Street') { |
| 35 | - if (isset($globalBingMapKey) && $globalBingMapKey != '') $MapType = 'Bing-Aerial'; |
|
| 36 | - else $MapType = 'OpenStreetMap'; |
|
| 38 | + if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
|
| 39 | + $MapType = 'Bing-Aerial'; |
|
| 40 | + } else { |
|
| 41 | + $MapType = 'OpenStreetMap'; |
|
| 42 | + } |
|
| 37 | 43 | } |
| 38 | 44 | if (($MapType == 'Bing-Aerial' || $MapType == 'Bing-Hybrid' || $MapType == 'Bing-Road') && (!isset($globalBingMapKey) || $globalBingMapKey == '')) { |
| 39 | 45 | $MapType = 'OpenStreetMap'; |
| 40 | 46 | } |
| 41 | 47 | if ($MapType == 'Mapbox') { |
| 42 | - if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId; |
|
| 43 | - else $MapBoxId = $_COOKIE['MapType3DId']; |
|
| 44 | -?> |
|
| 48 | + if ($_COOKIE['MapTypeId'] == 'default') { |
|
| 49 | + $MapBoxId = $globalMapboxId; |
|
| 50 | + } else { |
|
| 51 | + $MapBoxId = $_COOKIE['MapType3DId']; |
|
| 52 | + } |
|
| 53 | + ?> |
|
| 45 | 54 | var imProv = Cesium.MapboxImageryProvider({ |
| 46 | 55 | credit: 'Map data © OpenStreetMap contributors, ' + |
| 47 | 56 | 'CC-BY-SA, ' + |
@@ -108,13 +117,23 @@ discard block |
||
| 108 | 117 | credit : 'Imagery courtesy Natural Earth' |
| 109 | 118 | }); |
| 110 | 119 | <?php |
| 111 | - } elseif (isset($globalMapCustomLayer[$MapType])) { |
|
| 120 | + } elseif (isset($globalMapCustomLayer[$MapType])) { |
|
| 112 | 121 | $customid = $MapType; |
| 113 | 122 | ?> |
| 114 | 123 | var imProv = Cesium.createOpenStreetMapImageryProvider({ |
| 115 | 124 | url : '<?php print $globalMapCustomLayer[$customid]['url']; ?>', |
| 116 | - maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '99'; ?>, |
|
| 117 | - minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
| 125 | + maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
| 126 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
| 127 | +} else { |
|
| 128 | + print '99'; |
|
| 129 | +} |
|
| 130 | +?>, |
|
| 131 | + minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
| 132 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
| 133 | +} else { |
|
| 134 | + print '0'; |
|
| 135 | +} |
|
| 136 | +?>, |
|
| 118 | 137 | credit: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
| 119 | 138 | }); |
| 120 | 139 | <?php |
@@ -403,7 +422,12 @@ discard block |
||
| 403 | 422 | imageryProvider : imProv, |
| 404 | 423 | timeline : archive, |
| 405 | 424 | animation : false, |
| 406 | - shadows : <?php if ((isset($globalMap3DShadows) && $globalMap3DShadows === FALSE) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'true')) print 'false'; else print 'true'; ?>, |
|
| 425 | + shadows : <?php if ((isset($globalMap3DShadows) && $globalMap3DShadows === FALSE) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'true')) { |
|
| 426 | + print 'false'; |
|
| 427 | +} else { |
|
| 428 | + print 'true'; |
|
| 429 | +} |
|
| 430 | +?>, |
|
| 407 | 431 | infoBox : false, |
| 408 | 432 | navigationHelpButton : false, |
| 409 | 433 | geocoder : false, |
@@ -416,8 +440,11 @@ discard block |
||
| 416 | 440 | if (isset($_COOKIE['lastcentercoord']) || (isset($globalCenterLatitude) && isset($globalCenterLongitude) && $globalCenterLatitude != '' && $globalCenterLongitude != '')) { |
| 417 | 441 | if (isset($_COOKIE['lastcentercoord'])) { |
| 418 | 442 | $lastcentercoord = explode(',',$_COOKIE['lastcentercoord']); |
| 419 | - if (!isset($lastcentercoord[3])) $zoom = $lastcentercoord[2]*1000000.0; |
|
| 420 | - else $zoom = $lastcentercoord[3]; |
|
| 443 | + if (!isset($lastcentercoord[3])) { |
|
| 444 | + $zoom = $lastcentercoord[2]*1000000.0; |
|
| 445 | + } else { |
|
| 446 | + $zoom = $lastcentercoord[3]; |
|
| 447 | + } |
|
| 421 | 448 | $viewcenterlatitude = $lastcentercoord[0]; |
| 422 | 449 | $viewcenterlongitude = $lastcentercoord[1]; |
| 423 | 450 | } else { |
@@ -534,7 +561,12 @@ discard block |
||
| 534 | 561 | ?> |
| 535 | 562 | |
| 536 | 563 | update_locationsLayer(); |
| 537 | -setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
| 564 | +setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) { |
|
| 565 | + print $globalMapRefresh*1000*2; |
|
| 566 | +} else { |
|
| 567 | + print '60000'; |
|
| 568 | +} |
|
| 569 | +?>); |
|
| 538 | 570 | viewer.camera.moveEnd.addEventListener(function() { |
| 539 | 571 | <?php |
| 540 | 572 | if (isset($globalMapUseBbox) && $globalMapUseBbox) { |
@@ -52,7 +52,10 @@ discard block |
||
| 52 | 52 | <?php |
| 53 | 53 | if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
| 54 | 54 | ?> |
| 55 | -<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script> |
|
| 55 | +<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) { |
|
| 56 | + print '?tsk='.$tsk; |
|
| 57 | +} |
|
| 58 | +?>"></script> |
|
| 56 | 59 | <?php |
| 57 | 60 | if (!isset($globalAircraft) || $globalAircraft) { |
| 58 | 61 | ?> |
@@ -145,8 +148,14 @@ discard block |
||
| 145 | 148 | ?> |
| 146 | 149 | <form> |
| 147 | 150 | <ul> |
| 148 | - <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?></label></div></li> |
|
| 149 | - <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?></label></div></li> |
|
| 151 | + <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') { |
|
| 152 | + print 'checked'; |
|
| 153 | +} |
|
| 154 | +?> /><?php echo _("Display waypoints"); ?></label></div></li> |
|
| 155 | + <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') { |
|
| 156 | + print 'checked'; |
|
| 157 | +} |
|
| 158 | +?> /><?php echo _("Display airspace"); ?></label></div></li> |
|
| 150 | 159 | </ul> |
| 151 | 160 | </form> |
| 152 | 161 | <?php |
@@ -154,8 +163,14 @@ discard block |
||
| 154 | 163 | ?> |
| 155 | 164 | <form> |
| 156 | 165 | <ul> |
| 157 | - <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li> |
|
| 158 | - <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?> Beta</label></div></li> |
|
| 166 | + <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') { |
|
| 167 | + print 'checked'; |
|
| 168 | +} |
|
| 169 | +?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li> |
|
| 170 | + <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') { |
|
| 171 | + print 'checked'; |
|
| 172 | +} |
|
| 173 | +?> /><?php echo _("Display airspace"); ?> Beta</label></div></li> |
|
| 159 | 174 | </ul> |
| 160 | 175 | <p>This layers are in Beta, this can and will crash.</p> |
| 161 | 176 | </form> |
@@ -166,14 +181,32 @@ discard block |
||
| 166 | 181 | <h1>NOTAM</h1> |
| 167 | 182 | <form> |
| 168 | 183 | <ul> |
| 169 | - <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') print 'checked'; ?> /><?php echo _("Display NOTAM"); ?></label></div></li> |
|
| 184 | + <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') { |
|
| 185 | + print 'checked'; |
|
| 186 | +} |
|
| 187 | +?> /><?php echo _("Display NOTAM"); ?></label></div></li> |
|
| 170 | 188 | <li><?php echo _("NOTAM scope:"); ?> |
| 171 | 189 | <select class="selectpicker" onchange="notamscope(this);"> |
| 172 | - <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option> |
|
| 173 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option> |
|
| 174 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option> |
|
| 175 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option> |
|
| 176 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option> |
|
| 190 | + <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') { |
|
| 191 | + print ' selected'; |
|
| 192 | +} |
|
| 193 | +?>>All</option> |
|
| 194 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') { |
|
| 195 | + print ' selected'; |
|
| 196 | +} |
|
| 197 | +?>>Airport/Enroute warning</option> |
|
| 198 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') { |
|
| 199 | + print ' selected'; |
|
| 200 | +} |
|
| 201 | +?>>Airport warning</option> |
|
| 202 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') { |
|
| 203 | + print ' selected'; |
|
| 204 | +} |
|
| 205 | +?>>Navigation warning</option> |
|
| 206 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') { |
|
| 207 | + print ' selected'; |
|
| 208 | +} |
|
| 209 | +?>>Enroute warning</option> |
|
| 177 | 210 | </select |
| 178 | 211 | </li> |
| 179 | 212 | </ul> |
@@ -201,7 +234,10 @@ discard block |
||
| 201 | 234 | <div class="form-group"> |
| 202 | 235 | <label><?php echo _("From:"); ?></label> |
| 203 | 236 | <div class='input-group date' id='datetimepicker1'> |
| 204 | - <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required /> |
|
| 237 | + <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') { |
|
| 238 | + print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; |
|
| 239 | +} |
|
| 240 | +?>" required /> |
|
| 205 | 241 | <span class="input-group-addon"> |
| 206 | 242 | <span class="glyphicon glyphicon-calendar"></span> |
| 207 | 243 | </span> |
@@ -210,7 +246,10 @@ discard block |
||
| 210 | 246 | <div class="form-group"> |
| 211 | 247 | <label><?php echo _("To:"); ?></label> |
| 212 | 248 | <div class='input-group date' id='datetimepicker2'> |
| 213 | - <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" /> |
|
| 249 | + <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') { |
|
| 250 | + print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; |
|
| 251 | +} |
|
| 252 | +?>" /> |
|
| 214 | 253 | <span class="input-group-addon"> |
| 215 | 254 | <span class="glyphicon glyphicon-calendar"></span> |
| 216 | 255 | </span> |
@@ -242,8 +281,20 @@ discard block |
||
| 242 | 281 | </script> |
| 243 | 282 | <li><?php echo _("Playback speed:"); ?> |
| 244 | 283 | <div class="range"> |
| 245 | - <input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>"> |
|
| 246 | - <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output> |
|
| 284 | + <input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) { |
|
| 285 | + print $_POST['archivespeed']; |
|
| 286 | +} elseif (isset($_COOKIE['archive_speed'])) { |
|
| 287 | + print $_COOKIE['archive_speed']; |
|
| 288 | +} else { |
|
| 289 | + print '1'; |
|
| 290 | +} |
|
| 291 | +?>"> |
|
| 292 | + <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) { |
|
| 293 | + print $_COOKIE['archive_speed']; |
|
| 294 | +} else { |
|
| 295 | + print '1'; |
|
| 296 | +} |
|
| 297 | +?></output> |
|
| 247 | 298 | </div> |
| 248 | 299 | </li> |
| 249 | 300 | <?php |
@@ -272,14 +323,20 @@ discard block |
||
| 272 | 323 | <li><?php echo _("Type of Map:"); ?> |
| 273 | 324 | <?php |
| 274 | 325 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
| 275 | - if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
|
| 276 | - else $MapType = $_COOKIE['MapType']; |
|
| 326 | + if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') { |
|
| 327 | + $MapType = $globalMapProvider; |
|
| 328 | + } else { |
|
| 329 | + $MapType = $_COOKIE['MapType']; |
|
| 330 | + } |
|
| 277 | 331 | ?> |
| 278 | 332 | <select class="selectpicker" onchange="mapType(this);"> |
| 279 | 333 | <?php |
| 280 | 334 | } else { |
| 281 | - if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider; |
|
| 282 | - else $MapType = $_COOKIE['MapType3D']; |
|
| 335 | + if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') { |
|
| 336 | + $MapType = $globalMapProvider; |
|
| 337 | + } else { |
|
| 338 | + $MapType = $_COOKIE['MapType3D']; |
|
| 339 | + } |
|
| 283 | 340 | ?> |
| 284 | 341 | <select class="selectpicker" onchange="mapType3D(this);"> |
| 285 | 342 | <?php |
@@ -288,23 +345,44 @@ discard block |
||
| 288 | 345 | <?php |
| 289 | 346 | if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
| 290 | 347 | ?> |
| 291 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
| 348 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
| 349 | + print ' selected'; |
|
| 350 | +} |
|
| 351 | +?>>Natural Earth (local)</option> |
|
| 292 | 352 | <?php |
| 293 | 353 | } else { |
| 294 | 354 | if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
| 295 | 355 | ?> |
| 296 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
| 356 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
| 357 | + print ' selected'; |
|
| 358 | +} |
|
| 359 | +?>>Natural Earth (local)</option> |
|
| 297 | 360 | <?php |
| 298 | 361 | } |
| 299 | 362 | ?> |
| 300 | - <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option> |
|
| 301 | - <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option> |
|
| 363 | + <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') { |
|
| 364 | + print ' selected'; |
|
| 365 | +} |
|
| 366 | +?>>ArcGIS Streetmap</option> |
|
| 367 | + <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') { |
|
| 368 | + print ' selected'; |
|
| 369 | +} |
|
| 370 | +?>>ArcGIS Satellite</option> |
|
| 302 | 371 | <?php |
| 303 | 372 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
| 304 | 373 | ?> |
| 305 | - <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
|
| 306 | - <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
|
| 307 | - <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
|
| 374 | + <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') { |
|
| 375 | + print ' selected'; |
|
| 376 | +} |
|
| 377 | +?>>Bing-Aerial</option> |
|
| 378 | + <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') { |
|
| 379 | + print ' selected'; |
|
| 380 | +} |
|
| 381 | +?>>Bing-Hybrid</option> |
|
| 382 | + <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') { |
|
| 383 | + print ' selected'; |
|
| 384 | +} |
|
| 385 | +?>>Bing-Road</option> |
|
| 308 | 386 | <?php |
| 309 | 387 | } |
| 310 | 388 | ?> |
@@ -314,59 +392,143 @@ discard block |
||
| 314 | 392 | <?php |
| 315 | 393 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
| 316 | 394 | ?> |
| 317 | - <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
|
| 318 | - <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
|
| 319 | - <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
|
| 395 | + <option value="Here-Aerial"<?php if ($MapType == 'Here') { |
|
| 396 | + print ' selected'; |
|
| 397 | +} |
|
| 398 | +?>>Here-Aerial</option> |
|
| 399 | + <option value="Here-Hybrid"<?php if ($MapType == 'Here') { |
|
| 400 | + print ' selected'; |
|
| 401 | +} |
|
| 402 | +?>>Here-Hybrid</option> |
|
| 403 | + <option value="Here-Road"<?php if ($MapType == 'Here') { |
|
| 404 | + print ' selected'; |
|
| 405 | +} |
|
| 406 | +?>>Here-Road</option> |
|
| 320 | 407 | <?php |
| 321 | 408 | } |
| 322 | 409 | ?> |
| 323 | 410 | <?php |
| 324 | 411 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
| 325 | 412 | ?> |
| 326 | - <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
|
| 327 | - <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
|
| 328 | - <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
|
| 329 | - <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
|
| 413 | + <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') { |
|
| 414 | + print ' selected'; |
|
| 415 | +} |
|
| 416 | +?>>Google Roadmap</option> |
|
| 417 | + <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') { |
|
| 418 | + print ' selected'; |
|
| 419 | +} |
|
| 420 | +?>>Google Satellite</option> |
|
| 421 | + <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') { |
|
| 422 | + print ' selected'; |
|
| 423 | +} |
|
| 424 | +?>>Google Hybrid</option> |
|
| 425 | + <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') { |
|
| 426 | + print ' selected'; |
|
| 427 | +} |
|
| 428 | +?>>Google Terrain</option> |
|
| 330 | 429 | <?php |
| 331 | 430 | } |
| 332 | 431 | ?> |
| 333 | 432 | <?php |
| 334 | 433 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
| 335 | 434 | ?> |
| 336 | - <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
|
| 337 | - <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
|
| 338 | - <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
|
| 435 | + <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') { |
|
| 436 | + print ' selected'; |
|
| 437 | +} |
|
| 438 | +?>>MapQuest-OSM</option> |
|
| 439 | + <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') { |
|
| 440 | + print ' selected'; |
|
| 441 | +} |
|
| 442 | +?>>MapQuest-Aerial</option> |
|
| 443 | + <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') { |
|
| 444 | + print ' selected'; |
|
| 445 | +} |
|
| 446 | +?>>MapQuest-Hybrid</option> |
|
| 339 | 447 | <?php |
| 340 | 448 | } |
| 341 | 449 | ?> |
| 342 | - <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
|
| 343 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option> |
|
| 450 | + <option value="Yandex"<?php if ($MapType == 'Yandex') { |
|
| 451 | + print ' selected'; |
|
| 452 | +} |
|
| 453 | +?>>Yandex</option> |
|
| 454 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
| 455 | + print ' selected'; |
|
| 456 | +} |
|
| 457 | +?>>Natural Earth</option> |
|
| 344 | 458 | <?php |
| 345 | 459 | } |
| 346 | 460 | ?> |
| 347 | - <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option> |
|
| 461 | + <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') { |
|
| 462 | + print ' selected'; |
|
| 463 | +} |
|
| 464 | +?>>National Geographic Street</option> |
|
| 348 | 465 | <?php |
| 349 | 466 | if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
| 350 | - if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
|
| 351 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
| 467 | + if (!isset($_COOKIE['MapTypeId'])) { |
|
| 468 | + $MapBoxId = 'default'; |
|
| 469 | + } else { |
|
| 470 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
| 471 | + } |
|
| 352 | 472 | ?> |
| 353 | - <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option> |
|
| 354 | - <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
|
| 355 | - <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
|
| 356 | - <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
|
| 357 | - <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option> |
|
| 358 | - <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option> |
|
| 359 | - <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option> |
|
| 360 | - <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option> |
|
| 361 | - <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option> |
|
| 362 | - <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option> |
|
| 363 | - <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option> |
|
| 364 | - <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
|
| 365 | - <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
|
| 473 | + <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') { |
|
| 474 | + print ' selected'; |
|
| 475 | +} |
|
| 476 | +?>>Mapbox GL</option> |
|
| 477 | + <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') { |
|
| 478 | + print ' selected'; |
|
| 479 | +} |
|
| 480 | +?>>Mapbox default</option> |
|
| 481 | + <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') { |
|
| 482 | + print ' selected'; |
|
| 483 | +} |
|
| 484 | +?>>Mapbox streets</option> |
|
| 485 | + <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') { |
|
| 486 | + print ' selected'; |
|
| 487 | +} |
|
| 488 | +?>>Mapbox light</option> |
|
| 489 | + <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') { |
|
| 490 | + print ' selected'; |
|
| 491 | +} |
|
| 492 | +?>>Mapbox dark</option> |
|
| 493 | + <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') { |
|
| 494 | + print ' selected'; |
|
| 495 | +} |
|
| 496 | +?>>Mapbox satellite</option> |
|
| 497 | + <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') { |
|
| 498 | + print ' selected'; |
|
| 499 | +} |
|
| 500 | +?>>Mapbox streets-satellite</option> |
|
| 501 | + <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') { |
|
| 502 | + print ' selected'; |
|
| 503 | +} |
|
| 504 | +?>>Mapbox streets-basic</option> |
|
| 505 | + <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') { |
|
| 506 | + print ' selected'; |
|
| 507 | +} |
|
| 508 | +?>>Mapbox comic</option> |
|
| 509 | + <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') { |
|
| 510 | + print ' selected'; |
|
| 511 | +} |
|
| 512 | +?>>Mapbox outdoors</option> |
|
| 513 | + <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') { |
|
| 514 | + print ' selected'; |
|
| 515 | +} |
|
| 516 | +?>>Mapbox pencil</option> |
|
| 517 | + <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') { |
|
| 518 | + print ' selected'; |
|
| 519 | +} |
|
| 520 | +?>>Mapbox pirates</option> |
|
| 521 | + <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') { |
|
| 522 | + print ' selected'; |
|
| 523 | +} |
|
| 524 | +?>>Mapbox emerald</option> |
|
| 366 | 525 | <?php |
| 367 | 526 | } |
| 368 | 527 | ?> |
| 369 | - <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
|
| 528 | + <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') { |
|
| 529 | + print ' selected'; |
|
| 530 | +} |
|
| 531 | +?>>OpenStreetMap</option> |
|
| 370 | 532 | <?php |
| 371 | 533 | } |
| 372 | 534 | ?> |
@@ -377,10 +539,22 @@ discard block |
||
| 377 | 539 | ?> |
| 378 | 540 | <li><?php echo _("Type of Terrain:"); ?> |
| 379 | 541 | <select class="selectpicker" onchange="terrainType(this);"> |
| 380 | - <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
|
| 381 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
| 382 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
| 383 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
| 542 | + <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') { |
|
| 543 | + print ' selected'; |
|
| 544 | +} |
|
| 545 | +?>>stk terrain</option> |
|
| 546 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') { |
|
| 547 | + print ' selected'; |
|
| 548 | +} |
|
| 549 | +?>>ellipsoid</option> |
|
| 550 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') { |
|
| 551 | + print ' selected'; |
|
| 552 | +} |
|
| 553 | +?>>vr terrain</option> |
|
| 554 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') { |
|
| 555 | + print ' selected'; |
|
| 556 | +} |
|
| 557 | +?>>ArticDEM</option> |
|
| 384 | 558 | </select> |
| 385 | 559 | </li> |
| 386 | 560 | <?php |
@@ -390,57 +564,108 @@ discard block |
||
| 390 | 564 | <?php |
| 391 | 565 | if (isset($globalMap3D) && $globalMap3D) { |
| 392 | 566 | ?> |
| 393 | - <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li> |
|
| 567 | + <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') { |
|
| 568 | + print 'checked'; |
|
| 569 | +} |
|
| 570 | +?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li> |
|
| 394 | 571 | <?php |
| 395 | 572 | } |
| 396 | 573 | ?> |
| 397 | 574 | <?php |
| 398 | 575 | if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
| 399 | 576 | ?> |
| 400 | - <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
|
| 577 | + <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') { |
|
| 578 | + print 'checked'; |
|
| 579 | +} |
|
| 580 | +?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
|
| 401 | 581 | |
| 402 | 582 | <?php |
| 403 | 583 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 404 | 584 | ?> |
| 405 | - <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>--> |
|
| 406 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
| 407 | - <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
| 408 | - <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
| 409 | - <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
| 585 | + <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') { |
|
| 586 | + print 'checked'; |
|
| 587 | +} |
|
| 588 | +?> ><?php echo _("Display flight info as popup"); ?></label></div></li>--> |
|
| 589 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) { |
|
| 590 | + print 'checked'; |
|
| 591 | +} |
|
| 592 | +?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
| 593 | + <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) { |
|
| 594 | + print 'checked'; |
|
| 595 | +} |
|
| 596 | +?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
| 597 | + <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) { |
|
| 598 | + print 'checked'; |
|
| 599 | +} |
|
| 600 | +?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
| 601 | + <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
| 602 | + print 'checked'; |
|
| 603 | +} |
|
| 604 | +?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
| 410 | 605 | <?php |
| 411 | 606 | } elseif (!isset($globalTracker) || $globalTracker === TRUE) { |
| 412 | 607 | ?> |
| 413 | - <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) print 'checked'; ?> ><?php echo _("Enable map matching"); ?></label></div></li> |
|
| 608 | + <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) { |
|
| 609 | + print 'checked'; |
|
| 610 | +} |
|
| 611 | +?> ><?php echo _("Enable map matching"); ?></label></div></li> |
|
| 414 | 612 | <?php |
| 415 | 613 | } |
| 416 | 614 | if (isset($globalSatellite) && $globalSatellite === TRUE) { |
| 417 | 615 | ?> |
| 418 | - <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
| 616 | + <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
| 617 | + print 'checked'; |
|
| 618 | +} |
|
| 619 | +?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
| 419 | 620 | <?php |
| 420 | 621 | } |
| 421 | 622 | } |
| 422 | 623 | ?> |
| 423 | - <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
| 424 | - <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
| 425 | - <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
| 426 | - <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
| 624 | + <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) { |
|
| 625 | + print 'checked'; |
|
| 626 | +} |
|
| 627 | +?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
| 628 | + <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
| 629 | + print 'checked'; |
|
| 630 | +} |
|
| 631 | +?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
| 632 | + <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
| 633 | + print 'checked'; |
|
| 634 | +} |
|
| 635 | +?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
| 636 | + <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
| 637 | + print 'checked'; |
|
| 638 | +} |
|
| 639 | +?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
| 427 | 640 | <?php |
| 428 | 641 | if (isset($globalFires)) { |
| 429 | 642 | ?> |
| 430 | - <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
| 643 | + <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
| 644 | + print 'checked'; |
|
| 645 | +} |
|
| 646 | +?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
| 431 | 647 | <?php |
| 432 | 648 | } |
| 433 | 649 | if (isset($globalMap3D) && $globalMap3D) { |
| 434 | 650 | ?> |
| 435 | - <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') print 'checked'; ?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li> |
|
| 651 | + <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') { |
|
| 652 | + print 'checked'; |
|
| 653 | +} |
|
| 654 | +?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li> |
|
| 436 | 655 | <?php |
| 437 | 656 | } |
| 438 | 657 | ?> |
| 439 | 658 | <?php |
| 440 | 659 | if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
| 441 | 660 | ?> |
| 442 | - <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
| 443 | - <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li> |
|
| 661 | + <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) { |
|
| 662 | + print 'checked'; |
|
| 663 | +} |
|
| 664 | +?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
| 665 | + <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) { |
|
| 666 | + print 'checked'; |
|
| 667 | +} |
|
| 668 | +?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li> |
|
| 444 | 669 | <?php |
| 445 | 670 | } |
| 446 | 671 | if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
@@ -453,17 +678,25 @@ discard block |
||
| 453 | 678 | if (function_exists('array_column')) { |
| 454 | 679 | if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
| 455 | 680 | ?> |
| 456 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 681 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
| 682 | + print 'checked'; |
|
| 683 | +} |
|
| 684 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 457 | 685 | <?php |
| 458 | 686 | } |
| 459 | 687 | } elseif (isset($globalSources)) { |
| 460 | 688 | $dispolar = false; |
| 461 | 689 | foreach ($globalSources as $testsource) { |
| 462 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
| 690 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) { |
|
| 691 | + $dispolar = true; |
|
| 692 | + } |
|
| 463 | 693 | } |
| 464 | 694 | if ($dispolar) { |
| 465 | 695 | ?> |
| 466 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 696 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
| 697 | + print 'checked'; |
|
| 698 | +} |
|
| 699 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 467 | 700 | <?php |
| 468 | 701 | } |
| 469 | 702 | } |
@@ -476,11 +709,21 @@ discard block |
||
| 476 | 709 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 477 | 710 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 478 | 711 | ?> |
| 479 | - <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
| 712 | + <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') { |
|
| 713 | + print 'checked'; |
|
| 714 | +} |
|
| 715 | +?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
| 480 | 716 | <?php |
| 481 | 717 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
| 482 | 718 | ?> |
| 483 | - <li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li> |
|
| 719 | + <li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
| 720 | + print $_COOKIE['IconColor']; |
|
| 721 | +} elseif (isset($globalAircraftIconColor)) { |
|
| 722 | + print $globalAircraftIconColor; |
|
| 723 | +} else { |
|
| 724 | + print '1a3151'; |
|
| 725 | +} |
|
| 726 | +?>"></li> |
|
| 484 | 727 | <?php |
| 485 | 728 | } |
| 486 | 729 | } |
@@ -491,7 +734,14 @@ discard block |
||
| 491 | 734 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 492 | 735 | ?> |
| 493 | 736 | <li><?php echo _("Marine icon color:"); ?> |
| 494 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>"> |
|
| 737 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
| 738 | + print $_COOKIE['MarineIconColor']; |
|
| 739 | +} elseif (isset($globalMarineIconColor)) { |
|
| 740 | + print $globalMarineIconColor; |
|
| 741 | +} else { |
|
| 742 | + print '1a3151'; |
|
| 743 | +} |
|
| 744 | +?>"> |
|
| 495 | 745 | </li> |
| 496 | 746 | <?php |
| 497 | 747 | } |
@@ -502,7 +752,14 @@ discard block |
||
| 502 | 752 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 503 | 753 | ?> |
| 504 | 754 | <li><?php echo _("Tracker icon color:"); ?> |
| 505 | - <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>"> |
|
| 755 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
| 756 | + print $_COOKIE['TrackerIconColor']; |
|
| 757 | +} elseif (isset($globalTrackerIconColor)) { |
|
| 758 | + print $globalTrackerIconColor; |
|
| 759 | +} else { |
|
| 760 | + print '1a3151'; |
|
| 761 | +} |
|
| 762 | +?>"> |
|
| 506 | 763 | </li> |
| 507 | 764 | <?php |
| 508 | 765 | } |
@@ -513,8 +770,22 @@ discard block |
||
| 513 | 770 | ?> |
| 514 | 771 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
| 515 | 772 | <div class="range"> |
| 516 | - <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>"> |
|
| 517 | - <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output> |
|
| 773 | + <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) { |
|
| 774 | + print $_COOKIE['AirportZoom']; |
|
| 775 | +} elseif (isset($globalAirportZoom)) { |
|
| 776 | + print $globalAirportZoom; |
|
| 777 | +} else { |
|
| 778 | + print '7'; |
|
| 779 | +} |
|
| 780 | +?>"> |
|
| 781 | + <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) { |
|
| 782 | + print $_COOKIE['AirportZoom']; |
|
| 783 | +} elseif (isset($globalAirportZoom)) { |
|
| 784 | + print $globalAirportZoom; |
|
| 785 | +} else { |
|
| 786 | + print '7'; |
|
| 787 | +} |
|
| 788 | +?></output> |
|
| 518 | 789 | </div> |
| 519 | 790 | </li> |
| 520 | 791 | <?php |
@@ -525,17 +796,40 @@ discard block |
||
| 525 | 796 | ?> |
| 526 | 797 | <li><?php echo _("Set scaling factor for rendering resolution:"); ?> |
| 527 | 798 | <div class="range"> |
| 528 | - <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?>"> |
|
| 529 | - <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?></output> |
|
| 799 | + <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) { |
|
| 800 | + print $_COOKIE['resolutionScale']; |
|
| 801 | +} else { |
|
| 802 | + print '1'; |
|
| 803 | +} |
|
| 804 | +?>"> |
|
| 805 | + <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) { |
|
| 806 | + print $_COOKIE['resolutionScale']; |
|
| 807 | +} else { |
|
| 808 | + print '1'; |
|
| 809 | +} |
|
| 810 | +?></output> |
|
| 530 | 811 | </div> |
| 531 | 812 | </li> |
| 532 | 813 | <?php |
| 533 | 814 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 534 | 815 | ?> |
| 535 | - <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> > <?php echo _("Use airlines liveries"); ?></li> |
|
| 536 | - <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> > <?php echo _("Force Aircraft color"); ?> |
|
| 816 | + <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') { |
|
| 817 | + print 'checked'; |
|
| 818 | +} |
|
| 819 | +?> > <?php echo _("Use airlines liveries"); ?></li> |
|
| 820 | + <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') { |
|
| 821 | + print 'checked'; |
|
| 822 | +} |
|
| 823 | +?> > <?php echo _("Force Aircraft color"); ?> |
|
| 537 | 824 | <!--<li><?php echo _("Aircraft icon color:"); ?>--> |
| 538 | - <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>"> |
|
| 825 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
| 826 | + print $_COOKIE['IconColor']; |
|
| 827 | +} elseif (isset($globalAircraftIconColor)) { |
|
| 828 | + print $globalAircraftIconColor; |
|
| 829 | +} else { |
|
| 830 | + print 'ff0000'; |
|
| 831 | +} |
|
| 832 | +?>"> |
|
| 539 | 833 | </li> |
| 540 | 834 | <?php |
| 541 | 835 | } |
@@ -543,9 +837,19 @@ discard block |
||
| 543 | 837 | <?php |
| 544 | 838 | if (isset($globalMarine) && $globalMarine === TRUE) { |
| 545 | 839 | ?> |
| 546 | - <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?> |
|
| 840 | + <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') { |
|
| 841 | + print 'checked'; |
|
| 842 | +} |
|
| 843 | +?> ><?php echo _("Force Marine color"); ?> |
|
| 547 | 844 | <!--<li><?php echo _("Marine icon color:"); ?>--> |
| 548 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>"> |
|
| 845 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
| 846 | + print $_COOKIE['MarineIconColor']; |
|
| 847 | +} elseif (isset($globalMarineIconColor)) { |
|
| 848 | + print $globalMarineIconColor; |
|
| 849 | +} else { |
|
| 850 | + print 'ff0000'; |
|
| 851 | +} |
|
| 852 | +?>"> |
|
| 549 | 853 | </li> |
| 550 | 854 | <?php |
| 551 | 855 | } |
@@ -553,9 +857,19 @@ discard block |
||
| 553 | 857 | <?php |
| 554 | 858 | if (isset($globalTracker) && $globalTracker === TRUE) { |
| 555 | 859 | ?> |
| 556 | - <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?> |
|
| 860 | + <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') { |
|
| 861 | + print 'checked'; |
|
| 862 | +} |
|
| 863 | +?> ><?php echo _("Force Tracker color"); ?> |
|
| 557 | 864 | <!--<li><?php echo _("Tracker icon color:"); ?>--> |
| 558 | - <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>"> |
|
| 865 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
| 866 | + print $_COOKIE['TrackerIconColor']; |
|
| 867 | +} elseif (isset($globalTrackerIconColor)) { |
|
| 868 | + print $globalTrackerIconColor; |
|
| 869 | +} else { |
|
| 870 | + print 'ff0000'; |
|
| 871 | +} |
|
| 872 | +?>"> |
|
| 559 | 873 | </li> |
| 560 | 874 | <?php |
| 561 | 875 | } |
@@ -563,22 +877,46 @@ discard block |
||
| 563 | 877 | ?> |
| 564 | 878 | <li><?php echo _("Distance unit:"); ?> |
| 565 | 879 | <select class="selectpicker" onchange="unitdistance(this);"> |
| 566 | - <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option> |
|
| 567 | - <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option> |
|
| 568 | - <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option> |
|
| 880 | + <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
| 881 | + echo ' selected'; |
|
| 882 | +} |
|
| 883 | +?>>km</option> |
|
| 884 | + <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
| 885 | + echo ' selected'; |
|
| 886 | +} |
|
| 887 | +?>>nm</option> |
|
| 888 | + <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
| 889 | + echo ' selected'; |
|
| 890 | +} |
|
| 891 | +?>>mi</option> |
|
| 569 | 892 | </select> |
| 570 | 893 | </li> |
| 571 | 894 | <li><?php echo _("Altitude unit:"); ?> |
| 572 | 895 | <select class="selectpicker" onchange="unitaltitude(this);"> |
| 573 | - <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option> |
|
| 574 | - <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option> |
|
| 896 | + <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) { |
|
| 897 | + echo ' selected'; |
|
| 898 | +} |
|
| 899 | +?>>m</option> |
|
| 900 | + <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
|
| 901 | + echo ' selected'; |
|
| 902 | +} |
|
| 903 | +?>>feet</option> |
|
| 575 | 904 | </select> |
| 576 | 905 | </li> |
| 577 | 906 | <li><?php echo _("Speed unit:"); ?> |
| 578 | 907 | <select class="selectpicker" onchange="unitspeed(this);"> |
| 579 | - <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option> |
|
| 580 | - <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option> |
|
| 581 | - <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option> |
|
| 908 | + <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) { |
|
| 909 | + echo ' selected'; |
|
| 910 | +} |
|
| 911 | +?>>km/h</option> |
|
| 912 | + <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
|
| 913 | + echo ' selected'; |
|
| 914 | +} |
|
| 915 | +?>>mph</option> |
|
| 916 | + <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
|
| 917 | + echo ' selected'; |
|
| 918 | +} |
|
| 919 | +?>>knots</option> |
|
| 582 | 920 | </select> |
| 583 | 921 | </li> |
| 584 | 922 | |
@@ -596,9 +934,18 @@ discard block |
||
| 596 | 934 | <?php |
| 597 | 935 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
| 598 | 936 | ?> |
| 599 | - <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
| 600 | - <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
| 601 | - <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
| 937 | + <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) { |
|
| 938 | + print 'checked'; |
|
| 939 | +} |
|
| 940 | +?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
| 941 | + <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) { |
|
| 942 | + print 'checked'; |
|
| 943 | +} |
|
| 944 | +?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
| 945 | + <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) { |
|
| 946 | + print 'checked'; |
|
| 947 | +} |
|
| 948 | +?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
| 602 | 949 | <?php |
| 603 | 950 | } |
| 604 | 951 | ?> |
@@ -606,10 +953,16 @@ discard block |
||
| 606 | 953 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
| 607 | 954 | ?> |
| 608 | 955 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
| 609 | - <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
| 956 | + <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) { |
|
| 957 | + print 'checked'; |
|
| 958 | +} |
|
| 959 | +?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
| 610 | 960 | <?php } ?> |
| 611 | 961 | <?php if (isset($globalAPRS) && $globalAPRS) { ?> |
| 612 | - <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
| 962 | + <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) { |
|
| 963 | + print 'checked'; |
|
| 964 | +} |
|
| 965 | +?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
| 613 | 966 | <?php } ?> |
| 614 | 967 | <?php |
| 615 | 968 | } |
@@ -626,7 +979,9 @@ discard block |
||
| 626 | 979 | } |
| 627 | 980 | foreach($allairlinenames as $airline) { |
| 628 | 981 | $airline_name = $airline['airline_name']; |
| 629 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
| 982 | + if (strlen($airline_name) > 30) { |
|
| 983 | + $airline_name = substr($airline_name,0,30).'...'; |
|
| 984 | + } |
|
| 630 | 985 | if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
| 631 | 986 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
| 632 | 987 | } else { |
@@ -644,7 +999,10 @@ discard block |
||
| 644 | 999 | <li><?php echo _("Display alliance:"); ?> |
| 645 | 1000 | <br/> |
| 646 | 1001 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
| 647 | - <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
| 1002 | + <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') { |
|
| 1003 | + echo ' selected'; |
|
| 1004 | +} |
|
| 1005 | +?>><?php echo _("All"); ?></option> |
|
| 648 | 1006 | <?php |
| 649 | 1007 | foreach($allalliancenames as $alliance) { |
| 650 | 1008 | $alliance_name = $alliance['alliance']; |
@@ -703,10 +1061,22 @@ discard block |
||
| 703 | 1061 | ?> |
| 704 | 1062 | <li><?php echo _("Display airlines of type:"); ?><br/> |
| 705 | 1063 | <select class="selectpicker" onchange="airlinestype(this);"> |
| 706 | - <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
| 707 | - <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option> |
|
| 708 | - <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option> |
|
| 709 | - <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option> |
|
| 1064 | + <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') { |
|
| 1065 | + echo ' selected'; |
|
| 1066 | +} |
|
| 1067 | +?>><?php echo _("All"); ?></option> |
|
| 1068 | + <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') { |
|
| 1069 | + echo ' selected'; |
|
| 1070 | +} |
|
| 1071 | +?>><?php echo _("Passenger"); ?></option> |
|
| 1072 | + <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') { |
|
| 1073 | + echo ' selected'; |
|
| 1074 | +} |
|
| 1075 | +?>><?php echo _("Cargo"); ?></option> |
|
| 1076 | + <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') { |
|
| 1077 | + echo ' selected'; |
|
| 1078 | +} |
|
| 1079 | +?>><?php echo _("Military"); ?></option> |
|
| 710 | 1080 | </select> |
| 711 | 1081 | </li> |
| 712 | 1082 | <?php |
@@ -720,14 +1090,20 @@ discard block |
||
| 720 | 1090 | ?> |
| 721 | 1091 | <li> |
| 722 | 1092 | <?php echo _("Display vessels with MMSI:"); ?> |
| 723 | - <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" /> |
|
| 1093 | + <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) { |
|
| 1094 | + print $_COOKIE['filter_mmsi']; |
|
| 1095 | +} |
|
| 1096 | +?>" /> |
|
| 724 | 1097 | </li> |
| 725 | 1098 | <?php |
| 726 | 1099 | } |
| 727 | 1100 | ?> |
| 728 | 1101 | <li> |
| 729 | 1102 | <?php echo _("Display with ident:"); ?> |
| 730 | - <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
|
| 1103 | + <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) { |
|
| 1104 | + print $_COOKIE['filter_ident']; |
|
| 1105 | +} |
|
| 1106 | +?>" /> |
|
| 731 | 1107 | </li> |
| 732 | 1108 | </ul> |
| 733 | 1109 | </form> |
@@ -743,7 +1119,10 @@ discard block |
||
| 743 | 1119 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
| 744 | 1120 | <form> |
| 745 | 1121 | <ul> |
| 746 | - <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
| 1122 | + <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) { |
|
| 1123 | + print 'checked'; |
|
| 1124 | +} |
|
| 1125 | +?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
| 747 | 1126 | <li><?php echo _("Type:"); ?> |
| 748 | 1127 | <select class="selectpicker" multiple onchange="sattypes(this);"> |
| 749 | 1128 | <?php |
@@ -751,25 +1130,45 @@ discard block |
||
| 751 | 1130 | $types = $Satellite->get_tle_types(); |
| 752 | 1131 | foreach ($types as $type) { |
| 753 | 1132 | $type_name = $type['tle_type']; |
| 754 | - if ($type_name == 'musson') $type_name = 'Russian LEO Navigation'; |
|
| 755 | - else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System'; |
|
| 756 | - else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System'; |
|
| 757 | - else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational'; |
|
| 758 | - else if ($type_name == 'gps-ops') $type_name = 'GPS Operational'; |
|
| 759 | - else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System'; |
|
| 760 | - else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System'; |
|
| 761 | - else if ($type_name == 'sarsat') $type_name = 'Search & Rescue'; |
|
| 762 | - else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring'; |
|
| 763 | - else if ($type_name == 'resource') $type_name = 'Earth Resources'; |
|
| 764 | - else if ($type_name == 'stations') $type_name = 'Space Stations'; |
|
| 765 | - else if ($type_name == 'geo') $type_name = 'Geostationary'; |
|
| 766 | - else if ($type_name == 'amateur') $type_name = 'Amateur Radio'; |
|
| 767 | - else if ($type_name == 'x-comm') $type_name = 'Experimental'; |
|
| 768 | - else if ($type_name == 'other-comm') $type_name = 'Other Comm'; |
|
| 769 | - else if ($type_name == 'science') $type_name = 'Space & Earth Science'; |
|
| 770 | - else if ($type_name == 'military') $type_name = 'Miscellaneous Military'; |
|
| 771 | - else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
|
| 772 | - else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
|
| 1133 | + if ($type_name == 'musson') { |
|
| 1134 | + $type_name = 'Russian LEO Navigation'; |
|
| 1135 | + } else if ($type_name == 'nnss') { |
|
| 1136 | + $type_name = 'Navi Navigation Satellite System'; |
|
| 1137 | + } else if ($type_name == 'sbas') { |
|
| 1138 | + $type_name = 'Satellite-Based Augmentation System'; |
|
| 1139 | + } else if ($type_name == 'glo-ops') { |
|
| 1140 | + $type_name = 'Glonass Operational'; |
|
| 1141 | + } else if ($type_name == 'gps-ops') { |
|
| 1142 | + $type_name = 'GPS Operational'; |
|
| 1143 | + } else if ($type_name == 'argos') { |
|
| 1144 | + $type_name = 'ARGOS Data Collection System'; |
|
| 1145 | + } else if ($type_name == 'tdrss') { |
|
| 1146 | + $type_name = 'Tracking and Data Relay Satellite System'; |
|
| 1147 | + } else if ($type_name == 'sarsat') { |
|
| 1148 | + $type_name = 'Search & Rescue'; |
|
| 1149 | + } else if ($type_name == 'dmc') { |
|
| 1150 | + $type_name = 'Disaster Monitoring'; |
|
| 1151 | + } else if ($type_name == 'resource') { |
|
| 1152 | + $type_name = 'Earth Resources'; |
|
| 1153 | + } else if ($type_name == 'stations') { |
|
| 1154 | + $type_name = 'Space Stations'; |
|
| 1155 | + } else if ($type_name == 'geo') { |
|
| 1156 | + $type_name = 'Geostationary'; |
|
| 1157 | + } else if ($type_name == 'amateur') { |
|
| 1158 | + $type_name = 'Amateur Radio'; |
|
| 1159 | + } else if ($type_name == 'x-comm') { |
|
| 1160 | + $type_name = 'Experimental'; |
|
| 1161 | + } else if ($type_name == 'other-comm') { |
|
| 1162 | + $type_name = 'Other Comm'; |
|
| 1163 | + } else if ($type_name == 'science') { |
|
| 1164 | + $type_name = 'Space & Earth Science'; |
|
| 1165 | + } else if ($type_name == 'military') { |
|
| 1166 | + $type_name = 'Miscellaneous Military'; |
|
| 1167 | + } else if ($type_name == 'radar') { |
|
| 1168 | + $type_name = 'Radar Calibration'; |
|
| 1169 | + } else if ($type_name == 'tle-new') { |
|
| 1170 | + $type_name = 'Last 30 days launches'; |
|
| 1171 | + } |
|
| 773 | 1172 | |
| 774 | 1173 | if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
| 775 | 1174 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
@@ -52,7 +52,9 @@ discard block |
||
| 52 | 52 | try { |
| 53 | 53 | $GeoidClass = new GeoidHeight(); |
| 54 | 54 | } catch(Exception $e) { |
| 55 | - if ($globalDebug) echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n"; |
|
| 55 | + if ($globalDebug) { |
|
| 56 | + echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n"; |
|
| 57 | + } |
|
| 56 | 58 | $GeoidClass = FALSE; |
| 57 | 59 | } |
| 58 | 60 | } |
@@ -71,7 +73,9 @@ discard block |
||
| 71 | 73 | $dbc = $this->db; |
| 72 | 74 | $this->all_flights[$id]['schedule_check'] = true; |
| 73 | 75 | if ($globalSchedulesFetch) { |
| 74 | - if ($globalDebug) echo 'Getting schedule info...'."\n"; |
|
| 76 | + if ($globalDebug) { |
|
| 77 | + echo 'Getting schedule info...'."\n"; |
|
| 78 | + } |
|
| 75 | 79 | $Spotter = new Spotter($dbc); |
| 76 | 80 | $Schedule = new Schedule($dbc); |
| 77 | 81 | $Translation = new Translation($dbc); |
@@ -82,7 +86,9 @@ discard block |
||
| 82 | 86 | if ($Schedule->checkSchedule($operator) == 0) { |
| 83 | 87 | $schedule = $Schedule->fetchSchedule($operator); |
| 84 | 88 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 85 | - if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 89 | + if ($globalDebug) { |
|
| 90 | + echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 91 | + } |
|
| 86 | 92 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
| 87 | 93 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
| 88 | 94 | // Should also check if route schedule = route from DB |
@@ -91,7 +97,9 @@ discard block |
||
| 91 | 97 | $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
| 92 | 98 | if (trim($airport_icao) != '') { |
| 93 | 99 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
| 94 | - if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
|
| 100 | + if ($globalDebug) { |
|
| 101 | + echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
|
| 102 | + } |
|
| 95 | 103 | } |
| 96 | 104 | } |
| 97 | 105 | } |
@@ -100,20 +108,30 @@ discard block |
||
| 100 | 108 | $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
| 101 | 109 | if (trim($airport_icao) != '') { |
| 102 | 110 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
| 103 | - if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
|
| 111 | + if ($globalDebug) { |
|
| 112 | + echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
|
| 113 | + } |
|
| 104 | 114 | } |
| 105 | 115 | } |
| 106 | 116 | } |
| 107 | 117 | $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
| 108 | 118 | } |
| 109 | - } else $scheduleexist = true; |
|
| 110 | - } else $scheduleexist = true; |
|
| 119 | + } else { |
|
| 120 | + $scheduleexist = true; |
|
| 121 | + } |
|
| 122 | + } else { |
|
| 123 | + $scheduleexist = true; |
|
| 124 | + } |
|
| 111 | 125 | // close connection, at least one way will work ? |
| 112 | 126 | if ($scheduleexist) { |
| 113 | - if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
|
| 127 | + if ($globalDebug) { |
|
| 128 | + echo "-> get arrival/departure airport info for ".$ident."\n"; |
|
| 129 | + } |
|
| 114 | 130 | $sch = $Schedule->getSchedule($operator); |
| 115 | 131 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
| 116 | - if ($this->all_flights[$id]['addedSpotter'] == 1) $Spotter->updateLatestScheduleSpotterData($this->all_flights[$id]['id'],$sch['departure_airport_icao'],$sch['departure_airport_time'],$sch['arrival_airport_icao'],$sch['arrival_airport_time']); |
|
| 132 | + if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
| 133 | + $Spotter->updateLatestScheduleSpotterData($this->all_flights[$id]['id'],$sch['departure_airport_icao'],$sch['departure_airport_time'],$sch['arrival_airport_icao'],$sch['arrival_airport_time']); |
|
| 134 | + } |
|
| 117 | 135 | } |
| 118 | 136 | $Spotter->db = null; |
| 119 | 137 | $Schedule->db = null; |
@@ -133,14 +151,18 @@ discard block |
||
| 133 | 151 | |
| 134 | 152 | public function checkAll() { |
| 135 | 153 | global $globalDebug, $globalNoImport; |
| 136 | - if ($globalDebug) echo "Update last seen flights data...\n"; |
|
| 154 | + if ($globalDebug) { |
|
| 155 | + echo "Update last seen flights data...\n"; |
|
| 156 | + } |
|
| 137 | 157 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 138 | 158 | foreach ($this->all_flights as $key => $flight) { |
| 139 | 159 | if (isset($this->all_flights[$key]['id'])) { |
| 140 | 160 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
| 141 | 161 | $Spotter = new Spotter($this->db); |
| 142 | 162 | $real_arrival = $this->arrival($key); |
| 143 | - if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 163 | + if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) { |
|
| 164 | + $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 165 | + } |
|
| 144 | 166 | } |
| 145 | 167 | } |
| 146 | 168 | } |
@@ -148,24 +170,32 @@ discard block |
||
| 148 | 170 | |
| 149 | 171 | public function arrival($key) { |
| 150 | 172 | global $globalClosestMinDist, $globalDebug; |
| 151 | - if ($globalDebug) echo 'Update arrival...'."\n"; |
|
| 173 | + if ($globalDebug) { |
|
| 174 | + echo 'Update arrival...'."\n"; |
|
| 175 | + } |
|
| 152 | 176 | $Spotter = new Spotter($this->db); |
| 153 | 177 | $airport_icao = ''; |
| 154 | 178 | $airport_time = ''; |
| 155 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
| 179 | + if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') { |
|
| 180 | + $globalClosestMinDist = 50; |
|
| 181 | + } |
|
| 156 | 182 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 157 | 183 | $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
| 158 | 184 | if (isset($closestAirports[0])) { |
| 159 | 185 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
| 160 | 186 | $airport_icao = $closestAirports[0]['icao']; |
| 161 | 187 | $airport_time = $this->all_flights[$key]['datetime']; |
| 162 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 188 | + if ($globalDebug) { |
|
| 189 | + echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 190 | + } |
|
| 163 | 191 | } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
| 164 | 192 | foreach ($closestAirports as $airport) { |
| 165 | 193 | if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
| 166 | 194 | $airport_icao = $airport['icao']; |
| 167 | 195 | $airport_time = $this->all_flights[$key]['datetime']; |
| 168 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 196 | + if ($globalDebug) { |
|
| 197 | + echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 198 | + } |
|
| 169 | 199 | break; |
| 170 | 200 | } |
| 171 | 201 | } |
@@ -173,14 +203,20 @@ discard block |
||
| 173 | 203 | $airport_icao = $closestAirports[0]['icao']; |
| 174 | 204 | $airport_time = $this->all_flights[$key]['datetime']; |
| 175 | 205 | } else { |
| 176 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 206 | + if ($globalDebug) { |
|
| 207 | + echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 208 | + } |
|
| 177 | 209 | } |
| 178 | 210 | } else { |
| 179 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 211 | + if ($globalDebug) { |
|
| 212 | + echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 213 | + } |
|
| 180 | 214 | } |
| 181 | 215 | |
| 182 | 216 | } else { |
| 183 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 217 | + if ($globalDebug) { |
|
| 218 | + echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 219 | + } |
|
| 184 | 220 | } |
| 185 | 221 | return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
| 186 | 222 | } |
@@ -190,7 +226,9 @@ discard block |
||
| 190 | 226 | public function del() { |
| 191 | 227 | global $globalDebug, $globalNoImport, $globalNoDB; |
| 192 | 228 | // Delete old infos |
| 193 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
| 229 | + if ($globalDebug) { |
|
| 230 | + echo 'Delete old values and update latest data...'."\n"; |
|
| 231 | + } |
|
| 194 | 232 | |
| 195 | 233 | foreach ($this->all_flights as $key => $flight) { |
| 196 | 234 | if (isset($flight['lastupdate'])) { |
@@ -205,22 +243,30 @@ discard block |
||
| 205 | 243 | global $globalDebug, $globalNoImport, $globalNoDB; |
| 206 | 244 | // Delete old infos |
| 207 | 245 | if (isset($this->all_flights[$key]['id'])) { |
| 208 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 246 | + if ($globalDebug) { |
|
| 247 | + echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 248 | + } |
|
| 209 | 249 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
| 210 | 250 | $real_arrival = $this->arrival($key); |
| 211 | 251 | $Spotter = new Spotter($this->db); |
| 212 | 252 | $SpotterLive = new SpotterLive($this->db); |
| 213 | 253 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 214 | 254 | $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
| 215 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 255 | + if ($globalDebug && $result != 'success') { |
|
| 256 | + echo '!!! ERROR : '.$result."\n"; |
|
| 257 | + } |
|
| 216 | 258 | $this->all_flights[$key]['putinarchive'] = true; |
| 217 | 259 | $result = $SpotterLive->addLiveSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['aircraft_icao'], $this->all_flights[$key]['departure_airport'], $this->all_flights[$key]['arrival_airport'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['waypoints'], $this->all_flights[$key]['altitude'],$this->all_flights[$key]['altitude_real'], $this->all_flights[$key]['heading'], $this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'], $this->all_flights[$key]['departure_airport_time'], $this->all_flights[$key]['arrival_airport_time'], $this->all_flights[$key]['squawk'],$this->all_flights[$key]['route_stop'],$this->all_flights[$key]['hex'],$this->all_flights[$key]['putinarchive'],$this->all_flights[$key]['registration'],$this->all_flights[$key]['pilot_id'],$this->all_flights[$key]['pilot_name'], $this->all_flights[$key]['verticalrate'], $this->all_flights[$key]['noarchive'], $this->all_flights[$key]['ground'],$this->all_flights[$key]['format_source'],$this->all_flights[$key]['source_name'],$this->all_flights[$key]['over_country']); |
| 218 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 260 | + if ($globalDebug && $result != 'success') { |
|
| 261 | + echo '!!! ERROR : '.$result."\n"; |
|
| 262 | + } |
|
| 219 | 263 | } |
| 220 | 264 | $Spotter->db = null; |
| 221 | 265 | $SpotterLive->db = null; |
| 222 | 266 | } |
| 223 | - if ($globalDebug) echo "\n"; |
|
| 267 | + if ($globalDebug) { |
|
| 268 | + echo "\n"; |
|
| 269 | + } |
|
| 224 | 270 | } |
| 225 | 271 | unset($this->all_flights[$key]); |
| 226 | 272 | } |
@@ -228,9 +274,13 @@ discard block |
||
| 228 | 274 | public function add($line) { |
| 229 | 275 | global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights, $globalServerAPRS, $APRSSpotter, $globalNoImport, $globalNoDB, $globalVA, $globalAircraftMaxUpdate, $globalAircraftMinUpdate, $globalLiveInterval, $GeoidClass, $globalArchive; |
| 230 | 276 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
| 231 | - if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.01'; |
|
| 232 | - if (!isset($globalAircraftMaxUpdate) || $globalAircraftMaxUpdate == '') $globalAircraftMaxUpdate = 3000; |
|
| 233 | -/* |
|
| 277 | + if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') { |
|
| 278 | + $globalCoordMinChange = '0.01'; |
|
| 279 | + } |
|
| 280 | + if (!isset($globalAircraftMaxUpdate) || $globalAircraftMaxUpdate == '') { |
|
| 281 | + $globalAircraftMaxUpdate = 3000; |
|
| 282 | + } |
|
| 283 | + /* |
|
| 234 | 284 | $Spotter = new Spotter(); |
| 235 | 285 | $dbc = $Spotter->db; |
| 236 | 286 | $SpotterLive = new SpotterLive($dbc); |
@@ -252,19 +302,28 @@ discard block |
||
| 252 | 302 | // SBS format is CSV format |
| 253 | 303 | if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
| 254 | 304 | //print_r($line); |
| 255 | - if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
|
| 305 | + if (isset($line['hex'])) { |
|
| 306 | + $line['hex'] = strtoupper($line['hex']); |
|
| 307 | + } |
|
| 256 | 308 | if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && substr($line['hex'],0,1) != '~' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
| 257 | 309 | |
| 258 | 310 | // Increment message number |
| 259 | 311 | if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) { |
| 260 | 312 | $current_date = date('Y-m-d'); |
| 261 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 262 | - else $source = ''; |
|
| 263 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 313 | + if (isset($line['source_name'])) { |
|
| 314 | + $source = $line['source_name']; |
|
| 315 | + } else { |
|
| 316 | + $source = ''; |
|
| 317 | + } |
|
| 318 | + if ($source == '' || $line['format_source'] == 'aprs') { |
|
| 319 | + $source = $line['format_source']; |
|
| 320 | + } |
|
| 264 | 321 | if (!isset($this->stats[$current_date][$source]['msg'])) { |
| 265 | 322 | $this->stats[$current_date][$source]['msg']['date'] = time(); |
| 266 | 323 | $this->stats[$current_date][$source]['msg']['nb'] = 1; |
| 267 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 324 | + } else { |
|
| 325 | + $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 326 | + } |
|
| 268 | 327 | } |
| 269 | 328 | |
| 270 | 329 | /* |
@@ -280,23 +339,38 @@ discard block |
||
| 280 | 339 | //$this->db = $dbc; |
| 281 | 340 | |
| 282 | 341 | //$hex = trim($line['hex']); |
| 283 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 284 | - else $id = trim($line['id']); |
|
| 342 | + if (!isset($line['id'])) { |
|
| 343 | + $id = trim($line['hex']); |
|
| 344 | + } else { |
|
| 345 | + $id = trim($line['id']); |
|
| 346 | + } |
|
| 285 | 347 | |
| 286 | 348 | if (!isset($this->all_flights[$id])) { |
| 287 | - if ($globalDebug) echo 'New flight...'."\n"; |
|
| 349 | + if ($globalDebug) { |
|
| 350 | + echo 'New flight...'."\n"; |
|
| 351 | + } |
|
| 288 | 352 | $this->all_flights[$id] = array(); |
| 289 | 353 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 290 | 354 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
| 291 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 355 | + if (isset($globalDaemon) && $globalDaemon === FALSE) { |
|
| 356 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 357 | + } |
|
| 292 | 358 | if (!isset($line['id'])) { |
| 293 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
| 294 | -// if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
|
| 359 | + if (!isset($globalDaemon)) { |
|
| 360 | + $globalDaemon = TRUE; |
|
| 361 | + } |
|
| 362 | + // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
|
| 295 | 363 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 296 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 364 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
| 365 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 366 | + } |
|
| 297 | 367 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 298 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 299 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 368 | + } else { |
|
| 369 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 370 | + } |
|
| 371 | + if ($globalAllFlights !== FALSE) { |
|
| 372 | + $dataFound = true; |
|
| 373 | + } |
|
| 300 | 374 | } |
| 301 | 375 | if (isset($line['source_type']) && $line['source_type'] != '') { |
| 302 | 376 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
@@ -318,12 +392,20 @@ discard block |
||
| 318 | 392 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
| 319 | 393 | } |
| 320 | 394 | $Spotter->db = null; |
| 321 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 322 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 395 | + if ($globalDebugTimeElapsed) { |
|
| 396 | + echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 397 | + } |
|
| 398 | + if ($aircraft_icao != '') { |
|
| 399 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 400 | + } |
|
| 323 | 401 | } |
| 324 | 402 | } |
| 325 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 326 | - if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
| 403 | + if ($globalAllFlights !== FALSE) { |
|
| 404 | + $dataFound = true; |
|
| 405 | + } |
|
| 406 | + if ($globalDebug) { |
|
| 407 | + echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
| 408 | + } |
|
| 327 | 409 | } |
| 328 | 410 | if (isset($line['id']) && !isset($line['hex'])) { |
| 329 | 411 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
@@ -332,7 +414,9 @@ discard block |
||
| 332 | 414 | $icao = $line['aircraft_icao']; |
| 333 | 415 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 334 | 416 | $Spotter = new Spotter($this->db); |
| 335 | - if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
|
| 417 | + if (isset($Spotter->aircraft_correct_icaotype[$icao])) { |
|
| 418 | + $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
|
| 419 | + } |
|
| 336 | 420 | $Spotter->db = null; |
| 337 | 421 | } |
| 338 | 422 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao)); |
@@ -342,15 +426,24 @@ discard block |
||
| 342 | 426 | $Spotter = new Spotter($this->db); |
| 343 | 427 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
| 344 | 428 | $Spotter->db = null; |
| 345 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 429 | + if ($aircraft_icao != '') { |
|
| 430 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 431 | + } |
|
| 346 | 432 | } |
| 347 | 433 | } |
| 348 | 434 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) { |
| 349 | - if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
| 350 | - elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
| 351 | - elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
| 352 | - elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
| 353 | - if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 435 | + if ($line['aircraft_type'] == 'PARA_GLIDER') { |
|
| 436 | + $aircraft_icao = 'GLID'; |
|
| 437 | + } elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') { |
|
| 438 | + $aircraft_icao = 'UHEL'; |
|
| 439 | + } elseif ($line['aircraft_type'] == 'TOW_PLANE') { |
|
| 440 | + $aircraft_icao = 'TOWPLANE'; |
|
| 441 | + } elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') { |
|
| 442 | + $aircraft_icao = 'POWAIRC'; |
|
| 443 | + } |
|
| 444 | + if (isset($aircraft_icao)) { |
|
| 445 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 446 | + } |
|
| 354 | 447 | } |
| 355 | 448 | if (!isset($this->all_flights[$id]['aircraft_icao'])) { |
| 356 | 449 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
@@ -360,8 +453,11 @@ discard block |
||
| 360 | 453 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
| 361 | 454 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 362 | 455 | } else { |
| 363 | - if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 364 | - elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 456 | + if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) { |
|
| 457 | + echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 458 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) { |
|
| 459 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 460 | + } |
|
| 365 | 461 | /* |
| 366 | 462 | echo strtotime($line['datetime']).' > '.strtotime($this->all_flights[$id]['datetime']); |
| 367 | 463 | print_r($this->all_flights[$id]); |
@@ -370,16 +466,22 @@ discard block |
||
| 370 | 466 | return ''; |
| 371 | 467 | } |
| 372 | 468 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
| 373 | - if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
|
| 469 | + if ($globalDebug) { |
|
| 470 | + echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
|
| 471 | + } |
|
| 374 | 472 | return ''; |
| 375 | 473 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
| 376 | - if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
|
| 474 | + if ($globalDebug) { |
|
| 475 | + echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
|
| 476 | + } |
|
| 377 | 477 | return ''; |
| 378 | 478 | } elseif (!isset($line['datetime'])) { |
| 379 | 479 | date_default_timezone_set('UTC'); |
| 380 | 480 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
| 381 | 481 | } else { |
| 382 | - if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
|
| 482 | + if ($globalDebug) { |
|
| 483 | + echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
|
| 484 | + } |
|
| 383 | 485 | return ''; |
| 384 | 486 | } |
| 385 | 487 | |
@@ -400,30 +502,48 @@ discard block |
||
| 400 | 502 | |
| 401 | 503 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
| 402 | 504 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 403 | - if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
|
| 505 | + if ($globalDebug) { |
|
| 506 | + echo '---!!!! New ident, reset aircraft data...'."\n"; |
|
| 507 | + } |
|
| 404 | 508 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 405 | 509 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 406 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 407 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 408 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 510 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
| 511 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 512 | + } elseif (isset($line['id'])) { |
|
| 513 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 514 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
| 515 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 516 | + } |
|
| 409 | 517 | } else { |
| 410 | 518 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
| 411 | 519 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 412 | 520 | $timeelapsed = microtime(true); |
| 413 | 521 | $Spotter = new Spotter($this->db); |
| 414 | 522 | $fromsource = NULL; |
| 415 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 416 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 417 | - elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 418 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 419 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 523 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 524 | + $fromsource = $globalAirlinesSource; |
|
| 525 | + } elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') { |
|
| 526 | + $fromsource = 'vatsim'; |
|
| 527 | + } elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') { |
|
| 528 | + $fromsource = 'ivao'; |
|
| 529 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 530 | + $fromsource = 'vatsim'; |
|
| 531 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 532 | + $fromsource = 'ivao'; |
|
| 533 | + } |
|
| 420 | 534 | $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource,$this->all_flights[$id]['source_type']); |
| 421 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 535 | + if ($globalDebug && $result != 'success') { |
|
| 536 | + echo '!!! ERROR : '.$result."\n"; |
|
| 537 | + } |
|
| 422 | 538 | $Spotter->db = null; |
| 423 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 539 | + if ($globalDebugTimeElapsed) { |
|
| 540 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 541 | + } |
|
| 424 | 542 | } |
| 425 | 543 | } |
| 426 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 544 | + } else { |
|
| 545 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 546 | + } |
|
| 427 | 547 | |
| 428 | 548 | /* |
| 429 | 549 | if (!isset($line['id'])) { |
@@ -433,7 +553,9 @@ discard block |
||
| 433 | 553 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 434 | 554 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 435 | 555 | */ |
| 436 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 556 | + if (!isset($this->all_flights[$id]['id'])) { |
|
| 557 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 558 | + } |
|
| 437 | 559 | |
| 438 | 560 | //$putinarchive = true; |
| 439 | 561 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
@@ -451,7 +573,9 @@ discard block |
||
| 451 | 573 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 452 | 574 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 453 | 575 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
| 454 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 576 | + if ($globalDebugTimeElapsed) { |
|
| 577 | + echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 578 | + } |
|
| 455 | 579 | } |
| 456 | 580 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
| 457 | 581 | $timeelapsed = microtime(true); |
@@ -465,7 +589,9 @@ discard block |
||
| 465 | 589 | $Translation->db = null; |
| 466 | 590 | } |
| 467 | 591 | $Spotter->db = null; |
| 468 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 592 | + if ($globalDebugTimeElapsed) { |
|
| 593 | + echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 594 | + } |
|
| 469 | 595 | } |
| 470 | 596 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 471 | 597 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
@@ -474,9 +600,13 @@ discard block |
||
| 474 | 600 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
| 475 | 601 | } |
| 476 | 602 | } |
| 477 | - if (!isset($globalFork)) $globalFork = TRUE; |
|
| 603 | + if (!isset($globalFork)) { |
|
| 604 | + $globalFork = TRUE; |
|
| 605 | + } |
|
| 478 | 606 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
| 479 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
| 607 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) { |
|
| 608 | + $this->get_Schedule($id,trim($line['ident'])); |
|
| 609 | + } |
|
| 480 | 610 | } |
| 481 | 611 | } |
| 482 | 612 | } |
@@ -494,9 +624,13 @@ discard block |
||
| 494 | 624 | $speed = $speed*3.6; |
| 495 | 625 | if ($speed < 1000) { |
| 496 | 626 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
| 497 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
| 627 | + if ($globalDebug) { |
|
| 628 | + echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
| 629 | + } |
|
| 498 | 630 | } else { |
| 499 | - if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
| 631 | + if ($globalDebug) { |
|
| 632 | + echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
|
| 633 | + } |
|
| 500 | 634 | } |
| 501 | 635 | } |
| 502 | 636 | } |
@@ -505,13 +639,21 @@ discard block |
||
| 505 | 639 | |
| 506 | 640 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
| 507 | 641 | if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) { |
| 508 | - if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
| 642 | + if ($globalDebug) { |
|
| 643 | + echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
| 644 | + } |
|
| 509 | 645 | return false; |
| 510 | 646 | } |
| 511 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 512 | - else unset($timediff); |
|
| 513 | - if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
| 514 | - else unset($timediff_archive); |
|
| 647 | + if (isset($this->all_flights[$id]['time_last_coord'])) { |
|
| 648 | + $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 649 | + } else { |
|
| 650 | + unset($timediff); |
|
| 651 | + } |
|
| 652 | + if (isset($this->all_flights[$id]['time_last_archive_coord'])) { |
|
| 653 | + $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
| 654 | + } else { |
|
| 655 | + unset($timediff_archive); |
|
| 656 | + } |
|
| 515 | 657 | if ($this->tmd > 5 |
| 516 | 658 | || (isset($line['format_source']) |
| 517 | 659 | && $line['format_source'] == 'airwhere' |
@@ -548,16 +690,25 @@ discard block |
||
| 548 | 690 | $this->all_flights[$id]['putinarchive'] = true; |
| 549 | 691 | $this->tmd = 0; |
| 550 | 692 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 551 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 693 | + if ($globalDebug) { |
|
| 694 | + echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 695 | + } |
|
| 552 | 696 | $timeelapsed = microtime(true); |
| 553 | 697 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 554 | 698 | $Spotter = new Spotter($this->db); |
| 555 | 699 | $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
| 556 | - if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
|
| 557 | - else $this->all_flights[$id]['over_country'] = ''; |
|
| 700 | + if (!empty($all_country)) { |
|
| 701 | + $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
|
| 702 | + } else { |
|
| 703 | + $this->all_flights[$id]['over_country'] = ''; |
|
| 704 | + } |
|
| 558 | 705 | $Spotter->db = null; |
| 559 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 560 | - if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
|
| 706 | + if ($globalDebugTimeElapsed) { |
|
| 707 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 708 | + } |
|
| 709 | + if ($globalDebug) { |
|
| 710 | + echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
|
| 711 | + } |
|
| 561 | 712 | } |
| 562 | 713 | } |
| 563 | 714 | $this->all_flights[$id]['time_last_archive_coord'] = time(); |
@@ -603,7 +754,9 @@ discard block |
||
| 603 | 754 | */ |
| 604 | 755 | } |
| 605 | 756 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 606 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 757 | + if ($line['longitude'] > 180) { |
|
| 758 | + $line['longitude'] = $line['longitude'] - 360; |
|
| 759 | + } |
|
| 607 | 760 | //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
| 608 | 761 | if (!isset($this->all_flights[$id]['archive_longitude'])) { |
| 609 | 762 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -640,7 +793,9 @@ discard block |
||
| 640 | 793 | } |
| 641 | 794 | } |
| 642 | 795 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 643 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 796 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) { |
|
| 797 | + $dataFound = true; |
|
| 798 | + } |
|
| 644 | 799 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
| 645 | 800 | } |
| 646 | 801 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
@@ -662,35 +817,53 @@ discard block |
||
| 662 | 817 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 663 | 818 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 664 | 819 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 665 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 666 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 667 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 820 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
| 821 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 822 | + } elseif (isset($line['id'])) { |
|
| 823 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 824 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
| 825 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 826 | + } |
|
| 827 | + } |
|
| 828 | + if ($line['ground'] != 1) { |
|
| 829 | + $line['ground'] = 0; |
|
| 668 | 830 | } |
| 669 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 670 | 831 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
| 671 | 832 | //$dataFound = true; |
| 672 | 833 | } |
| 673 | 834 | if (isset($line['squawk']) && $line['squawk'] != '') { |
| 674 | 835 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
| 675 | - if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
|
| 836 | + if ($this->all_flights[$id]['squawk'] != $line['squawk']) { |
|
| 837 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 838 | + } |
|
| 676 | 839 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
| 677 | 840 | $highlight = ''; |
| 678 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 679 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 680 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 841 | + if ($this->all_flights[$id]['squawk'] == '7500') { |
|
| 842 | + $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 843 | + } |
|
| 844 | + if ($this->all_flights[$id]['squawk'] == '7600') { |
|
| 845 | + $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 846 | + } |
|
| 847 | + if ($this->all_flights[$id]['squawk'] == '7700') { |
|
| 848 | + $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 849 | + } |
|
| 681 | 850 | if ($highlight != '') { |
| 682 | 851 | $timeelapsed = microtime(true); |
| 683 | 852 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 684 | 853 | $Spotter = new Spotter($this->db); |
| 685 | 854 | $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
| 686 | 855 | $Spotter->db = null; |
| 687 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 856 | + if ($globalDebugTimeElapsed) { |
|
| 857 | + echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 858 | + } |
|
| 688 | 859 | } |
| 689 | 860 | //$putinarchive = true; |
| 690 | 861 | //$highlight = ''; |
| 691 | 862 | } |
| 692 | 863 | |
| 693 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 864 | + } else { |
|
| 865 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 866 | + } |
|
| 694 | 867 | //$dataFound = true; |
| 695 | 868 | } |
| 696 | 869 | |
@@ -703,19 +876,27 @@ discard block |
||
| 703 | 876 | } |
| 704 | 877 | } |
| 705 | 878 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
| 706 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
| 879 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) { |
|
| 880 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 881 | + } |
|
| 707 | 882 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
| 708 | 883 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
| 709 | 884 | //$dataFound = true; |
| 710 | 885 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
| 711 | 886 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
| 712 | 887 | if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 713 | - if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
|
| 888 | + if ($globalDebug) { |
|
| 889 | + echo '--- Reset because of altitude'."\n"; |
|
| 890 | + } |
|
| 714 | 891 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 715 | 892 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 716 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 717 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 718 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 893 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
| 894 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 895 | + } elseif (isset($line['id'])) { |
|
| 896 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 897 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
| 898 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 899 | + } |
|
| 719 | 900 | } |
| 720 | 901 | } |
| 721 | 902 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
@@ -726,22 +907,32 @@ discard block |
||
| 726 | 907 | } |
| 727 | 908 | |
| 728 | 909 | if (isset($line['heading']) && $line['heading'] != '') { |
| 729 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 910 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) { |
|
| 911 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 912 | + } |
|
| 730 | 913 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
| 731 | 914 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
| 732 | 915 | //$dataFound = true; |
| 733 | 916 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
| 734 | 917 | $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
| 735 | 918 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
| 736 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 737 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 919 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) { |
|
| 920 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 921 | + } |
|
| 922 | + if ($globalDebug) { |
|
| 923 | + echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 924 | + } |
|
| 738 | 925 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 739 | 926 | // If not enough messages and ACARS set heading to 0 |
| 740 | 927 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
| 741 | 928 | } |
| 742 | - if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 743 | - elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 744 | - elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false; |
|
| 929 | + if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) { |
|
| 930 | + $dataFound = false; |
|
| 931 | + } elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) { |
|
| 932 | + $dataFound = false; |
|
| 933 | + } elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) { |
|
| 934 | + $dataFound = false; |
|
| 935 | + } |
|
| 745 | 936 | |
| 746 | 937 | // print_r($this->all_flights[$id]); |
| 747 | 938 | //gets the callsign from the last hour |
@@ -758,23 +949,38 @@ discard block |
||
| 758 | 949 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
| 759 | 950 | if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
| 760 | 951 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 761 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
| 952 | + if ($globalDebug) { |
|
| 953 | + echo "Check if aircraft is already in DB..."; |
|
| 954 | + } |
|
| 762 | 955 | $timeelapsed = microtime(true); |
| 763 | 956 | $SpotterLive = new SpotterLive($this->db); |
| 764 | 957 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
| 765 | 958 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
| 766 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 959 | + if ($globalDebugTimeElapsed) { |
|
| 960 | + echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 961 | + } |
|
| 767 | 962 | } elseif (isset($line['id'])) { |
| 768 | 963 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
| 769 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 964 | + if ($globalDebugTimeElapsed) { |
|
| 965 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 966 | + } |
|
| 770 | 967 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
| 771 | 968 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
| 772 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 773 | - } else $recent_ident = ''; |
|
| 969 | + if ($globalDebugTimeElapsed) { |
|
| 970 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 971 | + } |
|
| 972 | + } else { |
|
| 973 | + $recent_ident = ''; |
|
| 974 | + } |
|
| 774 | 975 | $SpotterLive->db=null; |
| 775 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 776 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 777 | - } else $recent_ident = ''; |
|
| 976 | + if ($globalDebug && $recent_ident == '') { |
|
| 977 | + echo " Not in DB.\n"; |
|
| 978 | + } elseif ($globalDebug && $recent_ident != '') { |
|
| 979 | + echo " Already in DB.\n"; |
|
| 980 | + } |
|
| 981 | + } else { |
|
| 982 | + $recent_ident = ''; |
|
| 983 | + } |
|
| 778 | 984 | } else { |
| 779 | 985 | $recent_ident = ''; |
| 780 | 986 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
@@ -782,7 +988,9 @@ discard block |
||
| 782 | 988 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
| 783 | 989 | if($recent_ident == "") |
| 784 | 990 | { |
| 785 | - if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
|
| 991 | + if ($globalDebug) { |
|
| 992 | + echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
|
| 993 | + } |
|
| 786 | 994 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 787 | 995 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 788 | 996 | //adds the spotter data for the archive |
@@ -826,10 +1034,18 @@ discard block |
||
| 826 | 1034 | |
| 827 | 1035 | if (!$ignoreImport) { |
| 828 | 1036 | $highlight = ''; |
| 829 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 830 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 831 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
| 832 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 1037 | + if ($this->all_flights[$id]['squawk'] == '7500') { |
|
| 1038 | + $highlight = 'Squawk 7500 : Hijack'; |
|
| 1039 | + } |
|
| 1040 | + if ($this->all_flights[$id]['squawk'] == '7600') { |
|
| 1041 | + $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 1042 | + } |
|
| 1043 | + if ($this->all_flights[$id]['squawk'] == '7700') { |
|
| 1044 | + $highlight = 'Squawk 7700 : Emergency'; |
|
| 1045 | + } |
|
| 1046 | + if (!isset($this->all_flights[$id]['id'])) { |
|
| 1047 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 1048 | + } |
|
| 833 | 1049 | $timeelapsed = microtime(true); |
| 834 | 1050 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 835 | 1051 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -837,28 +1053,43 @@ discard block |
||
| 837 | 1053 | $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
| 838 | 1054 | $Spotter->db = null; |
| 839 | 1055 | if ($globalDebug) { |
| 840 | - if (isset($result['error'])) echo 'Error: '.$result['error']."\n"; |
|
| 841 | - else echo 'Success'; |
|
| 1056 | + if (isset($result['error'])) { |
|
| 1057 | + echo 'Error: '.$result['error']."\n"; |
|
| 1058 | + } else { |
|
| 1059 | + echo 'Success'; |
|
| 1060 | + } |
|
| 842 | 1061 | } |
| 843 | 1062 | if (count($result) > 1) { |
| 844 | 1063 | // ':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type, |
| 845 | - if ($this->all_flights[$id]['aircraft_icao'] == '') $this->all_flights[$id]['aircraft_icao'] = $result[':aircraft_icao']; |
|
| 846 | - if ($this->all_flights[$id]['registration'] == '') $this->all_flights[$id]['registration'] = $result[':registration']; |
|
| 1064 | + if ($this->all_flights[$id]['aircraft_icao'] == '') { |
|
| 1065 | + $this->all_flights[$id]['aircraft_icao'] = $result[':aircraft_icao']; |
|
| 1066 | + } |
|
| 1067 | + if ($this->all_flights[$id]['registration'] == '') { |
|
| 1068 | + $this->all_flights[$id]['registration'] = $result[':registration']; |
|
| 1069 | + } |
|
| 847 | 1070 | } |
| 848 | 1071 | } |
| 849 | 1072 | } |
| 850 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 1073 | + if ($globalDebugTimeElapsed) { |
|
| 1074 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 1075 | + } |
|
| 851 | 1076 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 852 | 1077 | |
| 853 | 1078 | // Add source stat in DB |
| 854 | 1079 | $Stats = new Stats($this->db); |
| 855 | 1080 | if (!empty($this->stats)) { |
| 856 | - if ($globalDebug) echo 'Add source stats : '; |
|
| 1081 | + if ($globalDebug) { |
|
| 1082 | + echo 'Add source stats : '; |
|
| 1083 | + } |
|
| 857 | 1084 | foreach($this->stats as $date => $data) { |
| 858 | 1085 | foreach($data as $source => $sourced) { |
| 859 | 1086 | //print_r($sourced); |
| 860 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 861 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 1087 | + if (isset($sourced['polar'])) { |
|
| 1088 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 1089 | + } |
|
| 1090 | + if (isset($sourced['hist'])) { |
|
| 1091 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 1092 | + } |
|
| 862 | 1093 | if (isset($sourced['msg'])) { |
| 863 | 1094 | if (time() - $sourced['msg']['date'] > 10) { |
| 864 | 1095 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
@@ -871,13 +1102,17 @@ discard block |
||
| 871 | 1102 | unset($this->stats[$date]); |
| 872 | 1103 | } |
| 873 | 1104 | } |
| 874 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 1105 | + if ($globalDebug) { |
|
| 1106 | + echo 'Done'."\n"; |
|
| 1107 | + } |
|
| 875 | 1108 | |
| 876 | 1109 | } |
| 877 | 1110 | $Stats->db = null; |
| 878 | 1111 | } |
| 879 | 1112 | $this->del(); |
| 880 | - } elseif ($globalDebug) echo 'Ignore data'."\n"; |
|
| 1113 | + } elseif ($globalDebug) { |
|
| 1114 | + echo 'Ignore data'."\n"; |
|
| 1115 | + } |
|
| 881 | 1116 | //$ignoreImport = false; |
| 882 | 1117 | $this->all_flights[$id]['addedSpotter'] = 1; |
| 883 | 1118 | //print_r($this->all_flights[$id]); |
@@ -894,7 +1129,9 @@ discard block |
||
| 894 | 1129 | */ |
| 895 | 1130 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
| 896 | 1131 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 897 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 1132 | + if ($globalDebug) { |
|
| 1133 | + echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 1134 | + } |
|
| 898 | 1135 | //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
| 899 | 1136 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 900 | 1137 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -903,7 +1140,9 @@ discard block |
||
| 903 | 1140 | $SpotterLive->db=null; |
| 904 | 1141 | } |
| 905 | 1142 | } |
| 906 | - if ($globalDebug) echo " Done\n"; |
|
| 1143 | + if ($globalDebug) { |
|
| 1144 | + echo " Done\n"; |
|
| 1145 | + } |
|
| 907 | 1146 | $this->last_delete = time(); |
| 908 | 1147 | } |
| 909 | 1148 | } else { |
@@ -930,11 +1169,17 @@ discard block |
||
| 930 | 1169 | //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
| 931 | 1170 | if ($globalDebug) { |
| 932 | 1171 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
| 933 | - if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 934 | - else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
|
| 1172 | + if (isset($this->all_flights[$id]['source_name'])) { |
|
| 1173 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 1174 | + } else { |
|
| 1175 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
|
| 1176 | + } |
|
| 935 | 1177 | } else { |
| 936 | - if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 937 | - else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
|
| 1178 | + if (isset($this->all_flights[$id]['source_name'])) { |
|
| 1179 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 1180 | + } else { |
|
| 1181 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
|
| 1182 | + } |
|
| 938 | 1183 | } |
| 939 | 1184 | } |
| 940 | 1185 | $ignoreImport = false; |
@@ -980,22 +1225,30 @@ discard block |
||
| 980 | 1225 | |
| 981 | 1226 | if (!$ignoreImport) { |
| 982 | 1227 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
| 983 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 1228 | + if (!isset($this->all_flights[$id]['id'])) { |
|
| 1229 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 1230 | + } |
|
| 984 | 1231 | $timeelapsed = microtime(true); |
| 985 | 1232 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 986 | 1233 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 987 | - if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
|
| 1234 | + if ($globalDebug) { |
|
| 1235 | + echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
|
| 1236 | + } |
|
| 988 | 1237 | $SpotterLive = new SpotterLive($this->db); |
| 989 | 1238 | $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
| 990 | 1239 | $SpotterLive->db = null; |
| 991 | - if ($globalDebug) echo $result."\n"; |
|
| 1240 | + if ($globalDebug) { |
|
| 1241 | + echo $result."\n"; |
|
| 1242 | + } |
|
| 992 | 1243 | } |
| 993 | 1244 | } |
| 994 | 1245 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
| 995 | 1246 | $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
| 996 | 1247 | } |
| 997 | 1248 | $this->all_flights[$id]['putinarchive'] = false; |
| 998 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 1249 | + if ($globalDebugTimeElapsed) { |
|
| 1250 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 1251 | + } |
|
| 999 | 1252 | |
| 1000 | 1253 | // Put statistics in $this->stats variable |
| 1001 | 1254 | //if ($line['format_source'] != 'aprs') { |
@@ -1003,7 +1256,9 @@ discard block |
||
| 1003 | 1256 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 1004 | 1257 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
| 1005 | 1258 | $source = $this->all_flights[$id]['source_name']; |
| 1006 | - if ($source == '') $source = $this->all_flights[$id]['format_source']; |
|
| 1259 | + if ($source == '') { |
|
| 1260 | + $source = $this->all_flights[$id]['format_source']; |
|
| 1261 | + } |
|
| 1007 | 1262 | if (!isset($this->source_location[$source])) { |
| 1008 | 1263 | $Location = new Source($this->db); |
| 1009 | 1264 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -1024,7 +1279,9 @@ discard block |
||
| 1024 | 1279 | $stats_heading = round($stats_heading/22.5); |
| 1025 | 1280 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
| 1026 | 1281 | $current_date = date('Y-m-d'); |
| 1027 | - if ($stats_heading == 16) $stats_heading = 0; |
|
| 1282 | + if ($stats_heading == 16) { |
|
| 1283 | + $stats_heading = 0; |
|
| 1284 | + } |
|
| 1028 | 1285 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 1029 | 1286 | for ($i=0;$i<=15;$i++) { |
| 1030 | 1287 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
@@ -1042,7 +1299,9 @@ discard block |
||
| 1042 | 1299 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 1043 | 1300 | end($this->stats[$current_date][$source]['hist']); |
| 1044 | 1301 | $mini = key($this->stats[$current_date][$source]['hist'])+10; |
| 1045 | - } else $mini = 0; |
|
| 1302 | + } else { |
|
| 1303 | + $mini = 0; |
|
| 1304 | + } |
|
| 1046 | 1305 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 1047 | 1306 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 1048 | 1307 | } |
@@ -1054,19 +1313,27 @@ discard block |
||
| 1054 | 1313 | } |
| 1055 | 1314 | |
| 1056 | 1315 | $this->all_flights[$id]['lastupdate'] = time(); |
| 1057 | - if ($this->all_flights[$id]['putinarchive']) $send = true; |
|
| 1316 | + if ($this->all_flights[$id]['putinarchive']) { |
|
| 1317 | + $send = true; |
|
| 1318 | + } |
|
| 1058 | 1319 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
| 1059 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 1320 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
| 1321 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 1322 | + } |
|
| 1060 | 1323 | //$this->del(); |
| 1061 | 1324 | |
| 1062 | 1325 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 1063 | 1326 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
| 1064 | - if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 1327 | + if ($globalDebug) { |
|
| 1328 | + echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 1329 | + } |
|
| 1065 | 1330 | $SpotterLive = new SpotterLive($this->db); |
| 1066 | 1331 | $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
| 1067 | 1332 | $SpotterLive->db = null; |
| 1068 | 1333 | //SpotterLive->deleteLiveSpotterData(); |
| 1069 | - if ($globalDebug) echo " Done\n"; |
|
| 1334 | + if ($globalDebug) { |
|
| 1335 | + echo " Done\n"; |
|
| 1336 | + } |
|
| 1070 | 1337 | $this->last_delete_hourly = time(); |
| 1071 | 1338 | } else { |
| 1072 | 1339 | $this->del(); |
@@ -1078,7 +1345,9 @@ discard block |
||
| 1078 | 1345 | //$ignoreImport = false; |
| 1079 | 1346 | } |
| 1080 | 1347 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 1081 | - if ($send) return $this->all_flights[$id]; |
|
| 1348 | + if ($send) { |
|
| 1349 | + return $this->all_flights[$id]; |
|
| 1350 | + } |
|
| 1082 | 1351 | } |
| 1083 | 1352 | } |
| 1084 | 1353 | } |