@@ -3,18 +3,31 @@ discard block |
||
| 3 | 3 | require_once('../require/class.Language.php'); |
| 4 | 4 | |
| 5 | 5 | // Compressed GeoJson is used if true |
| 6 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 7 | -else $compress = $globalJsonCompress; |
|
| 6 | +if (!isset($globalJsonCompress)) { |
|
| 7 | + $compress = true; |
|
| 8 | +} else { |
|
| 9 | + $compress = $globalJsonCompress; |
|
| 10 | +} |
|
| 8 | 11 | |
| 9 | -if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 10 | -if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 12 | +if (isset($_GET['ident'])) { |
|
| 13 | + $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 14 | +} |
|
| 15 | +if (isset($_GET['flightaware_id'])) { |
|
| 16 | + $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 17 | +} |
|
| 11 | 18 | $archive = false; |
| 12 | -if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') $archive = true; |
|
| 19 | +if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') { |
|
| 20 | + $archive = true; |
|
| 21 | +} |
|
| 13 | 22 | ?> |
| 14 | 23 | <?php |
| 15 | -if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor']; |
|
| 16 | -elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor; |
|
| 17 | -else $IconColor = '1a3151'; |
|
| 24 | +if (isset($_COOKIE['IconColor'])) { |
|
| 25 | + $IconColor = $_COOKIE['IconColor']; |
|
| 26 | +} elseif (isset($globalAircraftIconColor)) { |
|
| 27 | + $IconColor = $globalAircraftIconColor; |
|
| 28 | +} else { |
|
| 29 | + $IconColor = '1a3151'; |
|
| 30 | +} |
|
| 18 | 31 | ?> |
| 19 | 32 | <?php |
| 20 | 33 | if (isset($globalDebug) && $globalDebug === TRUE) { |
@@ -92,9 +105,12 @@ discard block |
||
| 92 | 105 | |
| 93 | 106 | function update_airportsLayer() { |
| 94 | 107 | <?php |
| 95 | - if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom']; |
|
| 96 | - else $getZoom = '7'; |
|
| 97 | -?> |
|
| 108 | + if (isset($_COOKIE['AirportZoom'])) { |
|
| 109 | + $getZoom = $_COOKIE['AirportZoom']; |
|
| 110 | + } else { |
|
| 111 | + $getZoom = '7'; |
|
| 112 | + } |
|
| 113 | + ?> |
|
| 98 | 114 | if (typeof airportsLayer != 'undefined') { |
| 99 | 115 | if (map.hasLayer(airportsLayer) == true) { |
| 100 | 116 | map.removeLayer(airportsLayer); |
@@ -378,7 +394,12 @@ discard block |
||
| 378 | 394 | <?php |
| 379 | 395 | } else { |
| 380 | 396 | ?> |
| 381 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 397 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 398 | + print $archiveupdatetime*1000; |
|
| 399 | +} else { |
|
| 400 | + print $globalMapRefresh*1000+20000; |
|
| 401 | +} |
|
| 402 | +?>+feature.properties.sqt*1000); |
|
| 382 | 403 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 383 | 404 | <?php |
| 384 | 405 | } |
@@ -428,7 +449,12 @@ discard block |
||
| 428 | 449 | <?php |
| 429 | 450 | } else { |
| 430 | 451 | ?> |
| 431 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 452 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 453 | + print $archiveupdatetime*1000; |
|
| 454 | +} else { |
|
| 455 | + print $globalMapRefresh*1000+20000; |
|
| 456 | +} |
|
| 457 | +?>+feature.properties.sqt*1000); |
|
| 432 | 458 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 433 | 459 | <?php |
| 434 | 460 | } |
@@ -475,7 +501,12 @@ discard block |
||
| 475 | 501 | <?php |
| 476 | 502 | } else { |
| 477 | 503 | ?> |
| 478 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 504 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 505 | + print $archiveupdatetime*1000; |
|
| 506 | +} else { |
|
| 507 | + print $globalMapRefresh*1000+20000; |
|
| 508 | +} |
|
| 509 | +?>+feature.properties.sqt*1000); |
|
| 479 | 510 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 480 | 511 | <?php |
| 481 | 512 | } |
@@ -981,7 +1012,12 @@ discard block |
||
| 981 | 1012 | } else { |
| 982 | 1013 | ?> |
| 983 | 1014 | //then load it again every 30 seconds |
| 984 | - reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
| 1015 | + reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) { |
|
| 1016 | + print $globalMapRefresh*1000; |
|
| 1017 | +} else { |
|
| 1018 | + print '30000'; |
|
| 1019 | +} |
|
| 1020 | +?>); |
|
| 985 | 1021 | var currentdate = new Date(); |
| 986 | 1022 | var currentyear = new Date().getFullYear(); |
| 987 | 1023 | var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0)); |
@@ -993,7 +1029,12 @@ discard block |
||
| 993 | 1029 | if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
| 994 | 1030 | ?> |
| 995 | 1031 | update_polarLayer(); |
| 996 | - setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
| 1032 | + setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) { |
|
| 1033 | + print $globalMapRefresh*1000*2; |
|
| 1034 | +} else { |
|
| 1035 | + print '60000'; |
|
| 1036 | +} |
|
| 1037 | +?>); |
|
| 997 | 1038 | <?php |
| 998 | 1039 | } |
| 999 | 1040 | ?> |
@@ -1008,7 +1049,12 @@ discard block |
||
| 1008 | 1049 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
| 1009 | 1050 | ?> |
| 1010 | 1051 | update_atcLayer(); |
| 1011 | - setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
| 1052 | + setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) { |
|
| 1053 | + print $globalMapRefresh*1000*2; |
|
| 1054 | +} else { |
|
| 1055 | + print '60000'; |
|
| 1056 | +} |
|
| 1057 | +?>); |
|
| 1012 | 1058 | <?php |
| 1013 | 1059 | } |
| 1014 | 1060 | ?> |
@@ -12,7 +12,9 @@ discard block |
||
| 12 | 12 | $tracker = false; |
| 13 | 13 | $marine = false; |
| 14 | 14 | $usecoord = false; |
| 15 | -if (isset($_GET['test'])) exit(); |
|
| 15 | +if (isset($_GET['test'])) { |
|
| 16 | + exit(); |
|
| 17 | +} |
|
| 16 | 18 | if (isset($_GET['tracker'])) { |
| 17 | 19 | $tracker = true; |
| 18 | 20 | } |
@@ -57,28 +59,55 @@ discard block |
||
| 57 | 59 | } |
| 58 | 60 | header('Content-Type: text/javascript'); |
| 59 | 61 | |
| 60 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 61 | -else $compress = $globalJsonCompress; |
|
| 62 | +if (!isset($globalJsonCompress)) { |
|
| 63 | + $compress = true; |
|
| 64 | +} else { |
|
| 65 | + $compress = $globalJsonCompress; |
|
| 66 | +} |
|
| 62 | 67 | |
| 63 | 68 | $from_archive = false; |
| 64 | 69 | $min = true; |
| 65 | 70 | $allhistory = false; |
| 66 | 71 | $filter['source'] = array(); |
| 67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 69 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 71 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 72 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 73 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 74 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 75 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 76 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 77 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 72 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
| 73 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 74 | +} |
|
| 75 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
| 76 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 77 | +} |
|
| 78 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
| 79 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 80 | +} |
|
| 81 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
| 82 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 83 | +} |
|
| 84 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
| 85 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 86 | +} |
|
| 87 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
| 88 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 89 | +} |
|
| 90 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
| 91 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 92 | +} |
|
| 93 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
| 94 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 95 | +} |
|
| 96 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
| 97 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 98 | +} |
|
| 99 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
| 100 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 101 | +} |
|
| 102 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
| 103 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 104 | +} |
|
| 78 | 105 | |
| 79 | 106 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 80 | 107 | $min = true; |
| 81 | -} else $min = false; |
|
| 108 | +} else { |
|
| 109 | + $min = false; |
|
| 110 | +} |
|
| 82 | 111 | |
| 83 | 112 | $spotter_array = array(); |
| 84 | 113 | |
@@ -189,24 +218,38 @@ discard block |
||
| 189 | 218 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
| 190 | 219 | } |
| 191 | 220 | } |
| 192 | - if ($flightcnt == '') $flightcnt = 0; |
|
| 193 | -} else $flightcnt = 0; |
|
| 221 | + if ($flightcnt == '') { |
|
| 222 | + $flightcnt = 0; |
|
| 223 | + } |
|
| 224 | + } else { |
|
| 225 | + $flightcnt = 0; |
|
| 226 | +} |
|
| 194 | 227 | |
| 195 | 228 | $sqltime = round(microtime(true)-$begintime,2); |
| 196 | 229 | |
| 197 | 230 | $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
| 198 | -if ($currenttime != '') $currenttime = round($currenttime/1000); |
|
| 231 | +if ($currenttime != '') { |
|
| 232 | + $currenttime = round($currenttime/1000); |
|
| 233 | +} |
|
| 199 | 234 | |
| 200 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
| 201 | -else $usenextlatlon = true; |
|
| 202 | -if ($usenextlatlon === false) $currenttime = ''; |
|
| 235 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
| 236 | + $usenextlatlon = false; |
|
| 237 | +} else { |
|
| 238 | + $usenextlatlon = true; |
|
| 239 | +} |
|
| 240 | +if ($usenextlatlon === false) { |
|
| 241 | + $currenttime = ''; |
|
| 242 | +} |
|
| 203 | 243 | $j = 0; |
| 204 | 244 | $prev_flightaware_id = ''; |
| 205 | 245 | $aircrafts_shadow = array(); |
| 206 | 246 | $output = '{'; |
| 207 | 247 | $output .= '"type": "FeatureCollection",'; |
| 208 | - if ($min) $output .= '"minimal": "true",'; |
|
| 209 | - else $output .= '"minimal": "false",'; |
|
| 248 | + if ($min) { |
|
| 249 | + $output .= '"minimal": "true",'; |
|
| 250 | + } else { |
|
| 251 | + $output .= '"minimal": "false",'; |
|
| 252 | + } |
|
| 210 | 253 | //$output .= '"fc": "'.$flightcnt.'",'; |
| 211 | 254 | $output .= '"sqt": "'.$sqltime.'",'; |
| 212 | 255 | |
@@ -251,18 +294,29 @@ discard block |
||
| 251 | 294 | } |
| 252 | 295 | $output .= '"properties": {'; |
| 253 | 296 | if (isset($spotter_item['flightaware_id'])) { |
| 254 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
| 255 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
| 297 | + if ($compress) { |
|
| 298 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
| 299 | + } else { |
|
| 300 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
| 301 | + } |
|
| 256 | 302 | } elseif (isset($spotter_item['famtrackid'])) { |
| 257 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
| 258 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
| 303 | + if ($compress) { |
|
| 304 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
| 305 | + } else { |
|
| 306 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
| 307 | + } |
|
| 259 | 308 | } elseif (isset($spotter_item['fammarine_id'])) { |
| 260 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
| 261 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
| 309 | + if ($compress) { |
|
| 310 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
| 311 | + } else { |
|
| 312 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
| 313 | + } |
|
| 262 | 314 | } |
| 263 | 315 | $output .= '"fc": "'.$flightcnt.'",'; |
| 264 | 316 | $output .= '"sqt": "'.$sqltime.'",'; |
| 265 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 317 | + if (isset($begindate)) { |
|
| 318 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 319 | + } |
|
| 266 | 320 | |
| 267 | 321 | /* |
| 268 | 322 | if ($min) $output .= '"minimal": "true",'; |
@@ -270,14 +324,22 @@ discard block |
||
| 270 | 324 | */ |
| 271 | 325 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
| 272 | 326 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
| 273 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 274 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 327 | + if ($compress) { |
|
| 328 | + $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 329 | + } else { |
|
| 330 | + $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 331 | + } |
|
| 275 | 332 | //" |
| 276 | 333 | } else { |
| 277 | - if ($compress) $output .= '"c": "NA",'; |
|
| 278 | - else $output .= '"callsign": "NA",'; |
|
| 334 | + if ($compress) { |
|
| 335 | + $output .= '"c": "NA",'; |
|
| 336 | + } else { |
|
| 337 | + $output .= '"callsign": "NA",'; |
|
| 338 | + } |
|
| 339 | + } |
|
| 340 | + if (isset($spotter_item['registration'])) { |
|
| 341 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 279 | 342 | } |
| 280 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 281 | 343 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
| 282 | 344 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
| 283 | 345 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -290,16 +352,23 @@ discard block |
||
| 290 | 352 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
| 291 | 353 | } |
| 292 | 354 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) { |
| 293 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
| 294 | - else { |
|
| 355 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
| 356 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 357 | + } else { |
|
| 295 | 358 | $aircraft_icao = $spotter_item['aircraft_icao']; |
| 296 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
| 297 | - else { |
|
| 359 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
| 360 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
| 361 | + } else { |
|
| 298 | 362 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
| 299 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 300 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 301 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 302 | - else $spotter_item['aircraft_shadow'] = ''; |
|
| 363 | + if (count($aircraft_info) > 0) { |
|
| 364 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 365 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
| 366 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 367 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
| 368 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 369 | + } else { |
|
| 370 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 371 | + } |
|
| 303 | 372 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
| 304 | 373 | } |
| 305 | 374 | } |
@@ -307,73 +376,139 @@ discard block |
||
| 307 | 376 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
| 308 | 377 | if ($tracker) { |
| 309 | 378 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
| 310 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
| 311 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 379 | + if ($compress) { |
|
| 380 | + $output .= '"as": "ambulance.png",'; |
|
| 381 | + } else { |
|
| 382 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 383 | + } |
|
| 312 | 384 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
| 313 | - if ($compress) $output .= '"as": "police.png",'; |
|
| 314 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
| 385 | + if ($compress) { |
|
| 386 | + $output .= '"as": "police.png",'; |
|
| 387 | + } else { |
|
| 388 | + $output .= '"aircraft_shadow": "police.png",'; |
|
| 389 | + } |
|
| 315 | 390 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
| 316 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 317 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 391 | + if ($compress) { |
|
| 392 | + $output .= '"as": "ship.png",'; |
|
| 393 | + } else { |
|
| 394 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 395 | + } |
|
| 318 | 396 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
| 319 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 320 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 397 | + if ($compress) { |
|
| 398 | + $output .= '"as": "ship.png",'; |
|
| 399 | + } else { |
|
| 400 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 401 | + } |
|
| 321 | 402 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
| 322 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 323 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 403 | + if ($compress) { |
|
| 404 | + $output .= '"as": "ship.png",'; |
|
| 405 | + } else { |
|
| 406 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 407 | + } |
|
| 324 | 408 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
| 325 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 326 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 409 | + if ($compress) { |
|
| 410 | + $output .= '"as": "truck.png",'; |
|
| 411 | + } else { |
|
| 412 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 413 | + } |
|
| 327 | 414 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
| 328 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 329 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 415 | + if ($compress) { |
|
| 416 | + $output .= '"as": "truck.png",'; |
|
| 417 | + } else { |
|
| 418 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 419 | + } |
|
| 330 | 420 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
| 331 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 332 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 421 | + if ($compress) { |
|
| 422 | + $output .= '"as": "aircraft.png",'; |
|
| 423 | + } else { |
|
| 424 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 425 | + } |
|
| 333 | 426 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
| 334 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 335 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 427 | + if ($compress) { |
|
| 428 | + $output .= '"as": "aircraft.png",'; |
|
| 429 | + } else { |
|
| 430 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 431 | + } |
|
| 336 | 432 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
| 337 | - if ($compress) $output .= '"as": "helico.png",'; |
|
| 338 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
| 433 | + if ($compress) { |
|
| 434 | + $output .= '"as": "helico.png",'; |
|
| 435 | + } else { |
|
| 436 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
| 437 | + } |
|
| 339 | 438 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
| 340 | - if ($compress) $output .= '"as": "rail.png",'; |
|
| 341 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
| 439 | + if ($compress) { |
|
| 440 | + $output .= '"as": "rail.png",'; |
|
| 441 | + } else { |
|
| 442 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
| 443 | + } |
|
| 342 | 444 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
| 343 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
| 344 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 445 | + if ($compress) { |
|
| 446 | + $output .= '"as": "firetruck.png",'; |
|
| 447 | + } else { |
|
| 448 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 449 | + } |
|
| 345 | 450 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
| 346 | - if ($compress) $output .= '"as": "bus.png",'; |
|
| 347 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
| 451 | + if ($compress) { |
|
| 452 | + $output .= '"as": "bus.png",'; |
|
| 453 | + } else { |
|
| 454 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
| 455 | + } |
|
| 348 | 456 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
| 349 | - if ($compress) $output .= '"as": "phone.png",'; |
|
| 350 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
| 457 | + if ($compress) { |
|
| 458 | + $output .= '"as": "phone.png",'; |
|
| 459 | + } else { |
|
| 460 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
| 461 | + } |
|
| 351 | 462 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
| 352 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
| 353 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 463 | + if ($compress) { |
|
| 464 | + $output .= '"as": "jogger.png",'; |
|
| 465 | + } else { |
|
| 466 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 467 | + } |
|
| 354 | 468 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
| 355 | - if ($compress) $output .= '"as": "bike.png",'; |
|
| 356 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
| 469 | + if ($compress) { |
|
| 470 | + $output .= '"as": "bike.png",'; |
|
| 471 | + } else { |
|
| 472 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
| 473 | + } |
|
| 357 | 474 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
| 358 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
| 359 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 475 | + if ($compress) { |
|
| 476 | + $output .= '"as": "motorcycle.png",'; |
|
| 477 | + } else { |
|
| 478 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 479 | + } |
|
| 360 | 480 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
| 361 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
| 362 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 481 | + if ($compress) { |
|
| 482 | + $output .= '"as": "balloon.png",'; |
|
| 483 | + } else { |
|
| 484 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 485 | + } |
|
| 363 | 486 | } else { |
| 364 | - if ($compress) $output .= '"as": "car.png",'; |
|
| 365 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
| 487 | + if ($compress) { |
|
| 488 | + $output .= '"as": "car.png",'; |
|
| 489 | + } else { |
|
| 490 | + $output .= '"aircraft_shadow": "car.png",'; |
|
| 491 | + } |
|
| 366 | 492 | } |
| 367 | 493 | } elseif ($marine) { |
| 368 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 369 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 494 | + if ($compress) { |
|
| 495 | + $output .= '"as": "ship.png",'; |
|
| 496 | + } else { |
|
| 497 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 498 | + } |
|
| 370 | 499 | } else { |
| 371 | - if ($compress) $output .= '"as": "default.png",'; |
|
| 372 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
| 500 | + if ($compress) { |
|
| 501 | + $output .= '"as": "default.png",'; |
|
| 502 | + } else { |
|
| 503 | + $output .= '"aircraft_shadow": "default.png",'; |
|
| 504 | + } |
|
| 373 | 505 | } |
| 374 | 506 | } else { |
| 375 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 376 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 507 | + if ($compress) { |
|
| 508 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 509 | + } else { |
|
| 510 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 511 | + } |
|
| 377 | 512 | } |
| 378 | 513 | if (isset($spotter_item['airline_name'])) { |
| 379 | 514 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -381,8 +516,11 @@ discard block |
||
| 381 | 516 | $output .= '"airline_name": "NA",'; |
| 382 | 517 | } |
| 383 | 518 | if (isset($spotter_item['departure_airport'])) { |
| 384 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 385 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 519 | + if ($compress) { |
|
| 520 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 521 | + } else { |
|
| 522 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 523 | + } |
|
| 386 | 524 | } |
| 387 | 525 | if (isset($spotter_item['departure_airport_city'])) { |
| 388 | 526 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -394,8 +532,11 @@ discard block |
||
| 394 | 532 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
| 395 | 533 | } |
| 396 | 534 | if (isset($spotter_item['arrival_airport'])) { |
| 397 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 398 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 535 | + if ($compress) { |
|
| 536 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 537 | + } else { |
|
| 538 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 539 | + } |
|
| 399 | 540 | } |
| 400 | 541 | if (isset($spotter_item['arrival_airport_city'])) { |
| 401 | 542 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -414,11 +555,17 @@ discard block |
||
| 414 | 555 | } |
| 415 | 556 | |
| 416 | 557 | if (isset($spotter_item['real_altitude'])) { |
| 417 | - if ($compress) $output .= '"a": "'.($spotter_item['real_altitude']/100).'",'; |
|
| 418 | - else $output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",'; |
|
| 558 | + if ($compress) { |
|
| 559 | + $output .= '"a": "'.($spotter_item['real_altitude']/100).'",'; |
|
| 560 | + } else { |
|
| 561 | + $output .= '"altitude": "'.($spotter_item['real_altitude']/100).'",'; |
|
| 562 | + } |
|
| 419 | 563 | } elseif (isset($spotter_item['altitude'])) { |
| 420 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 421 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 564 | + if ($compress) { |
|
| 565 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 566 | + } else { |
|
| 567 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 568 | + } |
|
| 422 | 569 | } |
| 423 | 570 | |
| 424 | 571 | $heading = $spotter_item['heading']; |
@@ -442,19 +589,24 @@ discard block |
||
| 442 | 589 | } |
| 443 | 590 | } |
| 444 | 591 | |
| 445 | - if ($compress)$output .= '"h": "'.$heading.'",'; |
|
| 446 | - else $output .= '"heading": "'.$heading.'",'; |
|
| 592 | + if ($compress) { |
|
| 593 | + $output .= '"h": "'.$heading.'",'; |
|
| 594 | + } else { |
|
| 595 | + $output .= '"heading": "'.$heading.'",'; |
|
| 596 | + } |
|
| 447 | 597 | if ($currenttime != '') { |
| 448 | 598 | if (strtotime($spotter_item['date']) < $currenttime) { |
| 449 | 599 | if (isset($archivespeed)) { |
| 450 | 600 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
| 451 | 601 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 452 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 453 | - else { |
|
| 602 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 603 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 604 | + } else { |
|
| 454 | 605 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
| 455 | 606 | $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 { |
|
| 607 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 608 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 609 | + } else { |
|
| 458 | 610 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
| 459 | 611 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 460 | 612 | } |
@@ -462,12 +614,14 @@ discard block |
||
| 462 | 614 | } elseif ($usenextlatlon) { |
| 463 | 615 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
| 464 | 616 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 465 | - if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 466 | - else { |
|
| 617 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 618 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 619 | + } else { |
|
| 467 | 620 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
| 468 | 621 | $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 { |
|
| 622 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 623 | + $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
|
| 624 | + } else { |
|
| 471 | 625 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
| 472 | 626 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 473 | 627 | } |
@@ -506,7 +660,9 @@ discard block |
||
| 506 | 660 | } |
| 507 | 661 | } |
| 508 | 662 | |
| 509 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
| 663 | + if (!$min) { |
|
| 664 | + $output .= '"image": "'.$image.'",'; |
|
| 665 | + } |
|
| 510 | 666 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
| 511 | 667 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
| 512 | 668 | } |
@@ -514,8 +670,11 @@ discard block |
||
| 514 | 670 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
| 515 | 671 | } |
| 516 | 672 | if (isset($spotter_item['squawk'])) { |
| 517 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 518 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 673 | + if ($compress) { |
|
| 674 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 675 | + } else { |
|
| 676 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 677 | + } |
|
| 519 | 678 | } |
| 520 | 679 | if (isset($spotter_item['squawk_usage'])) { |
| 521 | 680 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -534,14 +693,23 @@ discard block |
||
| 534 | 693 | } |
| 535 | 694 | // type when not aircraft ? |
| 536 | 695 | if (isset($spotter_item['type'])) { |
| 537 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
| 538 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
| 696 | + if ($compress) { |
|
| 697 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
| 698 | + } else { |
|
| 699 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
| 700 | + } |
|
| 539 | 701 | } elseif ($marine) { |
| 540 | - if ($compress) $output .= '"t": "ship"'; |
|
| 541 | - else $output .= '"type": "ship"'; |
|
| 702 | + if ($compress) { |
|
| 703 | + $output .= '"t": "ship"'; |
|
| 704 | + } else { |
|
| 705 | + $output .= '"type": "ship"'; |
|
| 706 | + } |
|
| 542 | 707 | } else { |
| 543 | - if ($compress) $output .= '"t": "aircraft"'; |
|
| 544 | - else $output .= '"type": "aircraft"'; |
|
| 708 | + if ($compress) { |
|
| 709 | + $output .= '"t": "aircraft"'; |
|
| 710 | + } else { |
|
| 711 | + $output .= '"type": "aircraft"'; |
|
| 712 | + } |
|
| 545 | 713 | } |
| 546 | 714 | $output .= '},'; |
| 547 | 715 | $output .= '"geometry": {'; |
@@ -549,15 +717,19 @@ discard block |
||
| 549 | 717 | $output .= '"coordinates": ['; |
| 550 | 718 | if ($currenttime != '') { |
| 551 | 719 | if (strtotime($spotter_item['date']) < $currenttime) { |
| 552 | - if (!isset($archivespeed)) $archivespeed = 1; |
|
| 720 | + if (!isset($archivespeed)) { |
|
| 721 | + $archivespeed = 1; |
|
| 722 | + } |
|
| 553 | 723 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
| 554 | 724 | $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 555 | - if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
| 556 | - else { |
|
| 725 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 726 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
| 727 | + } else { |
|
| 557 | 728 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
| 558 | 729 | $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 { |
|
| 730 | + if (!isset($idistance) || $fdistance < $idistance) { |
|
| 731 | + $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
|
| 732 | + } else { |
|
| 561 | 733 | $output .= $spotter_item['longitude'].', '; |
| 562 | 734 | $output .= $spotter_item['latitude']; |
| 563 | 735 | } |
@@ -635,7 +807,9 @@ discard block |
||
| 635 | 807 | } |
| 636 | 808 | */ |
| 637 | 809 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
| 638 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
| 810 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
| 811 | + $history = $_COOKIE['history']; |
|
| 812 | + } |
|
| 639 | 813 | |
| 640 | 814 | if ( |
| 641 | 815 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -705,8 +879,11 @@ discard block |
||
| 705 | 879 | $output_history .= ']}},'; |
| 706 | 880 | $output .= $output_history; |
| 707 | 881 | } |
| 708 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 709 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 882 | + if ($compress) { |
|
| 883 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 884 | + } else { |
|
| 885 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 886 | + } |
|
| 710 | 887 | } |
| 711 | 888 | $output_history .= '['; |
| 712 | 889 | $output_history .= $spotter_history['longitude'].', '; |
@@ -727,10 +904,15 @@ discard block |
||
| 727 | 904 | if ($d == false) { |
| 728 | 905 | if ($compress) { |
| 729 | 906 | $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",'; |
| 730 | - 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>",'; |
|
| 731 | - 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>",'; |
|
| 907 | + if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') { |
|
| 908 | + $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>",'; |
|
| 909 | + } elseif (isset($spotter_history_array[0]['mapmatching_engine'])) { |
|
| 910 | + $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",'; |
|
| 911 | + } |
|
| 732 | 912 | $output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
| 733 | - } else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 913 | + } else { |
|
| 914 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 915 | + } |
|
| 734 | 916 | $d = true; |
| 735 | 917 | } |
| 736 | 918 | $output_history .= '['; |
@@ -753,7 +935,9 @@ discard block |
||
| 753 | 935 | $output_historyd = '['; |
| 754 | 936 | $output_historyd .= $spotter_item['longitude'].', '; |
| 755 | 937 | $output_historyd .= $spotter_item['latitude']; |
| 756 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 938 | + if (isset($spotter_history['altitude'])) { |
|
| 939 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 940 | + } |
|
| 757 | 941 | $output_historyd .= '],'; |
| 758 | 942 | //$output_history = $output_historyd.$output_history; |
| 759 | 943 | $output_history = $output_history.$output_historyd; |
@@ -780,8 +964,11 @@ discard block |
||
| 780 | 964 | && $spotter_item['arrival_airport'] != 'NA' |
| 781 | 965 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
| 782 | 966 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
| 783 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 784 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 967 | + if ($compress) { |
|
| 968 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 969 | + } else { |
|
| 970 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 971 | + } |
|
| 785 | 972 | if (isset($spotter_item['departure_airport_latitude'])) { |
| 786 | 973 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
| 787 | 974 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -814,8 +1001,11 @@ discard block |
||
| 814 | 1001 | || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) |
| 815 | 1002 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
| 816 | 1003 | $havedata = false; |
| 817 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 818 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 1004 | + if ($compress) { |
|
| 1005 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 1006 | + } else { |
|
| 1007 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 1008 | + } |
|
| 819 | 1009 | |
| 820 | 1010 | //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
| 821 | 1011 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -840,7 +1030,9 @@ discard block |
||
| 840 | 1030 | $output_dest = substr($output_dest, 0, -1); |
| 841 | 1031 | } |
| 842 | 1032 | $output_dest .= ']}},'; |
| 843 | - if ($havedata) $output .= $output_dest; |
|
| 1033 | + if ($havedata) { |
|
| 1034 | + $output .= $output_dest; |
|
| 1035 | + } |
|
| 844 | 1036 | unset($output_dest); |
| 845 | 1037 | } |
| 846 | 1038 | } |
@@ -848,7 +1040,9 @@ discard block |
||
| 848 | 1040 | $output .= ']'; |
| 849 | 1041 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 850 | 1042 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
| 851 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 1043 | + if (isset($begindate)) { |
|
| 1044 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 1045 | + } |
|
| 852 | 1046 | $output .= '"fc": "'.$j.'"'; |
| 853 | 1047 | } else { |
| 854 | 1048 | $output .= '"features": '; |
@@ -17,62 +17,62 @@ discard block |
||
| 17 | 17 | * @param Array $filter the filter |
| 18 | 18 | * @return Array the SQL part |
| 19 | 19 | */ |
| 20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 22 | 22 | $filters = array(); |
| 23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
| 26 | 26 | } else { |
| 27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | if (isset($filter[0]['source'])) { |
| 31 | - $filters = array_merge($filters,$filter); |
|
| 31 | + $filters = array_merge($filters, $filter); |
|
| 32 | 32 | } |
| 33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 34 | 34 | $filter_query_join = ''; |
| 35 | 35 | $filter_query_where = ''; |
| 36 | - foreach($filters as $flt) { |
|
| 36 | + foreach ($filters as $flt) { |
|
| 37 | 37 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
| 38 | 38 | if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') { |
| 39 | 39 | if (isset($flt['source'])) { |
| 40 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 40 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 41 | 41 | } else { |
| 42 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 42 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
| 47 | 47 | if (isset($flt['source'])) { |
| 48 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 48 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 49 | 49 | } else { |
| 50 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 50 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 54 | 54 | if (isset($flt['source'])) { |
| 55 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 55 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 56 | 56 | } else { |
| 57 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 57 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
| 61 | 61 | if (isset($flt['source'])) { |
| 62 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 62 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 63 | 63 | } else { |
| 64 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 64 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
| 68 | 68 | if (isset($flt['source'])) { |
| 69 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
| 69 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 74 | 74 | if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') { |
| 75 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
| 75 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
| 83 | 83 | } |
| 84 | 84 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
| 85 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
| 85 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
| 86 | 86 | } |
| 87 | 87 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 88 | 88 | if (count($filter['source']) == 1) { |
| 89 | 89 | $filter_query_where .= " AND format_source = '".$filter['source'][0]."'"; |
| 90 | 90 | } else { |
| 91 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 91 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
@@ -121,15 +121,15 @@ discard block |
||
| 121 | 121 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
| 124 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
| 125 | 125 | } |
| 126 | 126 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 127 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 127 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 128 | 128 | } |
| 129 | 129 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 130 | 130 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 131 | 131 | if ($filter_query_where != '') { |
| 132 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 132 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 133 | 133 | } |
| 134 | 134 | $filter_query = $filter_query_join.$filter_query_where; |
| 135 | 135 | return $filter_query; |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | if ($limit != '') |
| 153 | 153 | { |
| 154 | 154 | $limit_array = explode(',', $limit); |
| 155 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 156 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 155 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 156 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 157 | 157 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 158 | 158 | { |
| 159 | 159 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } else { |
| 178 | 178 | $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= 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; |
| 179 | 179 | } |
| 180 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
| 180 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
| 181 | 181 | |
| 182 | 182 | return $spotter_array; |
| 183 | 183 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | { |
| 193 | 193 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 194 | 194 | date_default_timezone_set('UTC'); |
| 195 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 195 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 196 | 196 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 197 | 197 | if ($globalDBdriver == 'mysql') { |
| 198 | 198 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | try { |
| 216 | 216 | $sth = $this->db->prepare($query); |
| 217 | 217 | $sth->execute(); |
| 218 | - } catch(PDOException $e) { |
|
| 218 | + } catch (PDOException $e) { |
|
| 219 | 219 | echo $e->getMessage(); |
| 220 | 220 | die; |
| 221 | 221 | } |
@@ -229,20 +229,20 @@ discard block |
||
| 229 | 229 | * @return Array the spotter information |
| 230 | 230 | * |
| 231 | 231 | */ |
| 232 | - public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false, $id = '') |
|
| 232 | + public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = false, $id = '') |
|
| 233 | 233 | { |
| 234 | 234 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
| 235 | 235 | date_default_timezone_set('UTC'); |
| 236 | 236 | $usecoord = false; |
| 237 | 237 | if (is_array($coord) && !empty($coord)) { |
| 238 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 239 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 240 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 241 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 238 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 239 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 240 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 241 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 242 | 242 | $usecoord = true; |
| 243 | 243 | } |
| 244 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
| 245 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 244 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 245 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 246 | 246 | |
| 247 | 247 | if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
| 248 | 248 | if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' |
| 255 | 255 | ORDER BY spotter_archive.flightaware_id, spotter_archive.date"; |
| 256 | 256 | */ |
| 257 | - $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 |
|
| 257 | + $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 |
|
| 258 | 258 | 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 | 259 | if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
| 260 | 260 | if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id "; |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | ORDER BY flightaware_id, date"; |
| 269 | 269 | if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
| 270 | 270 | } else { |
| 271 | - $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 |
|
| 271 | + $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 |
|
| 272 | 272 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date "; |
| 273 | 273 | if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
| 274 | 274 | if ($id != '') $query .= "OR spotter_live.flightaware_id = :id "; |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' |
| 285 | 285 | ORDER BY spotter_archive.flightaware_id, spotter_archive.date"; |
| 286 | 286 | */ |
| 287 | - $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 |
|
| 287 | + $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 |
|
| 288 | 288 | 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 | 289 | if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
| 290 | 290 | if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id "; |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | try { |
| 312 | 312 | $sth = $this->db->prepare($query); |
| 313 | 313 | $sth->execute($query_values); |
| 314 | - } catch(PDOException $e) { |
|
| 314 | + } catch (PDOException $e) { |
|
| 315 | 315 | echo $e->getMessage(); |
| 316 | 316 | die; |
| 317 | 317 | } |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | public function getLiveSpotterCount($filter = array()) |
| 329 | 329 | { |
| 330 | 330 | global $globalDBdriver, $globalLiveInterval; |
| 331 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 331 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 332 | 332 | |
| 333 | 333 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 334 | 334 | if ($globalDBdriver == 'mysql') { |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | try { |
| 342 | 342 | $sth = $this->db->prepare($query); |
| 343 | 343 | $sth->execute(); |
| 344 | - } catch(PDOException $e) { |
|
| 344 | + } catch (PDOException $e) { |
|
| 345 | 345 | echo $e->getMessage(); |
| 346 | 346 | die; |
| 347 | 347 | } |
@@ -364,10 +364,10 @@ discard block |
||
| 364 | 364 | $filter_query = $this->getFilter($filter); |
| 365 | 365 | |
| 366 | 366 | if (is_array($coord)) { |
| 367 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 368 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 369 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 370 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 367 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 368 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 369 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 370 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 371 | 371 | } else return array(); |
| 372 | 372 | if ($globalDBdriver == 'mysql') { |
| 373 | 373 | $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; |
@@ -390,23 +390,23 @@ discard block |
||
| 390 | 390 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 391 | 391 | $Spotter = new Spotter($this->db); |
| 392 | 392 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 393 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 393 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 394 | 394 | |
| 395 | 395 | if (is_array($coord)) { |
| 396 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 397 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 398 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 399 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 396 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 397 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 398 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 399 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 400 | 400 | } else return array(); |
| 401 | 401 | if ($globalDBdriver == 'mysql') { |
| 402 | 402 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 403 | - $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 |
|
| 403 | + $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 |
|
| 404 | 404 | FROM spotter_live |
| 405 | 405 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
| 406 | 406 | AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
| 407 | 407 | AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC'; |
| 408 | 408 | } else { |
| 409 | - $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 |
|
| 409 | + $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 |
|
| 410 | 410 | FROM spotter_live |
| 411 | 411 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
| 412 | 412 | FROM spotter_live l |
@@ -418,14 +418,14 @@ discard block |
||
| 418 | 418 | } |
| 419 | 419 | } else { |
| 420 | 420 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 421 | - $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 |
|
| 421 | + $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 |
|
| 422 | 422 | FROM spotter_live |
| 423 | 423 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
| 424 | 424 | AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
| 425 | 425 | AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
| 426 | 426 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC"; |
| 427 | 427 | } else { |
| 428 | - $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 |
|
| 428 | + $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 |
|
| 429 | 429 | FROM spotter_live |
| 430 | 430 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
| 431 | 431 | FROM spotter_live l |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | try { |
| 441 | 441 | $sth = $this->db->prepare($query); |
| 442 | 442 | $sth->execute(); |
| 443 | - } catch(PDOException $e) { |
|
| 443 | + } catch (PDOException $e) { |
|
| 444 | 444 | echo $e->getMessage(); |
| 445 | 445 | die; |
| 446 | 446 | } |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | if ($interval == '1m') |
| 490 | 490 | { |
| 491 | 491 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 492 | - } else if ($interval == '15m'){ |
|
| 492 | + } else if ($interval == '15m') { |
|
| 493 | 493 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
| 494 | 494 | } |
| 495 | 495 | } |
@@ -497,14 +497,14 @@ discard block |
||
| 497 | 497 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 500 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 501 | 501 | WHERE spotter_live.latitude <> '' |
| 502 | 502 | AND spotter_live.longitude <> '' |
| 503 | 503 | ".$additional_query." |
| 504 | 504 | HAVING distance < :radius |
| 505 | 505 | ORDER BY distance"; |
| 506 | 506 | |
| 507 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 507 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
| 508 | 508 | |
| 509 | 509 | return $spotter_array; |
| 510 | 510 | } |
@@ -522,9 +522,9 @@ discard block |
||
| 522 | 522 | date_default_timezone_set('UTC'); |
| 523 | 523 | |
| 524 | 524 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 525 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 525 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 526 | 526 | |
| 527 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
| 527 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
| 528 | 528 | |
| 529 | 529 | return $spotter_array; |
| 530 | 530 | } |
@@ -535,16 +535,16 @@ discard block |
||
| 535 | 535 | * @return Array the spotter information |
| 536 | 536 | * |
| 537 | 537 | */ |
| 538 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
| 538 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
| 539 | 539 | { |
| 540 | 540 | $Spotter = new Spotter($this->db); |
| 541 | 541 | date_default_timezone_set('UTC'); |
| 542 | 542 | |
| 543 | 543 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 544 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 544 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 545 | 545 | |
| 546 | - $date = date('c',$date); |
|
| 547 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 546 | + $date = date('c', $date); |
|
| 547 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 548 | 548 | |
| 549 | 549 | return $spotter_array; |
| 550 | 550 | } |
@@ -560,8 +560,8 @@ discard block |
||
| 560 | 560 | $Spotter = new Spotter($this->db); |
| 561 | 561 | date_default_timezone_set('UTC'); |
| 562 | 562 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 563 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 564 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
| 563 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 564 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
| 565 | 565 | return $spotter_array; |
| 566 | 566 | } |
| 567 | 567 | |
@@ -571,15 +571,15 @@ discard block |
||
| 571 | 571 | * @return Array the spotter information |
| 572 | 572 | * |
| 573 | 573 | */ |
| 574 | - public function getDateLiveSpotterDataById($id,$date) |
|
| 574 | + public function getDateLiveSpotterDataById($id, $date) |
|
| 575 | 575 | { |
| 576 | 576 | $Spotter = new Spotter($this->db); |
| 577 | 577 | date_default_timezone_set('UTC'); |
| 578 | 578 | |
| 579 | 579 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 580 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 581 | - $date = date('c',$date); |
|
| 582 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
| 580 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 581 | + $date = date('c', $date); |
|
| 582 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
| 583 | 583 | return $spotter_array; |
| 584 | 584 | } |
| 585 | 585 | |
@@ -595,13 +595,13 @@ discard block |
||
| 595 | 595 | date_default_timezone_set('UTC'); |
| 596 | 596 | |
| 597 | 597 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 598 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 598 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 599 | 599 | |
| 600 | 600 | try { |
| 601 | 601 | |
| 602 | 602 | $sth = $this->db->prepare($query); |
| 603 | 603 | $sth->execute(array(':ident' => $ident)); |
| 604 | - } catch(PDOException $e) { |
|
| 604 | + } catch (PDOException $e) { |
|
| 605 | 605 | echo $e->getMessage(); |
| 606 | 606 | die; |
| 607 | 607 | } |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | * @return Array the spotter information |
| 617 | 617 | * |
| 618 | 618 | */ |
| 619 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
| 619 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
| 620 | 620 | { |
| 621 | 621 | global $globalDBdriver, $globalLiveInterval; |
| 622 | 622 | date_default_timezone_set('UTC'); |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | try { |
| 636 | 636 | $sth = $this->db->prepare($query); |
| 637 | 637 | $sth->execute(array(':id' => $id)); |
| 638 | - } catch(PDOException $e) { |
|
| 638 | + } catch (PDOException $e) { |
|
| 639 | 639 | echo $e->getMessage(); |
| 640 | 640 | die; |
| 641 | 641 | } |
@@ -653,12 +653,12 @@ discard block |
||
| 653 | 653 | { |
| 654 | 654 | date_default_timezone_set('UTC'); |
| 655 | 655 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 656 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 656 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 657 | 657 | try { |
| 658 | 658 | |
| 659 | 659 | $sth = $this->db->prepare($query); |
| 660 | 660 | $sth->execute(array(':ident' => $ident)); |
| 661 | - } catch(PDOException $e) { |
|
| 661 | + } catch (PDOException $e) { |
|
| 662 | 662 | echo $e->getMessage(); |
| 663 | 663 | die; |
| 664 | 664 | } |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | |
| 689 | 689 | $sth = $this->db->prepare($query); |
| 690 | 690 | $sth->execute(); |
| 691 | - } catch(PDOException $e) { |
|
| 691 | + } catch (PDOException $e) { |
|
| 692 | 692 | return "error"; |
| 693 | 693 | } |
| 694 | 694 | |
@@ -711,14 +711,14 @@ discard block |
||
| 711 | 711 | |
| 712 | 712 | $sth = $this->db->prepare($query); |
| 713 | 713 | $sth->execute(); |
| 714 | - } catch(PDOException $e) { |
|
| 714 | + } catch (PDOException $e) { |
|
| 715 | 715 | return "error"; |
| 716 | 716 | } |
| 717 | 717 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
| 718 | 718 | $i = 0; |
| 719 | - $j =0; |
|
| 719 | + $j = 0; |
|
| 720 | 720 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 721 | - foreach($all as $row) |
|
| 721 | + foreach ($all as $row) |
|
| 722 | 722 | { |
| 723 | 723 | $i++; |
| 724 | 724 | $j++; |
@@ -726,9 +726,9 @@ discard block |
||
| 726 | 726 | if ($globalDebug) echo "."; |
| 727 | 727 | try { |
| 728 | 728 | |
| 729 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 729 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 730 | 730 | $sth->execute(); |
| 731 | - } catch(PDOException $e) { |
|
| 731 | + } catch (PDOException $e) { |
|
| 732 | 732 | return "error"; |
| 733 | 733 | } |
| 734 | 734 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -739,9 +739,9 @@ discard block |
||
| 739 | 739 | if ($i > 0) { |
| 740 | 740 | try { |
| 741 | 741 | |
| 742 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 742 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 743 | 743 | $sth->execute(); |
| 744 | - } catch(PDOException $e) { |
|
| 744 | + } catch (PDOException $e) { |
|
| 745 | 745 | return "error"; |
| 746 | 746 | } |
| 747 | 747 | } |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | |
| 755 | 755 | $sth = $this->db->prepare($query); |
| 756 | 756 | $sth->execute(); |
| 757 | - } catch(PDOException $e) { |
|
| 757 | + } catch (PDOException $e) { |
|
| 758 | 758 | return "error"; |
| 759 | 759 | } |
| 760 | 760 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -802,13 +802,13 @@ discard block |
||
| 802 | 802 | public function deleteLiveSpotterDataByIdent($ident) |
| 803 | 803 | { |
| 804 | 804 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 805 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 805 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 806 | 806 | |
| 807 | 807 | try { |
| 808 | 808 | |
| 809 | 809 | $sth = $this->db->prepare($query); |
| 810 | 810 | $sth->execute(array(':ident' => $ident)); |
| 811 | - } catch(PDOException $e) { |
|
| 811 | + } catch (PDOException $e) { |
|
| 812 | 812 | return "error"; |
| 813 | 813 | } |
| 814 | 814 | |
@@ -824,13 +824,13 @@ discard block |
||
| 824 | 824 | public function deleteLiveSpotterDataById($id) |
| 825 | 825 | { |
| 826 | 826 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 827 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 827 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 828 | 828 | |
| 829 | 829 | try { |
| 830 | 830 | |
| 831 | 831 | $sth = $this->db->prepare($query); |
| 832 | 832 | $sth->execute(array(':id' => $id)); |
| 833 | - } catch(PDOException $e) { |
|
| 833 | + } catch (PDOException $e) { |
|
| 834 | 834 | return "error"; |
| 835 | 835 | } |
| 836 | 836 | |
@@ -848,13 +848,13 @@ discard block |
||
| 848 | 848 | { |
| 849 | 849 | global $globalDBdriver, $globalTimezone; |
| 850 | 850 | if ($globalDBdriver == 'mysql') { |
| 851 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 851 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 852 | 852 | WHERE spotter_live.ident = :ident |
| 853 | 853 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 854 | 854 | AND spotter_live.date < UTC_TIMESTAMP()'; |
| 855 | 855 | $query_data = array(':ident' => $ident); |
| 856 | 856 | } else { |
| 857 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 857 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 858 | 858 | WHERE spotter_live.ident = :ident |
| 859 | 859 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 860 | 860 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -863,8 +863,8 @@ discard block |
||
| 863 | 863 | |
| 864 | 864 | $sth = $this->db->prepare($query); |
| 865 | 865 | $sth->execute($query_data); |
| 866 | - $ident_result=''; |
|
| 867 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 866 | + $ident_result = ''; |
|
| 867 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 868 | 868 | { |
| 869 | 869 | $ident_result = $row['ident']; |
| 870 | 870 | } |
@@ -881,13 +881,13 @@ discard block |
||
| 881 | 881 | { |
| 882 | 882 | global $globalDBdriver, $globalTimezone; |
| 883 | 883 | if ($globalDBdriver == 'mysql') { |
| 884 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 884 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 885 | 885 | WHERE spotter_live.ident = :ident |
| 886 | 886 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; |
| 887 | 887 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 888 | 888 | $query_data = array(':ident' => $ident); |
| 889 | 889 | } else { |
| 890 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 890 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 891 | 891 | WHERE spotter_live.ident = :ident |
| 892 | 892 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '20 MINUTES'"; |
| 893 | 893 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -896,8 +896,8 @@ discard block |
||
| 896 | 896 | |
| 897 | 897 | $sth = $this->db->prepare($query); |
| 898 | 898 | $sth->execute($query_data); |
| 899 | - $ident_result=''; |
|
| 900 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 899 | + $ident_result = ''; |
|
| 900 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 901 | 901 | { |
| 902 | 902 | $ident_result = $row['flightaware_id']; |
| 903 | 903 | } |
@@ -914,13 +914,13 @@ discard block |
||
| 914 | 914 | { |
| 915 | 915 | global $globalDBdriver, $globalTimezone; |
| 916 | 916 | if ($globalDBdriver == 'mysql') { |
| 917 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 917 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 918 | 918 | WHERE spotter_live.flightaware_id = :id |
| 919 | 919 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 920 | 920 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 921 | 921 | $query_data = array(':id' => $id); |
| 922 | 922 | } else { |
| 923 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 923 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 924 | 924 | WHERE spotter_live.flightaware_id = :id |
| 925 | 925 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 926 | 926 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -929,8 +929,8 @@ discard block |
||
| 929 | 929 | |
| 930 | 930 | $sth = $this->db->prepare($query); |
| 931 | 931 | $sth->execute($query_data); |
| 932 | - $ident_result=''; |
|
| 933 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 932 | + $ident_result = ''; |
|
| 933 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 934 | 934 | { |
| 935 | 935 | $ident_result = $row['flightaware_id']; |
| 936 | 936 | } |
@@ -947,13 +947,13 @@ discard block |
||
| 947 | 947 | { |
| 948 | 948 | global $globalDBdriver, $globalTimezone; |
| 949 | 949 | if ($globalDBdriver == 'mysql') { |
| 950 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 950 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 951 | 951 | WHERE spotter_live.ModeS = :modes |
| 952 | 952 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; |
| 953 | 953 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 954 | 954 | $query_data = array(':modes' => $modes); |
| 955 | 955 | } else { |
| 956 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 956 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 957 | 957 | WHERE spotter_live.ModeS = :modes |
| 958 | 958 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 MINUTE'"; |
| 959 | 959 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -962,8 +962,8 @@ discard block |
||
| 962 | 962 | |
| 963 | 963 | $sth = $this->db->prepare($query); |
| 964 | 964 | $sth->execute($query_data); |
| 965 | - $ident_result=''; |
|
| 966 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 965 | + $ident_result = ''; |
|
| 966 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 967 | 967 | { |
| 968 | 968 | //$ident_result = $row['spotter_live_id']; |
| 969 | 969 | $ident_result = $row['flightaware_id']; |
@@ -988,8 +988,8 @@ discard block |
||
| 988 | 988 | return array(); |
| 989 | 989 | } else { |
| 990 | 990 | $q_array = explode(" ", $q); |
| 991 | - foreach ($q_array as $q_item){ |
|
| 992 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 991 | + foreach ($q_array as $q_item) { |
|
| 992 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 993 | 993 | $additional_query .= " AND ("; |
| 994 | 994 | $additional_query .= "(spotter_live.aircraft_icao like '%".$q_item."%') OR "; |
| 995 | 995 | $additional_query .= "(spotter_live.aircraft_name like '%".$q_item."%') OR "; |
@@ -1004,11 +1004,11 @@ discard block |
||
| 1004 | 1004 | } |
| 1005 | 1005 | } |
| 1006 | 1006 | if ($globalDBdriver == 'mysql') { |
| 1007 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1007 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1008 | 1008 | WHERE spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 1009 | 1009 | AND spotter_live.date < UTC_TIMESTAMP()"; |
| 1010 | 1010 | } else { |
| 1011 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1011 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1012 | 1012 | WHERE spotter_live.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 1013 | 1013 | AND spotter_live.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 1014 | 1014 | } |
@@ -1028,7 +1028,7 @@ discard block |
||
| 1028 | 1028 | * @return String success or false |
| 1029 | 1029 | * |
| 1030 | 1030 | */ |
| 1031 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
| 1031 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
| 1032 | 1032 | { |
| 1033 | 1033 | global $globalURL, $globalArchive, $globalDebug; |
| 1034 | 1034 | $Common = new Common(); |
@@ -1128,27 +1128,27 @@ discard block |
||
| 1128 | 1128 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
| 1129 | 1129 | |
| 1130 | 1130 | |
| 1131 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 1132 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 1133 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 1134 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1135 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1136 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1137 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1138 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
| 1139 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1140 | - $altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1141 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 1142 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1143 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
| 1144 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
| 1145 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
| 1146 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 1147 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 1148 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 1149 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
| 1150 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
| 1151 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
| 1131 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 1132 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 1133 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 1134 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1135 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1136 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1137 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1138 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
| 1139 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1140 | + $altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1141 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 1142 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1143 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
| 1144 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
| 1145 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
| 1146 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 1147 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 1148 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 1149 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
| 1150 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
| 1151 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
| 1152 | 1152 | |
| 1153 | 1153 | $airline_name = ''; |
| 1154 | 1154 | $airline_icao = ''; |
@@ -1170,10 +1170,10 @@ discard block |
||
| 1170 | 1170 | $arrival_airport_country = ''; |
| 1171 | 1171 | |
| 1172 | 1172 | |
| 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; |
|
| 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; |
|
| 1177 | 1177 | |
| 1178 | 1178 | $query = ''; |
| 1179 | 1179 | if ($globalArchive) { |
@@ -1184,19 +1184,19 @@ discard block |
||
| 1184 | 1184 | $query .= 'INSERT INTO spotter_live (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, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) |
| 1185 | 1185 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)'; |
| 1186 | 1186 | |
| 1187 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real); |
|
| 1187 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real); |
|
| 1188 | 1188 | try { |
| 1189 | 1189 | |
| 1190 | 1190 | $sth = $this->db->prepare($query); |
| 1191 | 1191 | $sth->execute($query_values); |
| 1192 | 1192 | $sth->closeCursor(); |
| 1193 | - } catch(PDOException $e) { |
|
| 1193 | + } catch (PDOException $e) { |
|
| 1194 | 1194 | return "error : ".$e->getMessage(); |
| 1195 | 1195 | } |
| 1196 | 1196 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 1197 | 1197 | if ($globalDebug) echo '(Add to SBS archive : '; |
| 1198 | 1198 | $SpotterArchive = new SpotterArchive($this->db); |
| 1199 | - $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); |
|
| 1199 | + $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 | 1200 | if ($globalDebug) echo $result.')'; |
| 1201 | 1201 | } elseif ($globalDebug && $putinarchive !== true) { |
| 1202 | 1202 | echo '(Not adding to archive)'; |
@@ -1209,7 +1209,7 @@ discard block |
||
| 1209 | 1209 | |
| 1210 | 1210 | public function getOrderBy() |
| 1211 | 1211 | { |
| 1212 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
| 1212 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
| 1213 | 1213 | return $orderby; |
| 1214 | 1214 | } |
| 1215 | 1215 | |
@@ -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 |
@@ -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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
@@ -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) { |