@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | <div id="showdetails" class="showdetails"></div> |
| 37 | 37 | <div id="infobox" class="infobox"><h4><?php echo _("Aircrafts detected"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div> |
| 38 | 38 | <?php |
| 39 | - if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
| 39 | + if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
| 40 | 40 | |
| 41 | 41 | ?> |
| 42 | 42 | <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script> |
| 43 | 43 | <?php |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | ?> |
| 46 | 46 | <div id="dialog" title="<?php echo _("Session has timed-out"); ?>"> |
| 47 | 47 | <p><?php echo _("In order to save data consumption web page times out after 30 minutes. Close this dialog to continue."); ?></p> |
@@ -55,34 +55,34 @@ discard block |
||
| 55 | 55 | <li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li> |
| 56 | 56 | <li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li> |
| 57 | 57 | <?php |
| 58 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 58 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 59 | 59 | if (isset($globalArchive) && $globalArchive == TRUE) { |
| 60 | 60 | ?> |
| 61 | 61 | <li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li> |
| 62 | 62 | <?php |
| 63 | 63 | } |
| 64 | - } |
|
| 64 | + } |
|
| 65 | 65 | ?> |
| 66 | 66 | <li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li> |
| 67 | 67 | <li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li> |
| 68 | 68 | <li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li> |
| 69 | 69 | <?php |
| 70 | - if (isset($globalMap3D) && $globalMap3D) { |
|
| 70 | + if (isset($globalMap3D) && $globalMap3D) { |
|
| 71 | 71 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
| 72 | 72 | ?> |
| 73 | 73 | <li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li> |
| 74 | 74 | <?php |
| 75 | - } else { |
|
| 76 | - if (isset($globalMapSatellites) && $globalMapSatellites) { |
|
| 75 | + } else { |
|
| 76 | + if (isset($globalMapSatellites) && $globalMapSatellites) { |
|
| 77 | 77 | ?> |
| 78 | 78 | <li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li> |
| 79 | 79 | <?php |
| 80 | - } |
|
| 80 | + } |
|
| 81 | 81 | ?> |
| 82 | 82 | <li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li> |
| 83 | 83 | <?php |
| 84 | 84 | } |
| 85 | - } |
|
| 85 | + } |
|
| 86 | 86 | ?> |
| 87 | 87 | </ul> |
| 88 | 88 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | ?> |
| 157 | 157 | </div> |
| 158 | 158 | <?php |
| 159 | - if (isset($globalArchive) && $globalArchive == TRUE) { |
|
| 159 | + if (isset($globalArchive) && $globalArchive == TRUE) { |
|
| 160 | 160 | ?> |
| 161 | 161 | <div class="sidebar-pane" id="archive"> |
| 162 | 162 | <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | </form> |
| 217 | 217 | </div> |
| 218 | 218 | <?php |
| 219 | - } |
|
| 219 | + } |
|
| 220 | 220 | ?> |
| 221 | 221 | <div class="sidebar-pane" id="settings"> |
| 222 | 222 | <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -227,56 +227,56 @@ discard block |
||
| 227 | 227 | <?php |
| 228 | 228 | if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
| 229 | 229 | else $MapType = $_COOKIE['MapType']; |
| 230 | - ?> |
|
| 230 | + ?> |
|
| 231 | 231 | <?php |
| 232 | 232 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
| 233 | - ?> |
|
| 233 | + ?> |
|
| 234 | 234 | <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
| 235 | 235 | <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
| 236 | 236 | <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
| 237 | 237 | <?php |
| 238 | 238 | } |
| 239 | - ?> |
|
| 239 | + ?> |
|
| 240 | 240 | <?php |
| 241 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 242 | - ?> |
|
| 241 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 242 | + ?> |
|
| 243 | 243 | <?php |
| 244 | - if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
|
| 245 | - ?> |
|
| 244 | + if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
|
| 245 | + ?> |
|
| 246 | 246 | <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
| 247 | 247 | <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
| 248 | 248 | <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
| 249 | 249 | <?php |
| 250 | - } |
|
| 251 | - ?> |
|
| 250 | + } |
|
| 251 | + ?> |
|
| 252 | 252 | <?php |
| 253 | - if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
|
| 254 | - ?> |
|
| 253 | + if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
|
| 254 | + ?> |
|
| 255 | 255 | <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
| 256 | 256 | <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
| 257 | 257 | <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
| 258 | 258 | <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
| 259 | 259 | <?php |
| 260 | - } |
|
| 261 | - ?> |
|
| 260 | + } |
|
| 261 | + ?> |
|
| 262 | 262 | <?php |
| 263 | - if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
|
| 264 | - ?> |
|
| 263 | + if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
|
| 264 | + ?> |
|
| 265 | 265 | <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
| 266 | 266 | <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
| 267 | 267 | <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
| 268 | 268 | <?php |
| 269 | - } |
|
| 270 | - ?> |
|
| 269 | + } |
|
| 270 | + ?> |
|
| 271 | 271 | <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
| 272 | 272 | <?php |
| 273 | 273 | } |
| 274 | - ?> |
|
| 274 | + ?> |
|
| 275 | 275 | <?php |
| 276 | - if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
| 276 | + if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
| 277 | 277 | if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
| 278 | 278 | else $MapBoxId = $_COOKIE['MapTypeId']; |
| 279 | - ?> |
|
| 279 | + ?> |
|
| 280 | 280 | <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
| 281 | 281 | <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
| 282 | 282 | <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
@@ -290,13 +290,13 @@ discard block |
||
| 290 | 290 | <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
| 291 | 291 | <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
| 292 | 292 | <?php |
| 293 | - } |
|
| 294 | - ?> |
|
| 293 | + } |
|
| 294 | + ?> |
|
| 295 | 295 | <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
| 296 | 296 | </select> |
| 297 | 297 | </li> |
| 298 | 298 | <?php |
| 299 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 299 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 300 | 300 | ?> |
| 301 | 301 | <li><?php echo _("Type of Terrain:"); ?> |
| 302 | 302 | <select class="selectpicker" onchange="terrainType(this);"> |
@@ -306,10 +306,10 @@ discard block |
||
| 306 | 306 | </select> |
| 307 | 307 | </li> |
| 308 | 308 | <?php |
| 309 | - } |
|
| 309 | + } |
|
| 310 | 310 | ?> |
| 311 | 311 | <?php |
| 312 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
| 312 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
| 313 | 313 | ?> |
| 314 | 314 | |
| 315 | 315 | <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li> |
@@ -317,54 +317,54 @@ discard block |
||
| 317 | 317 | <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
| 318 | 318 | <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
| 319 | 319 | <?php |
| 320 | - } |
|
| 320 | + } |
|
| 321 | 321 | ?> |
| 322 | 322 | <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
| 323 | 323 | <?php |
| 324 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 324 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 325 | 325 | ?> |
| 326 | 326 | <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> |
| 327 | 327 | <?php |
| 328 | - } |
|
| 328 | + } |
|
| 329 | 329 | ?> |
| 330 | 330 | |
| 331 | 331 | <?php |
| 332 | 332 | if (function_exists('array_column')) { |
| 333 | - if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
| 334 | - ?> |
|
| 333 | + if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
| 334 | + ?> |
|
| 335 | 335 | <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
| 336 | 336 | <?php |
| 337 | - } |
|
| 337 | + } |
|
| 338 | 338 | } elseif (isset($globalSources)) { |
| 339 | - $dispolar = false; |
|
| 340 | - foreach ($globalSources as $testsource) { |
|
| 341 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
| 342 | - } |
|
| 343 | - if ($dispolar) { |
|
| 344 | - ?> |
|
| 339 | + $dispolar = false; |
|
| 340 | + foreach ($globalSources as $testsource) { |
|
| 341 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
| 342 | + } |
|
| 343 | + if ($dispolar) { |
|
| 344 | + ?> |
|
| 345 | 345 | <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
| 346 | 346 | <?php |
| 347 | - } |
|
| 348 | - } |
|
| 349 | - ?> |
|
| 347 | + } |
|
| 348 | + } |
|
| 349 | + ?> |
|
| 350 | 350 | <?php |
| 351 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
| 351 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
| 352 | 352 | ?> |
| 353 | 353 | |
| 354 | 354 | <?php |
| 355 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
| 356 | - ?> |
|
| 355 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
| 356 | + ?> |
|
| 357 | 357 | <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
| 358 | 358 | <?php |
| 359 | 359 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
| 360 | - ?> |
|
| 360 | + ?> |
|
| 361 | 361 | <li><?php echo _("Aircraft icon color:"); ?> |
| 362 | 362 | <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"> |
| 363 | 363 | </li> |
| 364 | 364 | <?php |
| 365 | - } |
|
| 366 | - } |
|
| 367 | - ?> |
|
| 365 | + } |
|
| 366 | + } |
|
| 367 | + ?> |
|
| 368 | 368 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
| 369 | 369 | <div class="range"> |
| 370 | 370 | <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>"> |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | </div> |
| 373 | 373 | </li> |
| 374 | 374 | <?php |
| 375 | - } |
|
| 375 | + } |
|
| 376 | 376 | ?> |
| 377 | 377 | <li><?php echo _("Distance unit:"); ?> |
| 378 | 378 | <select class="selectpicker" onchange="unitdistance(this);"> |
@@ -405,16 +405,16 @@ discard block |
||
| 405 | 405 | <ul> |
| 406 | 406 | <?php |
| 407 | 407 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
| 408 | - ?> |
|
| 408 | + ?> |
|
| 409 | 409 | <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
| 410 | 410 | <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
| 411 | 411 | <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
| 412 | 412 | <?php |
| 413 | 413 | } |
| 414 | - ?> |
|
| 414 | + ?> |
|
| 415 | 415 | <?php |
| 416 | 416 | if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
| 417 | - ?> |
|
| 417 | + ?> |
|
| 418 | 418 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
| 419 | 419 | <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
| 420 | 420 | <?php } ?> |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | <?php } ?> |
| 424 | 424 | <?php |
| 425 | 425 | } |
| 426 | - ?> |
|
| 426 | + ?> |
|
| 427 | 427 | <li><?php echo _("Display airlines:"); ?> |
| 428 | 428 | <br/> |
| 429 | 429 | <select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines"> |
@@ -438,12 +438,12 @@ discard block |
||
| 438 | 438 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
| 439 | 439 | } |
| 440 | 440 | } |
| 441 | - ?> |
|
| 441 | + ?> |
|
| 442 | 442 | </select> |
| 443 | 443 | </li> |
| 444 | 444 | <?php |
| 445 | 445 | if (isset($globalAPRS) && $globalAPRS) { |
| 446 | - ?> |
|
| 446 | + ?> |
|
| 447 | 447 | <li><?php echo _("Display APRS sources name:"); ?> |
| 448 | 448 | <select class="selectpicker" multiple onchange="sources(this);"> |
| 449 | 449 | <?php |
@@ -455,15 +455,15 @@ discard block |
||
| 455 | 455 | echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>'; |
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | - ?> |
|
| 458 | + ?> |
|
| 459 | 459 | </select> |
| 460 | 460 | </li> |
| 461 | 461 | <?php |
| 462 | 462 | } |
| 463 | - ?> |
|
| 463 | + ?> |
|
| 464 | 464 | <?php |
| 465 | 465 | if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
| 466 | - ?> |
|
| 466 | + ?> |
|
| 467 | 467 | <li><?php echo _("Display airlines of type:"); ?><br/> |
| 468 | 468 | <select class="selectpicker" onchange="airlinestype(this);"> |
| 469 | 469 | <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | </li> |
| 475 | 475 | <?php |
| 476 | 476 | } |
| 477 | - ?> |
|
| 477 | + ?> |
|
| 478 | 478 | <li> |
| 479 | 479 | <?php echo _("Display flight with ident:"); ?> |
| 480 | 480 | <input type="text" name="identfilter" id="identfilter" value="<?php if (isset($_COOKIE['identfilter'])) print $_COOKIE['identfilter']; ?>" /> |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | </form> |
| 488 | 488 | </div> |
| 489 | 489 | <?php |
| 490 | - if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 490 | + if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 491 | 491 | ?> |
| 492 | 492 | <div class="sidebar-pane" id="satellites"> |
| 493 | 493 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -527,14 +527,14 @@ discard block |
||
| 527 | 527 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
| 528 | 528 | } |
| 529 | 529 | } |
| 530 | - ?> |
|
| 530 | + ?> |
|
| 531 | 531 | </select> |
| 532 | 532 | </li> |
| 533 | 533 | </ul> |
| 534 | 534 | </form> |
| 535 | 535 | </div> |
| 536 | 536 | <?php |
| 537 | - } |
|
| 537 | + } |
|
| 538 | 538 | ?> |
| 539 | 539 | </div> |
| 540 | 540 | </div> |
@@ -7,109 +7,109 @@ discard block |
||
| 7 | 7 | public $db; |
| 8 | 8 | |
| 9 | 9 | protected $texts = Array( |
| 10 | - 'MI' => 'Shallow', |
|
| 11 | - 'PR' => 'Partial', |
|
| 12 | - 'BC' => 'Low drifting', |
|
| 13 | - 'BL' => 'Blowing', |
|
| 14 | - 'SH' => 'Showers', |
|
| 15 | - 'TS' => 'Thunderstorm', |
|
| 16 | - 'FZ' => 'Freezing', |
|
| 17 | - 'DZ' => 'Drizzle', |
|
| 18 | - 'RA' => 'Rain', |
|
| 19 | - 'SN' => 'Snow', |
|
| 20 | - 'SG' => 'Snow Grains', |
|
| 21 | - 'IC' => 'Ice crystals', |
|
| 22 | - 'PL' => 'Ice pellets', |
|
| 23 | - 'GR' => 'Hail', |
|
| 24 | - 'GS' => 'Small hail', |
|
| 25 | - 'UP' => 'Unknown', |
|
| 26 | - 'BR' => 'Mist', |
|
| 27 | - 'FG' => 'Fog', |
|
| 28 | - 'FU' => 'Smoke', |
|
| 29 | - 'VA' => 'Volcanic ash', |
|
| 30 | - 'DU' => 'Widespread dust', |
|
| 31 | - 'SA' => 'Sand', |
|
| 32 | - 'HZ' => 'Haze', |
|
| 33 | - 'PY' => 'Spray', |
|
| 34 | - 'PO' => 'Well developed dust / sand whirls', |
|
| 35 | - 'SQ' => 'Squalls', |
|
| 36 | - 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
| 37 | - 'SS' => 'Sandstorm', |
|
| 38 | - 'DS' => 'Duststorm' |
|
| 10 | + 'MI' => 'Shallow', |
|
| 11 | + 'PR' => 'Partial', |
|
| 12 | + 'BC' => 'Low drifting', |
|
| 13 | + 'BL' => 'Blowing', |
|
| 14 | + 'SH' => 'Showers', |
|
| 15 | + 'TS' => 'Thunderstorm', |
|
| 16 | + 'FZ' => 'Freezing', |
|
| 17 | + 'DZ' => 'Drizzle', |
|
| 18 | + 'RA' => 'Rain', |
|
| 19 | + 'SN' => 'Snow', |
|
| 20 | + 'SG' => 'Snow Grains', |
|
| 21 | + 'IC' => 'Ice crystals', |
|
| 22 | + 'PL' => 'Ice pellets', |
|
| 23 | + 'GR' => 'Hail', |
|
| 24 | + 'GS' => 'Small hail', |
|
| 25 | + 'UP' => 'Unknown', |
|
| 26 | + 'BR' => 'Mist', |
|
| 27 | + 'FG' => 'Fog', |
|
| 28 | + 'FU' => 'Smoke', |
|
| 29 | + 'VA' => 'Volcanic ash', |
|
| 30 | + 'DU' => 'Widespread dust', |
|
| 31 | + 'SA' => 'Sand', |
|
| 32 | + 'HZ' => 'Haze', |
|
| 33 | + 'PY' => 'Spray', |
|
| 34 | + 'PO' => 'Well developed dust / sand whirls', |
|
| 35 | + 'SQ' => 'Squalls', |
|
| 36 | + 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
| 37 | + 'SS' => 'Sandstorm', |
|
| 38 | + 'DS' => 'Duststorm' |
|
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | 41 | public function __construct($dbc = null) { |
| 42 | - $Connection = new Connection($dbc); |
|
| 43 | - $this->db = $Connection->db; |
|
| 44 | - } |
|
| 42 | + $Connection = new Connection($dbc); |
|
| 43 | + $this->db = $Connection->db; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - public static function check_last_update() { |
|
| 47 | - global $globalDBdriver; |
|
| 48 | - if ($globalDBdriver == 'mysql') { |
|
| 46 | + public static function check_last_update() { |
|
| 47 | + global $globalDBdriver; |
|
| 48 | + if ($globalDBdriver == 'mysql') { |
|
| 49 | 49 | $query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_metar' AND value > DATE_SUB(NOW(), INTERVAL 20 MINUTE)"; |
| 50 | 50 | } else { |
| 51 | 51 | $query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_metar' AND value::timestamp > CURRENT_TIMESTAMP - INTERVAL '20 MINUTES'"; |
| 52 | 52 | } |
| 53 | - try { |
|
| 54 | - $Connection = new Connection(); |
|
| 55 | - $sth = $Connection->db->prepare($query); |
|
| 56 | - $sth->execute(); |
|
| 57 | - } catch(PDOException $e) { |
|
| 58 | - return "error : ".$e->getMessage(); |
|
| 59 | - } |
|
| 60 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 61 | - $sth->closeCursor(); |
|
| 62 | - if ($row['nb'] > 0) return false; |
|
| 63 | - else return true; |
|
| 64 | - } |
|
| 53 | + try { |
|
| 54 | + $Connection = new Connection(); |
|
| 55 | + $sth = $Connection->db->prepare($query); |
|
| 56 | + $sth->execute(); |
|
| 57 | + } catch(PDOException $e) { |
|
| 58 | + return "error : ".$e->getMessage(); |
|
| 59 | + } |
|
| 60 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 61 | + $sth->closeCursor(); |
|
| 62 | + if ($row['nb'] > 0) return false; |
|
| 63 | + else return true; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - public static function insert_last_update() { |
|
| 67 | - $query = "DELETE FROM config WHERE name = 'last_update_metar'; |
|
| 66 | + public static function insert_last_update() { |
|
| 67 | + $query = "DELETE FROM config WHERE name = 'last_update_metar'; |
|
| 68 | 68 | INSERT INTO config (name,value) VALUES ('last_update_metar',NOW());"; |
| 69 | - try { |
|
| 70 | - $Connection = new Connection(); |
|
| 71 | - $sth = $Connection->db->prepare($query); |
|
| 72 | - $sth->execute(); |
|
| 73 | - } catch(PDOException $e) { |
|
| 74 | - return "error : ".$e->getMessage(); |
|
| 75 | - } |
|
| 76 | - } |
|
| 69 | + try { |
|
| 70 | + $Connection = new Connection(); |
|
| 71 | + $sth = $Connection->db->prepare($query); |
|
| 72 | + $sth->execute(); |
|
| 73 | + } catch(PDOException $e) { |
|
| 74 | + return "error : ".$e->getMessage(); |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | |
| 80 | - public function parse($data) { |
|
| 81 | - //$data = str_replace(array('\n','\r','\r','\n'),'',$data); |
|
| 82 | - $codes = implode('|', array_keys($this->texts)); |
|
| 83 | - $regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#'; |
|
| 84 | - //$pieces = explode(' ',$data); |
|
| 85 | - $pieces = preg_split('/\s/',$data); |
|
| 86 | - $pos = 0; |
|
| 87 | - if ($pieces[0] == 'METAR') $pos++; |
|
| 88 | - elseif ($pieces[0] == 'SPECI') $pos++; |
|
| 89 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
| 90 | - $result = array(); |
|
| 91 | - $result['location'] = $pieces[$pos]; |
|
| 92 | - $pos++; |
|
| 93 | - $result['dayofmonth'] = substr($pieces[$pos],0,2); |
|
| 94 | - $result['time'] = substr($pieces[$pos],2,4); |
|
| 95 | - $c = count($pieces); |
|
| 96 | - for($pos++; $pos < $c; $pos++) { |
|
| 97 | - $piece = $pieces[$pos]; |
|
| 98 | - if ($piece == 'RMK') break; |
|
| 99 | - if ($piece == 'AUTO') $result['auto'] = true; |
|
| 100 | - if ($piece == 'COR') $result['correction'] = true; |
|
| 101 | - // Wind Speed |
|
| 102 | - if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
|
| 103 | - $result['wind']['direction'] = (float)$matches[1]; |
|
| 80 | + public function parse($data) { |
|
| 81 | + //$data = str_replace(array('\n','\r','\r','\n'),'',$data); |
|
| 82 | + $codes = implode('|', array_keys($this->texts)); |
|
| 83 | + $regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#'; |
|
| 84 | + //$pieces = explode(' ',$data); |
|
| 85 | + $pieces = preg_split('/\s/',$data); |
|
| 86 | + $pos = 0; |
|
| 87 | + if ($pieces[0] == 'METAR') $pos++; |
|
| 88 | + elseif ($pieces[0] == 'SPECI') $pos++; |
|
| 89 | + if (strlen($pieces[$pos]) != 4) $pos++; |
|
| 90 | + $result = array(); |
|
| 91 | + $result['location'] = $pieces[$pos]; |
|
| 92 | + $pos++; |
|
| 93 | + $result['dayofmonth'] = substr($pieces[$pos],0,2); |
|
| 94 | + $result['time'] = substr($pieces[$pos],2,4); |
|
| 95 | + $c = count($pieces); |
|
| 96 | + for($pos++; $pos < $c; $pos++) { |
|
| 97 | + $piece = $pieces[$pos]; |
|
| 98 | + if ($piece == 'RMK') break; |
|
| 99 | + if ($piece == 'AUTO') $result['auto'] = true; |
|
| 100 | + if ($piece == 'COR') $result['correction'] = true; |
|
| 101 | + // Wind Speed |
|
| 102 | + if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
|
| 103 | + $result['wind']['direction'] = (float)$matches[1]; |
|
| 104 | 104 | $result['wind']['unit'] = $matches[4]; |
| 105 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
| 106 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
| 107 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
| 105 | + if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
| 106 | + elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
| 107 | + elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
| 108 | 108 | $result['wind']['gust'] = (float)$matches[3]; |
| 109 | 109 | $result['wind']['unit'] = $matches[4]; |
| 110 | 110 | $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
| 111 | 111 | $result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0; |
| 112 | - } |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | 114 | /* if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) { |
| 115 | 115 | $result['wind_direction'] = (float)$matches[1]; |
@@ -126,35 +126,35 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | */ |
| 129 | - // Temperature |
|
| 130 | - if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) { |
|
| 131 | - $temp = (float)$matches[1]; |
|
| 129 | + // Temperature |
|
| 130 | + if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) { |
|
| 131 | + $temp = (float)$matches[1]; |
|
| 132 | 132 | if ($matches[1]{0} == 'M') { |
| 133 | 133 | $temp = ((float)substr($matches[1], 1)) * -1; |
| 134 | 134 | } |
| 135 | - $result['temperature'] = $temp; |
|
| 136 | - $dew = (float)$matches[2]; |
|
| 135 | + $result['temperature'] = $temp; |
|
| 136 | + $dew = (float)$matches[2]; |
|
| 137 | 137 | if ($matches[2]{0} == 'M') { |
| 138 | 138 | $dew = ((float)substr($matches[2], 1)) * -1; |
| 139 | 139 | } |
| 140 | 140 | $result['dew'] = $dew; |
| 141 | - } |
|
| 142 | - // QNH |
|
| 143 | - if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) { |
|
| 144 | - // #^(Q|A)(////|[0-9]{4})( )# |
|
| 145 | - if ($matches[1] == 'Q') { |
|
| 146 | - // hPa |
|
| 147 | - $result['QNH'] = $matches[2]; |
|
| 148 | - } else { |
|
| 149 | - // inHg |
|
| 150 | - $result['QNH'] = round(($matches[2] / 100)*33.86389,2); |
|
| 151 | 141 | } |
| 152 | - /* |
|
| 142 | + // QNH |
|
| 143 | + if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) { |
|
| 144 | + // #^(Q|A)(////|[0-9]{4})( )# |
|
| 145 | + if ($matches[1] == 'Q') { |
|
| 146 | + // hPa |
|
| 147 | + $result['QNH'] = $matches[2]; |
|
| 148 | + } else { |
|
| 149 | + // inHg |
|
| 150 | + $result['QNH'] = round(($matches[2] / 100)*33.86389,2); |
|
| 151 | + } |
|
| 152 | + /* |
|
| 153 | 153 | $result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100); |
| 154 | 154 | $result['QNH_format'] = $matches[1] == 'Q' ? 'hPa' : 'inHg'; |
| 155 | 155 | */ |
| 156 | - } |
|
| 157 | - /* |
|
| 156 | + } |
|
| 157 | + /* |
|
| 158 | 158 | // Wind Direction |
| 159 | 159 | if (preg_match('#^([0-9]{3})V([0-9]{3})$#', $piece, $matches)) { |
| 160 | 160 | $result['wind_direction'] = $matches[1]; |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | $result['speed_variable'] = $matches[1]; |
| 166 | 166 | } |
| 167 | 167 | */ |
| 168 | - // Visibility |
|
| 169 | - if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
|
| 170 | - if (isset($matches[3]) && strlen($matches[3]) > 0) { |
|
| 168 | + // Visibility |
|
| 169 | + if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
|
| 170 | + if (isset($matches[3]) && strlen($matches[3]) > 0) { |
|
| 171 | 171 | $result['visibility'] = (float)$matches[3] * 1609.34; |
| 172 | 172 | } else { |
| 173 | 173 | if ($matches[1] == '9999') { |
@@ -180,28 +180,28 @@ discard block |
||
| 180 | 180 | $result['visibility'] = '> 10000'; |
| 181 | 181 | $result['weather'] = "CAVOK"; |
| 182 | 182 | } |
| 183 | - } |
|
| 184 | - // Cloud Coverage |
|
| 185 | - if (preg_match('#^(SKC|CLR|FEW|SCT|BKN|OVC|VV)([0-9]{3})(CB|TCU|CU|CI)?$#', $piece, $matches)) { |
|
| 186 | - //$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : ''); |
|
| 187 | - $type = $matches[1]; |
|
| 188 | - $cloud = array(); |
|
| 189 | - if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear'; |
|
| 190 | - elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
| 191 | - elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud'; |
|
| 192 | - elseif ($type == 'FEW') $cloud['type'] = 'Few'; |
|
| 193 | - elseif ($type == 'SCT') $cloud['type'] = 'Scattered'; |
|
| 194 | - elseif ($type == 'BKN') $cloud['type'] = 'Broken'; |
|
| 195 | - elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
| 196 | - elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
|
| 197 | - $cloud['type_code'] = $type; |
|
| 198 | - $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
|
| 199 | - $cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
|
| 200 | - $result['cloud'][] = $cloud; |
|
| 201 | - } |
|
| 202 | - // RVR |
|
| 203 | - if (preg_match('#^(R.+)/([M|P])?(\d{4})(?:V(\d+)|[UDN])?(FT)?$#', $piece, $matches)) { |
|
| 204 | - $rvr = array(); |
|
| 183 | + } |
|
| 184 | + // Cloud Coverage |
|
| 185 | + if (preg_match('#^(SKC|CLR|FEW|SCT|BKN|OVC|VV)([0-9]{3})(CB|TCU|CU|CI)?$#', $piece, $matches)) { |
|
| 186 | + //$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : ''); |
|
| 187 | + $type = $matches[1]; |
|
| 188 | + $cloud = array(); |
|
| 189 | + if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear'; |
|
| 190 | + elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
| 191 | + elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud'; |
|
| 192 | + elseif ($type == 'FEW') $cloud['type'] = 'Few'; |
|
| 193 | + elseif ($type == 'SCT') $cloud['type'] = 'Scattered'; |
|
| 194 | + elseif ($type == 'BKN') $cloud['type'] = 'Broken'; |
|
| 195 | + elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
| 196 | + elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
|
| 197 | + $cloud['type_code'] = $type; |
|
| 198 | + $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
|
| 199 | + $cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
|
| 200 | + $result['cloud'][] = $cloud; |
|
| 201 | + } |
|
| 202 | + // RVR |
|
| 203 | + if (preg_match('#^(R.+)/([M|P])?(\d{4})(?:V(\d+)|[UDN])?(FT)?$#', $piece, $matches)) { |
|
| 204 | + $rvr = array(); |
|
| 205 | 205 | $rvr['runway'] = $matches[1]; |
| 206 | 206 | $rvr['assessment'] = $matches[2]; |
| 207 | 207 | $rvr['rvr'] = $matches[3]; |
@@ -210,33 +210,33 @@ discard block |
||
| 210 | 210 | $result['RVR'] = $rvr; |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - //if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
|
| 214 | - if (preg_match('#^R(\d{2}[LRC]?)/([\d/])([\d/])([\d/]{2})([\d/]{2})$#', $piece, $matches)) { |
|
| 215 | - //print_r($matches); |
|
| 216 | - // https://github.com/davidmegginson/metar-taf/blob/master/Metar.php |
|
| 217 | - $result['RVR']['runway'] = $matches[1]; |
|
| 218 | - $result['RVR']['deposits'] = $matches[2]; |
|
| 219 | - $result['RVR']['extent'] = $matches[3]; |
|
| 220 | - $result['RVR']['depth'] = $matches[4]; |
|
| 221 | - $result['RVR']['friction'] = $matches[5]; |
|
| 222 | - } |
|
| 223 | - if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
|
| 224 | - //echo $piece; |
|
| 225 | - //print_r($matches); |
|
| 226 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
| 227 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
| 213 | + //if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
|
| 214 | + if (preg_match('#^R(\d{2}[LRC]?)/([\d/])([\d/])([\d/]{2})([\d/]{2})$#', $piece, $matches)) { |
|
| 215 | + //print_r($matches); |
|
| 216 | + // https://github.com/davidmegginson/metar-taf/blob/master/Metar.php |
|
| 217 | + $result['RVR']['runway'] = $matches[1]; |
|
| 218 | + $result['RVR']['deposits'] = $matches[2]; |
|
| 219 | + $result['RVR']['extent'] = $matches[3]; |
|
| 220 | + $result['RVR']['depth'] = $matches[4]; |
|
| 221 | + $result['RVR']['friction'] = $matches[5]; |
|
| 222 | + } |
|
| 223 | + if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
|
| 224 | + //echo $piece; |
|
| 225 | + //print_r($matches); |
|
| 226 | + if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
| 227 | + else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
| 228 | 228 | if (isset($matches[3])) { |
| 229 | 229 | $range = Array( |
| 230 | - 'from' => (float)$matches[2], |
|
| 231 | - 'to' => (float)$matches[4], |
|
| 232 | - 'unit' => $matches[5] ? 'FT' : 'M' |
|
| 230 | + 'from' => (float)$matches[2], |
|
| 231 | + 'to' => (float)$matches[4], |
|
| 232 | + 'unit' => $matches[5] ? 'FT' : 'M' |
|
| 233 | 233 | ); |
| 234 | 234 | } |
| 235 | 235 | $result['RVR'] = $matches[1]; |
| 236 | 236 | $result['RVR_range'] = $range; |
| 237 | - } |
|
| 238 | - // Weather |
|
| 239 | - if (preg_match($regWeather, $piece, $matches)) { |
|
| 237 | + } |
|
| 238 | + // Weather |
|
| 239 | + if (preg_match($regWeather, $piece, $matches)) { |
|
| 240 | 240 | $text = Array(); |
| 241 | 241 | switch ($matches[1]) { |
| 242 | 242 | case '+': |
@@ -259,35 +259,35 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | if (!isset($result['weather'])) $result['weather'] = implode(' ', $text); |
| 261 | 261 | else $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
| 262 | - } |
|
| 263 | - } |
|
| 264 | - return $result; |
|
| 262 | + } |
|
| 263 | + } |
|
| 264 | + return $result; |
|
| 265 | 265 | |
| 266 | - } |
|
| 266 | + } |
|
| 267 | 267 | |
| 268 | 268 | public function getMETAR($icao) { |
| 269 | - global $globalMETARcycle, $globalDBdriver; |
|
| 270 | - if (isset($globalMETARcycle) && $globalMETARcycle) { |
|
| 271 | - $query = "SELECT * FROM metar WHERE metar_location = :icao"; |
|
| 272 | - } else { |
|
| 273 | - if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
| 274 | - else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
| 275 | - } |
|
| 276 | - $query_values = array(':icao' => $icao); |
|
| 277 | - try { |
|
| 278 | - $sth = $this->db->prepare($query); |
|
| 279 | - $sth->execute($query_values); |
|
| 280 | - } catch(PDOException $e) { |
|
| 281 | - return "error : ".$e->getMessage(); |
|
| 282 | - } |
|
| 283 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 284 | - if ((!isset($globalMETARcycle) || $globalMETARcycle === false) && count($all) == 0) { |
|
| 285 | - $all = $this->downloadMETAR($icao); |
|
| 286 | - } |
|
| 287 | - return $all; |
|
| 288 | - } |
|
| 269 | + global $globalMETARcycle, $globalDBdriver; |
|
| 270 | + if (isset($globalMETARcycle) && $globalMETARcycle) { |
|
| 271 | + $query = "SELECT * FROM metar WHERE metar_location = :icao"; |
|
| 272 | + } else { |
|
| 273 | + if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
| 274 | + else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
| 275 | + } |
|
| 276 | + $query_values = array(':icao' => $icao); |
|
| 277 | + try { |
|
| 278 | + $sth = $this->db->prepare($query); |
|
| 279 | + $sth->execute($query_values); |
|
| 280 | + } catch(PDOException $e) { |
|
| 281 | + return "error : ".$e->getMessage(); |
|
| 282 | + } |
|
| 283 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 284 | + if ((!isset($globalMETARcycle) || $globalMETARcycle === false) && count($all) == 0) { |
|
| 285 | + $all = $this->downloadMETAR($icao); |
|
| 286 | + } |
|
| 287 | + return $all; |
|
| 288 | + } |
|
| 289 | 289 | |
| 290 | - public function addMETAR($location,$metar,$date) { |
|
| 290 | + public function addMETAR($location,$metar,$date) { |
|
| 291 | 291 | global $globalDBdriver; |
| 292 | 292 | $date = date('Y-m-d H:i:s',strtotime($date)); |
| 293 | 293 | if ($globalDBdriver == 'mysql') { |
@@ -295,100 +295,100 @@ discard block |
||
| 295 | 295 | } else { |
| 296 | 296 | $query = "UPDATE metar SET metar_date = :date, metar = metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);"; |
| 297 | 297 | } |
| 298 | - $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar)); |
|
| 299 | - try { |
|
| 300 | - $sth = $this->db->prepare($query); |
|
| 301 | - $sth->execute($query_values); |
|
| 302 | - } catch(PDOException $e) { |
|
| 303 | - return "error : ".$e->getMessage(); |
|
| 304 | - } |
|
| 305 | - } |
|
| 298 | + $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar)); |
|
| 299 | + try { |
|
| 300 | + $sth = $this->db->prepare($query); |
|
| 301 | + $sth->execute($query_values); |
|
| 302 | + } catch(PDOException $e) { |
|
| 303 | + return "error : ".$e->getMessage(); |
|
| 304 | + } |
|
| 305 | + } |
|
| 306 | 306 | |
| 307 | - public function deleteMETAR($id) { |
|
| 308 | - $query = "DELETE FROM metar WHERE id = :id"; |
|
| 309 | - $query_values = array(':id' => $id); |
|
| 310 | - try { |
|
| 311 | - $sth = $this->db->prepare($query); |
|
| 312 | - $sth->execute($query_values); |
|
| 313 | - } catch(PDOException $e) { |
|
| 314 | - return "error : ".$e->getMessage(); |
|
| 315 | - } |
|
| 316 | - } |
|
| 317 | - public function deleteAllMETARLocation() { |
|
| 318 | - $query = "DELETE FROM metar"; |
|
| 319 | - try { |
|
| 320 | - $sth = $this->db->prepare($query); |
|
| 321 | - $sth->execute(); |
|
| 322 | - } catch(PDOException $e) { |
|
| 323 | - return "error : ".$e->getMessage(); |
|
| 324 | - } |
|
| 325 | - } |
|
| 307 | + public function deleteMETAR($id) { |
|
| 308 | + $query = "DELETE FROM metar WHERE id = :id"; |
|
| 309 | + $query_values = array(':id' => $id); |
|
| 310 | + try { |
|
| 311 | + $sth = $this->db->prepare($query); |
|
| 312 | + $sth->execute($query_values); |
|
| 313 | + } catch(PDOException $e) { |
|
| 314 | + return "error : ".$e->getMessage(); |
|
| 315 | + } |
|
| 316 | + } |
|
| 317 | + public function deleteAllMETARLocation() { |
|
| 318 | + $query = "DELETE FROM metar"; |
|
| 319 | + try { |
|
| 320 | + $sth = $this->db->prepare($query); |
|
| 321 | + $sth->execute(); |
|
| 322 | + } catch(PDOException $e) { |
|
| 323 | + return "error : ".$e->getMessage(); |
|
| 324 | + } |
|
| 325 | + } |
|
| 326 | 326 | |
| 327 | - public function addMETARCycle() { |
|
| 328 | - global $globalDebug, $globalIVAO; |
|
| 329 | - if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle..."; |
|
| 330 | - date_default_timezone_set("UTC"); |
|
| 331 | - $Common = new Common(); |
|
| 332 | - if (isset($globalIVAO) && $globalIVAO) { |
|
| 333 | - $cycle = $Common->getData('http://wx.ivao.aero/metar.php'); |
|
| 334 | - } else { |
|
| 327 | + public function addMETARCycle() { |
|
| 328 | + global $globalDebug, $globalIVAO; |
|
| 329 | + if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle..."; |
|
| 330 | + date_default_timezone_set("UTC"); |
|
| 331 | + $Common = new Common(); |
|
| 332 | + if (isset($globalIVAO) && $globalIVAO) { |
|
| 333 | + $cycle = $Common->getData('http://wx.ivao.aero/metar.php'); |
|
| 334 | + } else { |
|
| 335 | 335 | $cycle = $Common->getData('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT'); |
| 336 | - } |
|
| 337 | - if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
|
| 338 | - $date = ''; |
|
| 339 | - foreach(explode("\n",$cycle) as $line) { |
|
| 340 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
| 341 | - //echo "date : ".$line."\n"; |
|
| 342 | - $date = $line; |
|
| 343 | - } |
|
| 344 | - if ($line != '') { |
|
| 345 | - //$this->parse($line); |
|
| 346 | - //echo $line; |
|
| 347 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
| 348 | - $pos = 0; |
|
| 349 | - $pieces = preg_split('/\s/',$line); |
|
| 350 | - if ($pieces[0] == 'METAR') $pos++; |
|
| 351 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
| 352 | - $location = $pieces[$pos]; |
|
| 353 | - echo $this->addMETAR($location,$line,$date); |
|
| 354 | - } |
|
| 355 | - //echo $line."\n"; |
|
| 356 | - } |
|
| 357 | - if (isset($globalDebug) && $globalDebug) echo "Done\n"; |
|
| 336 | + } |
|
| 337 | + if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
|
| 338 | + $date = ''; |
|
| 339 | + foreach(explode("\n",$cycle) as $line) { |
|
| 340 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
| 341 | + //echo "date : ".$line."\n"; |
|
| 342 | + $date = $line; |
|
| 343 | + } |
|
| 344 | + if ($line != '') { |
|
| 345 | + //$this->parse($line); |
|
| 346 | + //echo $line; |
|
| 347 | + if ($date == '') $date = date('Y/m/d H:m'); |
|
| 348 | + $pos = 0; |
|
| 349 | + $pieces = preg_split('/\s/',$line); |
|
| 350 | + if ($pieces[0] == 'METAR') $pos++; |
|
| 351 | + if (strlen($pieces[$pos]) != 4) $pos++; |
|
| 352 | + $location = $pieces[$pos]; |
|
| 353 | + echo $this->addMETAR($location,$line,$date); |
|
| 354 | + } |
|
| 355 | + //echo $line."\n"; |
|
| 356 | + } |
|
| 357 | + if (isset($globalDebug) && $globalDebug) echo "Done\n"; |
|
| 358 | 358 | |
| 359 | - } |
|
| 360 | - public function downloadMETAR($icao) { |
|
| 361 | - global $globalMETARurl; |
|
| 362 | - if ($globalMETARurl == '') return array(); |
|
| 363 | - date_default_timezone_set("UTC"); |
|
| 364 | - $Common = new Common(); |
|
| 365 | - $url = str_replace('{icao}',$icao,$globalMETARurl); |
|
| 366 | - $cycle = $Common->getData($url); |
|
| 367 | - $date = ''; |
|
| 368 | - foreach(explode("\n",$cycle) as $line) { |
|
| 369 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
| 370 | - //echo "date : ".$line."\n"; |
|
| 371 | - $date = $line; |
|
| 372 | - } |
|
| 373 | - if ($line != '') { |
|
| 374 | - //$this->parse($line); |
|
| 375 | - //echo $line; |
|
| 376 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
| 377 | - $pos = 0; |
|
| 378 | - $pieces = preg_split('/\s/',$line); |
|
| 379 | - if ($pieces[0] == 'METAR') $pos++; |
|
| 380 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
| 381 | - $location = $pieces[$pos]; |
|
| 382 | - if (strlen($location == 4)) { |
|
| 383 | - $this->addMETAR($location,$line,$date); |
|
| 384 | - return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
|
| 385 | - } else return array(); |
|
| 386 | - } |
|
| 387 | - //echo $line."\n"; |
|
| 388 | - } |
|
| 389 | - return array(); |
|
| 359 | + } |
|
| 360 | + public function downloadMETAR($icao) { |
|
| 361 | + global $globalMETARurl; |
|
| 362 | + if ($globalMETARurl == '') return array(); |
|
| 363 | + date_default_timezone_set("UTC"); |
|
| 364 | + $Common = new Common(); |
|
| 365 | + $url = str_replace('{icao}',$icao,$globalMETARurl); |
|
| 366 | + $cycle = $Common->getData($url); |
|
| 367 | + $date = ''; |
|
| 368 | + foreach(explode("\n",$cycle) as $line) { |
|
| 369 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
| 370 | + //echo "date : ".$line."\n"; |
|
| 371 | + $date = $line; |
|
| 372 | + } |
|
| 373 | + if ($line != '') { |
|
| 374 | + //$this->parse($line); |
|
| 375 | + //echo $line; |
|
| 376 | + if ($date == '') $date = date('Y/m/d H:m'); |
|
| 377 | + $pos = 0; |
|
| 378 | + $pieces = preg_split('/\s/',$line); |
|
| 379 | + if ($pieces[0] == 'METAR') $pos++; |
|
| 380 | + if (strlen($pieces[$pos]) != 4) $pos++; |
|
| 381 | + $location = $pieces[$pos]; |
|
| 382 | + if (strlen($location == 4)) { |
|
| 383 | + $this->addMETAR($location,$line,$date); |
|
| 384 | + return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
|
| 385 | + } else return array(); |
|
| 386 | + } |
|
| 387 | + //echo $line."\n"; |
|
| 388 | + } |
|
| 389 | + return array(); |
|
| 390 | 390 | |
| 391 | - } |
|
| 391 | + } |
|
| 392 | 392 | } |
| 393 | 393 | /* |
| 394 | 394 | $METAR = new METAR(); |
@@ -15,67 +15,67 @@ discard block |
||
| 15 | 15 | if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
| 16 | 16 | $Connection = new Connection($dbc); |
| 17 | 17 | $this->db = $Connection->db(); |
| 18 | - } |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | 20 | public function addLastStatsUpdate($type,$stats_date) { |
| 21 | - $query = "DELETE FROM config WHERE name = :type; |
|
| 21 | + $query = "DELETE FROM config WHERE name = :type; |
|
| 22 | 22 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
| 23 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
| 24 | - try { |
|
| 25 | - $sth = $this->db->prepare($query); |
|
| 26 | - $sth->execute($query_values); |
|
| 27 | - } catch(PDOException $e) { |
|
| 28 | - return "error : ".$e->getMessage(); |
|
| 29 | - } |
|
| 30 | - } |
|
| 23 | + $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
| 24 | + try { |
|
| 25 | + $sth = $this->db->prepare($query); |
|
| 26 | + $sth->execute($query_values); |
|
| 27 | + } catch(PDOException $e) { |
|
| 28 | + return "error : ".$e->getMessage(); |
|
| 29 | + } |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | public function getLastStatsUpdate($type = 'last_update_stats') { |
| 33 | - $query = "SELECT value FROM config WHERE name = :type"; |
|
| 34 | - try { |
|
| 35 | - $sth = $this->db->prepare($query); |
|
| 36 | - $sth->execute(array(':type' => $type)); |
|
| 37 | - } catch(PDOException $e) { |
|
| 38 | - echo "error : ".$e->getMessage(); |
|
| 39 | - } |
|
| 40 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 41 | - return $all; |
|
| 42 | - } |
|
| 33 | + $query = "SELECT value FROM config WHERE name = :type"; |
|
| 34 | + try { |
|
| 35 | + $sth = $this->db->prepare($query); |
|
| 36 | + $sth->execute(array(':type' => $type)); |
|
| 37 | + } catch(PDOException $e) { |
|
| 38 | + echo "error : ".$e->getMessage(); |
|
| 39 | + } |
|
| 40 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 41 | + return $all; |
|
| 42 | + } |
|
| 43 | 43 | public function getAllAirlineNames($filter_name = '') { |
| 44 | 44 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 45 | - $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
|
| 46 | - try { |
|
| 47 | - $sth = $this->db->prepare($query); |
|
| 48 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 49 | - } catch(PDOException $e) { |
|
| 50 | - echo "error : ".$e->getMessage(); |
|
| 51 | - } |
|
| 52 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 53 | - return $all; |
|
| 54 | - } |
|
| 45 | + $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
|
| 46 | + try { |
|
| 47 | + $sth = $this->db->prepare($query); |
|
| 48 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 49 | + } catch(PDOException $e) { |
|
| 50 | + echo "error : ".$e->getMessage(); |
|
| 51 | + } |
|
| 52 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 53 | + return $all; |
|
| 54 | + } |
|
| 55 | 55 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
| 56 | 56 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 57 | - $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
|
| 58 | - try { |
|
| 59 | - $sth = $this->db->prepare($query); |
|
| 60 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 61 | - } catch(PDOException $e) { |
|
| 62 | - echo "error : ".$e->getMessage(); |
|
| 63 | - } |
|
| 64 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 65 | - return $all; |
|
| 66 | - } |
|
| 57 | + $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
|
| 58 | + try { |
|
| 59 | + $sth = $this->db->prepare($query); |
|
| 60 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 61 | + } catch(PDOException $e) { |
|
| 62 | + echo "error : ".$e->getMessage(); |
|
| 63 | + } |
|
| 64 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 65 | + return $all; |
|
| 66 | + } |
|
| 67 | 67 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
| 68 | 68 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 69 | - $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
|
| 70 | - try { |
|
| 71 | - $sth = $this->db->prepare($query); |
|
| 72 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 73 | - } catch(PDOException $e) { |
|
| 74 | - echo "error : ".$e->getMessage(); |
|
| 75 | - } |
|
| 76 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 77 | - return $all; |
|
| 78 | - } |
|
| 69 | + $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
|
| 70 | + try { |
|
| 71 | + $sth = $this->db->prepare($query); |
|
| 72 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 73 | + } catch(PDOException $e) { |
|
| 74 | + echo "error : ".$e->getMessage(); |
|
| 75 | + } |
|
| 76 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 77 | + return $all; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') { |
@@ -83,66 +83,66 @@ discard block |
||
| 83 | 83 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 84 | 84 | if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
| 85 | 85 | else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
| 86 | - try { |
|
| 87 | - $sth = $this->db->prepare($query); |
|
| 88 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 89 | - } catch(PDOException $e) { |
|
| 90 | - echo "error : ".$e->getMessage(); |
|
| 91 | - } |
|
| 92 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 93 | - if (empty($all)) { |
|
| 94 | - $filters = array('airlines' => array($stats_airline)); |
|
| 95 | - if ($filter_name != '') { |
|
| 96 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 97 | - } |
|
| 98 | - $Spotter = new Spotter($this->db); |
|
| 99 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
| 100 | - } |
|
| 101 | - return $all; |
|
| 86 | + try { |
|
| 87 | + $sth = $this->db->prepare($query); |
|
| 88 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 89 | + } catch(PDOException $e) { |
|
| 90 | + echo "error : ".$e->getMessage(); |
|
| 91 | + } |
|
| 92 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 93 | + if (empty($all)) { |
|
| 94 | + $filters = array('airlines' => array($stats_airline)); |
|
| 95 | + if ($filter_name != '') { |
|
| 96 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 97 | + } |
|
| 98 | + $Spotter = new Spotter($this->db); |
|
| 99 | + $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
| 100 | + } |
|
| 101 | + return $all; |
|
| 102 | 102 | } |
| 103 | 103 | public function countAllAirlineCountries($limit = true,$filter_name = '') { |
| 104 | 104 | global $globalStatsFilters; |
| 105 | 105 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 106 | 106 | if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
| 107 | 107 | else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC"; |
| 108 | - try { |
|
| 109 | - $sth = $this->db->prepare($query); |
|
| 110 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 111 | - } catch(PDOException $e) { |
|
| 112 | - echo "error : ".$e->getMessage(); |
|
| 113 | - } |
|
| 114 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 115 | - if (empty($all)) { |
|
| 116 | - $Spotter = new Spotter($this->db); |
|
| 117 | - $filters = array(); |
|
| 118 | - if ($filter_name != '') { |
|
| 119 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 120 | - } |
|
| 121 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
| 122 | - } |
|
| 123 | - return $all; |
|
| 108 | + try { |
|
| 109 | + $sth = $this->db->prepare($query); |
|
| 110 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 111 | + } catch(PDOException $e) { |
|
| 112 | + echo "error : ".$e->getMessage(); |
|
| 113 | + } |
|
| 114 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 115 | + if (empty($all)) { |
|
| 116 | + $Spotter = new Spotter($this->db); |
|
| 117 | + $filters = array(); |
|
| 118 | + if ($filter_name != '') { |
|
| 119 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 120 | + } |
|
| 121 | + $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
| 122 | + } |
|
| 123 | + return $all; |
|
| 124 | 124 | } |
| 125 | 125 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') { |
| 126 | 126 | global $globalStatsFilters; |
| 127 | 127 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 128 | 128 | if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
| 129 | 129 | else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
| 130 | - try { |
|
| 131 | - $sth = $this->db->prepare($query); |
|
| 132 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 133 | - } catch(PDOException $e) { |
|
| 134 | - echo "error : ".$e->getMessage(); |
|
| 135 | - } |
|
| 136 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 137 | - if (empty($all)) { |
|
| 138 | - $filters = array('airlines' => array($stats_airline)); |
|
| 139 | - if ($filter_name != '') { |
|
| 140 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 130 | + try { |
|
| 131 | + $sth = $this->db->prepare($query); |
|
| 132 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 133 | + } catch(PDOException $e) { |
|
| 134 | + echo "error : ".$e->getMessage(); |
|
| 135 | + } |
|
| 136 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 137 | + if (empty($all)) { |
|
| 138 | + $filters = array('airlines' => array($stats_airline)); |
|
| 139 | + if ($filter_name != '') { |
|
| 140 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 141 | 141 | } |
| 142 | - $Spotter = new Spotter($this->db); |
|
| 142 | + $Spotter = new Spotter($this->db); |
|
| 143 | 143 | $all = $Spotter->countAllAircraftManufacturers($filters); |
| 144 | - } |
|
| 145 | - return $all; |
|
| 144 | + } |
|
| 145 | + return $all; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') { |
@@ -150,44 +150,44 @@ discard block |
||
| 150 | 150 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 151 | 151 | if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
| 152 | 152 | else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
| 153 | - try { |
|
| 154 | - $sth = $this->db->prepare($query); |
|
| 155 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 156 | - } catch(PDOException $e) { |
|
| 157 | - echo "error : ".$e->getMessage(); |
|
| 158 | - } |
|
| 159 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 160 | - if (empty($all)) { |
|
| 153 | + try { |
|
| 154 | + $sth = $this->db->prepare($query); |
|
| 155 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 156 | + } catch(PDOException $e) { |
|
| 157 | + echo "error : ".$e->getMessage(); |
|
| 158 | + } |
|
| 159 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 160 | + if (empty($all)) { |
|
| 161 | 161 | $filters = array('airlines' => array($stats_airline)); |
| 162 | 162 | if ($filter_name != '') { |
| 163 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 163 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 164 | 164 | } |
| 165 | 165 | $Spotter = new Spotter($this->db); |
| 166 | 166 | $all = $Spotter->countAllArrivalCountries($limit,$filters); |
| 167 | - } |
|
| 168 | - return $all; |
|
| 167 | + } |
|
| 168 | + return $all; |
|
| 169 | 169 | } |
| 170 | 170 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') { |
| 171 | 171 | global $globalStatsFilters; |
| 172 | 172 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 173 | 173 | if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
| 174 | 174 | else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
| 175 | - try { |
|
| 176 | - $sth = $this->db->prepare($query); |
|
| 177 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 178 | - } catch(PDOException $e) { |
|
| 179 | - echo "error : ".$e->getMessage(); |
|
| 180 | - } |
|
| 181 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 182 | - if (empty($all)) { |
|
| 175 | + try { |
|
| 176 | + $sth = $this->db->prepare($query); |
|
| 177 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 178 | + } catch(PDOException $e) { |
|
| 179 | + echo "error : ".$e->getMessage(); |
|
| 180 | + } |
|
| 181 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 182 | + if (empty($all)) { |
|
| 183 | 183 | $filters = array('airlines' => array($stats_airline)); |
| 184 | 184 | if ($filter_name != '') { |
| 185 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 185 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 186 | 186 | } |
| 187 | 187 | $Spotter = new Spotter($this->db); |
| 188 | 188 | $all = $Spotter->countAllDepartureCountries($filters); |
| 189 | - } |
|
| 190 | - return $all; |
|
| 189 | + } |
|
| 190 | + return $all; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | public function countAllAirlines($limit = true,$filter_name = '') { |
@@ -195,45 +195,45 @@ discard block |
||
| 195 | 195 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 196 | 196 | if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
| 197 | 197 | else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC"; |
| 198 | - try { |
|
| 199 | - $sth = $this->db->prepare($query); |
|
| 200 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 201 | - } catch(PDOException $e) { |
|
| 202 | - echo "error : ".$e->getMessage(); |
|
| 203 | - } |
|
| 204 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 205 | - if (empty($all)) { |
|
| 206 | - $Spotter = new Spotter($this->db); |
|
| 207 | - $filters = array(); |
|
| 208 | - if ($filter_name != '') { |
|
| 209 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 198 | + try { |
|
| 199 | + $sth = $this->db->prepare($query); |
|
| 200 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 201 | + } catch(PDOException $e) { |
|
| 202 | + echo "error : ".$e->getMessage(); |
|
| 203 | + } |
|
| 204 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 205 | + if (empty($all)) { |
|
| 206 | + $Spotter = new Spotter($this->db); |
|
| 207 | + $filters = array(); |
|
| 208 | + if ($filter_name != '') { |
|
| 209 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
| 213 | - } |
|
| 214 | - return $all; |
|
| 212 | + $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
| 213 | + } |
|
| 214 | + return $all; |
|
| 215 | 215 | } |
| 216 | 216 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') { |
| 217 | 217 | global $globalStatsFilters; |
| 218 | 218 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 219 | 219 | if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
| 220 | 220 | else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
| 221 | - try { |
|
| 222 | - $sth = $this->db->prepare($query); |
|
| 223 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 224 | - } catch(PDOException $e) { |
|
| 225 | - echo "error : ".$e->getMessage(); |
|
| 226 | - } |
|
| 227 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 228 | - if (empty($all)) { |
|
| 221 | + try { |
|
| 222 | + $sth = $this->db->prepare($query); |
|
| 223 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 224 | + } catch(PDOException $e) { |
|
| 225 | + echo "error : ".$e->getMessage(); |
|
| 226 | + } |
|
| 227 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 228 | + if (empty($all)) { |
|
| 229 | 229 | $filters = array('airlines' => array($stats_airline)); |
| 230 | 230 | if ($filter_name != '') { |
| 231 | 231 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 232 | 232 | } |
| 233 | - $Spotter = new Spotter($this->db); |
|
| 234 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
| 235 | - } |
|
| 236 | - return $all; |
|
| 233 | + $Spotter = new Spotter($this->db); |
|
| 234 | + $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
| 235 | + } |
|
| 236 | + return $all; |
|
| 237 | 237 | } |
| 238 | 238 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') { |
| 239 | 239 | global $globalStatsFilters; |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | echo "error : ".$e->getMessage(); |
| 271 | 271 | } |
| 272 | 272 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 273 | - /* |
|
| 273 | + /* |
|
| 274 | 274 | if (empty($all)) { |
| 275 | 275 | $Spotter = new Spotter($this->db); |
| 276 | 276 | $all = $Spotter->countAllFlightOverCountries($limit); |
@@ -286,84 +286,84 @@ discard block |
||
| 286 | 286 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 287 | 287 | if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
| 288 | 288 | else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
| 289 | - try { |
|
| 290 | - $sth = $this->db->prepare($query); |
|
| 291 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 292 | - } catch(PDOException $e) { |
|
| 293 | - echo "error : ".$e->getMessage(); |
|
| 294 | - } |
|
| 295 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 296 | - if (empty($all)) { |
|
| 289 | + try { |
|
| 290 | + $sth = $this->db->prepare($query); |
|
| 291 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 292 | + } catch(PDOException $e) { |
|
| 293 | + echo "error : ".$e->getMessage(); |
|
| 294 | + } |
|
| 295 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 296 | + if (empty($all)) { |
|
| 297 | 297 | $filters = array('airlines' => array($stats_airline)); |
| 298 | 298 | if ($filter_name != '') { |
| 299 | 299 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 300 | 300 | } |
| 301 | - $Spotter = new Spotter($this->db); |
|
| 302 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
| 303 | - } |
|
| 304 | - return $all; |
|
| 301 | + $Spotter = new Spotter($this->db); |
|
| 302 | + $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
| 303 | + } |
|
| 304 | + return $all; |
|
| 305 | 305 | } |
| 306 | 306 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') { |
| 307 | 307 | global $globalStatsFilters; |
| 308 | 308 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 309 | 309 | if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
| 310 | 310 | else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
| 311 | - try { |
|
| 312 | - $sth = $this->db->prepare($query); |
|
| 313 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 314 | - } catch(PDOException $e) { |
|
| 315 | - echo "error : ".$e->getMessage(); |
|
| 316 | - } |
|
| 317 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 318 | - if (empty($all)) { |
|
| 311 | + try { |
|
| 312 | + $sth = $this->db->prepare($query); |
|
| 313 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 314 | + } catch(PDOException $e) { |
|
| 315 | + echo "error : ".$e->getMessage(); |
|
| 316 | + } |
|
| 317 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 318 | + if (empty($all)) { |
|
| 319 | 319 | $filters = array('airlines' => array($stats_airline)); |
| 320 | 320 | if ($filter_name != '') { |
| 321 | 321 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 322 | 322 | } |
| 323 | - $Spotter = new Spotter($this->db); |
|
| 324 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
| 325 | - } |
|
| 326 | - return $all; |
|
| 323 | + $Spotter = new Spotter($this->db); |
|
| 324 | + $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
| 325 | + } |
|
| 326 | + return $all; |
|
| 327 | 327 | } |
| 328 | 328 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') { |
| 329 | 329 | global $globalStatsFilters; |
| 330 | 330 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 331 | 331 | if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
| 332 | 332 | else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
| 333 | - try { |
|
| 334 | - $sth = $this->db->prepare($query); |
|
| 335 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 336 | - } catch(PDOException $e) { |
|
| 337 | - echo "error : ".$e->getMessage(); |
|
| 338 | - } |
|
| 339 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 340 | - if (empty($all)) { |
|
| 333 | + try { |
|
| 334 | + $sth = $this->db->prepare($query); |
|
| 335 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
| 336 | + } catch(PDOException $e) { |
|
| 337 | + echo "error : ".$e->getMessage(); |
|
| 338 | + } |
|
| 339 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 340 | + if (empty($all)) { |
|
| 341 | 341 | $filters = array('airlines' => array($stats_airline)); |
| 342 | - if ($filter_name != '') { |
|
| 343 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 344 | - } |
|
| 345 | - $Spotter = new Spotter($this->db); |
|
| 346 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
| 347 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
| 348 | - $all = array(); |
|
| 349 | - foreach ($pall as $value) { |
|
| 350 | - $icao = $value['airport_departure_icao']; |
|
| 351 | - $all[$icao] = $value; |
|
| 352 | - } |
|
| 342 | + if ($filter_name != '') { |
|
| 343 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 344 | + } |
|
| 345 | + $Spotter = new Spotter($this->db); |
|
| 346 | + $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
| 347 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
| 348 | + $all = array(); |
|
| 349 | + foreach ($pall as $value) { |
|
| 350 | + $icao = $value['airport_departure_icao']; |
|
| 351 | + $all[$icao] = $value; |
|
| 352 | + } |
|
| 353 | 353 | |
| 354 | - foreach ($dall as $value) { |
|
| 355 | - $icao = $value['airport_departure_icao']; |
|
| 356 | - if (isset($all[$icao])) { |
|
| 357 | - $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 358 | - } else $all[$icao] = $value; |
|
| 359 | - } |
|
| 360 | - $count = array(); |
|
| 361 | - foreach ($all as $key => $row) { |
|
| 362 | - $count[$key] = $row['airport_departure_icao_count']; |
|
| 363 | - } |
|
| 364 | - array_multisort($count,SORT_DESC,$all); |
|
| 365 | - } |
|
| 366 | - return $all; |
|
| 354 | + foreach ($dall as $value) { |
|
| 355 | + $icao = $value['airport_departure_icao']; |
|
| 356 | + if (isset($all[$icao])) { |
|
| 357 | + $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 358 | + } else $all[$icao] = $value; |
|
| 359 | + } |
|
| 360 | + $count = array(); |
|
| 361 | + foreach ($all as $key => $row) { |
|
| 362 | + $count[$key] = $row['airport_departure_icao_count']; |
|
| 363 | + } |
|
| 364 | + array_multisort($count,SORT_DESC,$all); |
|
| 365 | + } |
|
| 366 | + return $all; |
|
| 367 | 367 | } |
| 368 | 368 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') { |
| 369 | 369 | global $globalStatsFilters; |
@@ -385,26 +385,26 @@ discard block |
||
| 385 | 385 | $Spotter = new Spotter($this->db); |
| 386 | 386 | $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
| 387 | 387 | $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
| 388 | - $all = array(); |
|
| 389 | - foreach ($pall as $value) { |
|
| 390 | - $icao = $value['airport_arrival_icao']; |
|
| 391 | - $all[$icao] = $value; |
|
| 392 | - } |
|
| 388 | + $all = array(); |
|
| 389 | + foreach ($pall as $value) { |
|
| 390 | + $icao = $value['airport_arrival_icao']; |
|
| 391 | + $all[$icao] = $value; |
|
| 392 | + } |
|
| 393 | 393 | |
| 394 | - foreach ($dall as $value) { |
|
| 395 | - $icao = $value['airport_arrival_icao']; |
|
| 396 | - if (isset($all[$icao])) { |
|
| 397 | - $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 398 | - } else $all[$icao] = $value; |
|
| 399 | - } |
|
| 400 | - $count = array(); |
|
| 401 | - foreach ($all as $key => $row) { |
|
| 402 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
| 403 | - } |
|
| 404 | - array_multisort($count,SORT_DESC,$all); |
|
| 405 | - } |
|
| 394 | + foreach ($dall as $value) { |
|
| 395 | + $icao = $value['airport_arrival_icao']; |
|
| 396 | + if (isset($all[$icao])) { |
|
| 397 | + $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 398 | + } else $all[$icao] = $value; |
|
| 399 | + } |
|
| 400 | + $count = array(); |
|
| 401 | + foreach ($all as $key => $row) { |
|
| 402 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
| 403 | + } |
|
| 404 | + array_multisort($count,SORT_DESC,$all); |
|
| 405 | + } |
|
| 406 | 406 | |
| 407 | - return $all; |
|
| 407 | + return $all; |
|
| 408 | 408 | } |
| 409 | 409 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
| 410 | 410 | global $globalDBdriver, $globalStatsFilters; |
@@ -417,23 +417,23 @@ discard block |
||
| 417 | 417 | else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 418 | 418 | } |
| 419 | 419 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 420 | - try { |
|
| 421 | - $sth = $this->db->prepare($query); |
|
| 422 | - $sth->execute($query_data); |
|
| 423 | - } catch(PDOException $e) { |
|
| 424 | - echo "error : ".$e->getMessage(); |
|
| 425 | - } |
|
| 426 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 427 | - if (empty($all)) { |
|
| 420 | + try { |
|
| 421 | + $sth = $this->db->prepare($query); |
|
| 422 | + $sth->execute($query_data); |
|
| 423 | + } catch(PDOException $e) { |
|
| 424 | + echo "error : ".$e->getMessage(); |
|
| 425 | + } |
|
| 426 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 427 | + if (empty($all)) { |
|
| 428 | 428 | $filters = array('airlines' => array($stats_airline)); |
| 429 | 429 | if ($filter_name != '') { |
| 430 | 430 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 431 | 431 | } |
| 432 | - $Spotter = new Spotter($this->db); |
|
| 433 | - $all = $Spotter->countAllMonthsLastYear($filters); |
|
| 434 | - } |
|
| 432 | + $Spotter = new Spotter($this->db); |
|
| 433 | + $all = $Spotter->countAllMonthsLastYear($filters); |
|
| 434 | + } |
|
| 435 | 435 | |
| 436 | - return $all; |
|
| 436 | + return $all; |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
@@ -441,22 +441,22 @@ discard block |
||
| 441 | 441 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 442 | 442 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 443 | 443 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 444 | - try { |
|
| 445 | - $sth = $this->db->prepare($query); |
|
| 446 | - $sth->execute($query_data); |
|
| 447 | - } catch(PDOException $e) { |
|
| 448 | - echo "error : ".$e->getMessage(); |
|
| 449 | - } |
|
| 450 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 451 | - if (empty($all)) { |
|
| 444 | + try { |
|
| 445 | + $sth = $this->db->prepare($query); |
|
| 446 | + $sth->execute($query_data); |
|
| 447 | + } catch(PDOException $e) { |
|
| 448 | + echo "error : ".$e->getMessage(); |
|
| 449 | + } |
|
| 450 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 451 | + if (empty($all)) { |
|
| 452 | 452 | $filters = array('airlines' => array($stats_airline)); |
| 453 | 453 | if ($filter_name != '') { |
| 454 | 454 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 455 | 455 | } |
| 456 | - $Spotter = new Spotter($this->db); |
|
| 457 | - $all = $Spotter->countAllDatesLastMonth($filters); |
|
| 458 | - } |
|
| 459 | - return $all; |
|
| 456 | + $Spotter = new Spotter($this->db); |
|
| 457 | + $all = $Spotter->countAllDatesLastMonth($filters); |
|
| 458 | + } |
|
| 459 | + return $all; |
|
| 460 | 460 | } |
| 461 | 461 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
| 462 | 462 | global $globalDBdriver, $globalStatsFilters; |
@@ -467,108 +467,108 @@ discard block |
||
| 467 | 467 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 468 | 468 | } |
| 469 | 469 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 470 | - try { |
|
| 471 | - $sth = $this->db->prepare($query); |
|
| 472 | - $sth->execute($query_data); |
|
| 473 | - } catch(PDOException $e) { |
|
| 474 | - echo "error : ".$e->getMessage(); |
|
| 475 | - } |
|
| 476 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 477 | - if (empty($all)) { |
|
| 470 | + try { |
|
| 471 | + $sth = $this->db->prepare($query); |
|
| 472 | + $sth->execute($query_data); |
|
| 473 | + } catch(PDOException $e) { |
|
| 474 | + echo "error : ".$e->getMessage(); |
|
| 475 | + } |
|
| 476 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 477 | + if (empty($all)) { |
|
| 478 | 478 | $filters = array('airlines' => array($stats_airline)); |
| 479 | 479 | if ($filter_name != '') { |
| 480 | 480 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 481 | 481 | } |
| 482 | - $Spotter = new Spotter($this->db); |
|
| 483 | - $all = $Spotter->countAllDatesLast7Days($filters); |
|
| 484 | - } |
|
| 485 | - return $all; |
|
| 482 | + $Spotter = new Spotter($this->db); |
|
| 483 | + $all = $Spotter->countAllDatesLast7Days($filters); |
|
| 484 | + } |
|
| 485 | + return $all; |
|
| 486 | 486 | } |
| 487 | 487 | public function countAllDates($stats_airline = '',$filter_name = '') { |
| 488 | 488 | global $globalStatsFilters; |
| 489 | 489 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 490 | 490 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 491 | 491 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
| 492 | - try { |
|
| 493 | - $sth = $this->db->prepare($query); |
|
| 494 | - $sth->execute($query_data); |
|
| 495 | - } catch(PDOException $e) { |
|
| 496 | - echo "error : ".$e->getMessage(); |
|
| 497 | - } |
|
| 498 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 499 | - if (empty($all)) { |
|
| 492 | + try { |
|
| 493 | + $sth = $this->db->prepare($query); |
|
| 494 | + $sth->execute($query_data); |
|
| 495 | + } catch(PDOException $e) { |
|
| 496 | + echo "error : ".$e->getMessage(); |
|
| 497 | + } |
|
| 498 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 499 | + if (empty($all)) { |
|
| 500 | 500 | $filters = array('airlines' => array($stats_airline)); |
| 501 | 501 | if ($filter_name != '') { |
| 502 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 502 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 503 | 503 | } |
| 504 | - $Spotter = new Spotter($this->db); |
|
| 505 | - $all = $Spotter->countAllDates($filters); |
|
| 506 | - } |
|
| 507 | - return $all; |
|
| 504 | + $Spotter = new Spotter($this->db); |
|
| 505 | + $all = $Spotter->countAllDates($filters); |
|
| 506 | + } |
|
| 507 | + return $all; |
|
| 508 | 508 | } |
| 509 | 509 | public function countAllDatesByAirlines($filter_name = '') { |
| 510 | 510 | global $globalStatsFilters; |
| 511 | 511 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 512 | 512 | $query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name"; |
| 513 | 513 | $query_data = array('filter_name' => $filter_name); |
| 514 | - try { |
|
| 515 | - $sth = $this->db->prepare($query); |
|
| 516 | - $sth->execute($query_data); |
|
| 517 | - } catch(PDOException $e) { |
|
| 518 | - echo "error : ".$e->getMessage(); |
|
| 519 | - } |
|
| 520 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 521 | - if (empty($all)) { |
|
| 522 | - $filters = array(); |
|
| 523 | - if ($filter_name != '') { |
|
| 524 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 525 | - } |
|
| 526 | - $Spotter = new Spotter($this->db); |
|
| 527 | - $all = $Spotter->countAllDatesByAirlines($filters); |
|
| 528 | - } |
|
| 529 | - return $all; |
|
| 514 | + try { |
|
| 515 | + $sth = $this->db->prepare($query); |
|
| 516 | + $sth->execute($query_data); |
|
| 517 | + } catch(PDOException $e) { |
|
| 518 | + echo "error : ".$e->getMessage(); |
|
| 519 | + } |
|
| 520 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 521 | + if (empty($all)) { |
|
| 522 | + $filters = array(); |
|
| 523 | + if ($filter_name != '') { |
|
| 524 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 525 | + } |
|
| 526 | + $Spotter = new Spotter($this->db); |
|
| 527 | + $all = $Spotter->countAllDatesByAirlines($filters); |
|
| 528 | + } |
|
| 529 | + return $all; |
|
| 530 | 530 | } |
| 531 | 531 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
| 532 | 532 | global $globalStatsFilters; |
| 533 | 533 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 534 | - $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 535 | - try { |
|
| 536 | - $sth = $this->db->prepare($query); |
|
| 537 | - $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 538 | - } catch(PDOException $e) { |
|
| 539 | - echo "error : ".$e->getMessage(); |
|
| 540 | - } |
|
| 541 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 542 | - if (empty($all)) { |
|
| 534 | + $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 535 | + try { |
|
| 536 | + $sth = $this->db->prepare($query); |
|
| 537 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 538 | + } catch(PDOException $e) { |
|
| 539 | + echo "error : ".$e->getMessage(); |
|
| 540 | + } |
|
| 541 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 542 | + if (empty($all)) { |
|
| 543 | 543 | $filters = array('airlines' => array($stats_airline)); |
| 544 | 544 | if ($filter_name != '') { |
| 545 | 545 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
| 546 | 546 | } |
| 547 | - $Spotter = new Spotter($this->db); |
|
| 548 | - $all = $Spotter->countAllMonths($filters); |
|
| 549 | - } |
|
| 550 | - return $all; |
|
| 547 | + $Spotter = new Spotter($this->db); |
|
| 548 | + $all = $Spotter->countAllMonths($filters); |
|
| 549 | + } |
|
| 550 | + return $all; |
|
| 551 | 551 | } |
| 552 | 552 | public function countAllMilitaryMonths($filter_name = '') { |
| 553 | 553 | global $globalStatsFilters; |
| 554 | 554 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 555 | - $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
|
| 556 | - try { |
|
| 557 | - $sth = $this->db->prepare($query); |
|
| 558 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 559 | - } catch(PDOException $e) { |
|
| 560 | - echo "error : ".$e->getMessage(); |
|
| 561 | - } |
|
| 562 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 563 | - if (empty($all)) { |
|
| 564 | - $filters = array(); |
|
| 565 | - if ($filter_name != '') { |
|
| 566 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 567 | - } |
|
| 568 | - $Spotter = new Spotter($this->db); |
|
| 569 | - $all = $Spotter->countAllMilitaryMonths($filters); |
|
| 570 | - } |
|
| 571 | - return $all; |
|
| 555 | + $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
|
| 556 | + try { |
|
| 557 | + $sth = $this->db->prepare($query); |
|
| 558 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 559 | + } catch(PDOException $e) { |
|
| 560 | + echo "error : ".$e->getMessage(); |
|
| 561 | + } |
|
| 562 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 563 | + if (empty($all)) { |
|
| 564 | + $filters = array(); |
|
| 565 | + if ($filter_name != '') { |
|
| 566 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 567 | + } |
|
| 568 | + $Spotter = new Spotter($this->db); |
|
| 569 | + $all = $Spotter->countAllMilitaryMonths($filters); |
|
| 570 | + } |
|
| 571 | + return $all; |
|
| 572 | 572 | } |
| 573 | 573 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
| 574 | 574 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
@@ -584,22 +584,22 @@ discard block |
||
| 584 | 584 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
| 585 | 585 | } |
| 586 | 586 | if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
| 587 | - try { |
|
| 588 | - $sth = $this->db->prepare($query); |
|
| 589 | - $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 590 | - } catch(PDOException $e) { |
|
| 591 | - echo "error : ".$e->getMessage(); |
|
| 592 | - } |
|
| 593 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 594 | - if (empty($all)) { |
|
| 587 | + try { |
|
| 588 | + $sth = $this->db->prepare($query); |
|
| 589 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 590 | + } catch(PDOException $e) { |
|
| 591 | + echo "error : ".$e->getMessage(); |
|
| 592 | + } |
|
| 593 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 594 | + if (empty($all)) { |
|
| 595 | 595 | $filters = array('airlines' => array($stats_airline)); |
| 596 | 596 | if ($filter_name != '') { |
| 597 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 597 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 598 | 598 | } |
| 599 | - $Spotter = new Spotter($this->db); |
|
| 600 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
| 601 | - } |
|
| 602 | - return $all; |
|
| 599 | + $Spotter = new Spotter($this->db); |
|
| 600 | + $all = $Spotter->countAllHours($orderby,$filters); |
|
| 601 | + } |
|
| 602 | + return $all; |
|
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | public function countOverallFlights($stats_airline = '', $filter_name = '') { |
@@ -621,9 +621,9 @@ discard block |
||
| 621 | 621 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 622 | 622 | $all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name); |
| 623 | 623 | if (empty($all)) { |
| 624 | - $filters = array(); |
|
| 625 | - if ($filter_name != '') { |
|
| 626 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 624 | + $filters = array(); |
|
| 625 | + if ($filter_name != '') { |
|
| 626 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 627 | 627 | } |
| 628 | 628 | $Spotter = new Spotter($this->db); |
| 629 | 629 | $all = $Spotter->countOverallMilitaryFlights($filters); |
@@ -662,19 +662,19 @@ discard block |
||
| 662 | 662 | global $globalStatsFilters; |
| 663 | 663 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 664 | 664 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
| 665 | - try { |
|
| 666 | - $sth = $this->db->prepare($query); |
|
| 667 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 668 | - } catch(PDOException $e) { |
|
| 669 | - echo "error : ".$e->getMessage(); |
|
| 670 | - } |
|
| 671 | - $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 672 | - $all = $result[0]['nb_airline']; |
|
| 665 | + try { |
|
| 666 | + $sth = $this->db->prepare($query); |
|
| 667 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 668 | + } catch(PDOException $e) { |
|
| 669 | + echo "error : ".$e->getMessage(); |
|
| 670 | + } |
|
| 671 | + $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 672 | + $all = $result[0]['nb_airline']; |
|
| 673 | 673 | //$all = $this->getSumStats('airlines_bymonth',date('Y')); |
| 674 | 674 | if (empty($all)) { |
| 675 | - $filters = array(); |
|
| 676 | - if ($filter_name != '') { |
|
| 677 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 675 | + $filters = array(); |
|
| 676 | + if ($filter_name != '') { |
|
| 677 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
| 678 | 678 | } |
| 679 | 679 | $Spotter = new Spotter($this->db); |
| 680 | 680 | $all = $Spotter->countOverallAirlines($filters); |
@@ -725,166 +725,166 @@ discard block |
||
| 725 | 725 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 726 | 726 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
| 727 | 727 | $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
| 728 | - try { |
|
| 729 | - $sth = $this->db->prepare($query); |
|
| 730 | - $sth->execute($query_values); |
|
| 731 | - } catch(PDOException $e) { |
|
| 732 | - echo "error : ".$e->getMessage(); |
|
| 733 | - } |
|
| 734 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 735 | - return $all; |
|
| 728 | + try { |
|
| 729 | + $sth = $this->db->prepare($query); |
|
| 730 | + $sth->execute($query_values); |
|
| 731 | + } catch(PDOException $e) { |
|
| 732 | + echo "error : ".$e->getMessage(); |
|
| 733 | + } |
|
| 734 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 735 | + return $all; |
|
| 736 | 736 | } |
| 737 | 737 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
| 738 | 738 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 739 | - $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
|
| 740 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 741 | - try { |
|
| 742 | - $sth = $this->db->prepare($query); |
|
| 743 | - $sth->execute($query_values); |
|
| 744 | - } catch(PDOException $e) { |
|
| 745 | - echo "error : ".$e->getMessage(); |
|
| 746 | - } |
|
| 747 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 748 | - return $all; |
|
| 749 | - } |
|
| 739 | + $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
|
| 740 | + $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 741 | + try { |
|
| 742 | + $sth = $this->db->prepare($query); |
|
| 743 | + $sth->execute($query_values); |
|
| 744 | + } catch(PDOException $e) { |
|
| 745 | + echo "error : ".$e->getMessage(); |
|
| 746 | + } |
|
| 747 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 748 | + return $all; |
|
| 749 | + } |
|
| 750 | 750 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') { |
| 751 | 751 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 752 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 753 | - if ($globalDBdriver == 'mysql') { |
|
| 754 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 755 | - } else { |
|
| 756 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 757 | - } |
|
| 758 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 759 | - try { |
|
| 760 | - $sth = $this->db->prepare($query); |
|
| 761 | - $sth->execute($query_values); |
|
| 762 | - } catch(PDOException $e) { |
|
| 763 | - echo "error : ".$e->getMessage(); |
|
| 764 | - } |
|
| 765 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 766 | - return $all[0]['total']; |
|
| 767 | - } |
|
| 752 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 753 | + if ($globalDBdriver == 'mysql') { |
|
| 754 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 755 | + } else { |
|
| 756 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
| 757 | + } |
|
| 758 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 759 | + try { |
|
| 760 | + $sth = $this->db->prepare($query); |
|
| 761 | + $sth->execute($query_values); |
|
| 762 | + } catch(PDOException $e) { |
|
| 763 | + echo "error : ".$e->getMessage(); |
|
| 764 | + } |
|
| 765 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 766 | + return $all[0]['total']; |
|
| 767 | + } |
|
| 768 | 768 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
| 769 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 769 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 770 | 770 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 771 | - if ($globalDBdriver == 'mysql') { |
|
| 771 | + if ($globalDBdriver == 'mysql') { |
|
| 772 | 772 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 773 | 773 | } else { |
| 774 | 774 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 775 | - } |
|
| 776 | - $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 777 | - try { |
|
| 778 | - $sth = $this->db->prepare($query); |
|
| 779 | - $sth->execute($query_values); |
|
| 780 | - } catch(PDOException $e) { |
|
| 781 | - echo "error : ".$e->getMessage(); |
|
| 782 | - } |
|
| 783 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 784 | - return $all[0]['total']; |
|
| 785 | - } |
|
| 775 | + } |
|
| 776 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
| 777 | + try { |
|
| 778 | + $sth = $this->db->prepare($query); |
|
| 779 | + $sth->execute($query_values); |
|
| 780 | + } catch(PDOException $e) { |
|
| 781 | + echo "error : ".$e->getMessage(); |
|
| 782 | + } |
|
| 783 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 784 | + return $all[0]['total']; |
|
| 785 | + } |
|
| 786 | 786 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
| 787 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 787 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 788 | 788 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 789 | - if ($globalDBdriver == 'mysql') { |
|
| 789 | + if ($globalDBdriver == 'mysql') { |
|
| 790 | 790 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 791 | - } else { |
|
| 791 | + } else { |
|
| 792 | 792 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
| 793 | - } |
|
| 794 | - try { |
|
| 795 | - $sth = $this->db->prepare($query); |
|
| 796 | - $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 797 | - } catch(PDOException $e) { |
|
| 798 | - echo "error : ".$e->getMessage(); |
|
| 799 | - } |
|
| 800 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 801 | - return $all[0]['total']; |
|
| 802 | - } |
|
| 793 | + } |
|
| 794 | + try { |
|
| 795 | + $sth = $this->db->prepare($query); |
|
| 796 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
| 797 | + } catch(PDOException $e) { |
|
| 798 | + echo "error : ".$e->getMessage(); |
|
| 799 | + } |
|
| 800 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 801 | + return $all[0]['total']; |
|
| 802 | + } |
|
| 803 | 803 | public function getStatsAirlineTotal($filter_name = '') { |
| 804 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 804 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 805 | 805 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 806 | - if ($globalDBdriver == 'mysql') { |
|
| 806 | + if ($globalDBdriver == 'mysql') { |
|
| 807 | 807 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
| 808 | - } else { |
|
| 808 | + } else { |
|
| 809 | 809 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
| 810 | - } |
|
| 811 | - try { |
|
| 812 | - $sth = $this->db->prepare($query); |
|
| 813 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 814 | - } catch(PDOException $e) { |
|
| 815 | - echo "error : ".$e->getMessage(); |
|
| 816 | - } |
|
| 817 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 818 | - return $all[0]['total']; |
|
| 819 | - } |
|
| 810 | + } |
|
| 811 | + try { |
|
| 812 | + $sth = $this->db->prepare($query); |
|
| 813 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 814 | + } catch(PDOException $e) { |
|
| 815 | + echo "error : ".$e->getMessage(); |
|
| 816 | + } |
|
| 817 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 818 | + return $all[0]['total']; |
|
| 819 | + } |
|
| 820 | 820 | public function getStatsOwnerTotal($filter_name = '') { |
| 821 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 821 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 822 | 822 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 823 | - if ($globalDBdriver == 'mysql') { |
|
| 823 | + if ($globalDBdriver == 'mysql') { |
|
| 824 | 824 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
| 825 | 825 | } else { |
| 826 | 826 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
| 827 | - } |
|
| 828 | - try { |
|
| 829 | - $sth = $this->db->prepare($query); |
|
| 830 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 831 | - } catch(PDOException $e) { |
|
| 832 | - echo "error : ".$e->getMessage(); |
|
| 833 | - } |
|
| 834 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 835 | - return $all[0]['total']; |
|
| 836 | - } |
|
| 827 | + } |
|
| 828 | + try { |
|
| 829 | + $sth = $this->db->prepare($query); |
|
| 830 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 831 | + } catch(PDOException $e) { |
|
| 832 | + echo "error : ".$e->getMessage(); |
|
| 833 | + } |
|
| 834 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 835 | + return $all[0]['total']; |
|
| 836 | + } |
|
| 837 | 837 | public function getStatsPilotTotal($filter_name = '') { |
| 838 | - global $globalArchiveMonths, $globalDBdriver; |
|
| 838 | + global $globalArchiveMonths, $globalDBdriver; |
|
| 839 | 839 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 840 | - if ($globalDBdriver == 'mysql') { |
|
| 841 | - $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
| 842 | - } else { |
|
| 843 | - $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
| 844 | - } |
|
| 845 | - try { |
|
| 846 | - $sth = $this->db->prepare($query); |
|
| 847 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
| 848 | - } catch(PDOException $e) { |
|
| 849 | - echo "error : ".$e->getMessage(); |
|
| 850 | - } |
|
| 851 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 852 | - return $all[0]['total']; |
|
| 853 | - } |
|
| 840 | + if ($globalDBdriver == 'mysql') { |
|
| 841 | + $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
| 842 | + } else { |
|
| 843 | + $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
| 844 | + } |
|
| 845 | + try { |
|
| 846 | + $sth = $this->db->prepare($query); |
|
| 847 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
| 848 | + } catch(PDOException $e) { |
|
| 849 | + echo "error : ".$e->getMessage(); |
|
| 850 | + } |
|
| 851 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 852 | + return $all[0]['total']; |
|
| 853 | + } |
|
| 854 | 854 | |
| 855 | 855 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 856 | 856 | global $globalDBdriver; |
| 857 | 857 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 858 | 858 | if ($globalDBdriver == 'mysql') { |
| 859 | 859 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
| 860 | - } else { |
|
| 860 | + } else { |
|
| 861 | 861 | $query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 862 | 862 | } |
| 863 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 864 | - try { |
|
| 865 | - $sth = $this->db->prepare($query); |
|
| 866 | - $sth->execute($query_values); |
|
| 867 | - } catch(PDOException $e) { |
|
| 868 | - return "error : ".$e->getMessage(); |
|
| 869 | - } |
|
| 870 | - } |
|
| 863 | + $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 864 | + try { |
|
| 865 | + $sth = $this->db->prepare($query); |
|
| 866 | + $sth->execute($query_values); |
|
| 867 | + } catch(PDOException $e) { |
|
| 868 | + return "error : ".$e->getMessage(); |
|
| 869 | + } |
|
| 870 | + } |
|
| 871 | 871 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 872 | 872 | global $globalDBdriver; |
| 873 | 873 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 874 | 874 | if ($globalDBdriver == 'mysql') { |
| 875 | 875 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
| 876 | 876 | } else { |
| 877 | - //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
|
| 877 | + //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
|
| 878 | 878 | $query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 879 | - } |
|
| 880 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 881 | - try { |
|
| 882 | - $sth = $this->db->prepare($query); |
|
| 883 | - $sth->execute($query_values); |
|
| 884 | - } catch(PDOException $e) { |
|
| 885 | - return "error : ".$e->getMessage(); |
|
| 886 | - } |
|
| 887 | - } |
|
| 879 | + } |
|
| 880 | + $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 881 | + try { |
|
| 882 | + $sth = $this->db->prepare($query); |
|
| 883 | + $sth->execute($query_values); |
|
| 884 | + } catch(PDOException $e) { |
|
| 885 | + return "error : ".$e->getMessage(); |
|
| 886 | + } |
|
| 887 | + } |
|
| 888 | 888 | public function getStatsSource($date,$stats_type = '') { |
| 889 | 889 | if ($stats_type == '') { |
| 890 | 890 | $query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
@@ -893,15 +893,15 @@ discard block |
||
| 893 | 893 | $query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name"; |
| 894 | 894 | $query_values = array(':date' => $date,':stats_type' => $stats_type); |
| 895 | 895 | } |
| 896 | - try { |
|
| 897 | - $sth = $this->db->prepare($query); |
|
| 898 | - $sth->execute($query_values); |
|
| 899 | - } catch(PDOException $e) { |
|
| 900 | - echo "error : ".$e->getMessage(); |
|
| 901 | - } |
|
| 902 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 903 | - return $all; |
|
| 904 | - } |
|
| 896 | + try { |
|
| 897 | + $sth = $this->db->prepare($query); |
|
| 898 | + $sth->execute($query_values); |
|
| 899 | + } catch(PDOException $e) { |
|
| 900 | + echo "error : ".$e->getMessage(); |
|
| 901 | + } |
|
| 902 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 903 | + return $all; |
|
| 904 | + } |
|
| 905 | 905 | |
| 906 | 906 | public function addStatSource($data,$source_name,$stats_type,$date) { |
| 907 | 907 | global $globalDBdriver; |
@@ -909,25 +909,25 @@ discard block |
||
| 909 | 909 | $query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data"; |
| 910 | 910 | } else { |
| 911 | 911 | $query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; |
| 912 | - } |
|
| 913 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
| 914 | - try { |
|
| 915 | - $sth = $this->db->prepare($query); |
|
| 916 | - $sth->execute($query_values); |
|
| 917 | - } catch(PDOException $e) { |
|
| 918 | - return "error : ".$e->getMessage(); |
|
| 919 | - } |
|
| 920 | - } |
|
| 912 | + } |
|
| 913 | + $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
| 914 | + try { |
|
| 915 | + $sth = $this->db->prepare($query); |
|
| 916 | + $sth->execute($query_values); |
|
| 917 | + } catch(PDOException $e) { |
|
| 918 | + return "error : ".$e->getMessage(); |
|
| 919 | + } |
|
| 920 | + } |
|
| 921 | 921 | public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
| 922 | - $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
|
| 923 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 924 | - try { |
|
| 925 | - $sth = $this->db->prepare($query); |
|
| 926 | - $sth->execute($query_values); |
|
| 927 | - } catch(PDOException $e) { |
|
| 928 | - return "error : ".$e->getMessage(); |
|
| 929 | - } |
|
| 930 | - } |
|
| 922 | + $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
|
| 923 | + $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 924 | + try { |
|
| 925 | + $sth = $this->db->prepare($query); |
|
| 926 | + $sth->execute($query_values); |
|
| 927 | + } catch(PDOException $e) { |
|
| 928 | + return "error : ".$e->getMessage(); |
|
| 929 | + } |
|
| 930 | + } |
|
| 931 | 931 | public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') { |
| 932 | 932 | global $globalDBdriver; |
| 933 | 933 | if ($globalDBdriver == 'mysql') { |
@@ -935,14 +935,14 @@ discard block |
||
| 935 | 935 | } else { |
| 936 | 936 | $query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 937 | 937 | } |
| 938 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 939 | - try { |
|
| 940 | - $sth = $this->db->prepare($query); |
|
| 941 | - $sth->execute($query_values); |
|
| 942 | - } catch(PDOException $e) { |
|
| 943 | - return "error : ".$e->getMessage(); |
|
| 944 | - } |
|
| 945 | - } |
|
| 938 | + $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 939 | + try { |
|
| 940 | + $sth = $this->db->prepare($query); |
|
| 941 | + $sth->execute($query_values); |
|
| 942 | + } catch(PDOException $e) { |
|
| 943 | + return "error : ".$e->getMessage(); |
|
| 944 | + } |
|
| 945 | + } |
|
| 946 | 946 | public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') { |
| 947 | 947 | global $globalDBdriver; |
| 948 | 948 | if ($globalDBdriver == 'mysql') { |
@@ -950,14 +950,14 @@ discard block |
||
| 950 | 950 | } else { |
| 951 | 951 | $query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; |
| 952 | 952 | } |
| 953 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 954 | - try { |
|
| 955 | - $sth = $this->db->prepare($query); |
|
| 956 | - $sth->execute($query_values); |
|
| 957 | - } catch(PDOException $e) { |
|
| 958 | - return "error : ".$e->getMessage(); |
|
| 959 | - } |
|
| 960 | - } |
|
| 953 | + $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
| 954 | + try { |
|
| 955 | + $sth = $this->db->prepare($query); |
|
| 956 | + $sth->execute($query_values); |
|
| 957 | + } catch(PDOException $e) { |
|
| 958 | + return "error : ".$e->getMessage(); |
|
| 959 | + } |
|
| 960 | + } |
|
| 961 | 961 | public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') { |
| 962 | 962 | global $globalDBdriver; |
| 963 | 963 | if ($globalDBdriver == 'mysql') { |
@@ -965,14 +965,14 @@ discard block |
||
| 965 | 965 | } else { |
| 966 | 966 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; |
| 967 | 967 | } |
| 968 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 969 | - try { |
|
| 970 | - $sth = $this->db->prepare($query); |
|
| 971 | - $sth->execute($query_values); |
|
| 972 | - } catch(PDOException $e) { |
|
| 973 | - return "error : ".$e->getMessage(); |
|
| 974 | - } |
|
| 975 | - } |
|
| 968 | + $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 969 | + try { |
|
| 970 | + $sth = $this->db->prepare($query); |
|
| 971 | + $sth->execute($query_values); |
|
| 972 | + } catch(PDOException $e) { |
|
| 973 | + return "error : ".$e->getMessage(); |
|
| 974 | + } |
|
| 975 | + } |
|
| 976 | 976 | public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') { |
| 977 | 977 | global $globalDBdriver; |
| 978 | 978 | if ($globalDBdriver == 'mysql') { |
@@ -980,14 +980,14 @@ discard block |
||
| 980 | 980 | } else { |
| 981 | 981 | $query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 982 | 982 | } |
| 983 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 984 | - try { |
|
| 985 | - $sth = $this->db->prepare($query); |
|
| 986 | - $sth->execute($query_values); |
|
| 987 | - } catch(PDOException $e) { |
|
| 988 | - return "error : ".$e->getMessage(); |
|
| 989 | - } |
|
| 990 | - } |
|
| 983 | + $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
| 984 | + try { |
|
| 985 | + $sth = $this->db->prepare($query); |
|
| 986 | + $sth->execute($query_values); |
|
| 987 | + } catch(PDOException $e) { |
|
| 988 | + return "error : ".$e->getMessage(); |
|
| 989 | + } |
|
| 990 | + } |
|
| 991 | 991 | public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') { |
| 992 | 992 | global $globalDBdriver; |
| 993 | 993 | if ($globalDBdriver == 'mysql') { |
@@ -995,14 +995,14 @@ discard block |
||
| 995 | 995 | } else { |
| 996 | 996 | $query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; |
| 997 | 997 | } |
| 998 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 999 | - try { |
|
| 1000 | - $sth = $this->db->prepare($query); |
|
| 1001 | - $sth->execute($query_values); |
|
| 1002 | - } catch(PDOException $e) { |
|
| 1003 | - return "error : ".$e->getMessage(); |
|
| 1004 | - } |
|
| 1005 | - } |
|
| 998 | + $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
| 999 | + try { |
|
| 1000 | + $sth = $this->db->prepare($query); |
|
| 1001 | + $sth->execute($query_values); |
|
| 1002 | + } catch(PDOException $e) { |
|
| 1003 | + return "error : ".$e->getMessage(); |
|
| 1004 | + } |
|
| 1005 | + } |
|
| 1006 | 1006 | public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') { |
| 1007 | 1007 | global $globalDBdriver; |
| 1008 | 1008 | if ($globalDBdriver == 'mysql') { |
@@ -1010,14 +1010,14 @@ discard block |
||
| 1010 | 1010 | } else { |
| 1011 | 1011 | $query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1012 | 1012 | } |
| 1013 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1014 | - try { |
|
| 1015 | - $sth = $this->db->prepare($query); |
|
| 1016 | - $sth->execute($query_values); |
|
| 1017 | - } catch(PDOException $e) { |
|
| 1018 | - return "error : ".$e->getMessage(); |
|
| 1019 | - } |
|
| 1020 | - } |
|
| 1013 | + $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1014 | + try { |
|
| 1015 | + $sth = $this->db->prepare($query); |
|
| 1016 | + $sth->execute($query_values); |
|
| 1017 | + } catch(PDOException $e) { |
|
| 1018 | + return "error : ".$e->getMessage(); |
|
| 1019 | + } |
|
| 1020 | + } |
|
| 1021 | 1021 | public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '') { |
| 1022 | 1022 | global $globalDBdriver; |
| 1023 | 1023 | if ($globalDBdriver == 'mysql') { |
@@ -1025,14 +1025,14 @@ discard block |
||
| 1025 | 1025 | } else { |
| 1026 | 1026 | $query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1027 | 1027 | } |
| 1028 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1029 | - try { |
|
| 1030 | - $sth = $this->db->prepare($query); |
|
| 1031 | - $sth->execute($query_values); |
|
| 1032 | - } catch(PDOException $e) { |
|
| 1033 | - return "error : ".$e->getMessage(); |
|
| 1034 | - } |
|
| 1035 | - } |
|
| 1028 | + $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
| 1029 | + try { |
|
| 1030 | + $sth = $this->db->prepare($query); |
|
| 1031 | + $sth->execute($query_values); |
|
| 1032 | + } catch(PDOException $e) { |
|
| 1033 | + return "error : ".$e->getMessage(); |
|
| 1034 | + } |
|
| 1035 | + } |
|
| 1036 | 1036 | public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
| 1037 | 1037 | global $globalDBdriver; |
| 1038 | 1038 | if ($globalDBdriver == 'mysql') { |
@@ -1040,14 +1040,14 @@ discard block |
||
| 1040 | 1040 | } else { |
| 1041 | 1041 | $query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
| 1042 | 1042 | } |
| 1043 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1044 | - try { |
|
| 1045 | - $sth = $this->db->prepare($query); |
|
| 1046 | - $sth->execute($query_values); |
|
| 1047 | - } catch(PDOException $e) { |
|
| 1048 | - return "error : ".$e->getMessage(); |
|
| 1049 | - } |
|
| 1050 | - } |
|
| 1043 | + $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1044 | + try { |
|
| 1045 | + $sth = $this->db->prepare($query); |
|
| 1046 | + $sth->execute($query_values); |
|
| 1047 | + } catch(PDOException $e) { |
|
| 1048 | + return "error : ".$e->getMessage(); |
|
| 1049 | + } |
|
| 1050 | + } |
|
| 1051 | 1051 | public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
| 1052 | 1052 | global $globalDBdriver; |
| 1053 | 1053 | if ($globalDBdriver == 'mysql') { |
@@ -1055,14 +1055,14 @@ discard block |
||
| 1055 | 1055 | } else { |
| 1056 | 1056 | $query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1057 | 1057 | } |
| 1058 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1059 | - try { |
|
| 1060 | - $sth = $this->db->prepare($query); |
|
| 1061 | - $sth->execute($query_values); |
|
| 1062 | - } catch(PDOException $e) { |
|
| 1063 | - return "error : ".$e->getMessage(); |
|
| 1064 | - } |
|
| 1065 | - } |
|
| 1058 | + $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1059 | + try { |
|
| 1060 | + $sth = $this->db->prepare($query); |
|
| 1061 | + $sth->execute($query_values); |
|
| 1062 | + } catch(PDOException $e) { |
|
| 1063 | + return "error : ".$e->getMessage(); |
|
| 1064 | + } |
|
| 1065 | + } |
|
| 1066 | 1066 | public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
| 1067 | 1067 | global $globalDBdriver; |
| 1068 | 1068 | if ($globalDBdriver == 'mysql') { |
@@ -1070,14 +1070,14 @@ discard block |
||
| 1070 | 1070 | } else { |
| 1071 | 1071 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
| 1072 | 1072 | } |
| 1073 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1074 | - try { |
|
| 1075 | - $sth = $this->db->prepare($query); |
|
| 1076 | - $sth->execute($query_values); |
|
| 1077 | - } catch(PDOException $e) { |
|
| 1078 | - return "error : ".$e->getMessage(); |
|
| 1079 | - } |
|
| 1080 | - } |
|
| 1073 | + $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1074 | + try { |
|
| 1075 | + $sth = $this->db->prepare($query); |
|
| 1076 | + $sth->execute($query_values); |
|
| 1077 | + } catch(PDOException $e) { |
|
| 1078 | + return "error : ".$e->getMessage(); |
|
| 1079 | + } |
|
| 1080 | + } |
|
| 1081 | 1081 | public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
| 1082 | 1082 | global $globalDBdriver; |
| 1083 | 1083 | if ($globalDBdriver == 'mysql') { |
@@ -1085,52 +1085,52 @@ discard block |
||
| 1085 | 1085 | } else { |
| 1086 | 1086 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
| 1087 | 1087 | } |
| 1088 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1089 | - try { |
|
| 1090 | - $sth = $this->db->prepare($query); |
|
| 1091 | - $sth->execute($query_values); |
|
| 1092 | - } catch(PDOException $e) { |
|
| 1093 | - return "error : ".$e->getMessage(); |
|
| 1094 | - } |
|
| 1095 | - } |
|
| 1088 | + $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
| 1089 | + try { |
|
| 1090 | + $sth = $this->db->prepare($query); |
|
| 1091 | + $sth->execute($query_values); |
|
| 1092 | + } catch(PDOException $e) { |
|
| 1093 | + return "error : ".$e->getMessage(); |
|
| 1094 | + } |
|
| 1095 | + } |
|
| 1096 | 1096 | |
| 1097 | 1097 | public function deleteStat($id) { |
| 1098 | - $query = "DELETE FROM stats WHERE stats_id = :id"; |
|
| 1099 | - $query_values = array(':id' => $id); |
|
| 1100 | - try { |
|
| 1101 | - $sth = $this->db->prepare($query); |
|
| 1102 | - $sth->execute($query_values); |
|
| 1103 | - } catch(PDOException $e) { |
|
| 1104 | - return "error : ".$e->getMessage(); |
|
| 1105 | - } |
|
| 1106 | - } |
|
| 1098 | + $query = "DELETE FROM stats WHERE stats_id = :id"; |
|
| 1099 | + $query_values = array(':id' => $id); |
|
| 1100 | + try { |
|
| 1101 | + $sth = $this->db->prepare($query); |
|
| 1102 | + $sth->execute($query_values); |
|
| 1103 | + } catch(PDOException $e) { |
|
| 1104 | + return "error : ".$e->getMessage(); |
|
| 1105 | + } |
|
| 1106 | + } |
|
| 1107 | 1107 | public function deleteStatFlight($type) { |
| 1108 | - $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
|
| 1109 | - $query_values = array(':type' => $type); |
|
| 1110 | - try { |
|
| 1111 | - $sth = $this->db->prepare($query); |
|
| 1112 | - $sth->execute($query_values); |
|
| 1113 | - } catch(PDOException $e) { |
|
| 1114 | - return "error : ".$e->getMessage(); |
|
| 1115 | - } |
|
| 1116 | - } |
|
| 1108 | + $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
|
| 1109 | + $query_values = array(':type' => $type); |
|
| 1110 | + try { |
|
| 1111 | + $sth = $this->db->prepare($query); |
|
| 1112 | + $sth->execute($query_values); |
|
| 1113 | + } catch(PDOException $e) { |
|
| 1114 | + return "error : ".$e->getMessage(); |
|
| 1115 | + } |
|
| 1116 | + } |
|
| 1117 | 1117 | public function deleteStatAirport($type) { |
| 1118 | - $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
|
| 1119 | - $query_values = array(':type' => $type); |
|
| 1120 | - try { |
|
| 1121 | - $sth = $this->db->prepare($query); |
|
| 1122 | - $sth->execute($query_values); |
|
| 1123 | - } catch(PDOException $e) { |
|
| 1124 | - return "error : ".$e->getMessage(); |
|
| 1125 | - } |
|
| 1126 | - } |
|
| 1118 | + $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
|
| 1119 | + $query_values = array(':type' => $type); |
|
| 1120 | + try { |
|
| 1121 | + $sth = $this->db->prepare($query); |
|
| 1122 | + $sth->execute($query_values); |
|
| 1123 | + } catch(PDOException $e) { |
|
| 1124 | + return "error : ".$e->getMessage(); |
|
| 1125 | + } |
|
| 1126 | + } |
|
| 1127 | 1127 | |
| 1128 | - public function addOldStats() { |
|
| 1129 | - global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters; |
|
| 1130 | - $Common = new Common(); |
|
| 1131 | - $Connection = new Connection(); |
|
| 1132 | - date_default_timezone_set('UTC'); |
|
| 1133 | - $last_update = $this->getLastStatsUpdate('last_update_stats'); |
|
| 1128 | + public function addOldStats() { |
|
| 1129 | + global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters; |
|
| 1130 | + $Common = new Common(); |
|
| 1131 | + $Connection = new Connection(); |
|
| 1132 | + date_default_timezone_set('UTC'); |
|
| 1133 | + $last_update = $this->getLastStatsUpdate('last_update_stats'); |
|
| 1134 | 1134 | //print_r($last_update); |
| 1135 | 1135 | /* |
| 1136 | 1136 | $flightsbymonth = $this->getStats('flights_by_month'); |
@@ -1392,24 +1392,24 @@ discard block |
||
| 1392 | 1392 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
| 1393 | 1393 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
| 1394 | 1394 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
| 1395 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
| 1395 | + $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
| 1396 | 1396 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
| 1397 | - $alldata = array(); |
|
| 1397 | + $alldata = array(); |
|
| 1398 | 1398 | |
| 1399 | - foreach ($pall as $value) { |
|
| 1400 | - $icao = $value['airport_departure_icao']; |
|
| 1401 | - $alldata[$icao] = $value; |
|
| 1402 | - } |
|
| 1403 | - foreach ($dall as $value) { |
|
| 1404 | - $icao = $value['airport_departure_icao']; |
|
| 1405 | - if (isset($alldata[$icao])) { |
|
| 1406 | - $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 1407 | - } else $alldata[$icao] = $value; |
|
| 1408 | - } |
|
| 1409 | - $count = array(); |
|
| 1410 | - foreach ($alldata as $key => $row) { |
|
| 1411 | - $count[$key] = $row['airport_departure_icao_count']; |
|
| 1412 | - } |
|
| 1399 | + foreach ($pall as $value) { |
|
| 1400 | + $icao = $value['airport_departure_icao']; |
|
| 1401 | + $alldata[$icao] = $value; |
|
| 1402 | + } |
|
| 1403 | + foreach ($dall as $value) { |
|
| 1404 | + $icao = $value['airport_departure_icao']; |
|
| 1405 | + if (isset($alldata[$icao])) { |
|
| 1406 | + $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 1407 | + } else $alldata[$icao] = $value; |
|
| 1408 | + } |
|
| 1409 | + $count = array(); |
|
| 1410 | + foreach ($alldata as $key => $row) { |
|
| 1411 | + $count[$key] = $row['airport_departure_icao_count']; |
|
| 1412 | + } |
|
| 1413 | 1413 | array_multisort($count,SORT_DESC,$alldata); |
| 1414 | 1414 | foreach ($alldata as $number) { |
| 1415 | 1415 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']); |
@@ -1417,25 +1417,25 @@ discard block |
||
| 1417 | 1417 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
| 1418 | 1418 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
| 1419 | 1419 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
| 1420 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
| 1420 | + $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
| 1421 | 1421 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
| 1422 | - $alldata = array(); |
|
| 1423 | - foreach ($pall as $value) { |
|
| 1424 | - $icao = $value['airport_arrival_icao']; |
|
| 1425 | - $alldata[$icao] = $value; |
|
| 1426 | - } |
|
| 1427 | - foreach ($dall as $value) { |
|
| 1428 | - $icao = $value['airport_arrival_icao']; |
|
| 1429 | - if (isset($alldata[$icao])) { |
|
| 1430 | - $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 1431 | - } else $alldata[$icao] = $value; |
|
| 1432 | - } |
|
| 1433 | - $count = array(); |
|
| 1434 | - foreach ($alldata as $key => $row) { |
|
| 1435 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
| 1436 | - } |
|
| 1437 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 1438 | - foreach ($alldata as $number) { |
|
| 1422 | + $alldata = array(); |
|
| 1423 | + foreach ($pall as $value) { |
|
| 1424 | + $icao = $value['airport_arrival_icao']; |
|
| 1425 | + $alldata[$icao] = $value; |
|
| 1426 | + } |
|
| 1427 | + foreach ($dall as $value) { |
|
| 1428 | + $icao = $value['airport_arrival_icao']; |
|
| 1429 | + if (isset($alldata[$icao])) { |
|
| 1430 | + $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 1431 | + } else $alldata[$icao] = $value; |
|
| 1432 | + } |
|
| 1433 | + $count = array(); |
|
| 1434 | + foreach ($alldata as $key => $row) { |
|
| 1435 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
| 1436 | + } |
|
| 1437 | + array_multisort($count,SORT_DESC,$alldata); |
|
| 1438 | + foreach ($alldata as $number) { |
|
| 1439 | 1439 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']); |
| 1440 | 1440 | } |
| 1441 | 1441 | if ($Connection->tableExists('countries')) { |
@@ -1495,8 +1495,8 @@ discard block |
||
| 1495 | 1495 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
| 1496 | 1496 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
| 1497 | 1497 | $pall = $Spotter->getLast7DaysAirportsDeparture(); |
| 1498 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
|
| 1499 | - /* |
|
| 1498 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
|
| 1499 | + /* |
|
| 1500 | 1500 | $alldata = array(); |
| 1501 | 1501 | foreach ($pall as $value) { |
| 1502 | 1502 | $icao = $value['departure_airport_icao']; |
@@ -1515,29 +1515,29 @@ discard block |
||
| 1515 | 1515 | } |
| 1516 | 1516 | array_multisort($count,SORT_DESC,$alldata); |
| 1517 | 1517 | */ |
| 1518 | - foreach ($dall as $value) { |
|
| 1519 | - $icao = $value['departure_airport_icao']; |
|
| 1520 | - $ddate = $value['date']; |
|
| 1521 | - $find = false; |
|
| 1522 | - foreach ($pall as $pvalue) { |
|
| 1523 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1524 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 1525 | - $find = true; |
|
| 1526 | - break; |
|
| 1527 | - } |
|
| 1528 | - } |
|
| 1529 | - if ($find === false) { |
|
| 1530 | - $pall[] = $value; |
|
| 1531 | - } |
|
| 1532 | - } |
|
| 1533 | - $alldata = $pall; |
|
| 1518 | + foreach ($dall as $value) { |
|
| 1519 | + $icao = $value['departure_airport_icao']; |
|
| 1520 | + $ddate = $value['date']; |
|
| 1521 | + $find = false; |
|
| 1522 | + foreach ($pall as $pvalue) { |
|
| 1523 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1524 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 1525 | + $find = true; |
|
| 1526 | + break; |
|
| 1527 | + } |
|
| 1528 | + } |
|
| 1529 | + if ($find === false) { |
|
| 1530 | + $pall[] = $value; |
|
| 1531 | + } |
|
| 1532 | + } |
|
| 1533 | + $alldata = $pall; |
|
| 1534 | 1534 | foreach ($alldata as $number) { |
| 1535 | 1535 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
| 1536 | 1536 | } |
| 1537 | 1537 | echo '...Arrival'."\n"; |
| 1538 | 1538 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
| 1539 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival(); |
|
| 1540 | - /* |
|
| 1539 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival(); |
|
| 1540 | + /* |
|
| 1541 | 1541 | $alldata = array(); |
| 1542 | 1542 | foreach ($pall as $value) { |
| 1543 | 1543 | $icao = $value['arrival_airport_icao']; |
@@ -1557,22 +1557,22 @@ discard block |
||
| 1557 | 1557 | */ |
| 1558 | 1558 | |
| 1559 | 1559 | |
| 1560 | - foreach ($dall as $value) { |
|
| 1561 | - $icao = $value['arrival_airport_icao']; |
|
| 1562 | - $ddate = $value['date']; |
|
| 1563 | - $find = false; |
|
| 1564 | - foreach ($pall as $pvalue) { |
|
| 1565 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1566 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 1567 | - $find = true; |
|
| 1568 | - break; |
|
| 1569 | - } |
|
| 1570 | - } |
|
| 1571 | - if ($find === false) { |
|
| 1572 | - $pall[] = $value; |
|
| 1573 | - } |
|
| 1574 | - } |
|
| 1575 | - $alldata = $pall; |
|
| 1560 | + foreach ($dall as $value) { |
|
| 1561 | + $icao = $value['arrival_airport_icao']; |
|
| 1562 | + $ddate = $value['date']; |
|
| 1563 | + $find = false; |
|
| 1564 | + foreach ($pall as $pvalue) { |
|
| 1565 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1566 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 1567 | + $find = true; |
|
| 1568 | + break; |
|
| 1569 | + } |
|
| 1570 | + } |
|
| 1571 | + if ($find === false) { |
|
| 1572 | + $pall[] = $value; |
|
| 1573 | + } |
|
| 1574 | + } |
|
| 1575 | + $alldata = $pall; |
|
| 1576 | 1576 | foreach ($alldata as $number) { |
| 1577 | 1577 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
| 1578 | 1578 | } |
@@ -1639,51 +1639,51 @@ discard block |
||
| 1639 | 1639 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
| 1640 | 1640 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
| 1641 | 1641 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
| 1642 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
| 1642 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
| 1643 | 1643 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
| 1644 | - //$alldata = array(); |
|
| 1645 | - foreach ($dall as $value) { |
|
| 1646 | - $icao = $value['airport_departure_icao']; |
|
| 1647 | - $dicao = $value['airline_icao']; |
|
| 1648 | - $find = false; |
|
| 1649 | - foreach ($pall as $pvalue) { |
|
| 1650 | - if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
| 1651 | - $pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 1652 | - $find = true; |
|
| 1653 | - break; |
|
| 1654 | - } |
|
| 1655 | - } |
|
| 1656 | - if ($find === false) { |
|
| 1657 | - $pall[] = $value; |
|
| 1658 | - } |
|
| 1659 | - } |
|
| 1660 | - $alldata = $pall; |
|
| 1644 | + //$alldata = array(); |
|
| 1645 | + foreach ($dall as $value) { |
|
| 1646 | + $icao = $value['airport_departure_icao']; |
|
| 1647 | + $dicao = $value['airline_icao']; |
|
| 1648 | + $find = false; |
|
| 1649 | + foreach ($pall as $pvalue) { |
|
| 1650 | + if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
| 1651 | + $pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 1652 | + $find = true; |
|
| 1653 | + break; |
|
| 1654 | + } |
|
| 1655 | + } |
|
| 1656 | + if ($find === false) { |
|
| 1657 | + $pall[] = $value; |
|
| 1658 | + } |
|
| 1659 | + } |
|
| 1660 | + $alldata = $pall; |
|
| 1661 | 1661 | foreach ($alldata as $number) { |
| 1662 | 1662 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao']); |
| 1663 | 1663 | } |
| 1664 | 1664 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
| 1665 | 1665 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
| 1666 | 1666 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
| 1667 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
| 1667 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
| 1668 | 1668 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
| 1669 | - //$alldata = array(); |
|
| 1670 | - foreach ($dall as $value) { |
|
| 1671 | - $icao = $value['airport_arrival_icao']; |
|
| 1672 | - $dicao = $value['airline_icao']; |
|
| 1673 | - $find = false; |
|
| 1674 | - foreach ($pall as $pvalue) { |
|
| 1675 | - if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
| 1676 | - $pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 1677 | - $find = true; |
|
| 1678 | - break; |
|
| 1679 | - } |
|
| 1680 | - } |
|
| 1681 | - if ($find === false) { |
|
| 1682 | - $pall[] = $value; |
|
| 1683 | - } |
|
| 1684 | - } |
|
| 1685 | - $alldata = $pall; |
|
| 1686 | - foreach ($alldata as $number) { |
|
| 1669 | + //$alldata = array(); |
|
| 1670 | + foreach ($dall as $value) { |
|
| 1671 | + $icao = $value['airport_arrival_icao']; |
|
| 1672 | + $dicao = $value['airline_icao']; |
|
| 1673 | + $find = false; |
|
| 1674 | + foreach ($pall as $pvalue) { |
|
| 1675 | + if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
| 1676 | + $pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 1677 | + $find = true; |
|
| 1678 | + break; |
|
| 1679 | + } |
|
| 1680 | + } |
|
| 1681 | + if ($find === false) { |
|
| 1682 | + $pall[] = $value; |
|
| 1683 | + } |
|
| 1684 | + } |
|
| 1685 | + $alldata = $pall; |
|
| 1686 | + foreach ($alldata as $number) { |
|
| 1687 | 1687 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao']); |
| 1688 | 1688 | } |
| 1689 | 1689 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
@@ -1716,47 +1716,47 @@ discard block |
||
| 1716 | 1716 | } |
| 1717 | 1717 | if ($globalDebug) echo '...Departure'."\n"; |
| 1718 | 1718 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
| 1719 | - $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
|
| 1720 | - foreach ($dall as $value) { |
|
| 1721 | - $icao = $value['departure_airport_icao']; |
|
| 1722 | - $airline = $value['airline_icao']; |
|
| 1723 | - $ddate = $value['date']; |
|
| 1724 | - $find = false; |
|
| 1725 | - foreach ($pall as $pvalue) { |
|
| 1726 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) { |
|
| 1727 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 1728 | - $find = true; |
|
| 1729 | - break; |
|
| 1730 | - } |
|
| 1731 | - } |
|
| 1732 | - if ($find === false) { |
|
| 1733 | - $pall[] = $value; |
|
| 1734 | - } |
|
| 1735 | - } |
|
| 1736 | - $alldata = $pall; |
|
| 1719 | + $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
|
| 1720 | + foreach ($dall as $value) { |
|
| 1721 | + $icao = $value['departure_airport_icao']; |
|
| 1722 | + $airline = $value['airline_icao']; |
|
| 1723 | + $ddate = $value['date']; |
|
| 1724 | + $find = false; |
|
| 1725 | + foreach ($pall as $pvalue) { |
|
| 1726 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) { |
|
| 1727 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 1728 | + $find = true; |
|
| 1729 | + break; |
|
| 1730 | + } |
|
| 1731 | + } |
|
| 1732 | + if ($find === false) { |
|
| 1733 | + $pall[] = $value; |
|
| 1734 | + } |
|
| 1735 | + } |
|
| 1736 | + $alldata = $pall; |
|
| 1737 | 1737 | foreach ($alldata as $number) { |
| 1738 | 1738 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
| 1739 | 1739 | } |
| 1740 | 1740 | if ($globalDebug) echo '...Arrival'."\n"; |
| 1741 | 1741 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
| 1742 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
|
| 1743 | - foreach ($dall as $value) { |
|
| 1744 | - $icao = $value['arrival_airport_icao']; |
|
| 1745 | - $airline = $value['airline_icao']; |
|
| 1746 | - $ddate = $value['date']; |
|
| 1747 | - $find = false; |
|
| 1748 | - foreach ($pall as $pvalue) { |
|
| 1749 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) { |
|
| 1750 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 1751 | - $find = true; |
|
| 1752 | - break; |
|
| 1753 | - } |
|
| 1754 | - } |
|
| 1755 | - if ($find === false) { |
|
| 1756 | - $pall[] = $value; |
|
| 1757 | - } |
|
| 1758 | - } |
|
| 1759 | - $alldata = $pall; |
|
| 1742 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
|
| 1743 | + foreach ($dall as $value) { |
|
| 1744 | + $icao = $value['arrival_airport_icao']; |
|
| 1745 | + $airline = $value['airline_icao']; |
|
| 1746 | + $ddate = $value['date']; |
|
| 1747 | + $find = false; |
|
| 1748 | + foreach ($pall as $pvalue) { |
|
| 1749 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) { |
|
| 1750 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 1751 | + $find = true; |
|
| 1752 | + break; |
|
| 1753 | + } |
|
| 1754 | + } |
|
| 1755 | + if ($find === false) { |
|
| 1756 | + $pall[] = $value; |
|
| 1757 | + } |
|
| 1758 | + } |
|
| 1759 | + $alldata = $pall; |
|
| 1760 | 1760 | foreach ($alldata as $number) { |
| 1761 | 1761 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
| 1762 | 1762 | } |
@@ -1820,44 +1820,44 @@ discard block |
||
| 1820 | 1820 | } |
| 1821 | 1821 | |
| 1822 | 1822 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
| 1823 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
| 1824 | - $alldata = array(); |
|
| 1825 | - foreach ($pall as $value) { |
|
| 1826 | - $icao = $value['airport_departure_icao']; |
|
| 1827 | - $alldata[$icao] = $value; |
|
| 1828 | - } |
|
| 1829 | - foreach ($dall as $value) { |
|
| 1830 | - $icao = $value['airport_departure_icao']; |
|
| 1831 | - if (isset($alldata[$icao])) { |
|
| 1832 | - $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 1833 | - } else $alldata[$icao] = $value; |
|
| 1834 | - } |
|
| 1835 | - $count = array(); |
|
| 1836 | - foreach ($alldata as $key => $row) { |
|
| 1837 | - $count[$key] = $row['airport_departure_icao_count']; |
|
| 1838 | - } |
|
| 1823 | + $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
| 1824 | + $alldata = array(); |
|
| 1825 | + foreach ($pall as $value) { |
|
| 1826 | + $icao = $value['airport_departure_icao']; |
|
| 1827 | + $alldata[$icao] = $value; |
|
| 1828 | + } |
|
| 1829 | + foreach ($dall as $value) { |
|
| 1830 | + $icao = $value['airport_departure_icao']; |
|
| 1831 | + if (isset($alldata[$icao])) { |
|
| 1832 | + $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
| 1833 | + } else $alldata[$icao] = $value; |
|
| 1834 | + } |
|
| 1835 | + $count = array(); |
|
| 1836 | + foreach ($alldata as $key => $row) { |
|
| 1837 | + $count[$key] = $row['airport_departure_icao_count']; |
|
| 1838 | + } |
|
| 1839 | 1839 | array_multisort($count,SORT_DESC,$alldata); |
| 1840 | 1840 | foreach ($alldata as $number) { |
| 1841 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name); |
|
| 1841 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name); |
|
| 1842 | 1842 | } |
| 1843 | 1843 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,$filter); |
| 1844 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter); |
|
| 1844 | + $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter); |
|
| 1845 | 1845 | $alldata = array(); |
| 1846 | - foreach ($pall as $value) { |
|
| 1847 | - $icao = $value['airport_arrival_icao']; |
|
| 1848 | - $alldata[$icao] = $value; |
|
| 1849 | - } |
|
| 1850 | - foreach ($dall as $value) { |
|
| 1851 | - $icao = $value['airport_arrival_icao']; |
|
| 1852 | - if (isset($alldata[$icao])) { |
|
| 1853 | - $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 1854 | - } else $alldata[$icao] = $value; |
|
| 1855 | - } |
|
| 1856 | - $count = array(); |
|
| 1857 | - foreach ($alldata as $key => $row) { |
|
| 1858 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
| 1859 | - } |
|
| 1860 | - array_multisort($count,SORT_DESC,$alldata); |
|
| 1846 | + foreach ($pall as $value) { |
|
| 1847 | + $icao = $value['airport_arrival_icao']; |
|
| 1848 | + $alldata[$icao] = $value; |
|
| 1849 | + } |
|
| 1850 | + foreach ($dall as $value) { |
|
| 1851 | + $icao = $value['airport_arrival_icao']; |
|
| 1852 | + if (isset($alldata[$icao])) { |
|
| 1853 | + $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
| 1854 | + } else $alldata[$icao] = $value; |
|
| 1855 | + } |
|
| 1856 | + $count = array(); |
|
| 1857 | + foreach ($alldata as $key => $row) { |
|
| 1858 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
| 1859 | + } |
|
| 1860 | + array_multisort($count,SORT_DESC,$alldata); |
|
| 1861 | 1861 | foreach ($alldata as $number) { |
| 1862 | 1862 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name); |
| 1863 | 1863 | } |
@@ -1886,45 +1886,45 @@ discard block |
||
| 1886 | 1886 | } |
| 1887 | 1887 | echo '...Departure'."\n"; |
| 1888 | 1888 | $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
| 1889 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
| 1889 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
| 1890 | 1890 | foreach ($dall as $value) { |
| 1891 | - $icao = $value['departure_airport_icao']; |
|
| 1892 | - $ddate = $value['date']; |
|
| 1893 | - $find = false; |
|
| 1894 | - foreach ($pall as $pvalue) { |
|
| 1895 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1896 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 1897 | - $find = true; |
|
| 1898 | - break; |
|
| 1899 | - } |
|
| 1900 | - } |
|
| 1901 | - if ($find === false) { |
|
| 1902 | - $pall[] = $value; |
|
| 1903 | - } |
|
| 1904 | - } |
|
| 1905 | - $alldata = $pall; |
|
| 1891 | + $icao = $value['departure_airport_icao']; |
|
| 1892 | + $ddate = $value['date']; |
|
| 1893 | + $find = false; |
|
| 1894 | + foreach ($pall as $pvalue) { |
|
| 1895 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1896 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
| 1897 | + $find = true; |
|
| 1898 | + break; |
|
| 1899 | + } |
|
| 1900 | + } |
|
| 1901 | + if ($find === false) { |
|
| 1902 | + $pall[] = $value; |
|
| 1903 | + } |
|
| 1904 | + } |
|
| 1905 | + $alldata = $pall; |
|
| 1906 | 1906 | foreach ($alldata as $number) { |
| 1907 | 1907 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name); |
| 1908 | 1908 | } |
| 1909 | 1909 | echo '...Arrival'."\n"; |
| 1910 | 1910 | $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
| 1911 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
| 1911 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
| 1912 | 1912 | foreach ($dall as $value) { |
| 1913 | 1913 | $icao = $value['arrival_airport_icao']; |
| 1914 | 1914 | $ddate = $value['date']; |
| 1915 | - $find = false; |
|
| 1915 | + $find = false; |
|
| 1916 | 1916 | foreach ($pall as $pvalue) { |
| 1917 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1918 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 1919 | - $find = true; |
|
| 1920 | - break; |
|
| 1921 | - } |
|
| 1922 | - } |
|
| 1923 | - if ($find === false) { |
|
| 1924 | - $pall[] = $value; |
|
| 1925 | - } |
|
| 1926 | - } |
|
| 1927 | - $alldata = $pall; |
|
| 1917 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
| 1918 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
| 1919 | + $find = true; |
|
| 1920 | + break; |
|
| 1921 | + } |
|
| 1922 | + } |
|
| 1923 | + if ($find === false) { |
|
| 1924 | + $pall[] = $value; |
|
| 1925 | + } |
|
| 1926 | + } |
|
| 1927 | + $alldata = $pall; |
|
| 1928 | 1928 | foreach ($alldata as $number) { |
| 1929 | 1929 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name); |
| 1930 | 1930 | } |
@@ -9,16 +9,16 @@ discard block |
||
| 9 | 9 | require_once(dirname(__FILE__).'/class.Source.php'); |
| 10 | 10 | |
| 11 | 11 | class SpotterImport { |
| 12 | - private $all_flights = array(); |
|
| 13 | - private $last_delete_hourly = 0; |
|
| 14 | - private $last_delete = 0; |
|
| 15 | - private $stats = array(); |
|
| 16 | - private $tmd = 0; |
|
| 17 | - private $source_location = array(); |
|
| 18 | - public $db = null; |
|
| 19 | - public $nb = 0; |
|
| 20 | - |
|
| 21 | - public function __construct($dbc = null) { |
|
| 12 | + private $all_flights = array(); |
|
| 13 | + private $last_delete_hourly = 0; |
|
| 14 | + private $last_delete = 0; |
|
| 15 | + private $stats = array(); |
|
| 16 | + private $tmd = 0; |
|
| 17 | + private $source_location = array(); |
|
| 18 | + public $db = null; |
|
| 19 | + public $nb = 0; |
|
| 20 | + |
|
| 21 | + public function __construct($dbc = null) { |
|
| 22 | 22 | global $globalBeta; |
| 23 | 23 | $Connection = new Connection($dbc); |
| 24 | 24 | $this->db = $Connection->db(); |
@@ -29,18 +29,18 @@ discard block |
||
| 29 | 29 | $currentdate = date('Y-m-d'); |
| 30 | 30 | $sourcestat = $Stats->getStatsSource($currentdate); |
| 31 | 31 | if (!empty($sourcestat)) { |
| 32 | - foreach($sourcestat as $srcst) { |
|
| 33 | - $type = $srcst['stats_type']; |
|
| 32 | + foreach($sourcestat as $srcst) { |
|
| 33 | + $type = $srcst['stats_type']; |
|
| 34 | 34 | if ($type == 'polar' || $type == 'hist') { |
| 35 | - $source = $srcst['source_name']; |
|
| 36 | - $data = $srcst['source_data']; |
|
| 37 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
| 38 | - } |
|
| 39 | - } |
|
| 35 | + $source = $srcst['source_name']; |
|
| 36 | + $data = $srcst['source_data']; |
|
| 37 | + $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | + } |
|
| 40 | 41 | } |
| 41 | - } |
|
| 42 | 42 | |
| 43 | - public function get_Schedule($id,$ident) { |
|
| 43 | + public function get_Schedule($id,$ident) { |
|
| 44 | 44 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
| 45 | 45 | // Get schedule here, so it's done only one time |
| 46 | 46 | |
@@ -59,35 +59,35 @@ discard block |
||
| 59 | 59 | $Translation = new Translation($dbc); |
| 60 | 60 | $operator = $Spotter->getOperator($ident); |
| 61 | 61 | if ($Schedule->checkSchedule($operator) == 0) { |
| 62 | - $operator = $Translation->checkTranslation($ident); |
|
| 63 | - if ($Schedule->checkSchedule($operator) == 0) { |
|
| 62 | + $operator = $Translation->checkTranslation($ident); |
|
| 63 | + if ($Schedule->checkSchedule($operator) == 0) { |
|
| 64 | 64 | $schedule = $Schedule->fetchSchedule($operator); |
| 65 | 65 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 66 | - if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 67 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 68 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 69 | - // Should also check if route schedule = route from DB |
|
| 70 | - if ($schedule['DepartureAirportIATA'] != '') { |
|
| 66 | + if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 67 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 68 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 69 | + // Should also check if route schedule = route from DB |
|
| 70 | + if ($schedule['DepartureAirportIATA'] != '') { |
|
| 71 | 71 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
| 72 | - $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
| 73 | - if ($airport_icao != '') { |
|
| 72 | + $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
| 73 | + if ($airport_icao != '') { |
|
| 74 | 74 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
| 75 | 75 | if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
| 76 | - } |
|
| 76 | + } |
|
| 77 | + } |
|
| 77 | 78 | } |
| 78 | - } |
|
| 79 | - if ($schedule['ArrivalAirportIATA'] != '') { |
|
| 79 | + if ($schedule['ArrivalAirportIATA'] != '') { |
|
| 80 | 80 | if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) { |
| 81 | - $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
| 82 | - if ($airport_icao != '') { |
|
| 81 | + $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
| 82 | + if ($airport_icao != '') { |
|
| 83 | 83 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
| 84 | 84 | if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
| 85 | - } |
|
| 85 | + } |
|
| 86 | + } |
|
| 86 | 87 | } |
| 87 | - } |
|
| 88 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
| 88 | + $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
| 89 | + } |
|
| 89 | 90 | } |
| 90 | - } |
|
| 91 | 91 | } |
| 92 | 92 | // close connection, at least one way will work ? |
| 93 | 93 | |
@@ -105,92 +105,92 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | */ |
| 107 | 107 | } |
| 108 | - } |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - public function checkAll() { |
|
| 110 | + public function checkAll() { |
|
| 111 | 111 | global $globalDebug; |
| 112 | 112 | if ($globalDebug) echo "Update last seen flights data...\n"; |
| 113 | 113 | foreach ($this->all_flights as $key => $flight) { |
| 114 | - if (isset($this->all_flights[$key]['id'])) { |
|
| 114 | + if (isset($this->all_flights[$key]['id'])) { |
|
| 115 | 115 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
| 116 | - $Spotter = new Spotter($this->db); |
|
| 117 | - $real_arrival = $this->arrival($key); |
|
| 118 | - $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 119 | - } |
|
| 116 | + $Spotter = new Spotter($this->db); |
|
| 117 | + $real_arrival = $this->arrival($key); |
|
| 118 | + $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 119 | + } |
|
| 120 | + } |
|
| 120 | 121 | } |
| 121 | - } |
|
| 122 | 122 | |
| 123 | - public function arrival($key) { |
|
| 123 | + public function arrival($key) { |
|
| 124 | 124 | global $globalClosestMinDist, $globalDebug; |
| 125 | 125 | if ($globalDebug) echo 'Update arrival...'."\n"; |
| 126 | 126 | $Spotter = new Spotter($this->db); |
| 127 | - $airport_icao = ''; |
|
| 128 | - $airport_time = ''; |
|
| 129 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
| 127 | + $airport_icao = ''; |
|
| 128 | + $airport_time = ''; |
|
| 129 | + if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
| 130 | 130 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 131 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
| 132 | - if (isset($closestAirports[0])) { |
|
| 133 | - if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
| 134 | - $airport_icao = $closestAirports[0]['icao']; |
|
| 135 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
| 136 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 137 | - } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
| 138 | - foreach ($closestAirports as $airport) { |
|
| 139 | - if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
| 140 | - $airport_icao = $airport['icao']; |
|
| 141 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
| 142 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 143 | - break; |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
| 147 | - $airport_icao = $closestAirports[0]['icao']; |
|
| 148 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
| 149 | - } else { |
|
| 150 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 151 | - } |
|
| 152 | - } else { |
|
| 153 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - } else { |
|
| 157 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 158 | - } |
|
| 159 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - |
|
| 163 | - |
|
| 164 | - public function del() { |
|
| 131 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
| 132 | + if (isset($closestAirports[0])) { |
|
| 133 | + if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
| 134 | + $airport_icao = $closestAirports[0]['icao']; |
|
| 135 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
| 136 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 137 | + } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
| 138 | + foreach ($closestAirports as $airport) { |
|
| 139 | + if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
| 140 | + $airport_icao = $airport['icao']; |
|
| 141 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
| 142 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 143 | + break; |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
| 147 | + $airport_icao = $closestAirports[0]['icao']; |
|
| 148 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
| 149 | + } else { |
|
| 150 | + if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 151 | + } |
|
| 152 | + } else { |
|
| 153 | + if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + } else { |
|
| 157 | + if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 158 | + } |
|
| 159 | + return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + |
|
| 163 | + |
|
| 164 | + public function del() { |
|
| 165 | 165 | global $globalDebug; |
| 166 | 166 | // Delete old infos |
| 167 | 167 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 168 | 168 | foreach ($this->all_flights as $key => $flight) { |
| 169 | - if (isset($flight['lastupdate'])) { |
|
| 170 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
| 171 | - if (isset($this->all_flights[$key]['id'])) { |
|
| 172 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 169 | + if (isset($flight['lastupdate'])) { |
|
| 170 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
| 171 | + if (isset($this->all_flights[$key]['id'])) { |
|
| 172 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 173 | 173 | /* |
| 174 | 174 | $SpotterLive = new SpotterLive(); |
| 175 | 175 | $SpotterLive->deleteLiveSpotterDataById($this->all_flights[$key]['id']); |
| 176 | 176 | $SpotterLive->db = null; |
| 177 | 177 | */ |
| 178 | - $real_arrival = $this->arrival($key); |
|
| 179 | - $Spotter = new Spotter($this->db); |
|
| 180 | - if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
|
| 178 | + $real_arrival = $this->arrival($key); |
|
| 179 | + $Spotter = new Spotter($this->db); |
|
| 180 | + if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
|
| 181 | 181 | $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
| 182 | 182 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 183 | 183 | } |
| 184 | 184 | // Put in archive |
| 185 | 185 | // $Spotter->db = null; |
| 186 | - } |
|
| 187 | - unset($this->all_flights[$key]); |
|
| 188 | - } |
|
| 189 | - } |
|
| 190 | - } |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - public function add($line) { |
|
| 186 | + } |
|
| 187 | + unset($this->all_flights[$key]); |
|
| 188 | + } |
|
| 189 | + } |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + public function add($line) { |
|
| 194 | 194 | global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights; |
| 195 | 195 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
| 196 | 196 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
@@ -215,18 +215,18 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | // SBS format is CSV format |
| 217 | 217 | if(is_array($line) && isset($line['hex'])) { |
| 218 | - //print_r($line); |
|
| 219 | - if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) { |
|
| 218 | + //print_r($line); |
|
| 219 | + if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) { |
|
| 220 | 220 | |
| 221 | 221 | // Increment message number |
| 222 | 222 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
| 223 | - $current_date = date('Y-m-d'); |
|
| 224 | - $source = $line['source_name']; |
|
| 225 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 226 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 227 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 228 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 229 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 223 | + $current_date = date('Y-m-d'); |
|
| 224 | + $source = $line['source_name']; |
|
| 225 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 226 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 227 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 228 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 229 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /* |
@@ -242,17 +242,17 @@ discard block |
||
| 242 | 242 | //$this->db = $dbc; |
| 243 | 243 | |
| 244 | 244 | $hex = trim($line['hex']); |
| 245 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 246 | - else $id = trim($line['id']); |
|
| 245 | + if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 246 | + else $id = trim($line['id']); |
|
| 247 | 247 | |
| 248 | 248 | //print_r($this->all_flights); |
| 249 | 249 | if (!isset($this->all_flights[$id]['hex']) && ctype_xdigit($hex)) { |
| 250 | - $this->all_flights[$id] = array('hex' => $hex); |
|
| 251 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 252 | - //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
| 250 | + $this->all_flights[$id] = array('hex' => $hex); |
|
| 251 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 252 | + //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
| 253 | 253 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 254 | - //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 255 | - if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????')) { |
|
| 254 | + //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 255 | + if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????')) { |
|
| 256 | 256 | |
| 257 | 257 | $timeelapsed = microtime(true); |
| 258 | 258 | $Spotter = new Spotter($this->db); |
@@ -261,38 +261,38 @@ discard block |
||
| 261 | 261 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 262 | 262 | |
| 263 | 263 | if ($aircraft_icao == '' && isset($line['aircraft_type'])) { |
| 264 | - if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
| 265 | - elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
| 266 | - elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
| 267 | - elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
| 264 | + if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
| 265 | + elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
| 266 | + elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
| 267 | + elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
| 268 | 268 | } |
| 269 | 269 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
| 270 | - } else if (isset($line['aircraft_name'])) { |
|
| 270 | + } else if (isset($line['aircraft_name'])) { |
|
| 271 | 271 | // Get aircraft ICAO from aircraft name |
| 272 | 272 | $Spotter = new Spotter($this->db); |
| 273 | 273 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
| 274 | 274 | $Spotter->db = null; |
| 275 | 275 | if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
| 276 | 276 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
| 277 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
|
| 278 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true)); |
|
| 279 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 280 | - if (!isset($line['id'])) { |
|
| 277 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
|
| 278 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true)); |
|
| 279 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 280 | + if (!isset($line['id'])) { |
|
| 281 | 281 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 282 | 282 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
| 283 | 283 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 284 | 284 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 285 | - //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 286 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 285 | + //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 286 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 287 | 287 | |
| 288 | - if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n"; |
|
| 289 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 288 | + if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n"; |
|
| 289 | + if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 293 | - if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
| 293 | + if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
| 294 | 294 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 295 | - } else { |
|
| 295 | + } else { |
|
| 296 | 296 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 297 | 297 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 298 | 298 | /* |
@@ -301,38 +301,38 @@ discard block |
||
| 301 | 301 | print_r($line); |
| 302 | 302 | */ |
| 303 | 303 | return ''; |
| 304 | - } |
|
| 304 | + } |
|
| 305 | 305 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
| 306 | 306 | |
| 307 | 307 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') { |
| 308 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
| 308 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
| 309 | 309 | } |
| 310 | 310 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
| 311 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
| 311 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
| 312 | 312 | } |
| 313 | 313 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
| 314 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id'])); |
|
| 314 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id'])); |
|
| 315 | 315 | } |
| 316 | 316 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
| 317 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name'])); |
|
| 317 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name'])); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
| 321 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 322 | - if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
| 321 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 322 | + if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
| 323 | 323 | $timeelapsed = microtime(true); |
| 324 | - $Spotter = new Spotter($this->db); |
|
| 325 | - $fromsource = NULL; |
|
| 326 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 327 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 324 | + $Spotter = new Spotter($this->db); |
|
| 325 | + $fromsource = NULL; |
|
| 326 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 327 | + elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 328 | 328 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 329 | 329 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 330 | 330 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 331 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
| 331 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
| 332 | 332 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 333 | 333 | $Spotter->db = null; |
| 334 | 334 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 335 | - } |
|
| 335 | + } |
|
| 336 | 336 | |
| 337 | 337 | /* |
| 338 | 338 | if (!isset($line['id'])) { |
@@ -342,26 +342,26 @@ discard block |
||
| 342 | 342 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 343 | 343 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 344 | 344 | */ |
| 345 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 345 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 346 | 346 | |
| 347 | - //$putinarchive = true; |
|
| 348 | - if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
| 347 | + //$putinarchive = true; |
|
| 348 | + if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
| 349 | 349 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
| 350 | - } |
|
| 351 | - if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
| 350 | + } |
|
| 351 | + if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
| 352 | 352 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
| 353 | - } |
|
| 354 | - if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
| 355 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 356 | - } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
| 353 | + } |
|
| 354 | + if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
| 355 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 356 | + } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
| 357 | 357 | $timeelapsed = microtime(true); |
| 358 | 358 | $Spotter = new Spotter($this->db); |
| 359 | 359 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 360 | 360 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 361 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 361 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 362 | 362 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 363 | 363 | |
| 364 | - } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
| 364 | + } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
| 365 | 365 | $timeelapsed = microtime(true); |
| 366 | 366 | $Spotter = new Spotter($this->db); |
| 367 | 367 | $route = $Spotter->getRouteInfo(trim($line['ident'])); |
@@ -375,43 +375,43 @@ discard block |
||
| 375 | 375 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 376 | 376 | |
| 377 | 377 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 378 | - //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
| 379 | - if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
| 378 | + //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
| 379 | + if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
| 380 | 380 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
| 381 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
| 382 | - } |
|
| 381 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
| 382 | + } |
|
| 383 | 383 | } |
| 384 | 384 | if (!isset($globalFork)) $globalFork = TRUE; |
| 385 | 385 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
| 386 | 386 | if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
| 387 | 387 | } |
| 388 | - } |
|
| 388 | + } |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | if (isset($line['speed']) && $line['speed'] != '') { |
| 392 | 392 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
| 393 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
| 394 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
| 395 | - //$dataFound = true; |
|
| 393 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
| 394 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
| 395 | + //$dataFound = true; |
|
| 396 | 396 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
| 397 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 398 | - if ($distance > 1000 && $distance < 10000) { |
|
| 399 | - // use datetime |
|
| 397 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 398 | + if ($distance > 1000 && $distance < 10000) { |
|
| 399 | + // use datetime |
|
| 400 | 400 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
| 401 | 401 | $speed = $speed*3.6; |
| 402 | 402 | if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
| 403 | 403 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
| 404 | - } |
|
| 404 | + } |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | |
| 408 | 408 | |
| 409 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 410 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 411 | - else unset($timediff); |
|
| 412 | - if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
|
| 409 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 410 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 411 | + else unset($timediff); |
|
| 412 | + if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
|
| 413 | 413 | if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) { |
| 414 | - if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 414 | + if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 415 | 415 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 416 | 416 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 417 | 417 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -425,16 +425,16 @@ discard block |
||
| 425 | 425 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 426 | 426 | $this->tmd = 0; |
| 427 | 427 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
| 428 | - } |
|
| 428 | + } |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 432 | - //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
| 432 | + //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
| 433 | 433 | if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 434 | 434 | if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
| 435 | - $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
| 436 | - $dataFound = true; |
|
| 437 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 435 | + $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
| 436 | + $dataFound = true; |
|
| 437 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 438 | 438 | } |
| 439 | 439 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 440 | 440 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
@@ -445,20 +445,20 @@ discard block |
||
| 445 | 445 | //$putinarchive = true; |
| 446 | 446 | } |
| 447 | 447 | */ |
| 448 | - /* |
|
| 448 | + /* |
|
| 449 | 449 | } elseif (isset($this->all_flights[$id]['latitude'])) { |
| 450 | 450 | if ($globalDebug) echo '!!! Strange latitude value - diff : '.abs($this->all_flights[$id]['latitude']-$line['latitude']).'- previous lat : '.$this->all_flights[$id]['latitude'].'- new lat : '.$line['latitude']."\n"; |
| 451 | 451 | } |
| 452 | 452 | */ |
| 453 | 453 | } |
| 454 | 454 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 455 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 456 | - //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
| 455 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 456 | + //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
| 457 | 457 | if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 458 | 458 | if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
| 459 | - $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
| 460 | - $dataFound = true; |
|
| 461 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 459 | + $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
| 460 | + $dataFound = true; |
|
| 461 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 462 | 462 | } |
| 463 | 463 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 464 | 464 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
@@ -476,53 +476,53 @@ discard block |
||
| 476 | 476 | */ |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | - } else if ($globalDebug && $timediff > 20) { |
|
| 479 | + } else if ($globalDebug && $timediff > 20) { |
|
| 480 | 480 | $this->tmd = $this->tmd + 1; |
| 481 | 481 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
| 482 | 482 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
| 483 | 483 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
| 484 | 484 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
| 485 | - } |
|
| 485 | + } |
|
| 486 | 486 | } |
| 487 | 487 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 488 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 489 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
| 488 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 489 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
| 490 | 490 | } |
| 491 | 491 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
| 492 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 493 | - //$dataFound = true; |
|
| 492 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 493 | + //$dataFound = true; |
|
| 494 | 494 | } |
| 495 | 495 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 496 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
| 496 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
| 497 | 497 | } |
| 498 | 498 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 499 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
| 499 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
| 500 | 500 | } |
| 501 | 501 | if (isset($line['emergency']) && $line['emergency'] != '') { |
| 502 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 503 | - //$dataFound = true; |
|
| 502 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 503 | + //$dataFound = true; |
|
| 504 | 504 | } |
| 505 | 505 | if (isset($line['ground']) && $line['ground'] != '') { |
| 506 | - if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
| 506 | + if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
| 507 | 507 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 508 | 508 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 509 | 509 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 510 | 510 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
| 511 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 511 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 512 | 512 | elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 513 | - } |
|
| 514 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 515 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 516 | - //$dataFound = true; |
|
| 513 | + } |
|
| 514 | + if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 515 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 516 | + //$dataFound = true; |
|
| 517 | 517 | } |
| 518 | 518 | if (isset($line['squawk']) && $line['squawk'] != '') { |
| 519 | - if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
|
| 520 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 521 | - $highlight = ''; |
|
| 522 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 523 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 524 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 525 | - if ($highlight != '') { |
|
| 519 | + if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
|
| 520 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 521 | + $highlight = ''; |
|
| 522 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 523 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 524 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 525 | + if ($highlight != '') { |
|
| 526 | 526 | $timeelapsed = microtime(true); |
| 527 | 527 | $Spotter = new Spotter($this->db); |
| 528 | 528 | $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
@@ -532,38 +532,38 @@ discard block |
||
| 532 | 532 | $this->all_flights[$id]['putinarchive'] = true; |
| 533 | 533 | //$putinarchive = true; |
| 534 | 534 | //$highlight = ''; |
| 535 | - } |
|
| 535 | + } |
|
| 536 | 536 | |
| 537 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 538 | - //$dataFound = true; |
|
| 537 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 538 | + //$dataFound = true; |
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 542 | - //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
| 542 | + //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
| 543 | 543 | if (abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true; |
| 544 | 544 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
| 545 | 545 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
| 546 | 546 | //$dataFound = true; |
| 547 | - //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
| 547 | + //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 551 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
| 551 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | if (isset($line['heading']) && $line['heading'] != '') { |
| 555 | - if (abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 556 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
| 557 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
| 558 | - //$dataFound = true; |
|
| 555 | + if (abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 556 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
| 557 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
| 558 | + //$dataFound = true; |
|
| 559 | 559 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
| 560 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 561 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
| 562 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 563 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 560 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 561 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
| 562 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 563 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 564 | 564 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 565 | - // If not enough messages and ACARS set heading to 0 |
|
| 566 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 565 | + // If not enough messages and ACARS set heading to 0 |
|
| 566 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 567 | 567 | } |
| 568 | 568 | if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
| 569 | 569 | elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
@@ -574,119 +574,119 @@ discard block |
||
| 574 | 574 | //if ($dataFound == true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['ident'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
| 575 | 575 | //if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
| 576 | 576 | if ($dataFound === true && isset($this->all_flights[$id]['hex'])) { |
| 577 | - $this->all_flights[$id]['lastupdate'] = time(); |
|
| 578 | - if ($this->all_flights[$id]['addedSpotter'] == 0) { |
|
| 579 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 580 | - //print_r($this->all_flights); |
|
| 581 | - //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
| 582 | - //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
| 583 | - if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
| 577 | + $this->all_flights[$id]['lastupdate'] = time(); |
|
| 578 | + if ($this->all_flights[$id]['addedSpotter'] == 0) { |
|
| 579 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 580 | + //print_r($this->all_flights); |
|
| 581 | + //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
| 582 | + //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
| 583 | + if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
| 584 | 584 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
| 585 | 585 | $timeelapsed = microtime(true); |
| 586 | 586 | $SpotterLive = new SpotterLive($this->db); |
| 587 | 587 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) { |
| 588 | - $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
|
| 589 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 588 | + $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
|
| 589 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 590 | 590 | } elseif (isset($line['id'])) { |
| 591 | - $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
|
| 592 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 591 | + $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
|
| 592 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 593 | 593 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
| 594 | - $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
|
| 595 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 594 | + $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
|
| 595 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 596 | 596 | } else $recent_ident = ''; |
| 597 | 597 | $SpotterLive->db=null; |
| 598 | 598 | |
| 599 | 599 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
| 600 | 600 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
| 601 | - } else { |
|
| 601 | + } else { |
|
| 602 | 602 | $recent_ident = ''; |
| 603 | 603 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
| 604 | - } |
|
| 605 | - //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
| 606 | - if($recent_ident == "") |
|
| 607 | - { |
|
| 604 | + } |
|
| 605 | + //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
| 606 | + if($recent_ident == "") |
|
| 607 | + { |
|
| 608 | 608 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
| 609 | 609 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 610 | 610 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 611 | 611 | //adds the spotter data for the archive |
| 612 | 612 | $ignoreImport = false; |
| 613 | 613 | foreach($globalAirportIgnore as $airportIgnore) { |
| 614 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 614 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 615 | 615 | $ignoreImport = true; |
| 616 | - } |
|
| 616 | + } |
|
| 617 | 617 | } |
| 618 | 618 | if (count($globalAirportAccept) > 0) { |
| 619 | - $ignoreImport = true; |
|
| 620 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 619 | + $ignoreImport = true; |
|
| 620 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 621 | 621 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 622 | - $ignoreImport = false; |
|
| 622 | + $ignoreImport = false; |
|
| 623 | + } |
|
| 623 | 624 | } |
| 624 | - } |
|
| 625 | 625 | } |
| 626 | 626 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 627 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 627 | + foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 628 | 628 | if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
| 629 | - $ignoreImport = true; |
|
| 629 | + $ignoreImport = true; |
|
| 630 | + } |
|
| 630 | 631 | } |
| 631 | - } |
|
| 632 | 632 | } |
| 633 | 633 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 634 | - $ignoreImport = true; |
|
| 635 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 634 | + $ignoreImport = true; |
|
| 635 | + foreach($globalAirlineAccept as $airlineAccept) { |
|
| 636 | 636 | if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
| 637 | - $ignoreImport = false; |
|
| 637 | + $ignoreImport = false; |
|
| 638 | + } |
|
| 638 | 639 | } |
| 639 | - } |
|
| 640 | 640 | } |
| 641 | 641 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 642 | - $ignoreImport = true; |
|
| 643 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 642 | + $ignoreImport = true; |
|
| 643 | + foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 644 | 644 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 645 | - $ignoreImport = false; |
|
| 645 | + $ignoreImport = false; |
|
| 646 | + } |
|
| 646 | 647 | } |
| 647 | - } |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | if (!$ignoreImport) { |
| 651 | - $highlight = ''; |
|
| 652 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 653 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 654 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
| 655 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 656 | - $timeelapsed = microtime(true); |
|
| 657 | - $Spotter = new Spotter($this->db); |
|
| 658 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']); |
|
| 659 | - $Spotter->db = null; |
|
| 660 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 661 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 651 | + $highlight = ''; |
|
| 652 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 653 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 654 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
| 655 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 656 | + $timeelapsed = microtime(true); |
|
| 657 | + $Spotter = new Spotter($this->db); |
|
| 658 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']); |
|
| 659 | + $Spotter->db = null; |
|
| 660 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 661 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 662 | 662 | |
| 663 | - // Add source stat in DB |
|
| 664 | - $Stats = new Stats($this->db); |
|
| 665 | - if (!empty($this->stats)) { |
|
| 663 | + // Add source stat in DB |
|
| 664 | + $Stats = new Stats($this->db); |
|
| 665 | + if (!empty($this->stats)) { |
|
| 666 | 666 | if ($globalDebug) echo 'Add source stats : '; |
| 667 | - foreach($this->stats as $date => $data) { |
|
| 668 | - foreach($data as $source => $sourced) { |
|
| 669 | - //print_r($sourced); |
|
| 670 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 671 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 672 | - if (isset($sourced['msg'])) { |
|
| 673 | - if (time() - $sourced['msg']['date'] > 10) { |
|
| 674 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 675 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 676 | - unset($this->stats[$date][$source]['msg']); |
|
| 677 | - } |
|
| 678 | - } |
|
| 679 | - } |
|
| 680 | - if ($date != date('Y-m-d')) { |
|
| 681 | - unset($this->stats[$date]); |
|
| 682 | - } |
|
| 683 | - } |
|
| 684 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 685 | - |
|
| 686 | - } |
|
| 687 | - $Stats->db = null; |
|
| 667 | + foreach($this->stats as $date => $data) { |
|
| 668 | + foreach($data as $source => $sourced) { |
|
| 669 | + //print_r($sourced); |
|
| 670 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 671 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 672 | + if (isset($sourced['msg'])) { |
|
| 673 | + if (time() - $sourced['msg']['date'] > 10) { |
|
| 674 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 675 | + echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 676 | + unset($this->stats[$date][$source]['msg']); |
|
| 677 | + } |
|
| 678 | + } |
|
| 679 | + } |
|
| 680 | + if ($date != date('Y-m-d')) { |
|
| 681 | + unset($this->stats[$date]); |
|
| 682 | + } |
|
| 683 | + } |
|
| 684 | + if ($globalDebug) echo 'Done'."\n"; |
|
| 685 | + |
|
| 686 | + } |
|
| 687 | + $Stats->db = null; |
|
| 688 | 688 | |
| 689 | - $this->del(); |
|
| 689 | + $this->del(); |
|
| 690 | 690 | } elseif ($globalDebug) echo 'Ignore data'."\n"; |
| 691 | 691 | //$ignoreImport = false; |
| 692 | 692 | $this->all_flights[$id]['addedSpotter'] = 1; |
@@ -704,18 +704,18 @@ discard block |
||
| 704 | 704 | */ |
| 705 | 705 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
| 706 | 706 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 707 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 708 | - //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 709 | - $SpotterLive = new SpotterLive($this->db); |
|
| 710 | - $SpotterLive->deleteLiveSpotterData(); |
|
| 711 | - $SpotterLive->db=null; |
|
| 712 | - if ($globalDebug) echo " Done\n"; |
|
| 713 | - $this->last_delete = time(); |
|
| 707 | + if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 708 | + //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 709 | + $SpotterLive = new SpotterLive($this->db); |
|
| 710 | + $SpotterLive->deleteLiveSpotterData(); |
|
| 711 | + $SpotterLive->db=null; |
|
| 712 | + if ($globalDebug) echo " Done\n"; |
|
| 713 | + $this->last_delete = time(); |
|
| 714 | 714 | } |
| 715 | - } else { |
|
| 715 | + } else { |
|
| 716 | 716 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) { |
| 717 | - $this->all_flights[$id]['id'] = $recent_ident; |
|
| 718 | - $this->all_flights[$id]['addedSpotter'] = 1; |
|
| 717 | + $this->all_flights[$id]['id'] = $recent_ident; |
|
| 718 | + $this->all_flights[$id]['addedSpotter'] = 1; |
|
| 719 | 719 | } |
| 720 | 720 | if (isset($globalDaemon) && !$globalDaemon) { |
| 721 | 721 | $Spotter = new Spotter($this->db); |
@@ -723,14 +723,14 @@ discard block |
||
| 723 | 723 | $Spotter->db = null; |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | - } |
|
| 726 | + } |
|
| 727 | + } |
|
| 727 | 728 | } |
| 728 | - } |
|
| 729 | - //adds the spotter LIVE data |
|
| 730 | - //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
| 731 | - //echo "\nAdd in Live !! \n"; |
|
| 732 | - //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
|
| 733 | - if ($globalDebug) { |
|
| 729 | + //adds the spotter LIVE data |
|
| 730 | + //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
| 731 | + //echo "\nAdd in Live !! \n"; |
|
| 732 | + //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
|
| 733 | + if ($globalDebug) { |
|
| 734 | 734 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
| 735 | 735 | if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
| 736 | 736 | else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
@@ -738,49 +738,49 @@ discard block |
||
| 738 | 738 | if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
| 739 | 739 | else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
| 740 | 740 | } |
| 741 | - } |
|
| 742 | - $ignoreImport = false; |
|
| 743 | - if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
| 744 | - if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
| 741 | + } |
|
| 742 | + $ignoreImport = false; |
|
| 743 | + if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
| 744 | + if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
| 745 | 745 | |
| 746 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 747 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 748 | - $ignoreImport = true; |
|
| 746 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 747 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 748 | + $ignoreImport = true; |
|
| 749 | + } |
|
| 749 | 750 | } |
| 750 | - } |
|
| 751 | - if (count($globalAirportAccept) > 0) { |
|
| 752 | - $ignoreImport = true; |
|
| 753 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 754 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 751 | + if (count($globalAirportAccept) > 0) { |
|
| 752 | + $ignoreImport = true; |
|
| 753 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 754 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 755 | 755 | $ignoreImport = false; |
| 756 | - } |
|
| 756 | + } |
|
| 757 | 757 | } |
| 758 | - } |
|
| 759 | - if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
| 758 | + } |
|
| 759 | + if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
| 760 | 760 | foreach($globalAirlineIgnore as $airlineIgnore) { |
| 761 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 761 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 762 | 762 | $ignoreImport = true; |
| 763 | - } |
|
| 763 | + } |
|
| 764 | 764 | } |
| 765 | - } |
|
| 766 | - if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
| 765 | + } |
|
| 766 | + if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
| 767 | 767 | $ignoreImport = true; |
| 768 | 768 | foreach($globalAirlineAccept as $airlineAccept) { |
| 769 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 769 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 770 | 770 | $ignoreImport = false; |
| 771 | - } |
|
| 771 | + } |
|
| 772 | 772 | } |
| 773 | - } |
|
| 774 | - if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
| 773 | + } |
|
| 774 | + if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
| 775 | 775 | $ignoreImport = true; |
| 776 | 776 | foreach($globalPilotIdAccept as $pilotIdAccept) { |
| 777 | - if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
| 778 | - $ignoreImport = false; |
|
| 779 | - } |
|
| 777 | + if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
| 778 | + $ignoreImport = false; |
|
| 779 | + } |
|
| 780 | + } |
|
| 780 | 781 | } |
| 781 | - } |
|
| 782 | 782 | |
| 783 | - if (!$ignoreImport) { |
|
| 783 | + if (!$ignoreImport) { |
|
| 784 | 784 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
| 785 | 785 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
| 786 | 786 | $timeelapsed = microtime(true); |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | if ($stats_heading == 16) $stats_heading = 0; |
| 819 | 819 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 820 | 820 | for ($i=0;$i<=15;$i++) { |
| 821 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 821 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 822 | 822 | } |
| 823 | 823 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
| 824 | 824 | } else { |
@@ -831,11 +831,11 @@ discard block |
||
| 831 | 831 | //var_dump($this->stats); |
| 832 | 832 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 833 | 833 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 834 | - end($this->stats[$current_date][$source]['hist']); |
|
| 835 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 834 | + end($this->stats[$current_date][$source]['hist']); |
|
| 835 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 836 | 836 | } else $mini = 0; |
| 837 | 837 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 838 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 838 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 839 | 839 | } |
| 840 | 840 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
| 841 | 841 | } else { |
@@ -852,22 +852,22 @@ discard block |
||
| 852 | 852 | |
| 853 | 853 | |
| 854 | 854 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 855 | - if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 856 | - $SpotterLive = new SpotterLive($this->db); |
|
| 857 | - $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 858 | - $SpotterLive->db = null; |
|
| 859 | - //SpotterLive->deleteLiveSpotterData(); |
|
| 860 | - if ($globalDebug) echo " Done\n"; |
|
| 861 | - $this->last_delete_hourly = time(); |
|
| 855 | + if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 856 | + $SpotterLive = new SpotterLive($this->db); |
|
| 857 | + $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 858 | + $SpotterLive->db = null; |
|
| 859 | + //SpotterLive->deleteLiveSpotterData(); |
|
| 860 | + if ($globalDebug) echo " Done\n"; |
|
| 861 | + $this->last_delete_hourly = time(); |
|
| 862 | 862 | } |
| 863 | 863 | |
| 864 | - } |
|
| 865 | - //$ignoreImport = false; |
|
| 864 | + } |
|
| 865 | + //$ignoreImport = false; |
|
| 866 | 866 | } |
| 867 | 867 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 868 | 868 | if ($send) return $this->all_flights[$id]; |
| 869 | - } |
|
| 869 | + } |
|
| 870 | + } |
|
| 870 | 871 | } |
| 871 | - } |
|
| 872 | 872 | } |
| 873 | 873 | ?> |
@@ -8,47 +8,47 @@ discard block |
||
| 8 | 8 | $this->db = $Connection->db; |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Get SQL query part for filter used |
|
| 13 | - * @param Array $filter the filter |
|
| 14 | - * @return Array the SQL part |
|
| 15 | - */ |
|
| 16 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 11 | + /** |
|
| 12 | + * Get SQL query part for filter used |
|
| 13 | + * @param Array $filter the filter |
|
| 14 | + * @return Array the SQL part |
|
| 15 | + */ |
|
| 16 | + public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 17 | 17 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 18 | 18 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter); |
| 19 | 19 | if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter); |
| 20 | 20 | $filter_query_join = ''; |
| 21 | 21 | $filter_query_where = ''; |
| 22 | 22 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 23 | - if ($filter['airlines'][0] != '') { |
|
| 23 | + if ($filter['airlines'][0] != '') { |
|
| 24 | 24 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id"; |
| 25 | - } |
|
| 25 | + } |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
| 29 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id "; |
|
| 29 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id "; |
|
| 30 | 30 | } |
| 31 | 31 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
| 32 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id"; |
|
| 32 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id"; |
|
| 33 | 33 | } |
| 34 | 34 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 35 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 35 | + $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 36 | 36 | } |
| 37 | 37 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 38 | - $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
|
| 38 | + $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
|
| 39 | 39 | } |
| 40 | 40 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 41 | - if ($filter_query_where == '') { |
|
| 41 | + if ($filter_query_where == '') { |
|
| 42 | 42 | $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 43 | - } else { |
|
| 43 | + } else { |
|
| 44 | 44 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 45 | - } |
|
| 45 | + } |
|
| 46 | 46 | } |
| 47 | 47 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 48 | 48 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 49 | 49 | $filter_query = $filter_query_join.$filter_query_where; |
| 50 | 50 | return $filter_query; |
| 51 | - } |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | 53 | // Spotter_archive |
| 54 | 54 | public function 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 = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') { |
@@ -79,44 +79,44 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Gets all the spotter information based on a particular callsign |
|
| 84 | - * |
|
| 85 | - * @return Array the spotter information |
|
| 86 | - * |
|
| 87 | - */ |
|
| 88 | - public function getLastArchiveSpotterDataByIdent($ident) |
|
| 89 | - { |
|
| 82 | + /** |
|
| 83 | + * Gets all the spotter information based on a particular callsign |
|
| 84 | + * |
|
| 85 | + * @return Array the spotter information |
|
| 86 | + * |
|
| 87 | + */ |
|
| 88 | + public function getLastArchiveSpotterDataByIdent($ident) |
|
| 89 | + { |
|
| 90 | 90 | $Spotter = new Spotter($this->db); |
| 91 | - date_default_timezone_set('UTC'); |
|
| 91 | + date_default_timezone_set('UTC'); |
|
| 92 | 92 | |
| 93 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 94 | - //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
| 95 | - $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
| 93 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 94 | + //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
| 95 | + $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
| 96 | 96 | |
| 97 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
| 97 | + $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
| 98 | 98 | |
| 99 | - return $spotter_array; |
|
| 100 | - } |
|
| 99 | + return $spotter_array; |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | 102 | |
| 103 | - /** |
|
| 104 | - * Gets last the spotter information based on a particular id |
|
| 105 | - * |
|
| 106 | - * @return Array the spotter information |
|
| 107 | - * |
|
| 108 | - */ |
|
| 109 | - public function getLastArchiveSpotterDataById($id) |
|
| 110 | - { |
|
| 111 | - $Spotter = new Spotter($this->db); |
|
| 112 | - date_default_timezone_set('UTC'); |
|
| 113 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 114 | - //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
|
| 115 | - //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
| 116 | - $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
| 103 | + /** |
|
| 104 | + * Gets last the spotter information based on a particular id |
|
| 105 | + * |
|
| 106 | + * @return Array the spotter information |
|
| 107 | + * |
|
| 108 | + */ |
|
| 109 | + public function getLastArchiveSpotterDataById($id) |
|
| 110 | + { |
|
| 111 | + $Spotter = new Spotter($this->db); |
|
| 112 | + date_default_timezone_set('UTC'); |
|
| 113 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 114 | + //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
|
| 115 | + //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
| 116 | + $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
| 117 | 117 | |
| 118 | 118 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
| 119 | - /* |
|
| 119 | + /* |
|
| 120 | 120 | try { |
| 121 | 121 | $Connection = new Connection(); |
| 122 | 122 | $sth = Connection->$db->prepare($query); |
@@ -126,232 +126,232 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
| 128 | 128 | */ |
| 129 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
| 130 | - |
|
| 131 | - return $spotter_array; |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - /** |
|
| 135 | - * Gets all the spotter information based on a particular id |
|
| 136 | - * |
|
| 137 | - * @return Array the spotter information |
|
| 138 | - * |
|
| 139 | - */ |
|
| 140 | - public function getAllArchiveSpotterDataById($id) |
|
| 141 | - { |
|
| 142 | - date_default_timezone_set('UTC'); |
|
| 143 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 144 | - $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id"; |
|
| 129 | + $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
| 130 | + |
|
| 131 | + return $spotter_array; |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + /** |
|
| 135 | + * Gets all the spotter information based on a particular id |
|
| 136 | + * |
|
| 137 | + * @return Array the spotter information |
|
| 138 | + * |
|
| 139 | + */ |
|
| 140 | + public function getAllArchiveSpotterDataById($id) |
|
| 141 | + { |
|
| 142 | + date_default_timezone_set('UTC'); |
|
| 143 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 144 | + $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id"; |
|
| 145 | 145 | |
| 146 | 146 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
| 147 | 147 | |
| 148 | - try { |
|
| 149 | - $sth = $this->db->prepare($query); |
|
| 150 | - $sth->execute(array(':id' => $id)); |
|
| 151 | - } catch(PDOException $e) { |
|
| 152 | - echo $e->getMessage(); |
|
| 153 | - die; |
|
| 154 | - } |
|
| 155 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 156 | - |
|
| 157 | - return $spotter_array; |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * Gets coordinate & time spotter information based on a particular id |
|
| 162 | - * |
|
| 163 | - * @return Array the spotter information |
|
| 164 | - * |
|
| 165 | - */ |
|
| 166 | - public function getCoordArchiveSpotterDataById($id) |
|
| 167 | - { |
|
| 168 | - date_default_timezone_set('UTC'); |
|
| 169 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 170 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
| 148 | + try { |
|
| 149 | + $sth = $this->db->prepare($query); |
|
| 150 | + $sth->execute(array(':id' => $id)); |
|
| 151 | + } catch(PDOException $e) { |
|
| 152 | + echo $e->getMessage(); |
|
| 153 | + die; |
|
| 154 | + } |
|
| 155 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 156 | + |
|
| 157 | + return $spotter_array; |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * Gets coordinate & time spotter information based on a particular id |
|
| 162 | + * |
|
| 163 | + * @return Array the spotter information |
|
| 164 | + * |
|
| 165 | + */ |
|
| 166 | + public function getCoordArchiveSpotterDataById($id) |
|
| 167 | + { |
|
| 168 | + date_default_timezone_set('UTC'); |
|
| 169 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 170 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
| 171 | 171 | |
| 172 | 172 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
| 173 | 173 | |
| 174 | - try { |
|
| 175 | - $sth = $this->db->prepare($query); |
|
| 176 | - $sth->execute(array(':id' => $id)); |
|
| 177 | - } catch(PDOException $e) { |
|
| 178 | - echo $e->getMessage(); |
|
| 179 | - die; |
|
| 180 | - } |
|
| 181 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 174 | + try { |
|
| 175 | + $sth = $this->db->prepare($query); |
|
| 176 | + $sth->execute(array(':id' => $id)); |
|
| 177 | + } catch(PDOException $e) { |
|
| 178 | + echo $e->getMessage(); |
|
| 179 | + die; |
|
| 180 | + } |
|
| 181 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 182 | 182 | |
| 183 | - return $spotter_array; |
|
| 184 | - } |
|
| 183 | + return $spotter_array; |
|
| 184 | + } |
|
| 185 | 185 | |
| 186 | 186 | |
| 187 | - /** |
|
| 188 | - * Gets altitude information based on a particular callsign |
|
| 189 | - * |
|
| 190 | - * @return Array the spotter information |
|
| 191 | - * |
|
| 192 | - */ |
|
| 193 | - public function getAltitudeArchiveSpotterDataByIdent($ident) |
|
| 194 | - { |
|
| 187 | + /** |
|
| 188 | + * Gets altitude information based on a particular callsign |
|
| 189 | + * |
|
| 190 | + * @return Array the spotter information |
|
| 191 | + * |
|
| 192 | + */ |
|
| 193 | + public function getAltitudeArchiveSpotterDataByIdent($ident) |
|
| 194 | + { |
|
| 195 | 195 | |
| 196 | - date_default_timezone_set('UTC'); |
|
| 196 | + date_default_timezone_set('UTC'); |
|
| 197 | 197 | |
| 198 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 199 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
| 198 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 199 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
| 200 | 200 | |
| 201 | - try { |
|
| 202 | - $sth = $this->db->prepare($query); |
|
| 203 | - $sth->execute(array(':ident' => $ident)); |
|
| 204 | - } catch(PDOException $e) { |
|
| 205 | - echo $e->getMessage(); |
|
| 206 | - die; |
|
| 207 | - } |
|
| 208 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 201 | + try { |
|
| 202 | + $sth = $this->db->prepare($query); |
|
| 203 | + $sth->execute(array(':ident' => $ident)); |
|
| 204 | + } catch(PDOException $e) { |
|
| 205 | + echo $e->getMessage(); |
|
| 206 | + die; |
|
| 207 | + } |
|
| 208 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 209 | 209 | |
| 210 | - return $spotter_array; |
|
| 211 | - } |
|
| 210 | + return $spotter_array; |
|
| 211 | + } |
|
| 212 | 212 | |
| 213 | - /** |
|
| 214 | - * Gets altitude information based on a particular id |
|
| 215 | - * |
|
| 216 | - * @return Array the spotter information |
|
| 217 | - * |
|
| 218 | - */ |
|
| 219 | - public function getAltitudeArchiveSpotterDataById($id) |
|
| 220 | - { |
|
| 213 | + /** |
|
| 214 | + * Gets altitude information based on a particular id |
|
| 215 | + * |
|
| 216 | + * @return Array the spotter information |
|
| 217 | + * |
|
| 218 | + */ |
|
| 219 | + public function getAltitudeArchiveSpotterDataById($id) |
|
| 220 | + { |
|
| 221 | 221 | |
| 222 | - date_default_timezone_set('UTC'); |
|
| 222 | + date_default_timezone_set('UTC'); |
|
| 223 | 223 | |
| 224 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 225 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
| 224 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 225 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
| 226 | 226 | |
| 227 | - try { |
|
| 228 | - $sth = $this->db->prepare($query); |
|
| 229 | - $sth->execute(array(':id' => $id)); |
|
| 230 | - } catch(PDOException $e) { |
|
| 231 | - echo $e->getMessage(); |
|
| 232 | - die; |
|
| 233 | - } |
|
| 234 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 227 | + try { |
|
| 228 | + $sth = $this->db->prepare($query); |
|
| 229 | + $sth->execute(array(':id' => $id)); |
|
| 230 | + } catch(PDOException $e) { |
|
| 231 | + echo $e->getMessage(); |
|
| 232 | + die; |
|
| 233 | + } |
|
| 234 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 235 | 235 | |
| 236 | - return $spotter_array; |
|
| 237 | - } |
|
| 236 | + return $spotter_array; |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | - /** |
|
| 240 | - * Gets altitude & speed information based on a particular id |
|
| 241 | - * |
|
| 242 | - * @return Array the spotter information |
|
| 243 | - * |
|
| 244 | - */ |
|
| 245 | - public function getAltitudeSpeedArchiveSpotterDataById($id) |
|
| 246 | - { |
|
| 239 | + /** |
|
| 240 | + * Gets altitude & speed information based on a particular id |
|
| 241 | + * |
|
| 242 | + * @return Array the spotter information |
|
| 243 | + * |
|
| 244 | + */ |
|
| 245 | + public function getAltitudeSpeedArchiveSpotterDataById($id) |
|
| 246 | + { |
|
| 247 | 247 | |
| 248 | - date_default_timezone_set('UTC'); |
|
| 248 | + date_default_timezone_set('UTC'); |
|
| 249 | 249 | |
| 250 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 251 | - $query = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
| 250 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 251 | + $query = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
| 252 | 252 | |
| 253 | - try { |
|
| 254 | - $sth = $this->db->prepare($query); |
|
| 255 | - $sth->execute(array(':id' => $id)); |
|
| 256 | - } catch(PDOException $e) { |
|
| 257 | - echo $e->getMessage(); |
|
| 258 | - die; |
|
| 259 | - } |
|
| 260 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 253 | + try { |
|
| 254 | + $sth = $this->db->prepare($query); |
|
| 255 | + $sth->execute(array(':id' => $id)); |
|
| 256 | + } catch(PDOException $e) { |
|
| 257 | + echo $e->getMessage(); |
|
| 258 | + die; |
|
| 259 | + } |
|
| 260 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 261 | 261 | |
| 262 | - return $spotter_array; |
|
| 263 | - } |
|
| 262 | + return $spotter_array; |
|
| 263 | + } |
|
| 264 | 264 | |
| 265 | 265 | |
| 266 | - /** |
|
| 267 | - * Gets altitude information based on a particular callsign |
|
| 268 | - * |
|
| 269 | - * @return Array the spotter information |
|
| 270 | - * |
|
| 271 | - */ |
|
| 272 | - public function getLastAltitudeArchiveSpotterDataByIdent($ident) |
|
| 273 | - { |
|
| 266 | + /** |
|
| 267 | + * Gets altitude information based on a particular callsign |
|
| 268 | + * |
|
| 269 | + * @return Array the spotter information |
|
| 270 | + * |
|
| 271 | + */ |
|
| 272 | + public function getLastAltitudeArchiveSpotterDataByIdent($ident) |
|
| 273 | + { |
|
| 274 | 274 | |
| 275 | - date_default_timezone_set('UTC'); |
|
| 275 | + date_default_timezone_set('UTC'); |
|
| 276 | 276 | |
| 277 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 278 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
| 277 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 278 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
| 279 | 279 | // $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident"; |
| 280 | 280 | |
| 281 | - try { |
|
| 282 | - $sth = $this->db->prepare($query); |
|
| 283 | - $sth->execute(array(':ident' => $ident)); |
|
| 284 | - } catch(PDOException $e) { |
|
| 285 | - echo $e->getMessage(); |
|
| 286 | - die; |
|
| 287 | - } |
|
| 288 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 281 | + try { |
|
| 282 | + $sth = $this->db->prepare($query); |
|
| 283 | + $sth->execute(array(':ident' => $ident)); |
|
| 284 | + } catch(PDOException $e) { |
|
| 285 | + echo $e->getMessage(); |
|
| 286 | + die; |
|
| 287 | + } |
|
| 288 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 289 | 289 | |
| 290 | - return $spotter_array; |
|
| 291 | - } |
|
| 290 | + return $spotter_array; |
|
| 291 | + } |
|
| 292 | 292 | |
| 293 | 293 | |
| 294 | 294 | |
| 295 | - /** |
|
| 296 | - * Gets all the archive spotter information |
|
| 297 | - * |
|
| 298 | - * @return Array the spotter information |
|
| 299 | - * |
|
| 300 | - */ |
|
| 301 | - public function getSpotterArchiveData($ident,$flightaware_id,$date) |
|
| 302 | - { |
|
| 303 | - $Spotter = new Spotter($this->db); |
|
| 304 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 305 | - $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.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
| 295 | + /** |
|
| 296 | + * Gets all the archive spotter information |
|
| 297 | + * |
|
| 298 | + * @return Array the spotter information |
|
| 299 | + * |
|
| 300 | + */ |
|
| 301 | + public function getSpotterArchiveData($ident,$flightaware_id,$date) |
|
| 302 | + { |
|
| 303 | + $Spotter = new Spotter($this->db); |
|
| 304 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 305 | + $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.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
| 306 | 306 | |
| 307 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
| 307 | + $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
| 308 | 308 | |
| 309 | - return $spotter_array; |
|
| 310 | - } |
|
| 309 | + return $spotter_array; |
|
| 310 | + } |
|
| 311 | 311 | |
| 312 | - public function deleteSpotterArchiveTrackData() |
|
| 313 | - { |
|
| 312 | + public function deleteSpotterArchiveTrackData() |
|
| 313 | + { |
|
| 314 | 314 | global $globalArchiveKeepTrackMonths; |
| 315 | - date_default_timezone_set('UTC'); |
|
| 315 | + date_default_timezone_set('UTC'); |
|
| 316 | 316 | $query = 'DELETE FROM spotter_archive WHERE spotter_archive.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepTrackMonths.' MONTH)'; |
| 317 | - try { |
|
| 318 | - $sth = $this->db->prepare($query); |
|
| 319 | - $sth->execute(); |
|
| 320 | - } catch(PDOException $e) { |
|
| 321 | - echo $e->getMessage(); |
|
| 322 | - die; |
|
| 323 | - } |
|
| 317 | + try { |
|
| 318 | + $sth = $this->db->prepare($query); |
|
| 319 | + $sth->execute(); |
|
| 320 | + } catch(PDOException $e) { |
|
| 321 | + echo $e->getMessage(); |
|
| 322 | + die; |
|
| 323 | + } |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
| 327 | - * Gets Minimal Live Spotter data |
|
| 328 | - * |
|
| 329 | - * @return Array the spotter information |
|
| 330 | - * |
|
| 331 | - */ |
|
| 332 | - public function getMinLiveSpotterData($begindate,$enddate,$filter = array()) |
|
| 333 | - { |
|
| 334 | - global $globalDBdriver, $globalLiveInterval; |
|
| 335 | - date_default_timezone_set('UTC'); |
|
| 336 | - |
|
| 337 | - $filter_query = ''; |
|
| 338 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
| 339 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 340 | - } |
|
| 341 | - // Use spotter_output also ? |
|
| 342 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
| 343 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
| 344 | - } |
|
| 345 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
| 346 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
| 347 | - } |
|
| 348 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
| 349 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 353 | - if ($globalDBdriver == 'mysql') { |
|
| 354 | - /* |
|
| 327 | + * Gets Minimal Live Spotter data |
|
| 328 | + * |
|
| 329 | + * @return Array the spotter information |
|
| 330 | + * |
|
| 331 | + */ |
|
| 332 | + public function getMinLiveSpotterData($begindate,$enddate,$filter = array()) |
|
| 333 | + { |
|
| 334 | + global $globalDBdriver, $globalLiveInterval; |
|
| 335 | + date_default_timezone_set('UTC'); |
|
| 336 | + |
|
| 337 | + $filter_query = ''; |
|
| 338 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
| 339 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 340 | + } |
|
| 341 | + // Use spotter_output also ? |
|
| 342 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
| 343 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
| 344 | + } |
|
| 345 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
| 346 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
| 347 | + } |
|
| 348 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
| 349 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 350 | + } |
|
| 351 | + |
|
| 352 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 353 | + if ($globalDBdriver == 'mysql') { |
|
| 354 | + /* |
|
| 355 | 355 | $query = 'SELECT a.aircraft_shadow, 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 |
| 356 | 356 | FROM spotter_archive |
| 357 | 357 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
@@ -370,56 +370,56 @@ discard block |
||
| 370 | 370 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
| 371 | 371 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
| 372 | 372 | '.$filter_query.' ORDER BY flightaware_id'; |
| 373 | - } else { |
|
| 374 | - //$query = '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, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao'; |
|
| 375 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, 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, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
| 373 | + } else { |
|
| 374 | + //$query = '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, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao'; |
|
| 375 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, 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, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
| 376 | 376 | FROM spotter_archive |
| 377 | 377 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
| 378 | 378 | WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".' |
| 379 | 379 | '.$filter_query.' ORDER BY flightaware_id'; |
| 380 | - } |
|
| 381 | - //echo $query; |
|
| 382 | - try { |
|
| 383 | - $sth = $this->db->prepare($query); |
|
| 384 | - $sth->execute(); |
|
| 385 | - } catch(PDOException $e) { |
|
| 386 | - echo $e->getMessage(); |
|
| 387 | - die; |
|
| 388 | - } |
|
| 389 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 390 | - |
|
| 391 | - return $spotter_array; |
|
| 392 | - } |
|
| 380 | + } |
|
| 381 | + //echo $query; |
|
| 382 | + try { |
|
| 383 | + $sth = $this->db->prepare($query); |
|
| 384 | + $sth->execute(); |
|
| 385 | + } catch(PDOException $e) { |
|
| 386 | + echo $e->getMessage(); |
|
| 387 | + die; |
|
| 388 | + } |
|
| 389 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 390 | + |
|
| 391 | + return $spotter_array; |
|
| 392 | + } |
|
| 393 | 393 | |
| 394 | 394 | /** |
| 395 | - * Gets Minimal Live Spotter data |
|
| 396 | - * |
|
| 397 | - * @return Array the spotter information |
|
| 398 | - * |
|
| 399 | - */ |
|
| 400 | - public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) |
|
| 401 | - { |
|
| 402 | - global $globalDBdriver, $globalLiveInterval; |
|
| 403 | - date_default_timezone_set('UTC'); |
|
| 404 | - |
|
| 405 | - $filter_query = ''; |
|
| 406 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
| 407 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 408 | - } |
|
| 409 | - // Should use spotter_output also ? |
|
| 410 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
| 411 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
| 412 | - } |
|
| 413 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
| 414 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
| 415 | - } |
|
| 416 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
| 417 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 418 | - } |
|
| 419 | - |
|
| 420 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 421 | - if ($globalDBdriver == 'mysql') { |
|
| 422 | - /* |
|
| 395 | + * Gets Minimal Live Spotter data |
|
| 396 | + * |
|
| 397 | + * @return Array the spotter information |
|
| 398 | + * |
|
| 399 | + */ |
|
| 400 | + public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) |
|
| 401 | + { |
|
| 402 | + global $globalDBdriver, $globalLiveInterval; |
|
| 403 | + date_default_timezone_set('UTC'); |
|
| 404 | + |
|
| 405 | + $filter_query = ''; |
|
| 406 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
| 407 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 408 | + } |
|
| 409 | + // Should use spotter_output also ? |
|
| 410 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
| 411 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
| 412 | + } |
|
| 413 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
| 414 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
| 415 | + } |
|
| 416 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
| 417 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 418 | + } |
|
| 419 | + |
|
| 420 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 421 | + if ($globalDBdriver == 'mysql') { |
|
| 422 | + /* |
|
| 423 | 423 | $query = 'SELECT a.aircraft_shadow, 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 |
| 424 | 424 | FROM spotter_archive |
| 425 | 425 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
@@ -430,95 +430,95 @@ discard block |
||
| 430 | 430 | WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
| 431 | 431 | '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow'; |
| 432 | 432 | |
| 433 | - } else { |
|
| 434 | - //$query = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao'; |
|
| 435 | - /* |
|
| 433 | + } else { |
|
| 434 | + //$query = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao'; |
|
| 435 | + /* |
|
| 436 | 436 | $query = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
| 437 | 437 | FROM spotter_archive_output |
| 438 | 438 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
| 439 | 439 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
| 440 | 440 | '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow'; |
| 441 | 441 | */ |
| 442 | - $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
| 442 | + $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
| 443 | 443 | FROM spotter_archive_output |
| 444 | 444 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
| 445 | 445 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
| 446 | 446 | '.$filter_query.' LIMIT 200 OFFSET 0'; |
| 447 | 447 | // .' GROUP BY spotter_output.flightaware_id, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow'; |
| 448 | 448 | |
| 449 | - } |
|
| 450 | - //echo $query; |
|
| 451 | - try { |
|
| 452 | - $sth = $this->db->prepare($query); |
|
| 453 | - $sth->execute(); |
|
| 454 | - } catch(PDOException $e) { |
|
| 455 | - echo $e->getMessage(); |
|
| 456 | - die; |
|
| 457 | - } |
|
| 458 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 459 | - |
|
| 460 | - return $spotter_array; |
|
| 461 | - } |
|
| 449 | + } |
|
| 450 | + //echo $query; |
|
| 451 | + try { |
|
| 452 | + $sth = $this->db->prepare($query); |
|
| 453 | + $sth->execute(); |
|
| 454 | + } catch(PDOException $e) { |
|
| 455 | + echo $e->getMessage(); |
|
| 456 | + die; |
|
| 457 | + } |
|
| 458 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 459 | + |
|
| 460 | + return $spotter_array; |
|
| 461 | + } |
|
| 462 | 462 | |
| 463 | 463 | /** |
| 464 | - * Gets count Live Spotter data |
|
| 465 | - * |
|
| 466 | - * @return Array the spotter information |
|
| 467 | - * |
|
| 468 | - */ |
|
| 469 | - public function getLiveSpotterCount($begindate,$enddate,$filter = array()) |
|
| 470 | - { |
|
| 471 | - global $globalDBdriver, $globalLiveInterval; |
|
| 472 | - date_default_timezone_set('UTC'); |
|
| 473 | - |
|
| 474 | - $filter_query = ''; |
|
| 475 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
| 476 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 477 | - } |
|
| 478 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
| 479 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
| 480 | - } |
|
| 481 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
| 482 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
| 483 | - } |
|
| 484 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
| 485 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 486 | - } |
|
| 487 | - |
|
| 488 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 489 | - if ($globalDBdriver == 'mysql') { |
|
| 464 | + * Gets count Live Spotter data |
|
| 465 | + * |
|
| 466 | + * @return Array the spotter information |
|
| 467 | + * |
|
| 468 | + */ |
|
| 469 | + public function getLiveSpotterCount($begindate,$enddate,$filter = array()) |
|
| 470 | + { |
|
| 471 | + global $globalDBdriver, $globalLiveInterval; |
|
| 472 | + date_default_timezone_set('UTC'); |
|
| 473 | + |
|
| 474 | + $filter_query = ''; |
|
| 475 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
| 476 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 477 | + } |
|
| 478 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
| 479 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
| 480 | + } |
|
| 481 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
| 482 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
| 483 | + } |
|
| 484 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
| 485 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 486 | + } |
|
| 487 | + |
|
| 488 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 489 | + if ($globalDBdriver == 'mysql') { |
|
| 490 | 490 | $query = 'SELECT COUNT(DISTINCT flightaware_id) as nb |
| 491 | 491 | FROM spotter_archive l |
| 492 | 492 | WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query; |
| 493 | - } else { |
|
| 493 | + } else { |
|
| 494 | 494 | $query = 'SELECT COUNT(DISTINCT flightaware_id) as nb FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query; |
| 495 | - } |
|
| 496 | - //echo $query; |
|
| 497 | - try { |
|
| 498 | - $sth = $this->db->prepare($query); |
|
| 499 | - $sth->execute(); |
|
| 500 | - } catch(PDOException $e) { |
|
| 501 | - echo $e->getMessage(); |
|
| 502 | - die; |
|
| 503 | - } |
|
| 495 | + } |
|
| 496 | + //echo $query; |
|
| 497 | + try { |
|
| 498 | + $sth = $this->db->prepare($query); |
|
| 499 | + $sth->execute(); |
|
| 500 | + } catch(PDOException $e) { |
|
| 501 | + echo $e->getMessage(); |
|
| 502 | + die; |
|
| 503 | + } |
|
| 504 | 504 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 505 | 505 | $sth->closeCursor(); |
| 506 | - return $result['nb']; |
|
| 506 | + return $result['nb']; |
|
| 507 | 507 | |
| 508 | - } |
|
| 508 | + } |
|
| 509 | 509 | |
| 510 | 510 | |
| 511 | 511 | |
| 512 | 512 | // Spotter_Archive_output |
| 513 | 513 | |
| 514 | - /** |
|
| 515 | - * Gets all the spotter information |
|
| 516 | - * |
|
| 517 | - * @return Array the spotter information |
|
| 518 | - * |
|
| 519 | - */ |
|
| 520 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
| 521 | - { |
|
| 514 | + /** |
|
| 515 | + * Gets all the spotter information |
|
| 516 | + * |
|
| 517 | + * @return Array the spotter information |
|
| 518 | + * |
|
| 519 | + */ |
|
| 520 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
| 521 | + { |
|
| 522 | 522 | global $globalTimezone, $globalDBdriver; |
| 523 | 523 | require_once(dirname(__FILE__).'/class.Translation.php'); |
| 524 | 524 | $Translation = new Translation(); |
@@ -532,159 +532,159 @@ discard block |
||
| 532 | 532 | $filter_query = $this->getFilter($filters); |
| 533 | 533 | if ($q != "") |
| 534 | 534 | { |
| 535 | - if (!is_string($q)) |
|
| 536 | - { |
|
| 535 | + if (!is_string($q)) |
|
| 536 | + { |
|
| 537 | 537 | return false; |
| 538 | - } else { |
|
| 538 | + } else { |
|
| 539 | 539 | |
| 540 | 540 | $q_array = explode(" ", $q); |
| 541 | 541 | |
| 542 | 542 | foreach ($q_array as $q_item){ |
| 543 | - $additional_query .= " AND ("; |
|
| 544 | - $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR "; |
|
| 545 | - $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
|
| 546 | - $additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR "; |
|
| 547 | - $additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
|
| 548 | - $additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR "; |
|
| 549 | - $additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR "; |
|
| 550 | - $additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR "; |
|
| 551 | - $additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR "; |
|
| 552 | - $additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR "; |
|
| 553 | - $additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR "; |
|
| 554 | - $additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR "; |
|
| 555 | - $additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR "; |
|
| 556 | - $additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR "; |
|
| 557 | - $additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR "; |
|
| 558 | - $additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR "; |
|
| 559 | - $additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR "; |
|
| 560 | - $additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR "; |
|
| 561 | - $additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR "; |
|
| 562 | - $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
|
| 563 | - $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
|
| 564 | - $translate = $Translation->ident2icao($q_item); |
|
| 565 | - if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
| 566 | - $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
|
| 567 | - $additional_query .= ")"; |
|
| 543 | + $additional_query .= " AND ("; |
|
| 544 | + $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR "; |
|
| 545 | + $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
|
| 546 | + $additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR "; |
|
| 547 | + $additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
|
| 548 | + $additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR "; |
|
| 549 | + $additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR "; |
|
| 550 | + $additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR "; |
|
| 551 | + $additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR "; |
|
| 552 | + $additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR "; |
|
| 553 | + $additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR "; |
|
| 554 | + $additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR "; |
|
| 555 | + $additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR "; |
|
| 556 | + $additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR "; |
|
| 557 | + $additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR "; |
|
| 558 | + $additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR "; |
|
| 559 | + $additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR "; |
|
| 560 | + $additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR "; |
|
| 561 | + $additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR "; |
|
| 562 | + $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
|
| 563 | + $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
|
| 564 | + $translate = $Translation->ident2icao($q_item); |
|
| 565 | + if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
| 566 | + $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
|
| 567 | + $additional_query .= ")"; |
|
| 568 | + } |
|
| 568 | 569 | } |
| 569 | - } |
|
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if ($registration != "") |
| 573 | 573 | { |
| 574 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 575 | - if (!is_string($registration)) |
|
| 576 | - { |
|
| 574 | + $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 575 | + if (!is_string($registration)) |
|
| 576 | + { |
|
| 577 | 577 | return false; |
| 578 | - } else { |
|
| 578 | + } else { |
|
| 579 | 579 | $additional_query .= " AND (spotter_archive_output.registration = '".$registration."')"; |
| 580 | - } |
|
| 580 | + } |
|
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | if ($aircraft_icao != "") |
| 584 | 584 | { |
| 585 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 586 | - if (!is_string($aircraft_icao)) |
|
| 587 | - { |
|
| 585 | + $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 586 | + if (!is_string($aircraft_icao)) |
|
| 587 | + { |
|
| 588 | 588 | return false; |
| 589 | - } else { |
|
| 589 | + } else { |
|
| 590 | 590 | $additional_query .= " AND (spotter_archive_output.aircraft_icao = '".$aircraft_icao."')"; |
| 591 | - } |
|
| 591 | + } |
|
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | if ($aircraft_manufacturer != "") |
| 595 | 595 | { |
| 596 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 597 | - if (!is_string($aircraft_manufacturer)) |
|
| 598 | - { |
|
| 596 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 597 | + if (!is_string($aircraft_manufacturer)) |
|
| 598 | + { |
|
| 599 | 599 | return false; |
| 600 | - } else { |
|
| 600 | + } else { |
|
| 601 | 601 | $additional_query .= " AND (spotter_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')"; |
| 602 | - } |
|
| 602 | + } |
|
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | if ($highlights == "true") |
| 606 | 606 | { |
| 607 | - if (!is_string($highlights)) |
|
| 608 | - { |
|
| 607 | + if (!is_string($highlights)) |
|
| 608 | + { |
|
| 609 | 609 | return false; |
| 610 | - } else { |
|
| 610 | + } else { |
|
| 611 | 611 | $additional_query .= " AND (spotter_archive_output.highlight <> '')"; |
| 612 | - } |
|
| 612 | + } |
|
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | if ($airline_icao != "") |
| 616 | 616 | { |
| 617 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 618 | - if (!is_string($airline_icao)) |
|
| 619 | - { |
|
| 617 | + $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 618 | + if (!is_string($airline_icao)) |
|
| 619 | + { |
|
| 620 | 620 | return false; |
| 621 | - } else { |
|
| 621 | + } else { |
|
| 622 | 622 | $additional_query .= " AND (spotter_archive_output.airline_icao = '".$airline_icao."')"; |
| 623 | - } |
|
| 623 | + } |
|
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | if ($airline_country != "") |
| 627 | 627 | { |
| 628 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
| 629 | - if (!is_string($airline_country)) |
|
| 630 | - { |
|
| 628 | + $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
| 629 | + if (!is_string($airline_country)) |
|
| 630 | + { |
|
| 631 | 631 | return false; |
| 632 | - } else { |
|
| 632 | + } else { |
|
| 633 | 633 | $additional_query .= " AND (spotter_archive_output.airline_country = '".$airline_country."')"; |
| 634 | - } |
|
| 634 | + } |
|
| 635 | 635 | } |
| 636 | 636 | |
| 637 | 637 | if ($airline_type != "") |
| 638 | 638 | { |
| 639 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
| 640 | - if (!is_string($airline_type)) |
|
| 641 | - { |
|
| 639 | + $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
| 640 | + if (!is_string($airline_type)) |
|
| 641 | + { |
|
| 642 | 642 | return false; |
| 643 | - } else { |
|
| 643 | + } else { |
|
| 644 | 644 | if ($airline_type == "passenger") |
| 645 | 645 | { |
| 646 | - $additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')"; |
|
| 646 | + $additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')"; |
|
| 647 | 647 | } |
| 648 | 648 | if ($airline_type == "cargo") |
| 649 | 649 | { |
| 650 | - $additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')"; |
|
| 650 | + $additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')"; |
|
| 651 | 651 | } |
| 652 | 652 | if ($airline_type == "military") |
| 653 | 653 | { |
| 654 | - $additional_query .= " AND (spotter_archive_output.airline_type = 'military')"; |
|
| 654 | + $additional_query .= " AND (spotter_archive_output.airline_type = 'military')"; |
|
| 655 | + } |
|
| 655 | 656 | } |
| 656 | - } |
|
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | if ($airport != "") |
| 660 | 660 | { |
| 661 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 662 | - if (!is_string($airport)) |
|
| 663 | - { |
|
| 661 | + $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 662 | + if (!is_string($airport)) |
|
| 663 | + { |
|
| 664 | 664 | return false; |
| 665 | - } else { |
|
| 665 | + } else { |
|
| 666 | 666 | $additional_query .= " AND ((spotter_archive_output.departure_airport_icao = '".$airport."') OR (spotter_archive_output.arrival_airport_icao = '".$airport."'))"; |
| 667 | - } |
|
| 667 | + } |
|
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | if ($airport_country != "") |
| 671 | 671 | { |
| 672 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
| 673 | - if (!is_string($airport_country)) |
|
| 674 | - { |
|
| 672 | + $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
| 673 | + if (!is_string($airport_country)) |
|
| 674 | + { |
|
| 675 | 675 | return false; |
| 676 | - } else { |
|
| 676 | + } else { |
|
| 677 | 677 | $additional_query .= " AND ((spotter_archive_output.departure_airport_country = '".$airport_country."') OR (spotter_archive_output.arrival_airport_country = '".$airport_country."'))"; |
| 678 | - } |
|
| 678 | + } |
|
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | if ($callsign != "") |
| 682 | 682 | { |
| 683 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 684 | - if (!is_string($callsign)) |
|
| 685 | - { |
|
| 683 | + $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 684 | + if (!is_string($callsign)) |
|
| 685 | + { |
|
| 686 | 686 | return false; |
| 687 | - } else { |
|
| 687 | + } else { |
|
| 688 | 688 | $translate = $Translation->ident2icao($callsign); |
| 689 | 689 | if ($translate != $callsign) { |
| 690 | 690 | $additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)"; |
@@ -692,99 +692,99 @@ discard block |
||
| 692 | 692 | } else { |
| 693 | 693 | $additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')"; |
| 694 | 694 | } |
| 695 | - } |
|
| 695 | + } |
|
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | if ($owner != "") |
| 699 | 699 | { |
| 700 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 701 | - if (!is_string($owner)) |
|
| 702 | - { |
|
| 700 | + $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 701 | + if (!is_string($owner)) |
|
| 702 | + { |
|
| 703 | 703 | return false; |
| 704 | - } else { |
|
| 704 | + } else { |
|
| 705 | 705 | $additional_query .= " AND (spotter_archive_output.owner_name = '".$owner."')"; |
| 706 | - } |
|
| 706 | + } |
|
| 707 | 707 | } |
| 708 | 708 | |
| 709 | 709 | if ($pilot_name != "") |
| 710 | 710 | { |
| 711 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 712 | - if (!is_string($pilot_name)) |
|
| 713 | - { |
|
| 711 | + $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 712 | + if (!is_string($pilot_name)) |
|
| 713 | + { |
|
| 714 | 714 | return false; |
| 715 | - } else { |
|
| 715 | + } else { |
|
| 716 | 716 | $additional_query .= " AND (spotter_archive_output.pilot_name = '".$pilot_name."')"; |
| 717 | - } |
|
| 717 | + } |
|
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | if ($pilot_id != "") |
| 721 | 721 | { |
| 722 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
| 723 | - if (!is_string($pilot_id)) |
|
| 724 | - { |
|
| 722 | + $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
| 723 | + if (!is_string($pilot_id)) |
|
| 724 | + { |
|
| 725 | 725 | return false; |
| 726 | - } else { |
|
| 726 | + } else { |
|
| 727 | 727 | $additional_query .= " AND (spotter_archive_output.pilot_id = '".$pilot_id."')"; |
| 728 | - } |
|
| 728 | + } |
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | if ($departure_airport_route != "") |
| 732 | 732 | { |
| 733 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
| 734 | - if (!is_string($departure_airport_route)) |
|
| 735 | - { |
|
| 733 | + $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
| 734 | + if (!is_string($departure_airport_route)) |
|
| 735 | + { |
|
| 736 | 736 | return false; |
| 737 | - } else { |
|
| 737 | + } else { |
|
| 738 | 738 | $additional_query .= " AND (spotter_archive_output.departure_airport_icao = '".$departure_airport_route."')"; |
| 739 | - } |
|
| 739 | + } |
|
| 740 | 740 | } |
| 741 | 741 | |
| 742 | 742 | if ($arrival_airport_route != "") |
| 743 | 743 | { |
| 744 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
| 745 | - if (!is_string($arrival_airport_route)) |
|
| 746 | - { |
|
| 744 | + $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
| 745 | + if (!is_string($arrival_airport_route)) |
|
| 746 | + { |
|
| 747 | 747 | return false; |
| 748 | - } else { |
|
| 748 | + } else { |
|
| 749 | 749 | $additional_query .= " AND (spotter_archive_output.arrival_airport_icao = '".$arrival_airport_route."')"; |
| 750 | - } |
|
| 750 | + } |
|
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | if ($altitude != "") |
| 754 | 754 | { |
| 755 | - $altitude_array = explode(",", $altitude); |
|
| 755 | + $altitude_array = explode(",", $altitude); |
|
| 756 | 756 | |
| 757 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 758 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 757 | + $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 758 | + $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 759 | 759 | |
| 760 | 760 | |
| 761 | - if ($altitude_array[1] != "") |
|
| 762 | - { |
|
| 761 | + if ($altitude_array[1] != "") |
|
| 762 | + { |
|
| 763 | 763 | $altitude_array[0] = substr($altitude_array[0], 0, -2); |
| 764 | 764 | $altitude_array[1] = substr($altitude_array[1], 0, -2); |
| 765 | 765 | $additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' "; |
| 766 | - } else { |
|
| 766 | + } else { |
|
| 767 | 767 | $altitude_array[0] = substr($altitude_array[0], 0, -2); |
| 768 | 768 | $additional_query .= " AND altitude <= '".$altitude_array[0]."' "; |
| 769 | - } |
|
| 769 | + } |
|
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | if ($date_posted != "") |
| 773 | 773 | { |
| 774 | - $date_array = explode(",", $date_posted); |
|
| 774 | + $date_array = explode(",", $date_posted); |
|
| 775 | 775 | |
| 776 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
| 777 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
| 776 | + $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
| 777 | + $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
| 778 | 778 | |
| 779 | - if ($globalTimezone != '') { |
|
| 779 | + if ($globalTimezone != '') { |
|
| 780 | 780 | date_default_timezone_set($globalTimezone); |
| 781 | 781 | $datetime = new DateTime(); |
| 782 | 782 | $offset = $datetime->format('P'); |
| 783 | - } else $offset = '+00:00'; |
|
| 783 | + } else $offset = '+00:00'; |
|
| 784 | 784 | |
| 785 | 785 | |
| 786 | - if ($date_array[1] != "") |
|
| 787 | - { |
|
| 786 | + if ($date_array[1] != "") |
|
| 787 | + { |
|
| 788 | 788 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
| 789 | 789 | $date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1])); |
| 790 | 790 | if ($globalDBdriver == 'mysql') { |
@@ -792,28 +792,28 @@ discard block |
||
| 792 | 792 | } else { |
| 793 | 793 | $additional_query .= " AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." <= CAST('".$date_array[1]."' AS TIMESTAMP) "; |
| 794 | 794 | } |
| 795 | - } else { |
|
| 795 | + } else { |
|
| 796 | 796 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
| 797 | - if ($globalDBdriver == 'mysql') { |
|
| 797 | + if ($globalDBdriver == 'mysql') { |
|
| 798 | 798 | $additional_query .= " AND TIMESTAMP(CONVERT_TZ(spotter_archive_output.date,'+00:00', '".$offset."')) >= '".$date_array[0]."' "; |
| 799 | 799 | } else { |
| 800 | 800 | $additional_query .= " AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) "; |
| 801 | 801 | } |
| 802 | - } |
|
| 802 | + } |
|
| 803 | 803 | } |
| 804 | 804 | |
| 805 | 805 | if ($limit != "") |
| 806 | 806 | { |
| 807 | - $limit_array = explode(",", $limit); |
|
| 807 | + $limit_array = explode(",", $limit); |
|
| 808 | 808 | |
| 809 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 810 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 809 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 810 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 811 | 811 | |
| 812 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
| 813 | - { |
|
| 812 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
| 813 | + { |
|
| 814 | 814 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 815 | 815 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 816 | - } |
|
| 816 | + } |
|
| 817 | 817 | } |
| 818 | 818 | |
| 819 | 819 | |
@@ -844,33 +844,33 @@ discard block |
||
| 844 | 844 | $spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query); |
| 845 | 845 | |
| 846 | 846 | return $spotter_array; |
| 847 | - } |
|
| 847 | + } |
|
| 848 | 848 | |
| 849 | - public function deleteSpotterArchiveData() |
|
| 850 | - { |
|
| 849 | + public function deleteSpotterArchiveData() |
|
| 850 | + { |
|
| 851 | 851 | global $globalArchiveKeepMonths, $globalDBdriver; |
| 852 | - date_default_timezone_set('UTC'); |
|
| 853 | - if ($globalDBdriver == 'mysql') { |
|
| 852 | + date_default_timezone_set('UTC'); |
|
| 853 | + if ($globalDBdriver == 'mysql') { |
|
| 854 | 854 | $query = 'DELETE FROM spotter_archive_output WHERE spotter_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)'; |
| 855 | 855 | } else { |
| 856 | 856 | $query = "DELETE FROM spotter_archive_output WHERE spotter_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'"; |
| 857 | 857 | } |
| 858 | - try { |
|
| 859 | - $sth = $this->db->prepare($query); |
|
| 860 | - $sth->execute(); |
|
| 861 | - } catch(PDOException $e) { |
|
| 862 | - return "error"; |
|
| 863 | - } |
|
| 858 | + try { |
|
| 859 | + $sth = $this->db->prepare($query); |
|
| 860 | + $sth->execute(); |
|
| 861 | + } catch(PDOException $e) { |
|
| 862 | + return "error"; |
|
| 863 | + } |
|
| 864 | 864 | } |
| 865 | 865 | |
| 866 | - /** |
|
| 867 | - * Gets all the spotter information based on the callsign |
|
| 868 | - * |
|
| 869 | - * @return Array the spotter information |
|
| 870 | - * |
|
| 871 | - */ |
|
| 872 | - public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '') |
|
| 873 | - { |
|
| 866 | + /** |
|
| 867 | + * Gets all the spotter information based on the callsign |
|
| 868 | + * |
|
| 869 | + * @return Array the spotter information |
|
| 870 | + * |
|
| 871 | + */ |
|
| 872 | + public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '') |
|
| 873 | + { |
|
| 874 | 874 | $global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output"; |
| 875 | 875 | |
| 876 | 876 | date_default_timezone_set('UTC'); |
@@ -882,35 +882,35 @@ discard block |
||
| 882 | 882 | |
| 883 | 883 | if ($ident != "") |
| 884 | 884 | { |
| 885 | - if (!is_string($ident)) |
|
| 886 | - { |
|
| 885 | + if (!is_string($ident)) |
|
| 886 | + { |
|
| 887 | 887 | return false; |
| 888 | - } else { |
|
| 888 | + } else { |
|
| 889 | 889 | $additional_query = " AND (spotter_archive_output.ident = :ident)"; |
| 890 | 890 | $query_values = array(':ident' => $ident); |
| 891 | - } |
|
| 891 | + } |
|
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | if ($limit != "") |
| 895 | 895 | { |
| 896 | - $limit_array = explode(",", $limit); |
|
| 896 | + $limit_array = explode(",", $limit); |
|
| 897 | 897 | |
| 898 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 899 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 898 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 899 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 900 | 900 | |
| 901 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
| 902 | - { |
|
| 901 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
| 902 | + { |
|
| 903 | 903 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 904 | 904 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 905 | - } |
|
| 905 | + } |
|
| 906 | 906 | } |
| 907 | 907 | |
| 908 | 908 | if ($sort != "") |
| 909 | 909 | { |
| 910 | - $search_orderby_array = $Spotter->getOrderBy(); |
|
| 911 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 910 | + $search_orderby_array = $Spotter->getOrderBy(); |
|
| 911 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 912 | 912 | } else { |
| 913 | - $orderby_query = " ORDER BY spotter_archive_output.date DESC"; |
|
| 913 | + $orderby_query = " ORDER BY spotter_archive_output.date DESC"; |
|
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | $query = $global_query." WHERE spotter_archive_output.ident <> '' ".$additional_query." ".$orderby_query; |
@@ -918,16 +918,16 @@ discard block |
||
| 918 | 918 | $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
| 919 | 919 | |
| 920 | 920 | return $spotter_array; |
| 921 | - } |
|
| 922 | - |
|
| 923 | - /** |
|
| 924 | - * Gets all number of flight over countries |
|
| 925 | - * |
|
| 926 | - * @return Array the airline country list |
|
| 927 | - * |
|
| 928 | - */ |
|
| 929 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
| 930 | - { |
|
| 921 | + } |
|
| 922 | + |
|
| 923 | + /** |
|
| 924 | + * Gets all number of flight over countries |
|
| 925 | + * |
|
| 926 | + * @return Array the airline country list |
|
| 927 | + * |
|
| 928 | + */ |
|
| 929 | + public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
| 930 | + { |
|
| 931 | 931 | global $globalDBdriver; |
| 932 | 932 | /* |
| 933 | 933 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -937,14 +937,14 @@ discard block |
||
| 937 | 937 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 938 | 938 | FROM countries c, spotter_archive s |
| 939 | 939 | WHERE c.iso2 = s.over_country "; |
| 940 | - if ($olderthanmonths > 0) { |
|
| 941 | - if ($globalDBdriver == 'mysql') { |
|
| 940 | + if ($olderthanmonths > 0) { |
|
| 941 | + if ($globalDBdriver == 'mysql') { |
|
| 942 | 942 | $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 943 | 943 | } else { |
| 944 | 944 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 945 | 945 | } |
| 946 | 946 | } |
| 947 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 947 | + if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 948 | 948 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
| 949 | 949 | if ($limit) $query .= " LIMIT 0,10"; |
| 950 | 950 | |
@@ -957,23 +957,23 @@ discard block |
||
| 957 | 957 | |
| 958 | 958 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 959 | 959 | { |
| 960 | - $temp_array['flight_count'] = $row['nb']; |
|
| 961 | - $temp_array['flight_country'] = $row['name']; |
|
| 962 | - $temp_array['flight_country_iso3'] = $row['iso3']; |
|
| 963 | - $temp_array['flight_country_iso2'] = $row['iso2']; |
|
| 964 | - $flight_array[] = $temp_array; |
|
| 960 | + $temp_array['flight_count'] = $row['nb']; |
|
| 961 | + $temp_array['flight_country'] = $row['name']; |
|
| 962 | + $temp_array['flight_country_iso3'] = $row['iso3']; |
|
| 963 | + $temp_array['flight_country_iso2'] = $row['iso2']; |
|
| 964 | + $flight_array[] = $temp_array; |
|
| 965 | 965 | } |
| 966 | 966 | return $flight_array; |
| 967 | - } |
|
| 968 | - |
|
| 969 | - /** |
|
| 970 | - * Gets last spotter information based on a particular callsign |
|
| 971 | - * |
|
| 972 | - * @return Array the spotter information |
|
| 973 | - * |
|
| 974 | - */ |
|
| 975 | - public function getDateArchiveSpotterDataById($id,$date) |
|
| 976 | - { |
|
| 967 | + } |
|
| 968 | + |
|
| 969 | + /** |
|
| 970 | + * Gets last spotter information based on a particular callsign |
|
| 971 | + * |
|
| 972 | + * @return Array the spotter information |
|
| 973 | + * |
|
| 974 | + */ |
|
| 975 | + public function getDateArchiveSpotterDataById($id,$date) |
|
| 976 | + { |
|
| 977 | 977 | $Spotter = new Spotter($this->db); |
| 978 | 978 | date_default_timezone_set('UTC'); |
| 979 | 979 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
@@ -981,16 +981,16 @@ discard block |
||
| 981 | 981 | $date = date('c',$date); |
| 982 | 982 | $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
| 983 | 983 | return $spotter_array; |
| 984 | - } |
|
| 985 | - |
|
| 986 | - /** |
|
| 987 | - * Gets all the spotter information based on a particular callsign |
|
| 988 | - * |
|
| 989 | - * @return Array the spotter information |
|
| 990 | - * |
|
| 991 | - */ |
|
| 992 | - public function getDateArchiveSpotterDataByIdent($ident,$date) |
|
| 993 | - { |
|
| 984 | + } |
|
| 985 | + |
|
| 986 | + /** |
|
| 987 | + * Gets all the spotter information based on a particular callsign |
|
| 988 | + * |
|
| 989 | + * @return Array the spotter information |
|
| 990 | + * |
|
| 991 | + */ |
|
| 992 | + public function getDateArchiveSpotterDataByIdent($ident,$date) |
|
| 993 | + { |
|
| 994 | 994 | $Spotter = new Spotter($this->db); |
| 995 | 995 | date_default_timezone_set('UTC'); |
| 996 | 996 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
@@ -998,16 +998,16 @@ discard block |
||
| 998 | 998 | $date = date('c',$date); |
| 999 | 999 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
| 1000 | 1000 | return $spotter_array; |
| 1001 | - } |
|
| 1002 | - |
|
| 1003 | - /** |
|
| 1004 | - * Gets all the spotter information based on the airport |
|
| 1005 | - * |
|
| 1006 | - * @return Array the spotter information |
|
| 1007 | - * |
|
| 1008 | - */ |
|
| 1009 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
| 1010 | - { |
|
| 1001 | + } |
|
| 1002 | + |
|
| 1003 | + /** |
|
| 1004 | + * Gets all the spotter information based on the airport |
|
| 1005 | + * |
|
| 1006 | + * @return Array the spotter information |
|
| 1007 | + * |
|
| 1008 | + */ |
|
| 1009 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
| 1010 | + { |
|
| 1011 | 1011 | global $global_query; |
| 1012 | 1012 | $Spotter = new Spotter(); |
| 1013 | 1013 | date_default_timezone_set('UTC'); |
@@ -1018,35 +1018,35 @@ discard block |
||
| 1018 | 1018 | |
| 1019 | 1019 | if ($airport != "") |
| 1020 | 1020 | { |
| 1021 | - if (!is_string($airport)) |
|
| 1022 | - { |
|
| 1021 | + if (!is_string($airport)) |
|
| 1022 | + { |
|
| 1023 | 1023 | return false; |
| 1024 | - } else { |
|
| 1024 | + } else { |
|
| 1025 | 1025 | $additional_query .= " AND ((spotter_archive_output.departure_airport_icao = :airport) OR (spotter_archive_output.arrival_airport_icao = :airport))"; |
| 1026 | 1026 | $query_values = array(':airport' => $airport); |
| 1027 | - } |
|
| 1027 | + } |
|
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | 1030 | if ($limit != "") |
| 1031 | 1031 | { |
| 1032 | - $limit_array = explode(",", $limit); |
|
| 1032 | + $limit_array = explode(",", $limit); |
|
| 1033 | 1033 | |
| 1034 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1035 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1034 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1035 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1036 | 1036 | |
| 1037 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
| 1038 | - { |
|
| 1037 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
| 1038 | + { |
|
| 1039 | 1039 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 1040 | 1040 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 1041 | - } |
|
| 1041 | + } |
|
| 1042 | 1042 | } |
| 1043 | 1043 | |
| 1044 | 1044 | if ($sort != "") |
| 1045 | 1045 | { |
| 1046 | - $search_orderby_array = $Spotter->getOrderBy(); |
|
| 1047 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1046 | + $search_orderby_array = $Spotter->getOrderBy(); |
|
| 1047 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
| 1048 | 1048 | } else { |
| 1049 | - $orderby_query = " ORDER BY spotter_archive_output.date DESC"; |
|
| 1049 | + $orderby_query = " ORDER BY spotter_archive_output.date DESC"; |
|
| 1050 | 1050 | } |
| 1051 | 1051 | |
| 1052 | 1052 | $query = $global_query.$filter_query." spotter_archive_output.ident <> '' ".$additional_query." AND ((spotter_archive_output.departure_airport_icao <> 'NA') AND (spotter_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query; |
@@ -1054,6 +1054,6 @@ discard block |
||
| 1054 | 1054 | $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
| 1055 | 1055 | |
| 1056 | 1056 | return $spotter_array; |
| 1057 | - } |
|
| 1057 | + } |
|
| 1058 | 1058 | } |
| 1059 | 1059 | ?> |
| 1060 | 1060 | \ No newline at end of file |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * Get SQL query part for filter used |
|
| 17 | - * @param Array $filter the filter |
|
| 18 | - * @return Array the SQL part |
|
| 19 | - */ |
|
| 16 | + * Get SQL query part for filter used |
|
| 17 | + * @param Array $filter the filter |
|
| 18 | + * @return Array the SQL part |
|
| 19 | + */ |
|
| 20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 22 | 22 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter); |
@@ -55,14 +55,14 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | - * Executes the SQL statements to get the spotter information |
|
| 59 | - * |
|
| 60 | - * @param String $query the SQL query |
|
| 61 | - * @param Array $params parameter of the query |
|
| 62 | - * @param String $limitQuery the limit query |
|
| 63 | - * @return Array the spotter information |
|
| 64 | - * |
|
| 65 | - */ |
|
| 58 | + * Executes the SQL statements to get the spotter information |
|
| 59 | + * |
|
| 60 | + * @param String $query the SQL query |
|
| 61 | + * @param Array $params parameter of the query |
|
| 62 | + * @param String $limitQuery the limit query |
|
| 63 | + * @return Array the spotter information |
|
| 64 | + * |
|
| 65 | + */ |
|
| 66 | 66 | public function getDataFromDB($query, $params = array(), $limitQuery = '') |
| 67 | 67 | { |
| 68 | 68 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
@@ -226,11 +226,11 @@ discard block |
||
| 226 | 226 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 227 | 227 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 228 | 228 | } else $temp_array['aircraft_shadow'] = 'default.png'; |
| 229 | - } else { |
|
| 230 | - $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 229 | + } else { |
|
| 230 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 231 | 231 | $temp_array['aircraft_name'] = 'N/A'; |
| 232 | 232 | $temp_array['aircraft_manufacturer'] = 'N/A'; |
| 233 | - } |
|
| 233 | + } |
|
| 234 | 234 | } |
| 235 | 235 | $fromsource = NULL; |
| 236 | 236 | if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
@@ -413,11 +413,11 @@ discard block |
||
| 413 | 413 | |
| 414 | 414 | |
| 415 | 415 | /** |
| 416 | - * Gets all the spotter information |
|
| 417 | - * |
|
| 418 | - * @return Array the spotter information |
|
| 419 | - * |
|
| 420 | - */ |
|
| 416 | + * Gets all the spotter information |
|
| 417 | + * |
|
| 418 | + * @return Array the spotter information |
|
| 419 | + * |
|
| 420 | + */ |
|
| 421 | 421 | public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
| 422 | 422 | { |
| 423 | 423 | global $globalTimezone, $globalDBdriver; |
@@ -764,11 +764,11 @@ discard block |
||
| 764 | 764 | |
| 765 | 765 | |
| 766 | 766 | /** |
| 767 | - * Gets all the spotter information based on the latest data entry |
|
| 768 | - * |
|
| 769 | - * @return Array the spotter information |
|
| 770 | - * |
|
| 771 | - */ |
|
| 767 | + * Gets all the spotter information based on the latest data entry |
|
| 768 | + * |
|
| 769 | + * @return Array the spotter information |
|
| 770 | + * |
|
| 771 | + */ |
|
| 772 | 772 | public function getLatestSpotterData($limit = '', $sort = '', $filter = array()) |
| 773 | 773 | { |
| 774 | 774 | global $global_query; |
@@ -807,12 +807,12 @@ discard block |
||
| 807 | 807 | } |
| 808 | 808 | |
| 809 | 809 | |
| 810 | - /** |
|
| 811 | - * Gets all the spotter information based on a user's latitude and longitude |
|
| 812 | - * |
|
| 813 | - * @return Array the spotter information |
|
| 814 | - * |
|
| 815 | - */ |
|
| 810 | + /** |
|
| 811 | + * Gets all the spotter information based on a user's latitude and longitude |
|
| 812 | + * |
|
| 813 | + * @return Array the spotter information |
|
| 814 | + * |
|
| 815 | + */ |
|
| 816 | 816 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
| 817 | 817 | { |
| 818 | 818 | date_default_timezone_set('UTC'); |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | return false; |
| 841 | 841 | } |
| 842 | 842 | } |
| 843 | - $additional_query = ''; |
|
| 843 | + $additional_query = ''; |
|
| 844 | 844 | if ($interval != "") |
| 845 | 845 | { |
| 846 | 846 | if (!is_string($interval)) |
@@ -880,12 +880,12 @@ discard block |
||
| 880 | 880 | } |
| 881 | 881 | |
| 882 | 882 | |
| 883 | - /** |
|
| 884 | - * Gets all the spotter information sorted by the newest aircraft type |
|
| 885 | - * |
|
| 886 | - * @return Array the spotter information |
|
| 887 | - * |
|
| 888 | - */ |
|
| 883 | + /** |
|
| 884 | + * Gets all the spotter information sorted by the newest aircraft type |
|
| 885 | + * |
|
| 886 | + * @return Array the spotter information |
|
| 887 | + * |
|
| 888 | + */ |
|
| 889 | 889 | public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
| 890 | 890 | { |
| 891 | 891 | global $global_query; |
@@ -926,11 +926,11 @@ discard block |
||
| 926 | 926 | |
| 927 | 927 | |
| 928 | 928 | /** |
| 929 | - * Gets all the spotter information sorted by the newest aircraft registration |
|
| 930 | - * |
|
| 931 | - * @return Array the spotter information |
|
| 932 | - * |
|
| 933 | - */ |
|
| 929 | + * Gets all the spotter information sorted by the newest aircraft registration |
|
| 930 | + * |
|
| 931 | + * @return Array the spotter information |
|
| 932 | + * |
|
| 933 | + */ |
|
| 934 | 934 | public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array()) |
| 935 | 935 | { |
| 936 | 936 | global $global_query; |
@@ -970,11 +970,11 @@ discard block |
||
| 970 | 970 | |
| 971 | 971 | |
| 972 | 972 | /** |
| 973 | - * Gets all the spotter information sorted by the newest airline |
|
| 974 | - * |
|
| 975 | - * @return Array the spotter information |
|
| 976 | - * |
|
| 977 | - */ |
|
| 973 | + * Gets all the spotter information sorted by the newest airline |
|
| 974 | + * |
|
| 975 | + * @return Array the spotter information |
|
| 976 | + * |
|
| 977 | + */ |
|
| 978 | 978 | public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
| 979 | 979 | { |
| 980 | 980 | global $global_query; |
@@ -1013,12 +1013,12 @@ discard block |
||
| 1013 | 1013 | } |
| 1014 | 1014 | |
| 1015 | 1015 | |
| 1016 | - /** |
|
| 1017 | - * Gets all the spotter information sorted by the newest departure airport |
|
| 1018 | - * |
|
| 1019 | - * @return Array the spotter information |
|
| 1020 | - * |
|
| 1021 | - */ |
|
| 1016 | + /** |
|
| 1017 | + * Gets all the spotter information sorted by the newest departure airport |
|
| 1018 | + * |
|
| 1019 | + * @return Array the spotter information |
|
| 1020 | + * |
|
| 1021 | + */ |
|
| 1022 | 1022 | public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array()) |
| 1023 | 1023 | { |
| 1024 | 1024 | global $global_query; |
@@ -1060,11 +1060,11 @@ discard block |
||
| 1060 | 1060 | |
| 1061 | 1061 | |
| 1062 | 1062 | /** |
| 1063 | - * Gets all the spotter information sorted by the newest arrival airport |
|
| 1064 | - * |
|
| 1065 | - * @return Array the spotter information |
|
| 1066 | - * |
|
| 1067 | - */ |
|
| 1063 | + * Gets all the spotter information sorted by the newest arrival airport |
|
| 1064 | + * |
|
| 1065 | + * @return Array the spotter information |
|
| 1066 | + * |
|
| 1067 | + */ |
|
| 1068 | 1068 | public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array()) |
| 1069 | 1069 | { |
| 1070 | 1070 | global $global_query; |
@@ -1103,11 +1103,11 @@ discard block |
||
| 1103 | 1103 | |
| 1104 | 1104 | |
| 1105 | 1105 | /** |
| 1106 | - * Gets all the spotter information based on the spotter id |
|
| 1107 | - * |
|
| 1108 | - * @return Array the spotter information |
|
| 1109 | - * |
|
| 1110 | - */ |
|
| 1106 | + * Gets all the spotter information based on the spotter id |
|
| 1107 | + * |
|
| 1108 | + * @return Array the spotter information |
|
| 1109 | + * |
|
| 1110 | + */ |
|
| 1111 | 1111 | public function getSpotterDataByID($id = '') |
| 1112 | 1112 | { |
| 1113 | 1113 | global $global_query; |
@@ -1129,11 +1129,11 @@ discard block |
||
| 1129 | 1129 | |
| 1130 | 1130 | |
| 1131 | 1131 | /** |
| 1132 | - * Gets all the spotter information based on the callsign |
|
| 1133 | - * |
|
| 1134 | - * @return Array the spotter information |
|
| 1135 | - * |
|
| 1136 | - */ |
|
| 1132 | + * Gets all the spotter information based on the callsign |
|
| 1133 | + * |
|
| 1134 | + * @return Array the spotter information |
|
| 1135 | + * |
|
| 1136 | + */ |
|
| 1137 | 1137 | public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '') |
| 1138 | 1138 | { |
| 1139 | 1139 | global $global_query; |
@@ -1186,11 +1186,11 @@ discard block |
||
| 1186 | 1186 | |
| 1187 | 1187 | |
| 1188 | 1188 | /** |
| 1189 | - * Gets all the spotter information based on the aircraft type |
|
| 1190 | - * |
|
| 1191 | - * @return Array the spotter information |
|
| 1192 | - * |
|
| 1193 | - */ |
|
| 1189 | + * Gets all the spotter information based on the aircraft type |
|
| 1190 | + * |
|
| 1191 | + * @return Array the spotter information |
|
| 1192 | + * |
|
| 1193 | + */ |
|
| 1194 | 1194 | public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array()) |
| 1195 | 1195 | { |
| 1196 | 1196 | global $global_query; |
@@ -1244,11 +1244,11 @@ discard block |
||
| 1244 | 1244 | |
| 1245 | 1245 | |
| 1246 | 1246 | /** |
| 1247 | - * Gets all the spotter information based on the aircraft registration |
|
| 1248 | - * |
|
| 1249 | - * @return Array the spotter information |
|
| 1250 | - * |
|
| 1251 | - */ |
|
| 1247 | + * Gets all the spotter information based on the aircraft registration |
|
| 1248 | + * |
|
| 1249 | + * @return Array the spotter information |
|
| 1250 | + * |
|
| 1251 | + */ |
|
| 1252 | 1252 | public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array()) |
| 1253 | 1253 | { |
| 1254 | 1254 | global $global_query; |
@@ -1305,11 +1305,11 @@ discard block |
||
| 1305 | 1305 | |
| 1306 | 1306 | |
| 1307 | 1307 | /** |
| 1308 | - * Gets all the spotter information based on the airline |
|
| 1309 | - * |
|
| 1310 | - * @return Array the spotter information |
|
| 1311 | - * |
|
| 1312 | - */ |
|
| 1308 | + * Gets all the spotter information based on the airline |
|
| 1309 | + * |
|
| 1310 | + * @return Array the spotter information |
|
| 1311 | + * |
|
| 1312 | + */ |
|
| 1313 | 1313 | public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
| 1314 | 1314 | { |
| 1315 | 1315 | global $global_query; |
@@ -1362,11 +1362,11 @@ discard block |
||
| 1362 | 1362 | |
| 1363 | 1363 | |
| 1364 | 1364 | /** |
| 1365 | - * Gets all the spotter information based on the airport |
|
| 1366 | - * |
|
| 1367 | - * @return Array the spotter information |
|
| 1368 | - * |
|
| 1369 | - */ |
|
| 1365 | + * Gets all the spotter information based on the airport |
|
| 1366 | + * |
|
| 1367 | + * @return Array the spotter information |
|
| 1368 | + * |
|
| 1369 | + */ |
|
| 1370 | 1370 | public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
| 1371 | 1371 | { |
| 1372 | 1372 | global $global_query; |
@@ -1420,11 +1420,11 @@ discard block |
||
| 1420 | 1420 | |
| 1421 | 1421 | |
| 1422 | 1422 | /** |
| 1423 | - * Gets all the spotter information based on the date |
|
| 1424 | - * |
|
| 1425 | - * @return Array the spotter information |
|
| 1426 | - * |
|
| 1427 | - */ |
|
| 1423 | + * Gets all the spotter information based on the date |
|
| 1424 | + * |
|
| 1425 | + * @return Array the spotter information |
|
| 1426 | + * |
|
| 1427 | + */ |
|
| 1428 | 1428 | public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
| 1429 | 1429 | { |
| 1430 | 1430 | global $global_query, $globalTimezone, $globalDBdriver; |
@@ -1485,11 +1485,11 @@ discard block |
||
| 1485 | 1485 | |
| 1486 | 1486 | |
| 1487 | 1487 | /** |
| 1488 | - * Gets all the spotter information based on the country name |
|
| 1489 | - * |
|
| 1490 | - * @return Array the spotter information |
|
| 1491 | - * |
|
| 1492 | - */ |
|
| 1488 | + * Gets all the spotter information based on the country name |
|
| 1489 | + * |
|
| 1490 | + * @return Array the spotter information |
|
| 1491 | + * |
|
| 1492 | + */ |
|
| 1493 | 1493 | public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
| 1494 | 1494 | { |
| 1495 | 1495 | global $global_query; |
@@ -1543,11 +1543,11 @@ discard block |
||
| 1543 | 1543 | |
| 1544 | 1544 | |
| 1545 | 1545 | /** |
| 1546 | - * Gets all the spotter information based on the manufacturer name |
|
| 1547 | - * |
|
| 1548 | - * @return Array the spotter information |
|
| 1549 | - * |
|
| 1550 | - */ |
|
| 1546 | + * Gets all the spotter information based on the manufacturer name |
|
| 1547 | + * |
|
| 1548 | + * @return Array the spotter information |
|
| 1549 | + * |
|
| 1550 | + */ |
|
| 1551 | 1551 | public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array()) |
| 1552 | 1552 | { |
| 1553 | 1553 | global $global_query; |
@@ -1603,13 +1603,13 @@ discard block |
||
| 1603 | 1603 | |
| 1604 | 1604 | |
| 1605 | 1605 | /** |
| 1606 | - * Gets a list of all aircraft that take a route |
|
| 1607 | - * |
|
| 1608 | - * @param String $departure_airport_icao ICAO code of departure airport |
|
| 1609 | - * @param String $arrival_airport_icao ICAO code of arrival airport |
|
| 1610 | - * @return Array the spotter information |
|
| 1611 | - * |
|
| 1612 | - */ |
|
| 1606 | + * Gets a list of all aircraft that take a route |
|
| 1607 | + * |
|
| 1608 | + * @param String $departure_airport_icao ICAO code of departure airport |
|
| 1609 | + * @param String $arrival_airport_icao ICAO code of arrival airport |
|
| 1610 | + * @return Array the spotter information |
|
| 1611 | + * |
|
| 1612 | + */ |
|
| 1613 | 1613 | public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array()) |
| 1614 | 1614 | { |
| 1615 | 1615 | global $global_query; |
@@ -1676,11 +1676,11 @@ discard block |
||
| 1676 | 1676 | |
| 1677 | 1677 | |
| 1678 | 1678 | /** |
| 1679 | - * Gets all the spotter information based on the special column in the table |
|
| 1680 | - * |
|
| 1681 | - * @return Array the spotter information |
|
| 1682 | - * |
|
| 1683 | - */ |
|
| 1679 | + * Gets all the spotter information based on the special column in the table |
|
| 1680 | + * |
|
| 1681 | + * @return Array the spotter information |
|
| 1682 | + * |
|
| 1683 | + */ |
|
| 1684 | 1684 | public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array()) |
| 1685 | 1685 | { |
| 1686 | 1686 | global $global_query; |
@@ -1719,11 +1719,11 @@ discard block |
||
| 1719 | 1719 | } |
| 1720 | 1720 | |
| 1721 | 1721 | /** |
| 1722 | - * Gets all the highlight based on a aircraft registration |
|
| 1723 | - * |
|
| 1724 | - * @return String the highlight text |
|
| 1725 | - * |
|
| 1726 | - */ |
|
| 1722 | + * Gets all the highlight based on a aircraft registration |
|
| 1723 | + * |
|
| 1724 | + * @return String the highlight text |
|
| 1725 | + * |
|
| 1726 | + */ |
|
| 1727 | 1727 | public function getHighlightByRegistration($registration,$filter = array()) |
| 1728 | 1728 | { |
| 1729 | 1729 | global $global_query; |
@@ -1745,13 +1745,13 @@ discard block |
||
| 1745 | 1745 | |
| 1746 | 1746 | |
| 1747 | 1747 | /** |
| 1748 | - * Gets the squawk usage from squawk code |
|
| 1749 | - * |
|
| 1750 | - * @param String $squawk squawk code |
|
| 1751 | - * @param String $country country |
|
| 1752 | - * @return String usage |
|
| 1753 | - * |
|
| 1754 | - */ |
|
| 1748 | + * Gets the squawk usage from squawk code |
|
| 1749 | + * |
|
| 1750 | + * @param String $squawk squawk code |
|
| 1751 | + * @param String $country country |
|
| 1752 | + * @return String usage |
|
| 1753 | + * |
|
| 1754 | + */ |
|
| 1755 | 1755 | public function getSquawkUsage($squawk = '',$country = 'FR') |
| 1756 | 1756 | { |
| 1757 | 1757 | |
@@ -1772,12 +1772,12 @@ discard block |
||
| 1772 | 1772 | } |
| 1773 | 1773 | |
| 1774 | 1774 | /** |
| 1775 | - * Gets the airport icao from the iata |
|
| 1776 | - * |
|
| 1777 | - * @param String $airport_iata the iata code of the airport |
|
| 1778 | - * @return String airport iata |
|
| 1779 | - * |
|
| 1780 | - */ |
|
| 1775 | + * Gets the airport icao from the iata |
|
| 1776 | + * |
|
| 1777 | + * @param String $airport_iata the iata code of the airport |
|
| 1778 | + * @return String airport iata |
|
| 1779 | + * |
|
| 1780 | + */ |
|
| 1781 | 1781 | public function getAirportIcao($airport_iata = '') |
| 1782 | 1782 | { |
| 1783 | 1783 | |
@@ -1797,14 +1797,14 @@ discard block |
||
| 1797 | 1797 | } |
| 1798 | 1798 | |
| 1799 | 1799 | /** |
| 1800 | - * Gets the airport distance |
|
| 1801 | - * |
|
| 1802 | - * @param String $airport_icao the icao code of the airport |
|
| 1803 | - * @param Float $latitude the latitude |
|
| 1804 | - * @param Float $longitude the longitude |
|
| 1805 | - * @return Float distance to the airport |
|
| 1806 | - * |
|
| 1807 | - */ |
|
| 1800 | + * Gets the airport distance |
|
| 1801 | + * |
|
| 1802 | + * @param String $airport_icao the icao code of the airport |
|
| 1803 | + * @param Float $latitude the latitude |
|
| 1804 | + * @param Float $longitude the longitude |
|
| 1805 | + * @return Float distance to the airport |
|
| 1806 | + * |
|
| 1807 | + */ |
|
| 1808 | 1808 | public function getAirportDistance($airport_icao,$latitude,$longitude) |
| 1809 | 1809 | { |
| 1810 | 1810 | |
@@ -1825,12 +1825,12 @@ discard block |
||
| 1825 | 1825 | } |
| 1826 | 1826 | |
| 1827 | 1827 | /** |
| 1828 | - * Gets the airport info based on the icao |
|
| 1829 | - * |
|
| 1830 | - * @param String $airport the icao code of the airport |
|
| 1831 | - * @return Array airport information |
|
| 1832 | - * |
|
| 1833 | - */ |
|
| 1828 | + * Gets the airport info based on the icao |
|
| 1829 | + * |
|
| 1830 | + * @param String $airport the icao code of the airport |
|
| 1831 | + * @return Array airport information |
|
| 1832 | + * |
|
| 1833 | + */ |
|
| 1834 | 1834 | public function getAllAirportInfo($airport = '') |
| 1835 | 1835 | { |
| 1836 | 1836 | |
@@ -1876,12 +1876,12 @@ discard block |
||
| 1876 | 1876 | } |
| 1877 | 1877 | |
| 1878 | 1878 | /** |
| 1879 | - * Gets the airport info based on the country |
|
| 1880 | - * |
|
| 1881 | - * @param Array $countries Airports countries |
|
| 1882 | - * @return Array airport information |
|
| 1883 | - * |
|
| 1884 | - */ |
|
| 1879 | + * Gets the airport info based on the country |
|
| 1880 | + * |
|
| 1881 | + * @param Array $countries Airports countries |
|
| 1882 | + * @return Array airport information |
|
| 1883 | + * |
|
| 1884 | + */ |
|
| 1885 | 1885 | public function getAllAirportInfobyCountry($countries) |
| 1886 | 1886 | { |
| 1887 | 1887 | $lst_countries = ''; |
@@ -1919,12 +1919,12 @@ discard block |
||
| 1919 | 1919 | } |
| 1920 | 1920 | |
| 1921 | 1921 | /** |
| 1922 | - * Gets airports info based on the coord |
|
| 1923 | - * |
|
| 1924 | - * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
| 1925 | - * @return Array airport information |
|
| 1926 | - * |
|
| 1927 | - */ |
|
| 1922 | + * Gets airports info based on the coord |
|
| 1923 | + * |
|
| 1924 | + * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
| 1925 | + * @return Array airport information |
|
| 1926 | + * |
|
| 1927 | + */ |
|
| 1928 | 1928 | public function getAllAirportInfobyCoord($coord) |
| 1929 | 1929 | { |
| 1930 | 1930 | global $globalDBdriver; |
@@ -1955,12 +1955,12 @@ discard block |
||
| 1955 | 1955 | } |
| 1956 | 1956 | |
| 1957 | 1957 | /** |
| 1958 | - * Gets waypoints info based on the coord |
|
| 1959 | - * |
|
| 1960 | - * @param Array $coord waypoints coord |
|
| 1961 | - * @return Array airport information |
|
| 1962 | - * |
|
| 1963 | - */ |
|
| 1958 | + * Gets waypoints info based on the coord |
|
| 1959 | + * |
|
| 1960 | + * @param Array $coord waypoints coord |
|
| 1961 | + * @return Array airport information |
|
| 1962 | + * |
|
| 1963 | + */ |
|
| 1964 | 1964 | public function getAllWaypointsInfobyCoord($coord) |
| 1965 | 1965 | { |
| 1966 | 1966 | if (is_array($coord)) { |
@@ -1994,12 +1994,12 @@ discard block |
||
| 1994 | 1994 | |
| 1995 | 1995 | |
| 1996 | 1996 | /** |
| 1997 | - * Gets the airline info based on the icao code or iata code |
|
| 1998 | - * |
|
| 1999 | - * @param String $airline_icao the iata code of the airport |
|
| 2000 | - * @return Array airport information |
|
| 2001 | - * |
|
| 2002 | - */ |
|
| 1997 | + * Gets the airline info based on the icao code or iata code |
|
| 1998 | + * |
|
| 1999 | + * @param String $airline_icao the iata code of the airport |
|
| 2000 | + * @return Array airport information |
|
| 2001 | + * |
|
| 2002 | + */ |
|
| 2003 | 2003 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2004 | 2004 | { |
| 2005 | 2005 | global $globalUseRealAirlines; |
@@ -2030,7 +2030,7 @@ discard block |
||
| 2030 | 2030 | } else { |
| 2031 | 2031 | $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
| 2032 | 2032 | } |
| 2033 | - /* |
|
| 2033 | + /* |
|
| 2034 | 2034 | $airline_array = array(); |
| 2035 | 2035 | $temp_array = array(); |
| 2036 | 2036 | |
@@ -2062,12 +2062,12 @@ discard block |
||
| 2062 | 2062 | |
| 2063 | 2063 | |
| 2064 | 2064 | /** |
| 2065 | - * Gets the aircraft info based on the aircraft type |
|
| 2066 | - * |
|
| 2067 | - * @param String $aircraft_type the aircraft type |
|
| 2068 | - * @return Array aircraft information |
|
| 2069 | - * |
|
| 2070 | - */ |
|
| 2065 | + * Gets the aircraft info based on the aircraft type |
|
| 2066 | + * |
|
| 2067 | + * @param String $aircraft_type the aircraft type |
|
| 2068 | + * @return Array aircraft information |
|
| 2069 | + * |
|
| 2070 | + */ |
|
| 2071 | 2071 | public function getAllAircraftInfo($aircraft_type) |
| 2072 | 2072 | { |
| 2073 | 2073 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2099,12 +2099,12 @@ discard block |
||
| 2099 | 2099 | } |
| 2100 | 2100 | |
| 2101 | 2101 | /** |
| 2102 | - * Gets the aircraft icao based on the aircraft name/type |
|
| 2103 | - * |
|
| 2104 | - * @param String $aircraft_type the aircraft type |
|
| 2105 | - * @return String aircraft information |
|
| 2106 | - * |
|
| 2107 | - */ |
|
| 2102 | + * Gets the aircraft icao based on the aircraft name/type |
|
| 2103 | + * |
|
| 2104 | + * @param String $aircraft_type the aircraft type |
|
| 2105 | + * @return String aircraft information |
|
| 2106 | + * |
|
| 2107 | + */ |
|
| 2108 | 2108 | public function getAircraftIcao($aircraft_type) |
| 2109 | 2109 | { |
| 2110 | 2110 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2129,12 +2129,12 @@ discard block |
||
| 2129 | 2129 | } |
| 2130 | 2130 | |
| 2131 | 2131 | /** |
| 2132 | - * Gets the aircraft info based on the aircraft ident |
|
| 2133 | - * |
|
| 2134 | - * @param String $aircraft_modes the aircraft ident (hex) |
|
| 2135 | - * @return String aircraft type |
|
| 2136 | - * |
|
| 2137 | - */ |
|
| 2132 | + * Gets the aircraft info based on the aircraft ident |
|
| 2133 | + * |
|
| 2134 | + * @param String $aircraft_modes the aircraft ident (hex) |
|
| 2135 | + * @return String aircraft type |
|
| 2136 | + * |
|
| 2137 | + */ |
|
| 2138 | 2138 | public function getAllAircraftType($aircraft_modes) |
| 2139 | 2139 | { |
| 2140 | 2140 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -2152,12 +2152,12 @@ discard block |
||
| 2152 | 2152 | } |
| 2153 | 2153 | |
| 2154 | 2154 | /** |
| 2155 | - * Gets correct aircraft operator corde |
|
| 2156 | - * |
|
| 2157 | - * @param String $operator the aircraft operator code (callsign) |
|
| 2158 | - * @return String aircraft operator code |
|
| 2159 | - * |
|
| 2160 | - */ |
|
| 2155 | + * Gets correct aircraft operator corde |
|
| 2156 | + * |
|
| 2157 | + * @param String $operator the aircraft operator code (callsign) |
|
| 2158 | + * @return String aircraft operator code |
|
| 2159 | + * |
|
| 2160 | + */ |
|
| 2161 | 2161 | public function getOperator($operator) |
| 2162 | 2162 | { |
| 2163 | 2163 | $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
@@ -2174,16 +2174,16 @@ discard block |
||
| 2174 | 2174 | } |
| 2175 | 2175 | |
| 2176 | 2176 | /** |
| 2177 | - * Gets the aircraft route based on the aircraft callsign |
|
| 2178 | - * |
|
| 2179 | - * @param String $callsign the aircraft callsign |
|
| 2180 | - * @return Array aircraft type |
|
| 2181 | - * |
|
| 2182 | - */ |
|
| 2177 | + * Gets the aircraft route based on the aircraft callsign |
|
| 2178 | + * |
|
| 2179 | + * @param String $callsign the aircraft callsign |
|
| 2180 | + * @return Array aircraft type |
|
| 2181 | + * |
|
| 2182 | + */ |
|
| 2183 | 2183 | public function getRouteInfo($callsign) |
| 2184 | 2184 | { |
| 2185 | 2185 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2186 | - if ($callsign == '') return array(); |
|
| 2186 | + if ($callsign == '') return array(); |
|
| 2187 | 2187 | $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
| 2188 | 2188 | |
| 2189 | 2189 | $sth = $this->db->prepare($query); |
@@ -2197,12 +2197,12 @@ discard block |
||
| 2197 | 2197 | } |
| 2198 | 2198 | |
| 2199 | 2199 | /** |
| 2200 | - * Gets the aircraft info based on the aircraft registration |
|
| 2201 | - * |
|
| 2202 | - * @param String $registration the aircraft registration |
|
| 2203 | - * @return Array aircraft information |
|
| 2204 | - * |
|
| 2205 | - */ |
|
| 2200 | + * Gets the aircraft info based on the aircraft registration |
|
| 2201 | + * |
|
| 2202 | + * @param String $registration the aircraft registration |
|
| 2203 | + * @return Array aircraft information |
|
| 2204 | + * |
|
| 2205 | + */ |
|
| 2206 | 2206 | public function getAircraftInfoByRegistration($registration) |
| 2207 | 2207 | { |
| 2208 | 2208 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2229,12 +2229,12 @@ discard block |
||
| 2229 | 2229 | } |
| 2230 | 2230 | |
| 2231 | 2231 | /** |
| 2232 | - * Gets the aircraft owner & base based on the aircraft registration |
|
| 2233 | - * |
|
| 2234 | - * @param String $registration the aircraft registration |
|
| 2235 | - * @return Array aircraft information |
|
| 2236 | - * |
|
| 2237 | - */ |
|
| 2232 | + * Gets the aircraft owner & base based on the aircraft registration |
|
| 2233 | + * |
|
| 2234 | + * @param String $registration the aircraft registration |
|
| 2235 | + * @return Array aircraft information |
|
| 2236 | + * |
|
| 2237 | + */ |
|
| 2238 | 2238 | public function getAircraftOwnerByRegistration($registration) |
| 2239 | 2239 | { |
| 2240 | 2240 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2251,11 +2251,11 @@ discard block |
||
| 2251 | 2251 | |
| 2252 | 2252 | |
| 2253 | 2253 | /** |
| 2254 | - * Gets all flights (but with only little info) |
|
| 2255 | - * |
|
| 2256 | - * @return Array basic flight information |
|
| 2257 | - * |
|
| 2258 | - */ |
|
| 2254 | + * Gets all flights (but with only little info) |
|
| 2255 | + * |
|
| 2256 | + * @return Array basic flight information |
|
| 2257 | + * |
|
| 2258 | + */ |
|
| 2259 | 2259 | public function getAllFlightsforSitemap() |
| 2260 | 2260 | { |
| 2261 | 2261 | //$query = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT "; |
@@ -2263,7 +2263,7 @@ discard block |
||
| 2263 | 2263 | |
| 2264 | 2264 | $sth = $this->db->prepare($query); |
| 2265 | 2265 | $sth->execute(); |
| 2266 | - /* |
|
| 2266 | + /* |
|
| 2267 | 2267 | $flight_array = array(); |
| 2268 | 2268 | $temp_array = array(); |
| 2269 | 2269 | |
@@ -2285,11 +2285,11 @@ discard block |
||
| 2285 | 2285 | } |
| 2286 | 2286 | |
| 2287 | 2287 | /** |
| 2288 | - * Gets a list of all aircraft manufacturers |
|
| 2289 | - * |
|
| 2290 | - * @return Array list of aircraft types |
|
| 2291 | - * |
|
| 2292 | - */ |
|
| 2288 | + * Gets a list of all aircraft manufacturers |
|
| 2289 | + * |
|
| 2290 | + * @return Array list of aircraft types |
|
| 2291 | + * |
|
| 2292 | + */ |
|
| 2293 | 2293 | public function getAllManufacturers() |
| 2294 | 2294 | { |
| 2295 | 2295 | /* |
@@ -2318,11 +2318,11 @@ discard block |
||
| 2318 | 2318 | |
| 2319 | 2319 | |
| 2320 | 2320 | /** |
| 2321 | - * Gets a list of all aircraft types |
|
| 2322 | - * |
|
| 2323 | - * @return Array list of aircraft types |
|
| 2324 | - * |
|
| 2325 | - */ |
|
| 2321 | + * Gets a list of all aircraft types |
|
| 2322 | + * |
|
| 2323 | + * @return Array list of aircraft types |
|
| 2324 | + * |
|
| 2325 | + */ |
|
| 2326 | 2326 | public function getAllAircraftTypes($filters = array()) |
| 2327 | 2327 | { |
| 2328 | 2328 | /* |
@@ -2355,11 +2355,11 @@ discard block |
||
| 2355 | 2355 | |
| 2356 | 2356 | |
| 2357 | 2357 | /** |
| 2358 | - * Gets a list of all aircraft registrations |
|
| 2359 | - * |
|
| 2360 | - * @return Array list of aircraft registrations |
|
| 2361 | - * |
|
| 2362 | - */ |
|
| 2358 | + * Gets a list of all aircraft registrations |
|
| 2359 | + * |
|
| 2360 | + * @return Array list of aircraft registrations |
|
| 2361 | + * |
|
| 2362 | + */ |
|
| 2363 | 2363 | public function getAllAircraftRegistrations($filters = array()) |
| 2364 | 2364 | { |
| 2365 | 2365 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2384,12 +2384,12 @@ discard block |
||
| 2384 | 2384 | } |
| 2385 | 2385 | |
| 2386 | 2386 | /** |
| 2387 | - * Gets all source name |
|
| 2388 | - * |
|
| 2389 | - * @param String type format of source |
|
| 2390 | - * @return Array list of source name |
|
| 2391 | - * |
|
| 2392 | - */ |
|
| 2387 | + * Gets all source name |
|
| 2388 | + * |
|
| 2389 | + * @param String type format of source |
|
| 2390 | + * @return Array list of source name |
|
| 2391 | + * |
|
| 2392 | + */ |
|
| 2393 | 2393 | public function getAllSourceName($type = '',$filters = array()) |
| 2394 | 2394 | { |
| 2395 | 2395 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2420,11 +2420,11 @@ discard block |
||
| 2420 | 2420 | |
| 2421 | 2421 | |
| 2422 | 2422 | /** |
| 2423 | - * Gets a list of all airline names |
|
| 2424 | - * |
|
| 2425 | - * @return Array list of airline names |
|
| 2426 | - * |
|
| 2427 | - */ |
|
| 2423 | + * Gets a list of all airline names |
|
| 2424 | + * |
|
| 2425 | + * @return Array list of airline names |
|
| 2426 | + * |
|
| 2427 | + */ |
|
| 2428 | 2428 | public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
| 2429 | 2429 | { |
| 2430 | 2430 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
@@ -2474,11 +2474,11 @@ discard block |
||
| 2474 | 2474 | |
| 2475 | 2475 | |
| 2476 | 2476 | /** |
| 2477 | - * Gets a list of all airline countries |
|
| 2478 | - * |
|
| 2479 | - * @return Array list of airline countries |
|
| 2480 | - * |
|
| 2481 | - */ |
|
| 2477 | + * Gets a list of all airline countries |
|
| 2478 | + * |
|
| 2479 | + * @return Array list of airline countries |
|
| 2480 | + * |
|
| 2481 | + */ |
|
| 2482 | 2482 | public function getAllAirlineCountries($filters = array()) |
| 2483 | 2483 | { |
| 2484 | 2484 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2506,11 +2506,11 @@ discard block |
||
| 2506 | 2506 | |
| 2507 | 2507 | |
| 2508 | 2508 | /** |
| 2509 | - * Gets a list of all departure & arrival names |
|
| 2510 | - * |
|
| 2511 | - * @return Array list of airport names |
|
| 2512 | - * |
|
| 2513 | - */ |
|
| 2509 | + * Gets a list of all departure & arrival names |
|
| 2510 | + * |
|
| 2511 | + * @return Array list of airport names |
|
| 2512 | + * |
|
| 2513 | + */ |
|
| 2514 | 2514 | public function getAllAirportNames($filters = array()) |
| 2515 | 2515 | { |
| 2516 | 2516 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2559,11 +2559,11 @@ discard block |
||
| 2559 | 2559 | |
| 2560 | 2560 | |
| 2561 | 2561 | /** |
| 2562 | - * Gets a list of all departure & arrival airport countries |
|
| 2563 | - * |
|
| 2564 | - * @return Array list of airport countries |
|
| 2565 | - * |
|
| 2566 | - */ |
|
| 2562 | + * Gets a list of all departure & arrival airport countries |
|
| 2563 | + * |
|
| 2564 | + * @return Array list of airport countries |
|
| 2565 | + * |
|
| 2566 | + */ |
|
| 2567 | 2567 | public function getAllAirportCountries($filters = array()) |
| 2568 | 2568 | { |
| 2569 | 2569 | $airport_array = array(); |
@@ -2611,11 +2611,11 @@ discard block |
||
| 2611 | 2611 | |
| 2612 | 2612 | |
| 2613 | 2613 | /** |
| 2614 | - * Gets a list of all countries (airline, departure airport & arrival airport) |
|
| 2615 | - * |
|
| 2616 | - * @return Array list of countries |
|
| 2617 | - * |
|
| 2618 | - */ |
|
| 2614 | + * Gets a list of all countries (airline, departure airport & arrival airport) |
|
| 2615 | + * |
|
| 2616 | + * @return Array list of countries |
|
| 2617 | + * |
|
| 2618 | + */ |
|
| 2619 | 2619 | public function getAllCountries($filters = array()) |
| 2620 | 2620 | { |
| 2621 | 2621 | $Connection= new Connection($this->db); |
@@ -2692,11 +2692,11 @@ discard block |
||
| 2692 | 2692 | |
| 2693 | 2693 | |
| 2694 | 2694 | /** |
| 2695 | - * Gets a list of all idents/callsigns |
|
| 2696 | - * |
|
| 2697 | - * @return Array list of ident/callsign names |
|
| 2698 | - * |
|
| 2699 | - */ |
|
| 2695 | + * Gets a list of all idents/callsigns |
|
| 2696 | + * |
|
| 2697 | + * @return Array list of ident/callsign names |
|
| 2698 | + * |
|
| 2699 | + */ |
|
| 2700 | 2700 | public function getAllIdents($filters = array()) |
| 2701 | 2701 | { |
| 2702 | 2702 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2720,9 +2720,9 @@ discard block |
||
| 2720 | 2720 | } |
| 2721 | 2721 | |
| 2722 | 2722 | /** |
| 2723 | - * Get a list of flights from airport since 7 days |
|
| 2724 | - * @return Array number, icao, name and city of airports |
|
| 2725 | - */ |
|
| 2723 | + * Get a list of flights from airport since 7 days |
|
| 2724 | + * @return Array number, icao, name and city of airports |
|
| 2725 | + */ |
|
| 2726 | 2726 | |
| 2727 | 2727 | public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
| 2728 | 2728 | global $globalTimezone, $globalDBdriver; |
@@ -2753,9 +2753,9 @@ discard block |
||
| 2753 | 2753 | } |
| 2754 | 2754 | |
| 2755 | 2755 | /** |
| 2756 | - * Get a list of flights from airport since 7 days |
|
| 2757 | - * @return Array number, icao, name and city of airports |
|
| 2758 | - */ |
|
| 2756 | + * Get a list of flights from airport since 7 days |
|
| 2757 | + * @return Array number, icao, name and city of airports |
|
| 2758 | + */ |
|
| 2759 | 2759 | |
| 2760 | 2760 | public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') { |
| 2761 | 2761 | global $globalTimezone, $globalDBdriver; |
@@ -2785,9 +2785,9 @@ discard block |
||
| 2785 | 2785 | } |
| 2786 | 2786 | |
| 2787 | 2787 | /** |
| 2788 | - * Get a list of flights from detected airport since 7 days |
|
| 2789 | - * @return Array number, icao, name and city of airports |
|
| 2790 | - */ |
|
| 2788 | + * Get a list of flights from detected airport since 7 days |
|
| 2789 | + * @return Array number, icao, name and city of airports |
|
| 2790 | + */ |
|
| 2791 | 2791 | |
| 2792 | 2792 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
| 2793 | 2793 | global $globalTimezone, $globalDBdriver; |
@@ -2825,9 +2825,9 @@ discard block |
||
| 2825 | 2825 | } |
| 2826 | 2826 | |
| 2827 | 2827 | /** |
| 2828 | - * Get a list of flights from detected airport since 7 days |
|
| 2829 | - * @return Array number, icao, name and city of airports |
|
| 2830 | - */ |
|
| 2828 | + * Get a list of flights from detected airport since 7 days |
|
| 2829 | + * @return Array number, icao, name and city of airports |
|
| 2830 | + */ |
|
| 2831 | 2831 | |
| 2832 | 2832 | public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') { |
| 2833 | 2833 | global $globalTimezone, $globalDBdriver; |
@@ -2869,9 +2869,9 @@ discard block |
||
| 2869 | 2869 | |
| 2870 | 2870 | |
| 2871 | 2871 | /** |
| 2872 | - * Get a list of flights to airport since 7 days |
|
| 2873 | - * @return Array number, icao, name and city of airports |
|
| 2874 | - */ |
|
| 2872 | + * Get a list of flights to airport since 7 days |
|
| 2873 | + * @return Array number, icao, name and city of airports |
|
| 2874 | + */ |
|
| 2875 | 2875 | |
| 2876 | 2876 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
| 2877 | 2877 | global $globalTimezone, $globalDBdriver; |
@@ -2904,9 +2904,9 @@ discard block |
||
| 2904 | 2904 | |
| 2905 | 2905 | |
| 2906 | 2906 | /** |
| 2907 | - * Get a list of flights detected to airport since 7 days |
|
| 2908 | - * @return Array number, icao, name and city of airports |
|
| 2909 | - */ |
|
| 2907 | + * Get a list of flights detected to airport since 7 days |
|
| 2908 | + * @return Array number, icao, name and city of airports |
|
| 2909 | + */ |
|
| 2910 | 2910 | |
| 2911 | 2911 | public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
| 2912 | 2912 | global $globalTimezone, $globalDBdriver; |
@@ -2947,9 +2947,9 @@ discard block |
||
| 2947 | 2947 | |
| 2948 | 2948 | |
| 2949 | 2949 | /** |
| 2950 | - * Get a list of flights to airport since 7 days |
|
| 2951 | - * @return Array number, icao, name and city of airports |
|
| 2952 | - */ |
|
| 2950 | + * Get a list of flights to airport since 7 days |
|
| 2951 | + * @return Array number, icao, name and city of airports |
|
| 2952 | + */ |
|
| 2953 | 2953 | |
| 2954 | 2954 | public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') { |
| 2955 | 2955 | global $globalTimezone, $globalDBdriver; |
@@ -2981,9 +2981,9 @@ discard block |
||
| 2981 | 2981 | |
| 2982 | 2982 | |
| 2983 | 2983 | /** |
| 2984 | - * Get a list of flights detected to airport since 7 days |
|
| 2985 | - * @return Array number, icao, name and city of airports |
|
| 2986 | - */ |
|
| 2984 | + * Get a list of flights detected to airport since 7 days |
|
| 2985 | + * @return Array number, icao, name and city of airports |
|
| 2986 | + */ |
|
| 2987 | 2987 | |
| 2988 | 2988 | public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') { |
| 2989 | 2989 | global $globalTimezone, $globalDBdriver; |
@@ -3027,11 +3027,11 @@ discard block |
||
| 3027 | 3027 | |
| 3028 | 3028 | |
| 3029 | 3029 | /** |
| 3030 | - * Gets a list of all dates |
|
| 3031 | - * |
|
| 3032 | - * @return Array list of date names |
|
| 3033 | - * |
|
| 3034 | - */ |
|
| 3030 | + * Gets a list of all dates |
|
| 3031 | + * |
|
| 3032 | + * @return Array list of date names |
|
| 3033 | + * |
|
| 3034 | + */ |
|
| 3035 | 3035 | public function getAllDates() |
| 3036 | 3036 | { |
| 3037 | 3037 | global $globalTimezone, $globalDBdriver; |
@@ -3072,11 +3072,11 @@ discard block |
||
| 3072 | 3072 | |
| 3073 | 3073 | |
| 3074 | 3074 | /** |
| 3075 | - * Gets all route combinations |
|
| 3076 | - * |
|
| 3077 | - * @return Array the route list |
|
| 3078 | - * |
|
| 3079 | - */ |
|
| 3075 | + * Gets all route combinations |
|
| 3076 | + * |
|
| 3077 | + * @return Array the route list |
|
| 3078 | + * |
|
| 3079 | + */ |
|
| 3080 | 3080 | public function getAllRoutes() |
| 3081 | 3081 | { |
| 3082 | 3082 | $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
@@ -3102,13 +3102,13 @@ discard block |
||
| 3102 | 3102 | } |
| 3103 | 3103 | |
| 3104 | 3104 | /** |
| 3105 | - * Update ident spotter data |
|
| 3106 | - * |
|
| 3107 | - * @param String $flightaware_id the ID from flightaware |
|
| 3108 | - * @param String $ident the flight ident |
|
| 3109 | - * @return String success or false |
|
| 3110 | - * |
|
| 3111 | - */ |
|
| 3105 | + * Update ident spotter data |
|
| 3106 | + * |
|
| 3107 | + * @param String $flightaware_id the ID from flightaware |
|
| 3108 | + * @param String $ident the flight ident |
|
| 3109 | + * @return String success or false |
|
| 3110 | + * |
|
| 3111 | + */ |
|
| 3112 | 3112 | public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
| 3113 | 3113 | { |
| 3114 | 3114 | if (!is_numeric(substr($ident, 0, 3))) |
@@ -3129,14 +3129,14 @@ discard block |
||
| 3129 | 3129 | } else { |
| 3130 | 3130 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3131 | 3131 | } |
| 3132 | - $airline_name = $airline_array[0]['name']; |
|
| 3133 | - $airline_icao = $airline_array[0]['icao']; |
|
| 3134 | - $airline_country = $airline_array[0]['country']; |
|
| 3135 | - $airline_type = $airline_array[0]['type']; |
|
| 3132 | + $airline_name = $airline_array[0]['name']; |
|
| 3133 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3134 | + $airline_country = $airline_array[0]['country']; |
|
| 3135 | + $airline_type = $airline_array[0]['type']; |
|
| 3136 | 3136 | |
| 3137 | 3137 | |
| 3138 | 3138 | $query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id'; |
| 3139 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
| 3139 | + $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
| 3140 | 3140 | |
| 3141 | 3141 | try { |
| 3142 | 3142 | $sth = $this->db->prepare($query); |
@@ -3149,19 +3149,19 @@ discard block |
||
| 3149 | 3149 | |
| 3150 | 3150 | } |
| 3151 | 3151 | /** |
| 3152 | - * Update latest spotter data |
|
| 3153 | - * |
|
| 3154 | - * @param String $flightaware_id the ID from flightaware |
|
| 3155 | - * @param String $ident the flight ident |
|
| 3156 | - * @param String $arrival_airport_icao the arrival airport |
|
| 3157 | - * @return String success or false |
|
| 3158 | - * |
|
| 3159 | - */ |
|
| 3152 | + * Update latest spotter data |
|
| 3153 | + * |
|
| 3154 | + * @param String $flightaware_id the ID from flightaware |
|
| 3155 | + * @param String $ident the flight ident |
|
| 3156 | + * @param String $arrival_airport_icao the arrival airport |
|
| 3157 | + * @return String success or false |
|
| 3158 | + * |
|
| 3159 | + */ |
|
| 3160 | 3160 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3161 | 3161 | { |
| 3162 | 3162 | if ($groundspeed == '') $groundspeed = NULL; |
| 3163 | 3163 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
| 3164 | - $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
| 3164 | + $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
| 3165 | 3165 | |
| 3166 | 3166 | try { |
| 3167 | 3167 | $sth = $this->db->prepare($query); |
@@ -3175,32 +3175,32 @@ discard block |
||
| 3175 | 3175 | } |
| 3176 | 3176 | |
| 3177 | 3177 | /** |
| 3178 | - * Adds a new spotter data |
|
| 3179 | - * |
|
| 3180 | - * @param String $flightaware_id the ID from flightaware |
|
| 3181 | - * @param String $ident the flight ident |
|
| 3182 | - * @param String $aircraft_icao the aircraft type |
|
| 3183 | - * @param String $departure_airport_icao the departure airport |
|
| 3184 | - * @param String $arrival_airport_icao the arrival airport |
|
| 3185 | - * @param String $latitude latitude of flight |
|
| 3186 | - * @param String $longitude latitude of flight |
|
| 3187 | - * @param String $waypoints waypoints of flight |
|
| 3188 | - * @param String $altitude altitude of flight |
|
| 3189 | - * @param String $heading heading of flight |
|
| 3190 | - * @param String $groundspeed speed of flight |
|
| 3191 | - * @param String $date date of flight |
|
| 3192 | - * @param String $departure_airport_time departure time of flight |
|
| 3193 | - * @param String $arrival_airport_time arrival time of flight |
|
| 3194 | - * @param String $squawk squawk code of flight |
|
| 3195 | - * @param String $route_stop route stop of flight |
|
| 3196 | - * @param String $highlight highlight or not |
|
| 3197 | - * @param String $ModeS ModesS code of flight |
|
| 3198 | - * @param String $registration registration code of flight |
|
| 3199 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 3200 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 3201 | - * @param String $verticalrate vertival rate of flight |
|
| 3202 | - * @return String success or false |
|
| 3203 | - */ |
|
| 3178 | + * Adds a new spotter data |
|
| 3179 | + * |
|
| 3180 | + * @param String $flightaware_id the ID from flightaware |
|
| 3181 | + * @param String $ident the flight ident |
|
| 3182 | + * @param String $aircraft_icao the aircraft type |
|
| 3183 | + * @param String $departure_airport_icao the departure airport |
|
| 3184 | + * @param String $arrival_airport_icao the arrival airport |
|
| 3185 | + * @param String $latitude latitude of flight |
|
| 3186 | + * @param String $longitude latitude of flight |
|
| 3187 | + * @param String $waypoints waypoints of flight |
|
| 3188 | + * @param String $altitude altitude of flight |
|
| 3189 | + * @param String $heading heading of flight |
|
| 3190 | + * @param String $groundspeed speed of flight |
|
| 3191 | + * @param String $date date of flight |
|
| 3192 | + * @param String $departure_airport_time departure time of flight |
|
| 3193 | + * @param String $arrival_airport_time arrival time of flight |
|
| 3194 | + * @param String $squawk squawk code of flight |
|
| 3195 | + * @param String $route_stop route stop of flight |
|
| 3196 | + * @param String $highlight highlight or not |
|
| 3197 | + * @param String $ModeS ModesS code of flight |
|
| 3198 | + * @param String $registration registration code of flight |
|
| 3199 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 3200 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 3201 | + * @param String $verticalrate vertival rate of flight |
|
| 3202 | + * @return String success or false |
|
| 3203 | + */ |
|
| 3204 | 3204 | public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '') |
| 3205 | 3205 | { |
| 3206 | 3206 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
@@ -3414,8 +3414,8 @@ discard block |
||
| 3414 | 3414 | |
| 3415 | 3415 | if ($globalIVAO && $aircraft_icao != '') |
| 3416 | 3416 | { |
| 3417 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3418 | - else $airline_icao = ''; |
|
| 3417 | + if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3418 | + else $airline_icao = ''; |
|
| 3419 | 3419 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3420 | 3420 | if (!isset($image_array[0]['registration'])) |
| 3421 | 3421 | { |
@@ -3446,52 +3446,52 @@ discard block |
||
| 3446 | 3446 | |
| 3447 | 3447 | if (count($airline_array) == 0) |
| 3448 | 3448 | { |
| 3449 | - $airline_array = $this->getAllAirlineInfo('NA'); |
|
| 3450 | - } |
|
| 3451 | - if (count($aircraft_array) == 0) |
|
| 3452 | - { |
|
| 3453 | - $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
| 3454 | - } |
|
| 3455 | - if (count($departure_airport_array) == 0) |
|
| 3456 | - { |
|
| 3457 | - $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3458 | - } |
|
| 3459 | - if (count($arrival_airport_array) == 0) |
|
| 3460 | - { |
|
| 3461 | - $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3462 | - } |
|
| 3463 | - if ($registration == '') $registration = 'NA'; |
|
| 3464 | - if ($latitude == '' && $longitude == '') { |
|
| 3465 | - $latitude = 0; |
|
| 3466 | - $longitude = 0; |
|
| 3467 | - } |
|
| 3468 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3469 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3470 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3471 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3472 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3473 | - $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, 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,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
| 3449 | + $airline_array = $this->getAllAirlineInfo('NA'); |
|
| 3450 | + } |
|
| 3451 | + if (count($aircraft_array) == 0) |
|
| 3452 | + { |
|
| 3453 | + $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
| 3454 | + } |
|
| 3455 | + if (count($departure_airport_array) == 0) |
|
| 3456 | + { |
|
| 3457 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3458 | + } |
|
| 3459 | + if (count($arrival_airport_array) == 0) |
|
| 3460 | + { |
|
| 3461 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3462 | + } |
|
| 3463 | + if ($registration == '') $registration = 'NA'; |
|
| 3464 | + if ($latitude == '' && $longitude == '') { |
|
| 3465 | + $latitude = 0; |
|
| 3466 | + $longitude = 0; |
|
| 3467 | + } |
|
| 3468 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3469 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3470 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3471 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3472 | + if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3473 | + $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, 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,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
| 3474 | 3474 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,: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, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
| 3475 | 3475 | |
| 3476 | - $airline_name = $airline_array[0]['name']; |
|
| 3477 | - $airline_icao = $airline_array[0]['icao']; |
|
| 3478 | - $airline_country = $airline_array[0]['country']; |
|
| 3479 | - $airline_type = $airline_array[0]['type']; |
|
| 3476 | + $airline_name = $airline_array[0]['name']; |
|
| 3477 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3478 | + $airline_country = $airline_array[0]['country']; |
|
| 3479 | + $airline_type = $airline_array[0]['type']; |
|
| 3480 | 3480 | if ($airline_type == '') { |
| 3481 | 3481 | $timeelapsed = microtime(true); |
| 3482 | 3482 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3483 | 3483 | if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 3484 | 3484 | } |
| 3485 | 3485 | if ($airline_type == null) $airline_type = ''; |
| 3486 | - $aircraft_type = $aircraft_array[0]['type']; |
|
| 3487 | - $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
| 3488 | - $departure_airport_name = $departure_airport_array[0]['name']; |
|
| 3489 | - $departure_airport_city = $departure_airport_array[0]['city']; |
|
| 3490 | - $departure_airport_country = $departure_airport_array[0]['country']; |
|
| 3491 | - $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
| 3492 | - $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
| 3493 | - $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
| 3494 | - $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_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, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3486 | + $aircraft_type = $aircraft_array[0]['type']; |
|
| 3487 | + $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
| 3488 | + $departure_airport_name = $departure_airport_array[0]['name']; |
|
| 3489 | + $departure_airport_city = $departure_airport_array[0]['city']; |
|
| 3490 | + $departure_airport_country = $departure_airport_array[0]['country']; |
|
| 3491 | + $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
| 3492 | + $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
| 3493 | + $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
| 3494 | + $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_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, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3495 | 3495 | |
| 3496 | 3496 | try { |
| 3497 | 3497 | |
@@ -3499,7 +3499,7 @@ discard block |
||
| 3499 | 3499 | $sth->execute($query_values); |
| 3500 | 3500 | $this->db = null; |
| 3501 | 3501 | } catch (PDOException $e) { |
| 3502 | - return "error : ".$e->getMessage(); |
|
| 3502 | + return "error : ".$e->getMessage(); |
|
| 3503 | 3503 | } |
| 3504 | 3504 | |
| 3505 | 3505 | return "success"; |
@@ -3508,11 +3508,11 @@ discard block |
||
| 3508 | 3508 | |
| 3509 | 3509 | |
| 3510 | 3510 | /** |
| 3511 | - * Gets the aircraft ident within the last hour |
|
| 3512 | - * |
|
| 3513 | - * @return String the ident |
|
| 3514 | - * |
|
| 3515 | - */ |
|
| 3511 | + * Gets the aircraft ident within the last hour |
|
| 3512 | + * |
|
| 3513 | + * @return String the ident |
|
| 3514 | + * |
|
| 3515 | + */ |
|
| 3516 | 3516 | public function getIdentFromLastHour($ident) |
| 3517 | 3517 | { |
| 3518 | 3518 | global $globalDBdriver, $globalTimezone; |
@@ -3528,11 +3528,11 @@ discard block |
||
| 3528 | 3528 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 3529 | 3529 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
| 3530 | 3530 | $query_data = array(':ident' => $ident); |
| 3531 | - } |
|
| 3531 | + } |
|
| 3532 | 3532 | |
| 3533 | 3533 | $sth = $this->db->prepare($query); |
| 3534 | 3534 | $sth->execute($query_data); |
| 3535 | - $ident_result=''; |
|
| 3535 | + $ident_result=''; |
|
| 3536 | 3536 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 3537 | 3537 | { |
| 3538 | 3538 | $ident_result = $row['ident']; |
@@ -3543,11 +3543,11 @@ discard block |
||
| 3543 | 3543 | |
| 3544 | 3544 | |
| 3545 | 3545 | /** |
| 3546 | - * Gets the aircraft data from the last 20 seconds |
|
| 3547 | - * |
|
| 3548 | - * @return Array the spotter data |
|
| 3549 | - * |
|
| 3550 | - */ |
|
| 3546 | + * Gets the aircraft data from the last 20 seconds |
|
| 3547 | + * |
|
| 3548 | + * @return Array the spotter data |
|
| 3549 | + * |
|
| 3550 | + */ |
|
| 3551 | 3551 | public function getRealTimeData($q = '') |
| 3552 | 3552 | { |
| 3553 | 3553 | global $globalDBdriver; |
@@ -3591,11 +3591,11 @@ discard block |
||
| 3591 | 3591 | |
| 3592 | 3592 | |
| 3593 | 3593 | /** |
| 3594 | - * Gets all airlines that have flown over |
|
| 3595 | - * |
|
| 3596 | - * @return Array the airline list |
|
| 3597 | - * |
|
| 3598 | - */ |
|
| 3594 | + * Gets all airlines that have flown over |
|
| 3595 | + * |
|
| 3596 | + * @return Array the airline list |
|
| 3597 | + * |
|
| 3598 | + */ |
|
| 3599 | 3599 | public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 3600 | 3600 | { |
| 3601 | 3601 | global $globalDBdriver; |
@@ -3609,7 +3609,7 @@ discard block |
||
| 3609 | 3609 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3610 | 3610 | } |
| 3611 | 3611 | } |
| 3612 | - if ($sincedate != '') { |
|
| 3612 | + if ($sincedate != '') { |
|
| 3613 | 3613 | if ($globalDBdriver == 'mysql') { |
| 3614 | 3614 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 3615 | 3615 | } else { |
@@ -3636,26 +3636,26 @@ discard block |
||
| 3636 | 3636 | } |
| 3637 | 3637 | |
| 3638 | 3638 | /** |
| 3639 | - * Gets all pilots that have flown over |
|
| 3640 | - * |
|
| 3641 | - * @return Array the pilots list |
|
| 3642 | - * |
|
| 3643 | - */ |
|
| 3639 | + * Gets all pilots that have flown over |
|
| 3640 | + * |
|
| 3641 | + * @return Array the pilots list |
|
| 3642 | + * |
|
| 3643 | + */ |
|
| 3644 | 3644 | public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 3645 | 3645 | { |
| 3646 | 3646 | global $globalDBdriver; |
| 3647 | 3647 | $filter_query = $this->getFilter($filters,true,true); |
| 3648 | 3648 | $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count |
| 3649 | 3649 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' "; |
| 3650 | - if ($olderthanmonths > 0) { |
|
| 3651 | - if ($globalDBdriver == 'mysql') { |
|
| 3650 | + if ($olderthanmonths > 0) { |
|
| 3651 | + if ($globalDBdriver == 'mysql') { |
|
| 3652 | 3652 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 3653 | 3653 | } else { |
| 3654 | 3654 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3655 | 3655 | } |
| 3656 | 3656 | } |
| 3657 | - if ($sincedate != '') { |
|
| 3658 | - if ($globalDBdriver == 'mysql') { |
|
| 3657 | + if ($sincedate != '') { |
|
| 3658 | + if ($globalDBdriver == 'mysql') { |
|
| 3659 | 3659 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 3660 | 3660 | } else { |
| 3661 | 3661 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3682,25 +3682,25 @@ discard block |
||
| 3682 | 3682 | } |
| 3683 | 3683 | |
| 3684 | 3684 | /** |
| 3685 | - * Gets all pilots that have flown over |
|
| 3686 | - * |
|
| 3687 | - * @return Array the pilots list |
|
| 3688 | - * |
|
| 3689 | - */ |
|
| 3685 | + * Gets all pilots that have flown over |
|
| 3686 | + * |
|
| 3687 | + * @return Array the pilots list |
|
| 3688 | + * |
|
| 3689 | + */ |
|
| 3690 | 3690 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
| 3691 | 3691 | { |
| 3692 | 3692 | global $globalDBdriver; |
| 3693 | 3693 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count |
| 3694 | 3694 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
| 3695 | - if ($olderthanmonths > 0) { |
|
| 3696 | - if ($globalDBdriver == 'mysql') { |
|
| 3695 | + if ($olderthanmonths > 0) { |
|
| 3696 | + if ($globalDBdriver == 'mysql') { |
|
| 3697 | 3697 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 3698 | 3698 | } else { |
| 3699 | 3699 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3700 | 3700 | } |
| 3701 | 3701 | } |
| 3702 | - if ($sincedate != '') { |
|
| 3703 | - if ($globalDBdriver == 'mysql') { |
|
| 3702 | + if ($sincedate != '') { |
|
| 3703 | + if ($globalDBdriver == 'mysql') { |
|
| 3704 | 3704 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 3705 | 3705 | } else { |
| 3706 | 3706 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3728,26 +3728,26 @@ discard block |
||
| 3728 | 3728 | } |
| 3729 | 3729 | |
| 3730 | 3730 | /** |
| 3731 | - * Gets all owner that have flown over |
|
| 3732 | - * |
|
| 3733 | - * @return Array the pilots list |
|
| 3734 | - * |
|
| 3735 | - */ |
|
| 3731 | + * Gets all owner that have flown over |
|
| 3732 | + * |
|
| 3733 | + * @return Array the pilots list |
|
| 3734 | + * |
|
| 3735 | + */ |
|
| 3736 | 3736 | public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 3737 | 3737 | { |
| 3738 | 3738 | global $globalDBdriver; |
| 3739 | 3739 | $filter_query = $this->getFilter($filters,true,true); |
| 3740 | 3740 | $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
| 3741 | 3741 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 3742 | - if ($olderthanmonths > 0) { |
|
| 3743 | - if ($globalDBdriver == 'mysql') { |
|
| 3742 | + if ($olderthanmonths > 0) { |
|
| 3743 | + if ($globalDBdriver == 'mysql') { |
|
| 3744 | 3744 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 3745 | 3745 | } else { |
| 3746 | 3746 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3747 | 3747 | } |
| 3748 | 3748 | } |
| 3749 | - if ($sincedate != '') { |
|
| 3750 | - if ($globalDBdriver == 'mysql') { |
|
| 3749 | + if ($sincedate != '') { |
|
| 3750 | + if ($globalDBdriver == 'mysql') { |
|
| 3751 | 3751 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 3752 | 3752 | } else { |
| 3753 | 3753 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3773,26 +3773,26 @@ discard block |
||
| 3773 | 3773 | } |
| 3774 | 3774 | |
| 3775 | 3775 | /** |
| 3776 | - * Gets all owner that have flown over |
|
| 3777 | - * |
|
| 3778 | - * @return Array the pilots list |
|
| 3779 | - * |
|
| 3780 | - */ |
|
| 3776 | + * Gets all owner that have flown over |
|
| 3777 | + * |
|
| 3778 | + * @return Array the pilots list |
|
| 3779 | + * |
|
| 3780 | + */ |
|
| 3781 | 3781 | public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 3782 | 3782 | { |
| 3783 | 3783 | global $globalDBdriver; |
| 3784 | 3784 | $filter_query = $this->getFilter($filters,true,true); |
| 3785 | 3785 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
| 3786 | 3786 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 3787 | - if ($olderthanmonths > 0) { |
|
| 3788 | - if ($globalDBdriver == 'mysql') { |
|
| 3787 | + if ($olderthanmonths > 0) { |
|
| 3788 | + if ($globalDBdriver == 'mysql') { |
|
| 3789 | 3789 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 3790 | 3790 | } else { |
| 3791 | 3791 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3792 | 3792 | } |
| 3793 | 3793 | } |
| 3794 | - if ($sincedate != '') { |
|
| 3795 | - if ($globalDBdriver == 'mysql') { |
|
| 3794 | + if ($sincedate != '') { |
|
| 3795 | + if ($globalDBdriver == 'mysql') { |
|
| 3796 | 3796 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 3797 | 3797 | } else { |
| 3798 | 3798 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3819,11 +3819,11 @@ discard block |
||
| 3819 | 3819 | } |
| 3820 | 3820 | |
| 3821 | 3821 | /** |
| 3822 | - * Gets all airlines that have flown over by aircraft |
|
| 3823 | - * |
|
| 3824 | - * @return Array the airline list |
|
| 3825 | - * |
|
| 3826 | - */ |
|
| 3822 | + * Gets all airlines that have flown over by aircraft |
|
| 3823 | + * |
|
| 3824 | + * @return Array the airline list |
|
| 3825 | + * |
|
| 3826 | + */ |
|
| 3827 | 3827 | public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
| 3828 | 3828 | { |
| 3829 | 3829 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -3855,11 +3855,11 @@ discard block |
||
| 3855 | 3855 | |
| 3856 | 3856 | |
| 3857 | 3857 | /** |
| 3858 | - * Gets all airline countries that have flown over by aircraft |
|
| 3859 | - * |
|
| 3860 | - * @return Array the airline country list |
|
| 3861 | - * |
|
| 3862 | - */ |
|
| 3858 | + * Gets all airline countries that have flown over by aircraft |
|
| 3859 | + * |
|
| 3860 | + * @return Array the airline country list |
|
| 3861 | + * |
|
| 3862 | + */ |
|
| 3863 | 3863 | public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
| 3864 | 3864 | { |
| 3865 | 3865 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -3891,11 +3891,11 @@ discard block |
||
| 3891 | 3891 | |
| 3892 | 3892 | |
| 3893 | 3893 | /** |
| 3894 | - * Gets all airlines that have flown over by airport |
|
| 3895 | - * |
|
| 3896 | - * @return Array the airline list |
|
| 3897 | - * |
|
| 3898 | - */ |
|
| 3894 | + * Gets all airlines that have flown over by airport |
|
| 3895 | + * |
|
| 3896 | + * @return Array the airline list |
|
| 3897 | + * |
|
| 3898 | + */ |
|
| 3899 | 3899 | public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
| 3900 | 3900 | { |
| 3901 | 3901 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -3926,11 +3926,11 @@ discard block |
||
| 3926 | 3926 | |
| 3927 | 3927 | |
| 3928 | 3928 | /** |
| 3929 | - * Gets all airline countries that have flown over by airport icao |
|
| 3930 | - * |
|
| 3931 | - * @return Array the airline country list |
|
| 3932 | - * |
|
| 3933 | - */ |
|
| 3929 | + * Gets all airline countries that have flown over by airport icao |
|
| 3930 | + * |
|
| 3931 | + * @return Array the airline country list |
|
| 3932 | + * |
|
| 3933 | + */ |
|
| 3934 | 3934 | public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
| 3935 | 3935 | { |
| 3936 | 3936 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -3960,11 +3960,11 @@ discard block |
||
| 3960 | 3960 | |
| 3961 | 3961 | |
| 3962 | 3962 | /** |
| 3963 | - * Gets all airlines that have flown over by aircraft manufacturer |
|
| 3964 | - * |
|
| 3965 | - * @return Array the airline list |
|
| 3966 | - * |
|
| 3967 | - */ |
|
| 3963 | + * Gets all airlines that have flown over by aircraft manufacturer |
|
| 3964 | + * |
|
| 3965 | + * @return Array the airline list |
|
| 3966 | + * |
|
| 3967 | + */ |
|
| 3968 | 3968 | public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 3969 | 3969 | { |
| 3970 | 3970 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -3995,11 +3995,11 @@ discard block |
||
| 3995 | 3995 | |
| 3996 | 3996 | |
| 3997 | 3997 | /** |
| 3998 | - * Gets all airline countries that have flown over by aircraft manufacturer |
|
| 3999 | - * |
|
| 4000 | - * @return Array the airline country list |
|
| 4001 | - * |
|
| 4002 | - */ |
|
| 3998 | + * Gets all airline countries that have flown over by aircraft manufacturer |
|
| 3999 | + * |
|
| 4000 | + * @return Array the airline country list |
|
| 4001 | + * |
|
| 4002 | + */ |
|
| 4003 | 4003 | public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4004 | 4004 | { |
| 4005 | 4005 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4028,11 +4028,11 @@ discard block |
||
| 4028 | 4028 | |
| 4029 | 4029 | |
| 4030 | 4030 | /** |
| 4031 | - * Gets all airlines that have flown over by date |
|
| 4032 | - * |
|
| 4033 | - * @return Array the airline list |
|
| 4034 | - * |
|
| 4035 | - */ |
|
| 4031 | + * Gets all airlines that have flown over by date |
|
| 4032 | + * |
|
| 4033 | + * @return Array the airline list |
|
| 4034 | + * |
|
| 4035 | + */ |
|
| 4036 | 4036 | public function countAllAirlinesByDate($date,$filters = array()) |
| 4037 | 4037 | { |
| 4038 | 4038 | global $globalTimezone, $globalDBdriver; |
@@ -4076,11 +4076,11 @@ discard block |
||
| 4076 | 4076 | |
| 4077 | 4077 | |
| 4078 | 4078 | /** |
| 4079 | - * Gets all airline countries that have flown over by date |
|
| 4080 | - * |
|
| 4081 | - * @return Array the airline country list |
|
| 4082 | - * |
|
| 4083 | - */ |
|
| 4079 | + * Gets all airline countries that have flown over by date |
|
| 4080 | + * |
|
| 4081 | + * @return Array the airline country list |
|
| 4082 | + * |
|
| 4083 | + */ |
|
| 4084 | 4084 | public function countAllAirlineCountriesByDate($date,$filters = array()) |
| 4085 | 4085 | { |
| 4086 | 4086 | global $globalTimezone, $globalDBdriver; |
@@ -4123,11 +4123,11 @@ discard block |
||
| 4123 | 4123 | |
| 4124 | 4124 | |
| 4125 | 4125 | /** |
| 4126 | - * Gets all airlines that have flown over by ident/callsign |
|
| 4127 | - * |
|
| 4128 | - * @return Array the airline list |
|
| 4129 | - * |
|
| 4130 | - */ |
|
| 4126 | + * Gets all airlines that have flown over by ident/callsign |
|
| 4127 | + * |
|
| 4128 | + * @return Array the airline list |
|
| 4129 | + * |
|
| 4130 | + */ |
|
| 4131 | 4131 | public function countAllAirlinesByIdent($ident,$filters = array()) |
| 4132 | 4132 | { |
| 4133 | 4133 | $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
@@ -4157,11 +4157,11 @@ discard block |
||
| 4157 | 4157 | } |
| 4158 | 4158 | |
| 4159 | 4159 | /** |
| 4160 | - * Gets all airlines that have flown over by route |
|
| 4161 | - * |
|
| 4162 | - * @return Array the airline list |
|
| 4163 | - * |
|
| 4164 | - */ |
|
| 4160 | + * Gets all airlines that have flown over by route |
|
| 4161 | + * |
|
| 4162 | + * @return Array the airline list |
|
| 4163 | + * |
|
| 4164 | + */ |
|
| 4165 | 4165 | public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 4166 | 4166 | { |
| 4167 | 4167 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4193,11 +4193,11 @@ discard block |
||
| 4193 | 4193 | } |
| 4194 | 4194 | |
| 4195 | 4195 | /** |
| 4196 | - * Gets all airline countries that have flown over by route |
|
| 4197 | - * |
|
| 4198 | - * @return Array the airline country list |
|
| 4199 | - * |
|
| 4200 | - */ |
|
| 4196 | + * Gets all airline countries that have flown over by route |
|
| 4197 | + * |
|
| 4198 | + * @return Array the airline country list |
|
| 4199 | + * |
|
| 4200 | + */ |
|
| 4201 | 4201 | public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
| 4202 | 4202 | { |
| 4203 | 4203 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4229,11 +4229,11 @@ discard block |
||
| 4229 | 4229 | |
| 4230 | 4230 | |
| 4231 | 4231 | /** |
| 4232 | - * Gets all airlines that have flown over by country |
|
| 4233 | - * |
|
| 4234 | - * @return Array the airline list |
|
| 4235 | - * |
|
| 4236 | - */ |
|
| 4232 | + * Gets all airlines that have flown over by country |
|
| 4233 | + * |
|
| 4234 | + * @return Array the airline list |
|
| 4235 | + * |
|
| 4236 | + */ |
|
| 4237 | 4237 | public function countAllAirlinesByCountry($country,$filters = array()) |
| 4238 | 4238 | { |
| 4239 | 4239 | $country = filter_var($country,FILTER_SANITIZE_STRING); |
@@ -4263,11 +4263,11 @@ discard block |
||
| 4263 | 4263 | |
| 4264 | 4264 | |
| 4265 | 4265 | /** |
| 4266 | - * Gets all airline countries that have flown over by country |
|
| 4267 | - * |
|
| 4268 | - * @return Array the airline country list |
|
| 4269 | - * |
|
| 4270 | - */ |
|
| 4266 | + * Gets all airline countries that have flown over by country |
|
| 4267 | + * |
|
| 4268 | + * @return Array the airline country list |
|
| 4269 | + * |
|
| 4270 | + */ |
|
| 4271 | 4271 | public function countAllAirlineCountriesByCountry($country,$filters = array()) |
| 4272 | 4272 | { |
| 4273 | 4273 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4296,11 +4296,11 @@ discard block |
||
| 4296 | 4296 | |
| 4297 | 4297 | |
| 4298 | 4298 | /** |
| 4299 | - * Gets all airlines countries |
|
| 4300 | - * |
|
| 4301 | - * @return Array the airline country list |
|
| 4302 | - * |
|
| 4303 | - */ |
|
| 4299 | + * Gets all airlines countries |
|
| 4300 | + * |
|
| 4301 | + * @return Array the airline country list |
|
| 4302 | + * |
|
| 4303 | + */ |
|
| 4304 | 4304 | public function countAllAirlineCountries($limit = true, $filters = array()) |
| 4305 | 4305 | { |
| 4306 | 4306 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4326,11 +4326,11 @@ discard block |
||
| 4326 | 4326 | } |
| 4327 | 4327 | |
| 4328 | 4328 | /** |
| 4329 | - * Gets all number of flight over countries |
|
| 4330 | - * |
|
| 4331 | - * @return Array the airline country list |
|
| 4332 | - * |
|
| 4333 | - */ |
|
| 4329 | + * Gets all number of flight over countries |
|
| 4330 | + * |
|
| 4331 | + * @return Array the airline country list |
|
| 4332 | + * |
|
| 4333 | + */ |
|
| 4334 | 4334 | public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
| 4335 | 4335 | { |
| 4336 | 4336 | global $globalDBdriver; |
@@ -4345,15 +4345,15 @@ discard block |
||
| 4345 | 4345 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 4346 | 4346 | FROM countries c, spotter_live s |
| 4347 | 4347 | WHERE c.iso2 = s.over_country "; |
| 4348 | - if ($olderthanmonths > 0) { |
|
| 4348 | + if ($olderthanmonths > 0) { |
|
| 4349 | 4349 | if ($globalDBdriver == 'mysql') { |
| 4350 | 4350 | $query .= 'AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 4351 | 4351 | } else { |
| 4352 | 4352 | $query .= "AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 4353 | 4353 | } |
| 4354 | 4354 | } |
| 4355 | - if ($sincedate != '') { |
|
| 4356 | - if ($globalDBdriver == 'mysql') { |
|
| 4355 | + if ($sincedate != '') { |
|
| 4356 | + if ($globalDBdriver == 'mysql') { |
|
| 4357 | 4357 | $query .= "AND spotter_live.date > '".$sincedate."' "; |
| 4358 | 4358 | } else { |
| 4359 | 4359 | $query .= "AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4383,11 +4383,11 @@ discard block |
||
| 4383 | 4383 | |
| 4384 | 4384 | |
| 4385 | 4385 | /** |
| 4386 | - * Gets all aircraft types that have flown over |
|
| 4387 | - * |
|
| 4388 | - * @return Array the aircraft list |
|
| 4389 | - * |
|
| 4390 | - */ |
|
| 4386 | + * Gets all aircraft types that have flown over |
|
| 4387 | + * |
|
| 4388 | + * @return Array the aircraft list |
|
| 4389 | + * |
|
| 4390 | + */ |
|
| 4391 | 4391 | public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 4392 | 4392 | { |
| 4393 | 4393 | global $globalDBdriver; |
@@ -4430,11 +4430,11 @@ discard block |
||
| 4430 | 4430 | } |
| 4431 | 4431 | |
| 4432 | 4432 | /** |
| 4433 | - * Gets all aircraft types that have flown over by airline |
|
| 4434 | - * |
|
| 4435 | - * @return Array the aircraft list |
|
| 4436 | - * |
|
| 4437 | - */ |
|
| 4433 | + * Gets all aircraft types that have flown over by airline |
|
| 4434 | + * |
|
| 4435 | + * @return Array the aircraft list |
|
| 4436 | + * |
|
| 4437 | + */ |
|
| 4438 | 4438 | public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 4439 | 4439 | { |
| 4440 | 4440 | global $globalDBdriver; |
@@ -4478,11 +4478,11 @@ discard block |
||
| 4478 | 4478 | |
| 4479 | 4479 | |
| 4480 | 4480 | /** |
| 4481 | - * Gets all aircraft registration that have flown over by aircaft icao |
|
| 4482 | - * |
|
| 4483 | - * @return Array the aircraft list |
|
| 4484 | - * |
|
| 4485 | - */ |
|
| 4481 | + * Gets all aircraft registration that have flown over by aircaft icao |
|
| 4482 | + * |
|
| 4483 | + * @return Array the aircraft list |
|
| 4484 | + * |
|
| 4485 | + */ |
|
| 4486 | 4486 | public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
| 4487 | 4487 | { |
| 4488 | 4488 | $Image = new Image($this->db); |
@@ -4521,11 +4521,11 @@ discard block |
||
| 4521 | 4521 | |
| 4522 | 4522 | |
| 4523 | 4523 | /** |
| 4524 | - * Gets all aircraft types that have flown over by airline icao |
|
| 4525 | - * |
|
| 4526 | - * @return Array the aircraft list |
|
| 4527 | - * |
|
| 4528 | - */ |
|
| 4524 | + * Gets all aircraft types that have flown over by airline icao |
|
| 4525 | + * |
|
| 4526 | + * @return Array the aircraft list |
|
| 4527 | + * |
|
| 4528 | + */ |
|
| 4529 | 4529 | public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
| 4530 | 4530 | { |
| 4531 | 4531 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4554,11 +4554,11 @@ discard block |
||
| 4554 | 4554 | |
| 4555 | 4555 | |
| 4556 | 4556 | /** |
| 4557 | - * Gets all aircraft registration that have flown over by airline icao |
|
| 4558 | - * |
|
| 4559 | - * @return Array the aircraft list |
|
| 4560 | - * |
|
| 4561 | - */ |
|
| 4557 | + * Gets all aircraft registration that have flown over by airline icao |
|
| 4558 | + * |
|
| 4559 | + * @return Array the aircraft list |
|
| 4560 | + * |
|
| 4561 | + */ |
|
| 4562 | 4562 | public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
| 4563 | 4563 | { |
| 4564 | 4564 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4596,11 +4596,11 @@ discard block |
||
| 4596 | 4596 | |
| 4597 | 4597 | |
| 4598 | 4598 | /** |
| 4599 | - * Gets all aircraft manufacturer that have flown over by airline icao |
|
| 4600 | - * |
|
| 4601 | - * @return Array the aircraft list |
|
| 4602 | - * |
|
| 4603 | - */ |
|
| 4599 | + * Gets all aircraft manufacturer that have flown over by airline icao |
|
| 4600 | + * |
|
| 4601 | + * @return Array the aircraft list |
|
| 4602 | + * |
|
| 4603 | + */ |
|
| 4604 | 4604 | public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
| 4605 | 4605 | { |
| 4606 | 4606 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4628,11 +4628,11 @@ discard block |
||
| 4628 | 4628 | |
| 4629 | 4629 | |
| 4630 | 4630 | /** |
| 4631 | - * Gets all aircraft types that have flown over by airline icao |
|
| 4632 | - * |
|
| 4633 | - * @return Array the aircraft list |
|
| 4634 | - * |
|
| 4635 | - */ |
|
| 4631 | + * Gets all aircraft types that have flown over by airline icao |
|
| 4632 | + * |
|
| 4633 | + * @return Array the aircraft list |
|
| 4634 | + * |
|
| 4635 | + */ |
|
| 4636 | 4636 | public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
| 4637 | 4637 | { |
| 4638 | 4638 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4661,11 +4661,11 @@ discard block |
||
| 4661 | 4661 | |
| 4662 | 4662 | |
| 4663 | 4663 | /** |
| 4664 | - * Gets all aircraft registration that have flown over by airport icao |
|
| 4665 | - * |
|
| 4666 | - * @return Array the aircraft list |
|
| 4667 | - * |
|
| 4668 | - */ |
|
| 4664 | + * Gets all aircraft registration that have flown over by airport icao |
|
| 4665 | + * |
|
| 4666 | + * @return Array the aircraft list |
|
| 4667 | + * |
|
| 4668 | + */ |
|
| 4669 | 4669 | public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
| 4670 | 4670 | { |
| 4671 | 4671 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4702,11 +4702,11 @@ discard block |
||
| 4702 | 4702 | |
| 4703 | 4703 | |
| 4704 | 4704 | /** |
| 4705 | - * Gets all aircraft manufacturer that have flown over by airport icao |
|
| 4706 | - * |
|
| 4707 | - * @return Array the aircraft list |
|
| 4708 | - * |
|
| 4709 | - */ |
|
| 4705 | + * Gets all aircraft manufacturer that have flown over by airport icao |
|
| 4706 | + * |
|
| 4707 | + * @return Array the aircraft list |
|
| 4708 | + * |
|
| 4709 | + */ |
|
| 4710 | 4710 | public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
| 4711 | 4711 | { |
| 4712 | 4712 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4732,11 +4732,11 @@ discard block |
||
| 4732 | 4732 | } |
| 4733 | 4733 | |
| 4734 | 4734 | /** |
| 4735 | - * Gets all aircraft types that have flown over by aircraft manufacturer |
|
| 4736 | - * |
|
| 4737 | - * @return Array the aircraft list |
|
| 4738 | - * |
|
| 4739 | - */ |
|
| 4735 | + * Gets all aircraft types that have flown over by aircraft manufacturer |
|
| 4736 | + * |
|
| 4737 | + * @return Array the aircraft list |
|
| 4738 | + * |
|
| 4739 | + */ |
|
| 4740 | 4740 | public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4741 | 4741 | { |
| 4742 | 4742 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4763,11 +4763,11 @@ discard block |
||
| 4763 | 4763 | |
| 4764 | 4764 | |
| 4765 | 4765 | /** |
| 4766 | - * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
| 4767 | - * |
|
| 4768 | - * @return Array the aircraft list |
|
| 4769 | - * |
|
| 4770 | - */ |
|
| 4766 | + * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
| 4767 | + * |
|
| 4768 | + * @return Array the aircraft list |
|
| 4769 | + * |
|
| 4770 | + */ |
|
| 4771 | 4771 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
| 4772 | 4772 | { |
| 4773 | 4773 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4803,11 +4803,11 @@ discard block |
||
| 4803 | 4803 | } |
| 4804 | 4804 | |
| 4805 | 4805 | /** |
| 4806 | - * Gets all aircraft types that have flown over by date |
|
| 4807 | - * |
|
| 4808 | - * @return Array the aircraft list |
|
| 4809 | - * |
|
| 4810 | - */ |
|
| 4806 | + * Gets all aircraft types that have flown over by date |
|
| 4807 | + * |
|
| 4808 | + * @return Array the aircraft list |
|
| 4809 | + * |
|
| 4810 | + */ |
|
| 4811 | 4811 | public function countAllAircraftTypesByDate($date,$filters = array()) |
| 4812 | 4812 | { |
| 4813 | 4813 | global $globalTimezone, $globalDBdriver; |
@@ -4849,11 +4849,11 @@ discard block |
||
| 4849 | 4849 | |
| 4850 | 4850 | |
| 4851 | 4851 | /** |
| 4852 | - * Gets all aircraft registration that have flown over by date |
|
| 4853 | - * |
|
| 4854 | - * @return Array the aircraft list |
|
| 4855 | - * |
|
| 4856 | - */ |
|
| 4852 | + * Gets all aircraft registration that have flown over by date |
|
| 4853 | + * |
|
| 4854 | + * @return Array the aircraft list |
|
| 4855 | + * |
|
| 4856 | + */ |
|
| 4857 | 4857 | public function countAllAircraftRegistrationByDate($date,$filters = array()) |
| 4858 | 4858 | { |
| 4859 | 4859 | global $globalTimezone, $globalDBdriver; |
@@ -4904,11 +4904,11 @@ discard block |
||
| 4904 | 4904 | |
| 4905 | 4905 | |
| 4906 | 4906 | /** |
| 4907 | - * Gets all aircraft manufacturer that have flown over by date |
|
| 4908 | - * |
|
| 4909 | - * @return Array the aircraft manufacturer list |
|
| 4910 | - * |
|
| 4911 | - */ |
|
| 4907 | + * Gets all aircraft manufacturer that have flown over by date |
|
| 4908 | + * |
|
| 4909 | + * @return Array the aircraft manufacturer list |
|
| 4910 | + * |
|
| 4911 | + */ |
|
| 4912 | 4912 | public function countAllAircraftManufacturerByDate($date,$filters = array()) |
| 4913 | 4913 | { |
| 4914 | 4914 | global $globalTimezone, $globalDBdriver; |
@@ -4950,11 +4950,11 @@ discard block |
||
| 4950 | 4950 | |
| 4951 | 4951 | |
| 4952 | 4952 | /** |
| 4953 | - * Gets all aircraft types that have flown over by ident/callsign |
|
| 4954 | - * |
|
| 4955 | - * @return Array the aircraft list |
|
| 4956 | - * |
|
| 4957 | - */ |
|
| 4953 | + * Gets all aircraft types that have flown over by ident/callsign |
|
| 4954 | + * |
|
| 4955 | + * @return Array the aircraft list |
|
| 4956 | + * |
|
| 4957 | + */ |
|
| 4958 | 4958 | public function countAllAircraftTypesByIdent($ident,$filters = array()) |
| 4959 | 4959 | { |
| 4960 | 4960 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4983,11 +4983,11 @@ discard block |
||
| 4983 | 4983 | |
| 4984 | 4984 | |
| 4985 | 4985 | /** |
| 4986 | - * Gets all aircraft registration that have flown over by ident/callsign |
|
| 4987 | - * |
|
| 4988 | - * @return Array the aircraft list |
|
| 4989 | - * |
|
| 4990 | - */ |
|
| 4986 | + * Gets all aircraft registration that have flown over by ident/callsign |
|
| 4987 | + * |
|
| 4988 | + * @return Array the aircraft list |
|
| 4989 | + * |
|
| 4990 | + */ |
|
| 4991 | 4991 | public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
| 4992 | 4992 | { |
| 4993 | 4993 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5027,11 +5027,11 @@ discard block |
||
| 5027 | 5027 | |
| 5028 | 5028 | |
| 5029 | 5029 | /** |
| 5030 | - * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
| 5031 | - * |
|
| 5032 | - * @return Array the aircraft manufacturer list |
|
| 5033 | - * |
|
| 5034 | - */ |
|
| 5030 | + * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
| 5031 | + * |
|
| 5032 | + * @return Array the aircraft manufacturer list |
|
| 5033 | + * |
|
| 5034 | + */ |
|
| 5035 | 5035 | public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
| 5036 | 5036 | { |
| 5037 | 5037 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5057,11 +5057,11 @@ discard block |
||
| 5057 | 5057 | |
| 5058 | 5058 | |
| 5059 | 5059 | /** |
| 5060 | - * Gets all aircraft types that have flown over by route |
|
| 5061 | - * |
|
| 5062 | - * @return Array the aircraft list |
|
| 5063 | - * |
|
| 5064 | - */ |
|
| 5060 | + * Gets all aircraft types that have flown over by route |
|
| 5061 | + * |
|
| 5062 | + * @return Array the aircraft list |
|
| 5063 | + * |
|
| 5064 | + */ |
|
| 5065 | 5065 | public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 5066 | 5066 | { |
| 5067 | 5067 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5090,11 +5090,11 @@ discard block |
||
| 5090 | 5090 | } |
| 5091 | 5091 | |
| 5092 | 5092 | /** |
| 5093 | - * Gets all aircraft registration that have flown over by route |
|
| 5094 | - * |
|
| 5095 | - * @return Array the aircraft list |
|
| 5096 | - * |
|
| 5097 | - */ |
|
| 5093 | + * Gets all aircraft registration that have flown over by route |
|
| 5094 | + * |
|
| 5095 | + * @return Array the aircraft list |
|
| 5096 | + * |
|
| 5097 | + */ |
|
| 5098 | 5098 | public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 5099 | 5099 | { |
| 5100 | 5100 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5136,11 +5136,11 @@ discard block |
||
| 5136 | 5136 | |
| 5137 | 5137 | |
| 5138 | 5138 | /** |
| 5139 | - * Gets all aircraft manufacturer that have flown over by route |
|
| 5140 | - * |
|
| 5141 | - * @return Array the aircraft manufacturer list |
|
| 5142 | - * |
|
| 5143 | - */ |
|
| 5139 | + * Gets all aircraft manufacturer that have flown over by route |
|
| 5140 | + * |
|
| 5141 | + * @return Array the aircraft manufacturer list |
|
| 5142 | + * |
|
| 5143 | + */ |
|
| 5144 | 5144 | public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 5145 | 5145 | { |
| 5146 | 5146 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5174,11 +5174,11 @@ discard block |
||
| 5174 | 5174 | |
| 5175 | 5175 | |
| 5176 | 5176 | /** |
| 5177 | - * Gets all aircraft types that have flown over by country |
|
| 5178 | - * |
|
| 5179 | - * @return Array the aircraft list |
|
| 5180 | - * |
|
| 5181 | - */ |
|
| 5177 | + * Gets all aircraft types that have flown over by country |
|
| 5178 | + * |
|
| 5179 | + * @return Array the aircraft list |
|
| 5180 | + * |
|
| 5181 | + */ |
|
| 5182 | 5182 | public function countAllAircraftTypesByCountry($country,$filters = array()) |
| 5183 | 5183 | { |
| 5184 | 5184 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5209,11 +5209,11 @@ discard block |
||
| 5209 | 5209 | |
| 5210 | 5210 | |
| 5211 | 5211 | /** |
| 5212 | - * Gets all aircraft registration that have flown over by country |
|
| 5213 | - * |
|
| 5214 | - * @return Array the aircraft list |
|
| 5215 | - * |
|
| 5216 | - */ |
|
| 5212 | + * Gets all aircraft registration that have flown over by country |
|
| 5213 | + * |
|
| 5214 | + * @return Array the aircraft list |
|
| 5215 | + * |
|
| 5216 | + */ |
|
| 5217 | 5217 | public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
| 5218 | 5218 | { |
| 5219 | 5219 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5253,11 +5253,11 @@ discard block |
||
| 5253 | 5253 | |
| 5254 | 5254 | |
| 5255 | 5255 | /** |
| 5256 | - * Gets all aircraft manufacturer that have flown over by country |
|
| 5257 | - * |
|
| 5258 | - * @return Array the aircraft manufacturer list |
|
| 5259 | - * |
|
| 5260 | - */ |
|
| 5256 | + * Gets all aircraft manufacturer that have flown over by country |
|
| 5257 | + * |
|
| 5258 | + * @return Array the aircraft manufacturer list |
|
| 5259 | + * |
|
| 5260 | + */ |
|
| 5261 | 5261 | public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
| 5262 | 5262 | { |
| 5263 | 5263 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5288,17 +5288,17 @@ discard block |
||
| 5288 | 5288 | |
| 5289 | 5289 | |
| 5290 | 5290 | /** |
| 5291 | - * Gets all aircraft manufacturers that have flown over |
|
| 5292 | - * |
|
| 5293 | - * @return Array the aircraft list |
|
| 5294 | - * |
|
| 5295 | - */ |
|
| 5291 | + * Gets all aircraft manufacturers that have flown over |
|
| 5292 | + * |
|
| 5293 | + * @return Array the aircraft list |
|
| 5294 | + * |
|
| 5295 | + */ |
|
| 5296 | 5296 | public function countAllAircraftManufacturers($filters = array()) |
| 5297 | 5297 | { |
| 5298 | 5298 | $filter_query = $this->getFilter($filters,true,true); |
| 5299 | 5299 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
| 5300 | 5300 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
| 5301 | - $query .= " GROUP BY spotter_output.aircraft_manufacturer |
|
| 5301 | + $query .= " GROUP BY spotter_output.aircraft_manufacturer |
|
| 5302 | 5302 | ORDER BY aircraft_manufacturer_count DESC |
| 5303 | 5303 | LIMIT 10"; |
| 5304 | 5304 | |
@@ -5323,11 +5323,11 @@ discard block |
||
| 5323 | 5323 | |
| 5324 | 5324 | |
| 5325 | 5325 | /** |
| 5326 | - * Gets all aircraft registrations that have flown over |
|
| 5327 | - * |
|
| 5328 | - * @return Array the aircraft list |
|
| 5329 | - * |
|
| 5330 | - */ |
|
| 5326 | + * Gets all aircraft registrations that have flown over |
|
| 5327 | + * |
|
| 5328 | + * @return Array the aircraft list |
|
| 5329 | + * |
|
| 5330 | + */ |
|
| 5331 | 5331 | public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 5332 | 5332 | { |
| 5333 | 5333 | global $globalDBdriver; |
@@ -5335,15 +5335,15 @@ discard block |
||
| 5335 | 5335 | $filter_query = $this->getFilter($filters,true,true); |
| 5336 | 5336 | $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5337 | 5337 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
| 5338 | - if ($olderthanmonths > 0) { |
|
| 5339 | - if ($globalDBdriver == 'mysql') { |
|
| 5338 | + if ($olderthanmonths > 0) { |
|
| 5339 | + if ($globalDBdriver == 'mysql') { |
|
| 5340 | 5340 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 5341 | 5341 | } else { |
| 5342 | 5342 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 5343 | 5343 | } |
| 5344 | 5344 | } |
| 5345 | - if ($sincedate != '') { |
|
| 5346 | - if ($globalDBdriver == 'mysql') { |
|
| 5345 | + if ($sincedate != '') { |
|
| 5346 | + if ($globalDBdriver == 'mysql') { |
|
| 5347 | 5347 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 5348 | 5348 | } else { |
| 5349 | 5349 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5352,7 +5352,7 @@ discard block |
||
| 5352 | 5352 | |
| 5353 | 5353 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5354 | 5354 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5355 | - $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 5355 | + $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 5356 | 5356 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5357 | 5357 | |
| 5358 | 5358 | $sth = $this->db->prepare($query); |
@@ -5383,11 +5383,11 @@ discard block |
||
| 5383 | 5383 | |
| 5384 | 5384 | |
| 5385 | 5385 | /** |
| 5386 | - * Gets all aircraft registrations that have flown over |
|
| 5387 | - * |
|
| 5388 | - * @return Array the aircraft list |
|
| 5389 | - * |
|
| 5390 | - */ |
|
| 5386 | + * Gets all aircraft registrations that have flown over |
|
| 5387 | + * |
|
| 5388 | + * @return Array the aircraft list |
|
| 5389 | + * |
|
| 5390 | + */ |
|
| 5391 | 5391 | public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 5392 | 5392 | { |
| 5393 | 5393 | global $globalDBdriver; |
@@ -5395,15 +5395,15 @@ discard block |
||
| 5395 | 5395 | $Image = new Image($this->db); |
| 5396 | 5396 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5397 | 5397 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
| 5398 | - if ($olderthanmonths > 0) { |
|
| 5399 | - if ($globalDBdriver == 'mysql') { |
|
| 5398 | + if ($olderthanmonths > 0) { |
|
| 5399 | + if ($globalDBdriver == 'mysql') { |
|
| 5400 | 5400 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5401 | 5401 | } else { |
| 5402 | 5402 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 5403 | 5403 | } |
| 5404 | 5404 | } |
| 5405 | - if ($sincedate != '') { |
|
| 5406 | - if ($globalDBdriver == 'mysql') { |
|
| 5405 | + if ($sincedate != '') { |
|
| 5406 | + if ($globalDBdriver == 'mysql') { |
|
| 5407 | 5407 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 5408 | 5408 | } else { |
| 5409 | 5409 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5412,7 +5412,7 @@ discard block |
||
| 5412 | 5412 | |
| 5413 | 5413 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5414 | 5414 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5415 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 5415 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 5416 | 5416 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5417 | 5417 | |
| 5418 | 5418 | $sth = $this->db->prepare($query); |
@@ -5444,35 +5444,35 @@ discard block |
||
| 5444 | 5444 | |
| 5445 | 5445 | |
| 5446 | 5446 | /** |
| 5447 | - * Gets all departure airports of the airplanes that have flown over |
|
| 5448 | - * |
|
| 5449 | - * @return Array the airport list |
|
| 5450 | - * |
|
| 5451 | - */ |
|
| 5447 | + * Gets all departure airports of the airplanes that have flown over |
|
| 5448 | + * |
|
| 5449 | + * @return Array the airport list |
|
| 5450 | + * |
|
| 5451 | + */ |
|
| 5452 | 5452 | public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 5453 | 5453 | { |
| 5454 | 5454 | global $globalDBdriver; |
| 5455 | 5455 | $filter_query = $this->getFilter($filters,true,true); |
| 5456 | 5456 | $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 5457 | 5457 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'"; |
| 5458 | - if ($olderthanmonths > 0) { |
|
| 5459 | - if ($globalDBdriver == 'mysql') { |
|
| 5458 | + if ($olderthanmonths > 0) { |
|
| 5459 | + if ($globalDBdriver == 'mysql') { |
|
| 5460 | 5460 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 5461 | 5461 | } else { |
| 5462 | 5462 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 5463 | 5463 | } |
| 5464 | - } |
|
| 5465 | - if ($sincedate != '') { |
|
| 5466 | - if ($globalDBdriver == 'mysql') { |
|
| 5464 | + } |
|
| 5465 | + if ($sincedate != '') { |
|
| 5466 | + if ($globalDBdriver == 'mysql') { |
|
| 5467 | 5467 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 5468 | 5468 | } else { |
| 5469 | 5469 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 5470 | 5470 | } |
| 5471 | 5471 | } |
| 5472 | 5472 | |
| 5473 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5474 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5475 | - $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5473 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5474 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5475 | + $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5476 | 5476 | ORDER BY airport_departure_icao_count DESC"; |
| 5477 | 5477 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5478 | 5478 | |
@@ -5496,35 +5496,35 @@ discard block |
||
| 5496 | 5496 | } |
| 5497 | 5497 | |
| 5498 | 5498 | /** |
| 5499 | - * Gets all departure airports of the airplanes that have flown over |
|
| 5500 | - * |
|
| 5501 | - * @return Array the airport list |
|
| 5502 | - * |
|
| 5503 | - */ |
|
| 5499 | + * Gets all departure airports of the airplanes that have flown over |
|
| 5500 | + * |
|
| 5501 | + * @return Array the airport list |
|
| 5502 | + * |
|
| 5503 | + */ |
|
| 5504 | 5504 | public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 5505 | 5505 | { |
| 5506 | 5506 | global $globalDBdriver; |
| 5507 | 5507 | $filter_query = $this->getFilter($filters,true,true); |
| 5508 | 5508 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 5509 | 5509 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' "; |
| 5510 | - if ($olderthanmonths > 0) { |
|
| 5511 | - if ($globalDBdriver == 'mysql') { |
|
| 5510 | + if ($olderthanmonths > 0) { |
|
| 5511 | + if ($globalDBdriver == 'mysql') { |
|
| 5512 | 5512 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5513 | 5513 | } else { |
| 5514 | 5514 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 5515 | 5515 | } |
| 5516 | - } |
|
| 5517 | - if ($sincedate != '') { |
|
| 5518 | - if ($globalDBdriver == 'mysql') { |
|
| 5516 | + } |
|
| 5517 | + if ($sincedate != '') { |
|
| 5518 | + if ($globalDBdriver == 'mysql') { |
|
| 5519 | 5519 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 5520 | 5520 | } else { |
| 5521 | 5521 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 5522 | 5522 | } |
| 5523 | 5523 | } |
| 5524 | 5524 | |
| 5525 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5526 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5527 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5525 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5526 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5527 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5528 | 5528 | ORDER BY airport_departure_icao_count DESC"; |
| 5529 | 5529 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5530 | 5530 | |
@@ -5549,37 +5549,37 @@ discard block |
||
| 5549 | 5549 | } |
| 5550 | 5550 | |
| 5551 | 5551 | /** |
| 5552 | - * Gets all detected departure airports of the airplanes that have flown over |
|
| 5553 | - * |
|
| 5554 | - * @return Array the airport list |
|
| 5555 | - * |
|
| 5556 | - */ |
|
| 5552 | + * Gets all detected departure airports of the airplanes that have flown over |
|
| 5553 | + * |
|
| 5554 | + * @return Array the airport list |
|
| 5555 | + * |
|
| 5556 | + */ |
|
| 5557 | 5557 | public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 5558 | 5558 | { |
| 5559 | 5559 | global $globalDBdriver; |
| 5560 | 5560 | $filter_query = $this->getFilter($filters,true,true); |
| 5561 | 5561 | $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
| 5562 | 5562 | FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao"; |
| 5563 | - if ($olderthanmonths > 0) { |
|
| 5564 | - if ($globalDBdriver == 'mysql') { |
|
| 5563 | + if ($olderthanmonths > 0) { |
|
| 5564 | + if ($globalDBdriver == 'mysql') { |
|
| 5565 | 5565 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 5566 | 5566 | } else { |
| 5567 | 5567 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 5568 | 5568 | } |
| 5569 | - } |
|
| 5570 | - if ($sincedate != '') { |
|
| 5571 | - if ($globalDBdriver == 'mysql') { |
|
| 5569 | + } |
|
| 5570 | + if ($sincedate != '') { |
|
| 5571 | + if ($globalDBdriver == 'mysql') { |
|
| 5572 | 5572 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 5573 | 5573 | } else { |
| 5574 | 5574 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 5575 | 5575 | } |
| 5576 | 5576 | } |
| 5577 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5578 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5579 | - $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 5577 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5578 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5579 | + $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 5580 | 5580 | ORDER BY airport_departure_icao_count DESC"; |
| 5581 | 5581 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5582 | - //echo $query; |
|
| 5582 | + //echo $query; |
|
| 5583 | 5583 | $sth = $this->db->prepare($query); |
| 5584 | 5584 | $sth->execute(); |
| 5585 | 5585 | |
@@ -5600,35 +5600,35 @@ discard block |
||
| 5600 | 5600 | } |
| 5601 | 5601 | |
| 5602 | 5602 | /** |
| 5603 | - * Gets all detected departure airports of the airplanes that have flown over |
|
| 5604 | - * |
|
| 5605 | - * @return Array the airport list |
|
| 5606 | - * |
|
| 5607 | - */ |
|
| 5603 | + * Gets all detected departure airports of the airplanes that have flown over |
|
| 5604 | + * |
|
| 5605 | + * @return Array the airport list |
|
| 5606 | + * |
|
| 5607 | + */ |
|
| 5608 | 5608 | public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 5609 | 5609 | { |
| 5610 | 5610 | global $globalDBdriver; |
| 5611 | 5611 | $filter_query = $this->getFilter($filters,true,true); |
| 5612 | 5612 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
| 5613 | 5613 | FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao "; |
| 5614 | - if ($olderthanmonths > 0) { |
|
| 5615 | - if ($globalDBdriver == 'mysql') { |
|
| 5614 | + if ($olderthanmonths > 0) { |
|
| 5615 | + if ($globalDBdriver == 'mysql') { |
|
| 5616 | 5616 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5617 | 5617 | } else { |
| 5618 | 5618 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 5619 | 5619 | } |
| 5620 | - } |
|
| 5621 | - if ($sincedate != '') { |
|
| 5622 | - if ($globalDBdriver == 'mysql') { |
|
| 5620 | + } |
|
| 5621 | + if ($sincedate != '') { |
|
| 5622 | + if ($globalDBdriver == 'mysql') { |
|
| 5623 | 5623 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 5624 | 5624 | } else { |
| 5625 | 5625 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
| 5626 | 5626 | } |
| 5627 | 5627 | } |
| 5628 | 5628 | |
| 5629 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5630 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5631 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 5629 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5630 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5631 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 5632 | 5632 | ORDER BY airport_departure_icao_count DESC"; |
| 5633 | 5633 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5634 | 5634 | |
@@ -5653,11 +5653,11 @@ discard block |
||
| 5653 | 5653 | } |
| 5654 | 5654 | |
| 5655 | 5655 | /** |
| 5656 | - * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
| 5657 | - * |
|
| 5658 | - * @return Array the airport list |
|
| 5659 | - * |
|
| 5660 | - */ |
|
| 5656 | + * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
| 5657 | + * |
|
| 5658 | + * @return Array the airport list |
|
| 5659 | + * |
|
| 5660 | + */ |
|
| 5661 | 5661 | public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
| 5662 | 5662 | { |
| 5663 | 5663 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5691,11 +5691,11 @@ discard block |
||
| 5691 | 5691 | |
| 5692 | 5692 | |
| 5693 | 5693 | /** |
| 5694 | - * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
| 5695 | - * |
|
| 5696 | - * @return Array the airport list |
|
| 5697 | - * |
|
| 5698 | - */ |
|
| 5694 | + * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
| 5695 | + * |
|
| 5696 | + * @return Array the airport list |
|
| 5697 | + * |
|
| 5698 | + */ |
|
| 5699 | 5699 | public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
| 5700 | 5700 | { |
| 5701 | 5701 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5726,11 +5726,11 @@ discard block |
||
| 5726 | 5726 | |
| 5727 | 5727 | |
| 5728 | 5728 | /** |
| 5729 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
| 5730 | - * |
|
| 5731 | - * @return Array the airport list |
|
| 5732 | - * |
|
| 5733 | - */ |
|
| 5729 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
| 5730 | + * |
|
| 5731 | + * @return Array the airport list |
|
| 5732 | + * |
|
| 5733 | + */ |
|
| 5734 | 5734 | public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
| 5735 | 5735 | { |
| 5736 | 5736 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5763,11 +5763,11 @@ discard block |
||
| 5763 | 5763 | |
| 5764 | 5764 | |
| 5765 | 5765 | /** |
| 5766 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 5767 | - * |
|
| 5768 | - * @return Array the airport list |
|
| 5769 | - * |
|
| 5770 | - */ |
|
| 5766 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 5767 | + * |
|
| 5768 | + * @return Array the airport list |
|
| 5769 | + * |
|
| 5770 | + */ |
|
| 5771 | 5771 | public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
| 5772 | 5772 | { |
| 5773 | 5773 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5797,11 +5797,11 @@ discard block |
||
| 5797 | 5797 | |
| 5798 | 5798 | |
| 5799 | 5799 | /** |
| 5800 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
| 5801 | - * |
|
| 5802 | - * @return Array the airport list |
|
| 5803 | - * |
|
| 5804 | - */ |
|
| 5800 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
| 5801 | + * |
|
| 5802 | + * @return Array the airport list |
|
| 5803 | + * |
|
| 5804 | + */ |
|
| 5805 | 5805 | public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
| 5806 | 5806 | { |
| 5807 | 5807 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5834,11 +5834,11 @@ discard block |
||
| 5834 | 5834 | |
| 5835 | 5835 | |
| 5836 | 5836 | /** |
| 5837 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 5838 | - * |
|
| 5839 | - * @return Array the airport list |
|
| 5840 | - * |
|
| 5841 | - */ |
|
| 5837 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 5838 | + * |
|
| 5839 | + * @return Array the airport list |
|
| 5840 | + * |
|
| 5841 | + */ |
|
| 5842 | 5842 | public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
| 5843 | 5843 | { |
| 5844 | 5844 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5868,11 +5868,11 @@ discard block |
||
| 5868 | 5868 | |
| 5869 | 5869 | |
| 5870 | 5870 | /** |
| 5871 | - * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
| 5872 | - * |
|
| 5873 | - * @return Array the airport list |
|
| 5874 | - * |
|
| 5875 | - */ |
|
| 5871 | + * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
| 5872 | + * |
|
| 5873 | + * @return Array the airport list |
|
| 5874 | + * |
|
| 5875 | + */ |
|
| 5876 | 5876 | public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
| 5877 | 5877 | { |
| 5878 | 5878 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5905,11 +5905,11 @@ discard block |
||
| 5905 | 5905 | |
| 5906 | 5906 | |
| 5907 | 5907 | /** |
| 5908 | - * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
| 5909 | - * |
|
| 5910 | - * @return Array the airport list |
|
| 5911 | - * |
|
| 5912 | - */ |
|
| 5908 | + * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
| 5909 | + * |
|
| 5910 | + * @return Array the airport list |
|
| 5911 | + * |
|
| 5912 | + */ |
|
| 5913 | 5913 | public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
| 5914 | 5914 | { |
| 5915 | 5915 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5940,11 +5940,11 @@ discard block |
||
| 5940 | 5940 | |
| 5941 | 5941 | |
| 5942 | 5942 | /** |
| 5943 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
| 5944 | - * |
|
| 5945 | - * @return Array the airport list |
|
| 5946 | - * |
|
| 5947 | - */ |
|
| 5943 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
| 5944 | + * |
|
| 5945 | + * @return Array the airport list |
|
| 5946 | + * |
|
| 5947 | + */ |
|
| 5948 | 5948 | public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
| 5949 | 5949 | { |
| 5950 | 5950 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5977,11 +5977,11 @@ discard block |
||
| 5977 | 5977 | |
| 5978 | 5978 | |
| 5979 | 5979 | /** |
| 5980 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
| 5981 | - * |
|
| 5982 | - * @return Array the airport list |
|
| 5983 | - * |
|
| 5984 | - */ |
|
| 5980 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
| 5981 | + * |
|
| 5982 | + * @return Array the airport list |
|
| 5983 | + * |
|
| 5984 | + */ |
|
| 5985 | 5985 | public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 5986 | 5986 | { |
| 5987 | 5987 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6011,11 +6011,11 @@ discard block |
||
| 6011 | 6011 | |
| 6012 | 6012 | |
| 6013 | 6013 | /** |
| 6014 | - * Gets all departure airports of the airplanes that have flown over based on a date |
|
| 6015 | - * |
|
| 6016 | - * @return Array the airport list |
|
| 6017 | - * |
|
| 6018 | - */ |
|
| 6014 | + * Gets all departure airports of the airplanes that have flown over based on a date |
|
| 6015 | + * |
|
| 6016 | + * @return Array the airport list |
|
| 6017 | + * |
|
| 6018 | + */ |
|
| 6019 | 6019 | public function countAllDepartureAirportsByDate($date,$filters = array()) |
| 6020 | 6020 | { |
| 6021 | 6021 | global $globalTimezone, $globalDBdriver; |
@@ -6061,11 +6061,11 @@ discard block |
||
| 6061 | 6061 | |
| 6062 | 6062 | |
| 6063 | 6063 | /** |
| 6064 | - * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
| 6065 | - * |
|
| 6066 | - * @return Array the airport list |
|
| 6067 | - * |
|
| 6068 | - */ |
|
| 6064 | + * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
| 6065 | + * |
|
| 6066 | + * @return Array the airport list |
|
| 6067 | + * |
|
| 6068 | + */ |
|
| 6069 | 6069 | public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
| 6070 | 6070 | { |
| 6071 | 6071 | global $globalTimezone, $globalDBdriver; |
@@ -6108,11 +6108,11 @@ discard block |
||
| 6108 | 6108 | |
| 6109 | 6109 | |
| 6110 | 6110 | /** |
| 6111 | - * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
| 6112 | - * |
|
| 6113 | - * @return Array the airport list |
|
| 6114 | - * |
|
| 6115 | - */ |
|
| 6111 | + * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
| 6112 | + * |
|
| 6113 | + * @return Array the airport list |
|
| 6114 | + * |
|
| 6115 | + */ |
|
| 6116 | 6116 | public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
| 6117 | 6117 | { |
| 6118 | 6118 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6146,11 +6146,11 @@ discard block |
||
| 6146 | 6146 | |
| 6147 | 6147 | |
| 6148 | 6148 | /** |
| 6149 | - * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 6150 | - * |
|
| 6151 | - * @return Array the airport list |
|
| 6152 | - * |
|
| 6153 | - */ |
|
| 6149 | + * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 6150 | + * |
|
| 6151 | + * @return Array the airport list |
|
| 6152 | + * |
|
| 6153 | + */ |
|
| 6154 | 6154 | public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
| 6155 | 6155 | { |
| 6156 | 6156 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6181,11 +6181,11 @@ discard block |
||
| 6181 | 6181 | |
| 6182 | 6182 | |
| 6183 | 6183 | /** |
| 6184 | - * Gets all departure airports of the airplanes that have flown over based on a country |
|
| 6185 | - * |
|
| 6186 | - * @return Array the airport list |
|
| 6187 | - * |
|
| 6188 | - */ |
|
| 6184 | + * Gets all departure airports of the airplanes that have flown over based on a country |
|
| 6185 | + * |
|
| 6186 | + * @return Array the airport list |
|
| 6187 | + * |
|
| 6188 | + */ |
|
| 6189 | 6189 | public function countAllDepartureAirportsByCountry($country,$filters = array()) |
| 6190 | 6190 | { |
| 6191 | 6191 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6219,11 +6219,11 @@ discard block |
||
| 6219 | 6219 | |
| 6220 | 6220 | |
| 6221 | 6221 | /** |
| 6222 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6223 | - * |
|
| 6224 | - * @return Array the airport list |
|
| 6225 | - * |
|
| 6226 | - */ |
|
| 6222 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6223 | + * |
|
| 6224 | + * @return Array the airport list |
|
| 6225 | + * |
|
| 6226 | + */ |
|
| 6227 | 6227 | public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
| 6228 | 6228 | { |
| 6229 | 6229 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6253,40 +6253,40 @@ discard block |
||
| 6253 | 6253 | |
| 6254 | 6254 | |
| 6255 | 6255 | /** |
| 6256 | - * Gets all arrival airports of the airplanes that have flown over |
|
| 6257 | - * |
|
| 6258 | - * @return Array the airport list |
|
| 6259 | - * |
|
| 6260 | - */ |
|
| 6256 | + * Gets all arrival airports of the airplanes that have flown over |
|
| 6257 | + * |
|
| 6258 | + * @return Array the airport list |
|
| 6259 | + * |
|
| 6260 | + */ |
|
| 6261 | 6261 | public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
| 6262 | 6262 | { |
| 6263 | 6263 | global $globalDBdriver; |
| 6264 | 6264 | $filter_query = $this->getFilter($filters,true,true); |
| 6265 | 6265 | $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6266 | 6266 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'"; |
| 6267 | - if ($olderthanmonths > 0) { |
|
| 6268 | - if ($globalDBdriver == 'mysql') { |
|
| 6267 | + if ($olderthanmonths > 0) { |
|
| 6268 | + if ($globalDBdriver == 'mysql') { |
|
| 6269 | 6269 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6270 | 6270 | } else { |
| 6271 | 6271 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6272 | 6272 | } |
| 6273 | - if ($sincedate != '') { |
|
| 6274 | - if ($globalDBdriver == 'mysql') { |
|
| 6273 | + if ($sincedate != '') { |
|
| 6274 | + if ($globalDBdriver == 'mysql') { |
|
| 6275 | 6275 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6276 | 6276 | } else { |
| 6277 | 6277 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6278 | 6278 | } |
| 6279 | 6279 | } |
| 6280 | - if ($globalDBdriver == 'mysql') { |
|
| 6280 | + if ($globalDBdriver == 'mysql') { |
|
| 6281 | 6281 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6282 | 6282 | } else { |
| 6283 | 6283 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6284 | 6284 | } |
| 6285 | 6285 | } |
| 6286 | 6286 | |
| 6287 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6288 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6289 | - $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6287 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6288 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6289 | + $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6290 | 6290 | ORDER BY airport_arrival_icao_count DESC"; |
| 6291 | 6291 | if ($limit) $query .= " LIMIT 10"; |
| 6292 | 6292 | |
@@ -6315,40 +6315,40 @@ discard block |
||
| 6315 | 6315 | } |
| 6316 | 6316 | |
| 6317 | 6317 | /** |
| 6318 | - * Gets all arrival airports of the airplanes that have flown over |
|
| 6319 | - * |
|
| 6320 | - * @return Array the airport list |
|
| 6321 | - * |
|
| 6322 | - */ |
|
| 6318 | + * Gets all arrival airports of the airplanes that have flown over |
|
| 6319 | + * |
|
| 6320 | + * @return Array the airport list |
|
| 6321 | + * |
|
| 6322 | + */ |
|
| 6323 | 6323 | public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
| 6324 | 6324 | { |
| 6325 | 6325 | global $globalDBdriver; |
| 6326 | 6326 | $filter_query = $this->getFilter($filters,true,true); |
| 6327 | 6327 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6328 | 6328 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' "; |
| 6329 | - if ($olderthanmonths > 0) { |
|
| 6330 | - if ($globalDBdriver == 'mysql') { |
|
| 6329 | + if ($olderthanmonths > 0) { |
|
| 6330 | + if ($globalDBdriver == 'mysql') { |
|
| 6331 | 6331 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6332 | 6332 | } else { |
| 6333 | 6333 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6334 | 6334 | } |
| 6335 | - if ($sincedate != '') { |
|
| 6336 | - if ($globalDBdriver == 'mysql') { |
|
| 6335 | + if ($sincedate != '') { |
|
| 6336 | + if ($globalDBdriver == 'mysql') { |
|
| 6337 | 6337 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6338 | 6338 | } else { |
| 6339 | 6339 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6340 | 6340 | } |
| 6341 | 6341 | } |
| 6342 | - if ($globalDBdriver == 'mysql') { |
|
| 6342 | + if ($globalDBdriver == 'mysql') { |
|
| 6343 | 6343 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6344 | 6344 | } else { |
| 6345 | 6345 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6346 | 6346 | } |
| 6347 | 6347 | } |
| 6348 | 6348 | |
| 6349 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6350 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6351 | - $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6349 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6350 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6351 | + $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6352 | 6352 | ORDER BY airport_arrival_icao_count DESC"; |
| 6353 | 6353 | if ($limit) $query .= " LIMIT 10"; |
| 6354 | 6354 | |
@@ -6379,39 +6379,39 @@ discard block |
||
| 6379 | 6379 | |
| 6380 | 6380 | |
| 6381 | 6381 | /** |
| 6382 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
| 6383 | - * |
|
| 6384 | - * @return Array the airport list |
|
| 6385 | - * |
|
| 6386 | - */ |
|
| 6382 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
| 6383 | + * |
|
| 6384 | + * @return Array the airport list |
|
| 6385 | + * |
|
| 6386 | + */ |
|
| 6387 | 6387 | public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
| 6388 | 6388 | { |
| 6389 | 6389 | global $globalDBdriver; |
| 6390 | 6390 | $filter_query = $this->getFilter($filters,true,true); |
| 6391 | 6391 | $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
| 6392 | 6392 | FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao"; |
| 6393 | - if ($olderthanmonths > 0) { |
|
| 6394 | - if ($globalDBdriver == 'mysql') { |
|
| 6393 | + if ($olderthanmonths > 0) { |
|
| 6394 | + if ($globalDBdriver == 'mysql') { |
|
| 6395 | 6395 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6396 | 6396 | } else { |
| 6397 | 6397 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6398 | 6398 | } |
| 6399 | - if ($sincedate != '') { |
|
| 6400 | - if ($globalDBdriver == 'mysql') { |
|
| 6399 | + if ($sincedate != '') { |
|
| 6400 | + if ($globalDBdriver == 'mysql') { |
|
| 6401 | 6401 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6402 | 6402 | } else { |
| 6403 | 6403 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6404 | 6404 | } |
| 6405 | 6405 | } |
| 6406 | - if ($globalDBdriver == 'mysql') { |
|
| 6406 | + if ($globalDBdriver == 'mysql') { |
|
| 6407 | 6407 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6408 | 6408 | } else { |
| 6409 | 6409 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6410 | 6410 | } |
| 6411 | 6411 | } |
| 6412 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6413 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6414 | - $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 6412 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6413 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6414 | + $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 6415 | 6415 | ORDER BY airport_arrival_icao_count DESC"; |
| 6416 | 6416 | if ($limit) $query .= " LIMIT 10"; |
| 6417 | 6417 | |
@@ -6440,40 +6440,40 @@ discard block |
||
| 6440 | 6440 | } |
| 6441 | 6441 | |
| 6442 | 6442 | /** |
| 6443 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
| 6444 | - * |
|
| 6445 | - * @return Array the airport list |
|
| 6446 | - * |
|
| 6447 | - */ |
|
| 6443 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
| 6444 | + * |
|
| 6445 | + * @return Array the airport list |
|
| 6446 | + * |
|
| 6447 | + */ |
|
| 6448 | 6448 | public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
| 6449 | 6449 | { |
| 6450 | 6450 | global $globalDBdriver; |
| 6451 | 6451 | $filter_query = $this->getFilter($filters,true,true); |
| 6452 | 6452 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
| 6453 | 6453 | FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao "; |
| 6454 | - if ($olderthanmonths > 0) { |
|
| 6455 | - if ($globalDBdriver == 'mysql') { |
|
| 6454 | + if ($olderthanmonths > 0) { |
|
| 6455 | + if ($globalDBdriver == 'mysql') { |
|
| 6456 | 6456 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6457 | 6457 | } else { |
| 6458 | 6458 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6459 | 6459 | } |
| 6460 | - if ($sincedate != '') { |
|
| 6461 | - if ($globalDBdriver == 'mysql') { |
|
| 6460 | + if ($sincedate != '') { |
|
| 6461 | + if ($globalDBdriver == 'mysql') { |
|
| 6462 | 6462 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6463 | 6463 | } else { |
| 6464 | 6464 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6465 | 6465 | } |
| 6466 | 6466 | } |
| 6467 | - if ($globalDBdriver == 'mysql') { |
|
| 6467 | + if ($globalDBdriver == 'mysql') { |
|
| 6468 | 6468 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6469 | 6469 | } else { |
| 6470 | 6470 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6471 | 6471 | } |
| 6472 | 6472 | } |
| 6473 | 6473 | |
| 6474 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6475 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6476 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 6474 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6475 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6476 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 6477 | 6477 | ORDER BY airport_arrival_icao_count DESC"; |
| 6478 | 6478 | if ($limit) $query .= " LIMIT 10"; |
| 6479 | 6479 | |
@@ -6503,11 +6503,11 @@ discard block |
||
| 6503 | 6503 | } |
| 6504 | 6504 | |
| 6505 | 6505 | /** |
| 6506 | - * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
| 6507 | - * |
|
| 6508 | - * @return Array the airport list |
|
| 6509 | - * |
|
| 6510 | - */ |
|
| 6506 | + * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
| 6507 | + * |
|
| 6508 | + * @return Array the airport list |
|
| 6509 | + * |
|
| 6510 | + */ |
|
| 6511 | 6511 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
| 6512 | 6512 | { |
| 6513 | 6513 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6539,11 +6539,11 @@ discard block |
||
| 6539 | 6539 | |
| 6540 | 6540 | |
| 6541 | 6541 | /** |
| 6542 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
| 6543 | - * |
|
| 6544 | - * @return Array the airport list |
|
| 6545 | - * |
|
| 6546 | - */ |
|
| 6542 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
| 6543 | + * |
|
| 6544 | + * @return Array the airport list |
|
| 6545 | + * |
|
| 6546 | + */ |
|
| 6547 | 6547 | public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
| 6548 | 6548 | { |
| 6549 | 6549 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6574,11 +6574,11 @@ discard block |
||
| 6574 | 6574 | |
| 6575 | 6575 | |
| 6576 | 6576 | /** |
| 6577 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
| 6578 | - * |
|
| 6579 | - * @return Array the airport list |
|
| 6580 | - * |
|
| 6581 | - */ |
|
| 6577 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
| 6578 | + * |
|
| 6579 | + * @return Array the airport list |
|
| 6580 | + * |
|
| 6581 | + */ |
|
| 6582 | 6582 | public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
| 6583 | 6583 | { |
| 6584 | 6584 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6612,11 +6612,11 @@ discard block |
||
| 6612 | 6612 | |
| 6613 | 6613 | |
| 6614 | 6614 | /** |
| 6615 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6616 | - * |
|
| 6617 | - * @return Array the airport list |
|
| 6618 | - * |
|
| 6619 | - */ |
|
| 6615 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6616 | + * |
|
| 6617 | + * @return Array the airport list |
|
| 6618 | + * |
|
| 6619 | + */ |
|
| 6620 | 6620 | public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
| 6621 | 6621 | { |
| 6622 | 6622 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6646,11 +6646,11 @@ discard block |
||
| 6646 | 6646 | |
| 6647 | 6647 | |
| 6648 | 6648 | /** |
| 6649 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
| 6650 | - * |
|
| 6651 | - * @return Array the airport list |
|
| 6652 | - * |
|
| 6653 | - */ |
|
| 6649 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
| 6650 | + * |
|
| 6651 | + * @return Array the airport list |
|
| 6652 | + * |
|
| 6653 | + */ |
|
| 6654 | 6654 | public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
| 6655 | 6655 | { |
| 6656 | 6656 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6684,11 +6684,11 @@ discard block |
||
| 6684 | 6684 | |
| 6685 | 6685 | |
| 6686 | 6686 | /** |
| 6687 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 6688 | - * |
|
| 6689 | - * @return Array the airport list |
|
| 6690 | - * |
|
| 6691 | - */ |
|
| 6687 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 6688 | + * |
|
| 6689 | + * @return Array the airport list |
|
| 6690 | + * |
|
| 6691 | + */ |
|
| 6692 | 6692 | public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
| 6693 | 6693 | { |
| 6694 | 6694 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6719,11 +6719,11 @@ discard block |
||
| 6719 | 6719 | |
| 6720 | 6720 | |
| 6721 | 6721 | /** |
| 6722 | - * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
| 6723 | - * |
|
| 6724 | - * @return Array the airport list |
|
| 6725 | - * |
|
| 6726 | - */ |
|
| 6722 | + * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
| 6723 | + * |
|
| 6724 | + * @return Array the airport list |
|
| 6725 | + * |
|
| 6726 | + */ |
|
| 6727 | 6727 | public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
| 6728 | 6728 | { |
| 6729 | 6729 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6756,11 +6756,11 @@ discard block |
||
| 6756 | 6756 | |
| 6757 | 6757 | |
| 6758 | 6758 | /** |
| 6759 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
| 6760 | - * |
|
| 6761 | - * @return Array the airport list |
|
| 6762 | - * |
|
| 6763 | - */ |
|
| 6759 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
| 6760 | + * |
|
| 6761 | + * @return Array the airport list |
|
| 6762 | + * |
|
| 6763 | + */ |
|
| 6764 | 6764 | public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
| 6765 | 6765 | { |
| 6766 | 6766 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6790,11 +6790,11 @@ discard block |
||
| 6790 | 6790 | |
| 6791 | 6791 | |
| 6792 | 6792 | /** |
| 6793 | - * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
| 6794 | - * |
|
| 6795 | - * @return Array the airport list |
|
| 6796 | - * |
|
| 6797 | - */ |
|
| 6793 | + * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
| 6794 | + * |
|
| 6795 | + * @return Array the airport list |
|
| 6796 | + * |
|
| 6797 | + */ |
|
| 6798 | 6798 | public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
| 6799 | 6799 | { |
| 6800 | 6800 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6828,11 +6828,11 @@ discard block |
||
| 6828 | 6828 | |
| 6829 | 6829 | |
| 6830 | 6830 | /** |
| 6831 | - * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
| 6832 | - * |
|
| 6833 | - * @return Array the airport list |
|
| 6834 | - * |
|
| 6835 | - */ |
|
| 6831 | + * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
| 6832 | + * |
|
| 6833 | + * @return Array the airport list |
|
| 6834 | + * |
|
| 6835 | + */ |
|
| 6836 | 6836 | public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 6837 | 6837 | { |
| 6838 | 6838 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6863,11 +6863,11 @@ discard block |
||
| 6863 | 6863 | |
| 6864 | 6864 | |
| 6865 | 6865 | /** |
| 6866 | - * Gets all arrival airports of the airplanes that have flown over based on a date |
|
| 6867 | - * |
|
| 6868 | - * @return Array the airport list |
|
| 6869 | - * |
|
| 6870 | - */ |
|
| 6866 | + * Gets all arrival airports of the airplanes that have flown over based on a date |
|
| 6867 | + * |
|
| 6868 | + * @return Array the airport list |
|
| 6869 | + * |
|
| 6870 | + */ |
|
| 6871 | 6871 | public function countAllArrivalAirportsByDate($date,$filters = array()) |
| 6872 | 6872 | { |
| 6873 | 6873 | global $globalTimezone, $globalDBdriver; |
@@ -6913,11 +6913,11 @@ discard block |
||
| 6913 | 6913 | |
| 6914 | 6914 | |
| 6915 | 6915 | /** |
| 6916 | - * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
| 6917 | - * |
|
| 6918 | - * @return Array the airport list |
|
| 6919 | - * |
|
| 6920 | - */ |
|
| 6916 | + * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
| 6917 | + * |
|
| 6918 | + * @return Array the airport list |
|
| 6919 | + * |
|
| 6920 | + */ |
|
| 6921 | 6921 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
| 6922 | 6922 | { |
| 6923 | 6923 | global $globalTimezone, $globalDBdriver; |
@@ -6960,11 +6960,11 @@ discard block |
||
| 6960 | 6960 | |
| 6961 | 6961 | |
| 6962 | 6962 | /** |
| 6963 | - * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
| 6964 | - * |
|
| 6965 | - * @return Array the airport list |
|
| 6966 | - * |
|
| 6967 | - */ |
|
| 6963 | + * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
| 6964 | + * |
|
| 6965 | + * @return Array the airport list |
|
| 6966 | + * |
|
| 6967 | + */ |
|
| 6968 | 6968 | public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
| 6969 | 6969 | { |
| 6970 | 6970 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6997,11 +6997,11 @@ discard block |
||
| 6997 | 6997 | |
| 6998 | 6998 | |
| 6999 | 6999 | /** |
| 7000 | - * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 7001 | - * |
|
| 7002 | - * @return Array the airport list |
|
| 7003 | - * |
|
| 7004 | - */ |
|
| 7000 | + * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 7001 | + * |
|
| 7002 | + * @return Array the airport list |
|
| 7003 | + * |
|
| 7004 | + */ |
|
| 7005 | 7005 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
| 7006 | 7006 | { |
| 7007 | 7007 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7032,11 +7032,11 @@ discard block |
||
| 7032 | 7032 | |
| 7033 | 7033 | |
| 7034 | 7034 | /** |
| 7035 | - * Gets all arrival airports of the airplanes that have flown over based on a country |
|
| 7036 | - * |
|
| 7037 | - * @return Array the airport list |
|
| 7038 | - * |
|
| 7039 | - */ |
|
| 7035 | + * Gets all arrival airports of the airplanes that have flown over based on a country |
|
| 7036 | + * |
|
| 7037 | + * @return Array the airport list |
|
| 7038 | + * |
|
| 7039 | + */ |
|
| 7040 | 7040 | public function countAllArrivalAirportsByCountry($country,$filters = array()) |
| 7041 | 7041 | { |
| 7042 | 7042 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7069,11 +7069,11 @@ discard block |
||
| 7069 | 7069 | |
| 7070 | 7070 | |
| 7071 | 7071 | /** |
| 7072 | - * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
| 7073 | - * |
|
| 7074 | - * @return Array the airport list |
|
| 7075 | - * |
|
| 7076 | - */ |
|
| 7072 | + * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
| 7073 | + * |
|
| 7074 | + * @return Array the airport list |
|
| 7075 | + * |
|
| 7076 | + */ |
|
| 7077 | 7077 | public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
| 7078 | 7078 | { |
| 7079 | 7079 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7104,11 +7104,11 @@ discard block |
||
| 7104 | 7104 | |
| 7105 | 7105 | |
| 7106 | 7106 | /** |
| 7107 | - * Counts all airport departure countries |
|
| 7108 | - * |
|
| 7109 | - * @return Array the airport departure list |
|
| 7110 | - * |
|
| 7111 | - */ |
|
| 7107 | + * Counts all airport departure countries |
|
| 7108 | + * |
|
| 7109 | + * @return Array the airport departure list |
|
| 7110 | + * |
|
| 7111 | + */ |
|
| 7112 | 7112 | public function countAllDepartureCountries($filters = array()) |
| 7113 | 7113 | { |
| 7114 | 7114 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7138,11 +7138,11 @@ discard block |
||
| 7138 | 7138 | |
| 7139 | 7139 | |
| 7140 | 7140 | /** |
| 7141 | - * Counts all airport arrival countries |
|
| 7142 | - * |
|
| 7143 | - * @return Array the airport arrival list |
|
| 7144 | - * |
|
| 7145 | - */ |
|
| 7141 | + * Counts all airport arrival countries |
|
| 7142 | + * |
|
| 7143 | + * @return Array the airport arrival list |
|
| 7144 | + * |
|
| 7145 | + */ |
|
| 7146 | 7146 | public function countAllArrivalCountries($limit = true,$filters = array()) |
| 7147 | 7147 | { |
| 7148 | 7148 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7175,11 +7175,11 @@ discard block |
||
| 7175 | 7175 | |
| 7176 | 7176 | |
| 7177 | 7177 | /** |
| 7178 | - * Gets all route combinations |
|
| 7179 | - * |
|
| 7180 | - * @return Array the route list |
|
| 7181 | - * |
|
| 7182 | - */ |
|
| 7178 | + * Gets all route combinations |
|
| 7179 | + * |
|
| 7180 | + * @return Array the route list |
|
| 7181 | + * |
|
| 7182 | + */ |
|
| 7183 | 7183 | public function countAllRoutes($filters = array()) |
| 7184 | 7184 | { |
| 7185 | 7185 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7218,11 +7218,11 @@ discard block |
||
| 7218 | 7218 | |
| 7219 | 7219 | |
| 7220 | 7220 | /** |
| 7221 | - * Gets all route combinations based on an aircraft |
|
| 7222 | - * |
|
| 7223 | - * @return Array the route list |
|
| 7224 | - * |
|
| 7225 | - */ |
|
| 7221 | + * Gets all route combinations based on an aircraft |
|
| 7222 | + * |
|
| 7223 | + * @return Array the route list |
|
| 7224 | + * |
|
| 7225 | + */ |
|
| 7226 | 7226 | public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
| 7227 | 7227 | { |
| 7228 | 7228 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7258,11 +7258,11 @@ discard block |
||
| 7258 | 7258 | |
| 7259 | 7259 | |
| 7260 | 7260 | /** |
| 7261 | - * Gets all route combinations based on an aircraft registration |
|
| 7262 | - * |
|
| 7263 | - * @return Array the route list |
|
| 7264 | - * |
|
| 7265 | - */ |
|
| 7261 | + * Gets all route combinations based on an aircraft registration |
|
| 7262 | + * |
|
| 7263 | + * @return Array the route list |
|
| 7264 | + * |
|
| 7265 | + */ |
|
| 7266 | 7266 | public function countAllRoutesByRegistration($registration, $filters = array()) |
| 7267 | 7267 | { |
| 7268 | 7268 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7300,11 +7300,11 @@ discard block |
||
| 7300 | 7300 | |
| 7301 | 7301 | |
| 7302 | 7302 | /** |
| 7303 | - * Gets all route combinations based on an airline |
|
| 7304 | - * |
|
| 7305 | - * @return Array the route list |
|
| 7306 | - * |
|
| 7307 | - */ |
|
| 7303 | + * Gets all route combinations based on an airline |
|
| 7304 | + * |
|
| 7305 | + * @return Array the route list |
|
| 7306 | + * |
|
| 7307 | + */ |
|
| 7308 | 7308 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
| 7309 | 7309 | { |
| 7310 | 7310 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7342,11 +7342,11 @@ discard block |
||
| 7342 | 7342 | |
| 7343 | 7343 | |
| 7344 | 7344 | /** |
| 7345 | - * Gets all route combinations based on an airport |
|
| 7346 | - * |
|
| 7347 | - * @return Array the route list |
|
| 7348 | - * |
|
| 7349 | - */ |
|
| 7345 | + * Gets all route combinations based on an airport |
|
| 7346 | + * |
|
| 7347 | + * @return Array the route list |
|
| 7348 | + * |
|
| 7349 | + */ |
|
| 7350 | 7350 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
| 7351 | 7351 | { |
| 7352 | 7352 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7383,11 +7383,11 @@ discard block |
||
| 7383 | 7383 | |
| 7384 | 7384 | |
| 7385 | 7385 | /** |
| 7386 | - * Gets all route combinations based on an country |
|
| 7387 | - * |
|
| 7388 | - * @return Array the route list |
|
| 7389 | - * |
|
| 7390 | - */ |
|
| 7386 | + * Gets all route combinations based on an country |
|
| 7387 | + * |
|
| 7388 | + * @return Array the route list |
|
| 7389 | + * |
|
| 7390 | + */ |
|
| 7391 | 7391 | public function countAllRoutesByCountry($country, $filters = array()) |
| 7392 | 7392 | { |
| 7393 | 7393 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7423,11 +7423,11 @@ discard block |
||
| 7423 | 7423 | |
| 7424 | 7424 | |
| 7425 | 7425 | /** |
| 7426 | - * Gets all route combinations based on an date |
|
| 7427 | - * |
|
| 7428 | - * @return Array the route list |
|
| 7429 | - * |
|
| 7430 | - */ |
|
| 7426 | + * Gets all route combinations based on an date |
|
| 7427 | + * |
|
| 7428 | + * @return Array the route list |
|
| 7429 | + * |
|
| 7430 | + */ |
|
| 7431 | 7431 | public function countAllRoutesByDate($date, $filters = array()) |
| 7432 | 7432 | { |
| 7433 | 7433 | global $globalTimezone, $globalDBdriver; |
@@ -7477,11 +7477,11 @@ discard block |
||
| 7477 | 7477 | |
| 7478 | 7478 | |
| 7479 | 7479 | /** |
| 7480 | - * Gets all route combinations based on an ident/callsign |
|
| 7481 | - * |
|
| 7482 | - * @return Array the route list |
|
| 7483 | - * |
|
| 7484 | - */ |
|
| 7480 | + * Gets all route combinations based on an ident/callsign |
|
| 7481 | + * |
|
| 7482 | + * @return Array the route list |
|
| 7483 | + * |
|
| 7484 | + */ |
|
| 7485 | 7485 | public function countAllRoutesByIdent($ident, $filters = array()) |
| 7486 | 7486 | { |
| 7487 | 7487 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7518,11 +7518,11 @@ discard block |
||
| 7518 | 7518 | |
| 7519 | 7519 | |
| 7520 | 7520 | /** |
| 7521 | - * Gets all route combinations based on an manufacturer |
|
| 7522 | - * |
|
| 7523 | - * @return Array the route list |
|
| 7524 | - * |
|
| 7525 | - */ |
|
| 7521 | + * Gets all route combinations based on an manufacturer |
|
| 7522 | + * |
|
| 7523 | + * @return Array the route list |
|
| 7524 | + * |
|
| 7525 | + */ |
|
| 7526 | 7526 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
| 7527 | 7527 | { |
| 7528 | 7528 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7560,11 +7560,11 @@ discard block |
||
| 7560 | 7560 | |
| 7561 | 7561 | |
| 7562 | 7562 | /** |
| 7563 | - * Gets all route combinations with waypoints |
|
| 7564 | - * |
|
| 7565 | - * @return Array the route list |
|
| 7566 | - * |
|
| 7567 | - */ |
|
| 7563 | + * Gets all route combinations with waypoints |
|
| 7564 | + * |
|
| 7565 | + * @return Array the route list |
|
| 7566 | + * |
|
| 7567 | + */ |
|
| 7568 | 7568 | public function countAllRoutesWithWaypoints($filters = array()) |
| 7569 | 7569 | { |
| 7570 | 7570 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7601,11 +7601,11 @@ discard block |
||
| 7601 | 7601 | } |
| 7602 | 7602 | |
| 7603 | 7603 | /** |
| 7604 | - * Gets all callsigns that have flown over |
|
| 7605 | - * |
|
| 7606 | - * @return Array the callsign list |
|
| 7607 | - * |
|
| 7608 | - */ |
|
| 7604 | + * Gets all callsigns that have flown over |
|
| 7605 | + * |
|
| 7606 | + * @return Array the callsign list |
|
| 7607 | + * |
|
| 7608 | + */ |
|
| 7609 | 7609 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 7610 | 7610 | { |
| 7611 | 7611 | global $globalDBdriver; |
@@ -7643,11 +7643,11 @@ discard block |
||
| 7643 | 7643 | } |
| 7644 | 7644 | |
| 7645 | 7645 | /** |
| 7646 | - * Gets all callsigns that have flown over |
|
| 7647 | - * |
|
| 7648 | - * @return Array the callsign list |
|
| 7649 | - * |
|
| 7650 | - */ |
|
| 7646 | + * Gets all callsigns that have flown over |
|
| 7647 | + * |
|
| 7648 | + * @return Array the callsign list |
|
| 7649 | + * |
|
| 7650 | + */ |
|
| 7651 | 7651 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
| 7652 | 7652 | { |
| 7653 | 7653 | global $globalDBdriver; |
@@ -7688,11 +7688,11 @@ discard block |
||
| 7688 | 7688 | |
| 7689 | 7689 | |
| 7690 | 7690 | /** |
| 7691 | - * Counts all dates |
|
| 7692 | - * |
|
| 7693 | - * @return Array the date list |
|
| 7694 | - * |
|
| 7695 | - */ |
|
| 7691 | + * Counts all dates |
|
| 7692 | + * |
|
| 7693 | + * @return Array the date list |
|
| 7694 | + * |
|
| 7695 | + */ |
|
| 7696 | 7696 | public function countAllDates($filters = array()) |
| 7697 | 7697 | { |
| 7698 | 7698 | global $globalTimezone, $globalDBdriver; |
@@ -7737,11 +7737,11 @@ discard block |
||
| 7737 | 7737 | } |
| 7738 | 7738 | |
| 7739 | 7739 | /** |
| 7740 | - * Counts all dates |
|
| 7741 | - * |
|
| 7742 | - * @return Array the date list |
|
| 7743 | - * |
|
| 7744 | - */ |
|
| 7740 | + * Counts all dates |
|
| 7741 | + * |
|
| 7742 | + * @return Array the date list |
|
| 7743 | + * |
|
| 7744 | + */ |
|
| 7745 | 7745 | public function countAllDatesByAirlines($filters = array()) |
| 7746 | 7746 | { |
| 7747 | 7747 | global $globalTimezone, $globalDBdriver; |
@@ -7786,11 +7786,11 @@ discard block |
||
| 7786 | 7786 | } |
| 7787 | 7787 | |
| 7788 | 7788 | /** |
| 7789 | - * Counts all dates during the last 7 days |
|
| 7790 | - * |
|
| 7791 | - * @return Array the date list |
|
| 7792 | - * |
|
| 7793 | - */ |
|
| 7789 | + * Counts all dates during the last 7 days |
|
| 7790 | + * |
|
| 7791 | + * @return Array the date list |
|
| 7792 | + * |
|
| 7793 | + */ |
|
| 7794 | 7794 | public function countAllDatesLast7Days($filters = array()) |
| 7795 | 7795 | { |
| 7796 | 7796 | global $globalTimezone, $globalDBdriver; |
@@ -7812,7 +7812,7 @@ discard block |
||
| 7812 | 7812 | $query .= " GROUP BY date_name |
| 7813 | 7813 | ORDER BY date_name ASC"; |
| 7814 | 7814 | $query_data = array(':offset' => $offset); |
| 7815 | - } |
|
| 7815 | + } |
|
| 7816 | 7816 | |
| 7817 | 7817 | $sth = $this->db->prepare($query); |
| 7818 | 7818 | $sth->execute($query_data); |
@@ -7832,11 +7832,11 @@ discard block |
||
| 7832 | 7832 | } |
| 7833 | 7833 | |
| 7834 | 7834 | /** |
| 7835 | - * Counts all dates during the last month |
|
| 7836 | - * |
|
| 7837 | - * @return Array the date list |
|
| 7838 | - * |
|
| 7839 | - */ |
|
| 7835 | + * Counts all dates during the last month |
|
| 7836 | + * |
|
| 7837 | + * @return Array the date list |
|
| 7838 | + * |
|
| 7839 | + */ |
|
| 7840 | 7840 | public function countAllDatesLastMonth($filters = array()) |
| 7841 | 7841 | { |
| 7842 | 7842 | global $globalTimezone, $globalDBdriver; |
@@ -7858,7 +7858,7 @@ discard block |
||
| 7858 | 7858 | $query .= " GROUP BY date_name |
| 7859 | 7859 | ORDER BY date_name ASC"; |
| 7860 | 7860 | $query_data = array(':offset' => $offset); |
| 7861 | - } |
|
| 7861 | + } |
|
| 7862 | 7862 | |
| 7863 | 7863 | $sth = $this->db->prepare($query); |
| 7864 | 7864 | $sth->execute($query_data); |
@@ -7879,11 +7879,11 @@ discard block |
||
| 7879 | 7879 | |
| 7880 | 7880 | |
| 7881 | 7881 | /** |
| 7882 | - * Counts all dates during the last month |
|
| 7883 | - * |
|
| 7884 | - * @return Array the date list |
|
| 7885 | - * |
|
| 7886 | - */ |
|
| 7882 | + * Counts all dates during the last month |
|
| 7883 | + * |
|
| 7884 | + * @return Array the date list |
|
| 7885 | + * |
|
| 7886 | + */ |
|
| 7887 | 7887 | public function countAllDatesLastMonthByAirlines($filters = array()) |
| 7888 | 7888 | { |
| 7889 | 7889 | global $globalTimezone, $globalDBdriver; |
@@ -7906,7 +7906,7 @@ discard block |
||
| 7906 | 7906 | GROUP BY spotter_output.airline_icao, date_name |
| 7907 | 7907 | ORDER BY date_name ASC"; |
| 7908 | 7908 | $query_data = array(':offset' => $offset); |
| 7909 | - } |
|
| 7909 | + } |
|
| 7910 | 7910 | |
| 7911 | 7911 | $sth = $this->db->prepare($query); |
| 7912 | 7912 | $sth->execute($query_data); |
@@ -7928,11 +7928,11 @@ discard block |
||
| 7928 | 7928 | |
| 7929 | 7929 | |
| 7930 | 7930 | /** |
| 7931 | - * Counts all month |
|
| 7932 | - * |
|
| 7933 | - * @return Array the month list |
|
| 7934 | - * |
|
| 7935 | - */ |
|
| 7931 | + * Counts all month |
|
| 7932 | + * |
|
| 7933 | + * @return Array the month list |
|
| 7934 | + * |
|
| 7935 | + */ |
|
| 7936 | 7936 | public function countAllMonths($filters = array()) |
| 7937 | 7937 | { |
| 7938 | 7938 | global $globalTimezone, $globalDBdriver; |
@@ -7974,11 +7974,11 @@ discard block |
||
| 7974 | 7974 | } |
| 7975 | 7975 | |
| 7976 | 7976 | /** |
| 7977 | - * Counts all month |
|
| 7978 | - * |
|
| 7979 | - * @return Array the month list |
|
| 7980 | - * |
|
| 7981 | - */ |
|
| 7977 | + * Counts all month |
|
| 7978 | + * |
|
| 7979 | + * @return Array the month list |
|
| 7980 | + * |
|
| 7981 | + */ |
|
| 7982 | 7982 | public function countAllMonthsByAirlines($filters = array()) |
| 7983 | 7983 | { |
| 7984 | 7984 | global $globalTimezone, $globalDBdriver; |
@@ -8023,11 +8023,11 @@ discard block |
||
| 8023 | 8023 | } |
| 8024 | 8024 | |
| 8025 | 8025 | /** |
| 8026 | - * Counts all military month |
|
| 8027 | - * |
|
| 8028 | - * @return Array the month list |
|
| 8029 | - * |
|
| 8030 | - */ |
|
| 8026 | + * Counts all military month |
|
| 8027 | + * |
|
| 8028 | + * @return Array the month list |
|
| 8029 | + * |
|
| 8030 | + */ |
|
| 8031 | 8031 | public function countAllMilitaryMonths($filters = array()) |
| 8032 | 8032 | { |
| 8033 | 8033 | global $globalTimezone, $globalDBdriver; |
@@ -8068,11 +8068,11 @@ discard block |
||
| 8068 | 8068 | } |
| 8069 | 8069 | |
| 8070 | 8070 | /** |
| 8071 | - * Counts all month owners |
|
| 8072 | - * |
|
| 8073 | - * @return Array the month list |
|
| 8074 | - * |
|
| 8075 | - */ |
|
| 8071 | + * Counts all month owners |
|
| 8072 | + * |
|
| 8073 | + * @return Array the month list |
|
| 8074 | + * |
|
| 8075 | + */ |
|
| 8076 | 8076 | public function countAllMonthsOwners($filters = array()) |
| 8077 | 8077 | { |
| 8078 | 8078 | global $globalTimezone, $globalDBdriver; |
@@ -8114,11 +8114,11 @@ discard block |
||
| 8114 | 8114 | } |
| 8115 | 8115 | |
| 8116 | 8116 | /** |
| 8117 | - * Counts all month owners |
|
| 8118 | - * |
|
| 8119 | - * @return Array the month list |
|
| 8120 | - * |
|
| 8121 | - */ |
|
| 8117 | + * Counts all month owners |
|
| 8118 | + * |
|
| 8119 | + * @return Array the month list |
|
| 8120 | + * |
|
| 8121 | + */ |
|
| 8122 | 8122 | public function countAllMonthsOwnersByAirlines($filters = array()) |
| 8123 | 8123 | { |
| 8124 | 8124 | global $globalTimezone, $globalDBdriver; |
@@ -8161,11 +8161,11 @@ discard block |
||
| 8161 | 8161 | } |
| 8162 | 8162 | |
| 8163 | 8163 | /** |
| 8164 | - * Counts all month pilot |
|
| 8165 | - * |
|
| 8166 | - * @return Array the month list |
|
| 8167 | - * |
|
| 8168 | - */ |
|
| 8164 | + * Counts all month pilot |
|
| 8165 | + * |
|
| 8166 | + * @return Array the month list |
|
| 8167 | + * |
|
| 8168 | + */ |
|
| 8169 | 8169 | public function countAllMonthsPilots($filters = array()) |
| 8170 | 8170 | { |
| 8171 | 8171 | global $globalTimezone, $globalDBdriver; |
@@ -8207,11 +8207,11 @@ discard block |
||
| 8207 | 8207 | } |
| 8208 | 8208 | |
| 8209 | 8209 | /** |
| 8210 | - * Counts all month pilot |
|
| 8211 | - * |
|
| 8212 | - * @return Array the month list |
|
| 8213 | - * |
|
| 8214 | - */ |
|
| 8210 | + * Counts all month pilot |
|
| 8211 | + * |
|
| 8212 | + * @return Array the month list |
|
| 8213 | + * |
|
| 8214 | + */ |
|
| 8215 | 8215 | public function countAllMonthsPilotsByAirlines($filters = array()) |
| 8216 | 8216 | { |
| 8217 | 8217 | global $globalTimezone, $globalDBdriver; |
@@ -8254,11 +8254,11 @@ discard block |
||
| 8254 | 8254 | } |
| 8255 | 8255 | |
| 8256 | 8256 | /** |
| 8257 | - * Counts all month airline |
|
| 8258 | - * |
|
| 8259 | - * @return Array the month list |
|
| 8260 | - * |
|
| 8261 | - */ |
|
| 8257 | + * Counts all month airline |
|
| 8258 | + * |
|
| 8259 | + * @return Array the month list |
|
| 8260 | + * |
|
| 8261 | + */ |
|
| 8262 | 8262 | public function countAllMonthsAirlines($filters = array()) |
| 8263 | 8263 | { |
| 8264 | 8264 | global $globalTimezone, $globalDBdriver; |
@@ -8300,11 +8300,11 @@ discard block |
||
| 8300 | 8300 | } |
| 8301 | 8301 | |
| 8302 | 8302 | /** |
| 8303 | - * Counts all month aircraft |
|
| 8304 | - * |
|
| 8305 | - * @return Array the month list |
|
| 8306 | - * |
|
| 8307 | - */ |
|
| 8303 | + * Counts all month aircraft |
|
| 8304 | + * |
|
| 8305 | + * @return Array the month list |
|
| 8306 | + * |
|
| 8307 | + */ |
|
| 8308 | 8308 | public function countAllMonthsAircrafts($filters = array()) |
| 8309 | 8309 | { |
| 8310 | 8310 | global $globalTimezone, $globalDBdriver; |
@@ -8347,11 +8347,11 @@ discard block |
||
| 8347 | 8347 | |
| 8348 | 8348 | |
| 8349 | 8349 | /** |
| 8350 | - * Counts all month aircraft |
|
| 8351 | - * |
|
| 8352 | - * @return Array the month list |
|
| 8353 | - * |
|
| 8354 | - */ |
|
| 8350 | + * Counts all month aircraft |
|
| 8351 | + * |
|
| 8352 | + * @return Array the month list |
|
| 8353 | + * |
|
| 8354 | + */ |
|
| 8355 | 8355 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
| 8356 | 8356 | { |
| 8357 | 8357 | global $globalTimezone, $globalDBdriver; |
@@ -8394,11 +8394,11 @@ discard block |
||
| 8394 | 8394 | } |
| 8395 | 8395 | |
| 8396 | 8396 | /** |
| 8397 | - * Counts all month real arrival |
|
| 8398 | - * |
|
| 8399 | - * @return Array the month list |
|
| 8400 | - * |
|
| 8401 | - */ |
|
| 8397 | + * Counts all month real arrival |
|
| 8398 | + * |
|
| 8399 | + * @return Array the month list |
|
| 8400 | + * |
|
| 8401 | + */ |
|
| 8402 | 8402 | public function countAllMonthsRealArrivals($filters = array()) |
| 8403 | 8403 | { |
| 8404 | 8404 | global $globalTimezone, $globalDBdriver; |
@@ -8441,11 +8441,11 @@ discard block |
||
| 8441 | 8441 | |
| 8442 | 8442 | |
| 8443 | 8443 | /** |
| 8444 | - * Counts all month real arrival |
|
| 8445 | - * |
|
| 8446 | - * @return Array the month list |
|
| 8447 | - * |
|
| 8448 | - */ |
|
| 8444 | + * Counts all month real arrival |
|
| 8445 | + * |
|
| 8446 | + * @return Array the month list |
|
| 8447 | + * |
|
| 8448 | + */ |
|
| 8449 | 8449 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
| 8450 | 8450 | { |
| 8451 | 8451 | global $globalTimezone, $globalDBdriver; |
@@ -8489,11 +8489,11 @@ discard block |
||
| 8489 | 8489 | |
| 8490 | 8490 | |
| 8491 | 8491 | /** |
| 8492 | - * Counts all dates during the last year |
|
| 8493 | - * |
|
| 8494 | - * @return Array the date list |
|
| 8495 | - * |
|
| 8496 | - */ |
|
| 8492 | + * Counts all dates during the last year |
|
| 8493 | + * |
|
| 8494 | + * @return Array the date list |
|
| 8495 | + * |
|
| 8496 | + */ |
|
| 8497 | 8497 | public function countAllMonthsLastYear($filters) |
| 8498 | 8498 | { |
| 8499 | 8499 | global $globalTimezone, $globalDBdriver; |
@@ -8515,7 +8515,7 @@ discard block |
||
| 8515 | 8515 | $query .= " GROUP BY year_name, month_name |
| 8516 | 8516 | ORDER BY year_name, month_name ASC"; |
| 8517 | 8517 | $query_data = array(':offset' => $offset); |
| 8518 | - } |
|
| 8518 | + } |
|
| 8519 | 8519 | |
| 8520 | 8520 | $sth = $this->db->prepare($query); |
| 8521 | 8521 | $sth->execute($query_data); |
@@ -8538,11 +8538,11 @@ discard block |
||
| 8538 | 8538 | |
| 8539 | 8539 | |
| 8540 | 8540 | /** |
| 8541 | - * Counts all hours |
|
| 8542 | - * |
|
| 8543 | - * @return Array the hour list |
|
| 8544 | - * |
|
| 8545 | - */ |
|
| 8541 | + * Counts all hours |
|
| 8542 | + * |
|
| 8543 | + * @return Array the hour list |
|
| 8544 | + * |
|
| 8545 | + */ |
|
| 8546 | 8546 | public function countAllHours($orderby,$filters = array()) |
| 8547 | 8547 | { |
| 8548 | 8548 | global $globalTimezone, $globalDBdriver; |
@@ -8603,11 +8603,11 @@ discard block |
||
| 8603 | 8603 | } |
| 8604 | 8604 | |
| 8605 | 8605 | /** |
| 8606 | - * Counts all hours |
|
| 8607 | - * |
|
| 8608 | - * @return Array the hour list |
|
| 8609 | - * |
|
| 8610 | - */ |
|
| 8606 | + * Counts all hours |
|
| 8607 | + * |
|
| 8608 | + * @return Array the hour list |
|
| 8609 | + * |
|
| 8610 | + */ |
|
| 8611 | 8611 | public function countAllHoursByAirlines($orderby, $filters = array()) |
| 8612 | 8612 | { |
| 8613 | 8613 | global $globalTimezone, $globalDBdriver; |
@@ -8670,11 +8670,11 @@ discard block |
||
| 8670 | 8670 | |
| 8671 | 8671 | |
| 8672 | 8672 | /** |
| 8673 | - * Counts all hours by airline |
|
| 8674 | - * |
|
| 8675 | - * @return Array the hour list |
|
| 8676 | - * |
|
| 8677 | - */ |
|
| 8673 | + * Counts all hours by airline |
|
| 8674 | + * |
|
| 8675 | + * @return Array the hour list |
|
| 8676 | + * |
|
| 8677 | + */ |
|
| 8678 | 8678 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
| 8679 | 8679 | { |
| 8680 | 8680 | global $globalTimezone, $globalDBdriver; |
@@ -8720,11 +8720,11 @@ discard block |
||
| 8720 | 8720 | |
| 8721 | 8721 | |
| 8722 | 8722 | /** |
| 8723 | - * Counts all hours by aircraft |
|
| 8724 | - * |
|
| 8725 | - * @return Array the hour list |
|
| 8726 | - * |
|
| 8727 | - */ |
|
| 8723 | + * Counts all hours by aircraft |
|
| 8724 | + * |
|
| 8725 | + * @return Array the hour list |
|
| 8726 | + * |
|
| 8727 | + */ |
|
| 8728 | 8728 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
| 8729 | 8729 | { |
| 8730 | 8730 | global $globalTimezone, $globalDBdriver; |
@@ -8767,11 +8767,11 @@ discard block |
||
| 8767 | 8767 | |
| 8768 | 8768 | |
| 8769 | 8769 | /** |
| 8770 | - * Counts all hours by aircraft registration |
|
| 8771 | - * |
|
| 8772 | - * @return Array the hour list |
|
| 8773 | - * |
|
| 8774 | - */ |
|
| 8770 | + * Counts all hours by aircraft registration |
|
| 8771 | + * |
|
| 8772 | + * @return Array the hour list |
|
| 8773 | + * |
|
| 8774 | + */ |
|
| 8775 | 8775 | public function countAllHoursByRegistration($registration, $filters = array()) |
| 8776 | 8776 | { |
| 8777 | 8777 | global $globalTimezone, $globalDBdriver; |
@@ -8814,11 +8814,11 @@ discard block |
||
| 8814 | 8814 | |
| 8815 | 8815 | |
| 8816 | 8816 | /** |
| 8817 | - * Counts all hours by airport |
|
| 8818 | - * |
|
| 8819 | - * @return Array the hour list |
|
| 8820 | - * |
|
| 8821 | - */ |
|
| 8817 | + * Counts all hours by airport |
|
| 8818 | + * |
|
| 8819 | + * @return Array the hour list |
|
| 8820 | + * |
|
| 8821 | + */ |
|
| 8822 | 8822 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
| 8823 | 8823 | { |
| 8824 | 8824 | global $globalTimezone, $globalDBdriver; |
@@ -8862,11 +8862,11 @@ discard block |
||
| 8862 | 8862 | |
| 8863 | 8863 | |
| 8864 | 8864 | /** |
| 8865 | - * Counts all hours by manufacturer |
|
| 8866 | - * |
|
| 8867 | - * @return Array the hour list |
|
| 8868 | - * |
|
| 8869 | - */ |
|
| 8865 | + * Counts all hours by manufacturer |
|
| 8866 | + * |
|
| 8867 | + * @return Array the hour list |
|
| 8868 | + * |
|
| 8869 | + */ |
|
| 8870 | 8870 | public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
| 8871 | 8871 | { |
| 8872 | 8872 | global $globalTimezone, $globalDBdriver; |
@@ -8910,11 +8910,11 @@ discard block |
||
| 8910 | 8910 | |
| 8911 | 8911 | |
| 8912 | 8912 | /** |
| 8913 | - * Counts all hours by date |
|
| 8914 | - * |
|
| 8915 | - * @return Array the hour list |
|
| 8916 | - * |
|
| 8917 | - */ |
|
| 8913 | + * Counts all hours by date |
|
| 8914 | + * |
|
| 8915 | + * @return Array the hour list |
|
| 8916 | + * |
|
| 8917 | + */ |
|
| 8918 | 8918 | public function countAllHoursByDate($date, $filters = array()) |
| 8919 | 8919 | { |
| 8920 | 8920 | global $globalTimezone, $globalDBdriver; |
@@ -8958,11 +8958,11 @@ discard block |
||
| 8958 | 8958 | |
| 8959 | 8959 | |
| 8960 | 8960 | /** |
| 8961 | - * Counts all hours by a ident/callsign |
|
| 8962 | - * |
|
| 8963 | - * @return Array the hour list |
|
| 8964 | - * |
|
| 8965 | - */ |
|
| 8961 | + * Counts all hours by a ident/callsign |
|
| 8962 | + * |
|
| 8963 | + * @return Array the hour list |
|
| 8964 | + * |
|
| 8965 | + */ |
|
| 8966 | 8966 | public function countAllHoursByIdent($ident, $filters = array()) |
| 8967 | 8967 | { |
| 8968 | 8968 | global $globalTimezone, $globalDBdriver; |
@@ -9007,11 +9007,11 @@ discard block |
||
| 9007 | 9007 | |
| 9008 | 9008 | |
| 9009 | 9009 | /** |
| 9010 | - * Counts all hours by route |
|
| 9011 | - * |
|
| 9012 | - * @return Array the hour list |
|
| 9013 | - * |
|
| 9014 | - */ |
|
| 9010 | + * Counts all hours by route |
|
| 9011 | + * |
|
| 9012 | + * @return Array the hour list |
|
| 9013 | + * |
|
| 9014 | + */ |
|
| 9015 | 9015 | public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
| 9016 | 9016 | { |
| 9017 | 9017 | global $globalTimezone, $globalDBdriver; |
@@ -9055,11 +9055,11 @@ discard block |
||
| 9055 | 9055 | |
| 9056 | 9056 | |
| 9057 | 9057 | /** |
| 9058 | - * Counts all hours by country |
|
| 9059 | - * |
|
| 9060 | - * @return Array the hour list |
|
| 9061 | - * |
|
| 9062 | - */ |
|
| 9058 | + * Counts all hours by country |
|
| 9059 | + * |
|
| 9060 | + * @return Array the hour list |
|
| 9061 | + * |
|
| 9062 | + */ |
|
| 9063 | 9063 | public function countAllHoursByCountry($country, $filters = array()) |
| 9064 | 9064 | { |
| 9065 | 9065 | global $globalTimezone, $globalDBdriver; |
@@ -9104,11 +9104,11 @@ discard block |
||
| 9104 | 9104 | |
| 9105 | 9105 | |
| 9106 | 9106 | /** |
| 9107 | - * Counts all aircraft that have flown over |
|
| 9108 | - * |
|
| 9109 | - * @return Integer the number of aircrafts |
|
| 9110 | - * |
|
| 9111 | - */ |
|
| 9107 | + * Counts all aircraft that have flown over |
|
| 9108 | + * |
|
| 9109 | + * @return Integer the number of aircrafts |
|
| 9110 | + * |
|
| 9111 | + */ |
|
| 9112 | 9112 | public function countOverallAircrafts($filters = array()) |
| 9113 | 9113 | { |
| 9114 | 9114 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9120,11 +9120,11 @@ discard block |
||
| 9120 | 9120 | } |
| 9121 | 9121 | |
| 9122 | 9122 | /** |
| 9123 | - * Counts all flight that really arrival |
|
| 9124 | - * |
|
| 9125 | - * @return Integer the number of aircrafts |
|
| 9126 | - * |
|
| 9127 | - */ |
|
| 9123 | + * Counts all flight that really arrival |
|
| 9124 | + * |
|
| 9125 | + * @return Integer the number of aircrafts |
|
| 9126 | + * |
|
| 9127 | + */ |
|
| 9128 | 9128 | public function countOverallArrival($filters = array()) |
| 9129 | 9129 | { |
| 9130 | 9130 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9137,11 +9137,11 @@ discard block |
||
| 9137 | 9137 | } |
| 9138 | 9138 | |
| 9139 | 9139 | /** |
| 9140 | - * Counts all pilots that have flown over |
|
| 9141 | - * |
|
| 9142 | - * @return Integer the number of pilots |
|
| 9143 | - * |
|
| 9144 | - */ |
|
| 9140 | + * Counts all pilots that have flown over |
|
| 9141 | + * |
|
| 9142 | + * @return Integer the number of pilots |
|
| 9143 | + * |
|
| 9144 | + */ |
|
| 9145 | 9145 | public function countOverallPilots($filters = array()) |
| 9146 | 9146 | { |
| 9147 | 9147 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9153,11 +9153,11 @@ discard block |
||
| 9153 | 9153 | } |
| 9154 | 9154 | |
| 9155 | 9155 | /** |
| 9156 | - * Counts all owners that have flown over |
|
| 9157 | - * |
|
| 9158 | - * @return Integer the number of owners |
|
| 9159 | - * |
|
| 9160 | - */ |
|
| 9156 | + * Counts all owners that have flown over |
|
| 9157 | + * |
|
| 9158 | + * @return Integer the number of owners |
|
| 9159 | + * |
|
| 9160 | + */ |
|
| 9161 | 9161 | public function countOverallOwners($filters = array()) |
| 9162 | 9162 | { |
| 9163 | 9163 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9170,11 +9170,11 @@ discard block |
||
| 9170 | 9170 | |
| 9171 | 9171 | |
| 9172 | 9172 | /** |
| 9173 | - * Counts all flights that have flown over |
|
| 9174 | - * |
|
| 9175 | - * @return Integer the number of flights |
|
| 9176 | - * |
|
| 9177 | - */ |
|
| 9173 | + * Counts all flights that have flown over |
|
| 9174 | + * |
|
| 9175 | + * @return Integer the number of flights |
|
| 9176 | + * |
|
| 9177 | + */ |
|
| 9178 | 9178 | public function countOverallFlights($filters = array()) |
| 9179 | 9179 | { |
| 9180 | 9180 | $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
@@ -9187,11 +9187,11 @@ discard block |
||
| 9187 | 9187 | } |
| 9188 | 9188 | |
| 9189 | 9189 | /** |
| 9190 | - * Counts all military flights that have flown over |
|
| 9191 | - * |
|
| 9192 | - * @return Integer the number of flights |
|
| 9193 | - * |
|
| 9194 | - */ |
|
| 9190 | + * Counts all military flights that have flown over |
|
| 9191 | + * |
|
| 9192 | + * @return Integer the number of flights |
|
| 9193 | + * |
|
| 9194 | + */ |
|
| 9195 | 9195 | public function countOverallMilitaryFlights($filters = array()) |
| 9196 | 9196 | { |
| 9197 | 9197 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9206,11 +9206,11 @@ discard block |
||
| 9206 | 9206 | |
| 9207 | 9207 | |
| 9208 | 9208 | /** |
| 9209 | - * Counts all airlines that have flown over |
|
| 9210 | - * |
|
| 9211 | - * @return Integer the number of airlines |
|
| 9212 | - * |
|
| 9213 | - */ |
|
| 9209 | + * Counts all airlines that have flown over |
|
| 9210 | + * |
|
| 9211 | + * @return Integer the number of airlines |
|
| 9212 | + * |
|
| 9213 | + */ |
|
| 9214 | 9214 | public function countOverallAirlines($filters = array()) |
| 9215 | 9215 | { |
| 9216 | 9216 | $query = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count |
@@ -9224,11 +9224,11 @@ discard block |
||
| 9224 | 9224 | |
| 9225 | 9225 | |
| 9226 | 9226 | /** |
| 9227 | - * Counts all hours of today |
|
| 9228 | - * |
|
| 9229 | - * @return Array the hour list |
|
| 9230 | - * |
|
| 9231 | - */ |
|
| 9227 | + * Counts all hours of today |
|
| 9228 | + * |
|
| 9229 | + * @return Array the hour list |
|
| 9230 | + * |
|
| 9231 | + */ |
|
| 9232 | 9232 | public function countAllHoursFromToday($filters = array()) |
| 9233 | 9233 | { |
| 9234 | 9234 | global $globalTimezone, $globalDBdriver; |
@@ -9268,11 +9268,11 @@ discard block |
||
| 9268 | 9268 | } |
| 9269 | 9269 | |
| 9270 | 9270 | /** |
| 9271 | - * Gets all the spotter information based on calculated upcoming flights |
|
| 9272 | - * |
|
| 9273 | - * @return Array the spotter information |
|
| 9274 | - * |
|
| 9275 | - */ |
|
| 9271 | + * Gets all the spotter information based on calculated upcoming flights |
|
| 9272 | + * |
|
| 9273 | + * @return Array the spotter information |
|
| 9274 | + * |
|
| 9275 | + */ |
|
| 9276 | 9276 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
| 9277 | 9277 | { |
| 9278 | 9278 | global $global_query, $globalDBdriver, $globalTimezone; |
@@ -9347,12 +9347,12 @@ discard block |
||
| 9347 | 9347 | } |
| 9348 | 9348 | |
| 9349 | 9349 | |
| 9350 | - /** |
|
| 9351 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 9352 | - * |
|
| 9353 | - * @return Integer the Barrie Spotter ID |
|
| 9350 | + /** |
|
| 9351 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 9352 | + * |
|
| 9353 | + * @return Integer the Barrie Spotter ID |
|
| 9354 | 9354 | q * |
| 9355 | - */ |
|
| 9355 | + */ |
|
| 9356 | 9356 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
| 9357 | 9357 | { |
| 9358 | 9358 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -9373,13 +9373,13 @@ discard block |
||
| 9373 | 9373 | |
| 9374 | 9374 | |
| 9375 | 9375 | /** |
| 9376 | - * Parses a date string |
|
| 9377 | - * |
|
| 9378 | - * @param String $dateString the date string |
|
| 9379 | - * @param String $timezone the timezone of a user |
|
| 9380 | - * @return Array the time information |
|
| 9381 | - * |
|
| 9382 | - */ |
|
| 9376 | + * Parses a date string |
|
| 9377 | + * |
|
| 9378 | + * @param String $dateString the date string |
|
| 9379 | + * @param String $timezone the timezone of a user |
|
| 9380 | + * @return Array the time information |
|
| 9381 | + * |
|
| 9382 | + */ |
|
| 9383 | 9383 | public function parseDateString($dateString, $timezone = '') |
| 9384 | 9384 | { |
| 9385 | 9385 | $time_array = array(); |
@@ -9415,12 +9415,12 @@ discard block |
||
| 9415 | 9415 | |
| 9416 | 9416 | |
| 9417 | 9417 | /** |
| 9418 | - * Parses the direction degrees to working |
|
| 9419 | - * |
|
| 9420 | - * @param Float $direction the direction in degrees |
|
| 9421 | - * @return Array the direction information |
|
| 9422 | - * |
|
| 9423 | - */ |
|
| 9418 | + * Parses the direction degrees to working |
|
| 9419 | + * |
|
| 9420 | + * @param Float $direction the direction in degrees |
|
| 9421 | + * @return Array the direction information |
|
| 9422 | + * |
|
| 9423 | + */ |
|
| 9424 | 9424 | public function parseDirection($direction = 0) |
| 9425 | 9425 | { |
| 9426 | 9426 | if ($direction == '') $direction = 0; |
@@ -9499,12 +9499,12 @@ discard block |
||
| 9499 | 9499 | |
| 9500 | 9500 | |
| 9501 | 9501 | /** |
| 9502 | - * Gets the aircraft registration |
|
| 9503 | - * |
|
| 9504 | - * @param String $flightaware_id the flight aware id |
|
| 9505 | - * @return String the aircraft registration |
|
| 9506 | - * |
|
| 9507 | - */ |
|
| 9502 | + * Gets the aircraft registration |
|
| 9503 | + * |
|
| 9504 | + * @param String $flightaware_id the flight aware id |
|
| 9505 | + * @return String the aircraft registration |
|
| 9506 | + * |
|
| 9507 | + */ |
|
| 9508 | 9508 | |
| 9509 | 9509 | public function getAircraftRegistration($flightaware_id) |
| 9510 | 9510 | { |
@@ -9533,12 +9533,12 @@ discard block |
||
| 9533 | 9533 | |
| 9534 | 9534 | |
| 9535 | 9535 | /** |
| 9536 | - * Gets the aircraft registration from ModeS |
|
| 9537 | - * |
|
| 9538 | - * @param String $aircraft_modes the flight ModeS in hex |
|
| 9539 | - * @return String the aircraft registration |
|
| 9540 | - * |
|
| 9541 | - */ |
|
| 9536 | + * Gets the aircraft registration from ModeS |
|
| 9537 | + * |
|
| 9538 | + * @param String $aircraft_modes the flight ModeS in hex |
|
| 9539 | + * @return String the aircraft registration |
|
| 9540 | + * |
|
| 9541 | + */ |
|
| 9542 | 9542 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
| 9543 | 9543 | { |
| 9544 | 9544 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -9551,19 +9551,19 @@ discard block |
||
| 9551 | 9551 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 9552 | 9552 | $sth->closeCursor(); |
| 9553 | 9553 | if (count($row) > 0) { |
| 9554 | - //return $row['Registration']; |
|
| 9555 | - return $row['registration']; |
|
| 9554 | + //return $row['Registration']; |
|
| 9555 | + return $row['registration']; |
|
| 9556 | 9556 | } else return ''; |
| 9557 | 9557 | |
| 9558 | 9558 | } |
| 9559 | 9559 | |
| 9560 | 9560 | /** |
| 9561 | - * Gets the aircraft type from ModeS |
|
| 9562 | - * |
|
| 9563 | - * @param String $aircraft_modes the flight ModeS in hex |
|
| 9564 | - * @return String the aircraft type |
|
| 9565 | - * |
|
| 9566 | - */ |
|
| 9561 | + * Gets the aircraft type from ModeS |
|
| 9562 | + * |
|
| 9563 | + * @param String $aircraft_modes the flight ModeS in hex |
|
| 9564 | + * @return String the aircraft type |
|
| 9565 | + * |
|
| 9566 | + */ |
|
| 9567 | 9567 | public function getAircraftTypeBymodeS($aircraft_modes) |
| 9568 | 9568 | { |
| 9569 | 9569 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -9576,19 +9576,19 @@ discard block |
||
| 9576 | 9576 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 9577 | 9577 | $sth->closeCursor(); |
| 9578 | 9578 | if (count($row) > 0) { |
| 9579 | - if ($row['type_flight'] == null) return ''; |
|
| 9580 | - else return $row['type_flight']; |
|
| 9579 | + if ($row['type_flight'] == null) return ''; |
|
| 9580 | + else return $row['type_flight']; |
|
| 9581 | 9581 | } else return ''; |
| 9582 | 9582 | |
| 9583 | 9583 | } |
| 9584 | 9584 | |
| 9585 | 9585 | /** |
| 9586 | - * Gets Countrie from latitude/longitude |
|
| 9587 | - * |
|
| 9588 | - * @param Float $latitude latitute of the flight |
|
| 9589 | - * @param Float $longitude longitute of the flight |
|
| 9590 | - * @return String the countrie |
|
| 9591 | - */ |
|
| 9586 | + * Gets Countrie from latitude/longitude |
|
| 9587 | + * |
|
| 9588 | + * @param Float $latitude latitute of the flight |
|
| 9589 | + * @param Float $longitude longitute of the flight |
|
| 9590 | + * @return String the countrie |
|
| 9591 | + */ |
|
| 9592 | 9592 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 9593 | 9593 | { |
| 9594 | 9594 | global $globalDBdriver, $globalDebug; |
@@ -9625,12 +9625,12 @@ discard block |
||
| 9625 | 9625 | } |
| 9626 | 9626 | |
| 9627 | 9627 | /** |
| 9628 | - * converts the registration code using the country prefix |
|
| 9629 | - * |
|
| 9630 | - * @param String $registration the aircraft registration |
|
| 9631 | - * @return String the aircraft registration |
|
| 9632 | - * |
|
| 9633 | - */ |
|
| 9628 | + * converts the registration code using the country prefix |
|
| 9629 | + * |
|
| 9630 | + * @param String $registration the aircraft registration |
|
| 9631 | + * @return String the aircraft registration |
|
| 9632 | + * |
|
| 9633 | + */ |
|
| 9634 | 9634 | public function convertAircraftRegistration($registration) |
| 9635 | 9635 | { |
| 9636 | 9636 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -9682,12 +9682,12 @@ discard block |
||
| 9682 | 9682 | } |
| 9683 | 9683 | |
| 9684 | 9684 | /** |
| 9685 | - * Country from the registration code |
|
| 9686 | - * |
|
| 9687 | - * @param String $registration the aircraft registration |
|
| 9688 | - * @return String the country |
|
| 9689 | - * |
|
| 9690 | - */ |
|
| 9685 | + * Country from the registration code |
|
| 9686 | + * |
|
| 9687 | + * @param String $registration the aircraft registration |
|
| 9688 | + * @return String the country |
|
| 9689 | + * |
|
| 9690 | + */ |
|
| 9691 | 9691 | public function countryFromAircraftRegistration($registration) |
| 9692 | 9692 | { |
| 9693 | 9693 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -9706,8 +9706,8 @@ discard block |
||
| 9706 | 9706 | $country = $row['country']; |
| 9707 | 9707 | } |
| 9708 | 9708 | } else { |
| 9709 | - $registration_1 = substr($registration, 0, 1); |
|
| 9710 | - $registration_2 = substr($registration, 0, 2); |
|
| 9709 | + $registration_1 = substr($registration, 0, 1); |
|
| 9710 | + $registration_2 = substr($registration, 0, 2); |
|
| 9711 | 9711 | |
| 9712 | 9712 | $country = ''; |
| 9713 | 9713 | //first get the prefix based on two characters |
@@ -9743,11 +9743,11 @@ discard block |
||
| 9743 | 9743 | } |
| 9744 | 9744 | |
| 9745 | 9745 | /** |
| 9746 | - * Set a new highlight value for a flight |
|
| 9747 | - * |
|
| 9748 | - * @param String $flightaware_id flightaware_id from spotter_output table |
|
| 9749 | - * @param String $highlight New highlight value |
|
| 9750 | - */ |
|
| 9746 | + * Set a new highlight value for a flight |
|
| 9747 | + * |
|
| 9748 | + * @param String $flightaware_id flightaware_id from spotter_output table |
|
| 9749 | + * @param String $highlight New highlight value |
|
| 9750 | + */ |
|
| 9751 | 9751 | public function setHighlightFlight($flightaware_id,$highlight) { |
| 9752 | 9752 | |
| 9753 | 9753 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
@@ -9756,12 +9756,12 @@ discard block |
||
| 9756 | 9756 | } |
| 9757 | 9757 | |
| 9758 | 9758 | /** |
| 9759 | - * Gets the short url from bit.ly |
|
| 9760 | - * |
|
| 9761 | - * @param String $url the full url |
|
| 9762 | - * @return String the bit.ly url |
|
| 9763 | - * |
|
| 9764 | - */ |
|
| 9759 | + * Gets the short url from bit.ly |
|
| 9760 | + * |
|
| 9761 | + * @param String $url the full url |
|
| 9762 | + * @return String the bit.ly url |
|
| 9763 | + * |
|
| 9764 | + */ |
|
| 9765 | 9765 | public function getBitlyURL($url) |
| 9766 | 9766 | { |
| 9767 | 9767 | global $globalBitlyAccessToken; |
@@ -10050,11 +10050,11 @@ discard block |
||
| 10050 | 10050 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
| 10051 | 10051 | FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10052 | 10052 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 10053 | - } else { |
|
| 10053 | + } else { |
|
| 10054 | 10054 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
| 10055 | 10055 | FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10056 | 10056 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 10057 | - } |
|
| 10057 | + } |
|
| 10058 | 10058 | $sth = $this->db->prepare($query); |
| 10059 | 10059 | $sth->execute(); |
| 10060 | 10060 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | // When button "Remove all filters" is clicked |
| 29 | 29 | if (isset($_POST['removefilters'])) { |
| 30 | 30 | $allfilters = array_filter(array_keys($_COOKIE),function($key) { |
| 31 | - return strpos($key,'filter_') === 0; |
|
| 31 | + return strpos($key,'filter_') === 0; |
|
| 32 | 32 | }); |
| 33 | 33 | foreach ($allfilters as $filt) { |
| 34 | 34 | unset($_COOKIE[$filt]); |
@@ -167,16 +167,16 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | ?> |
| 169 | 169 | <?php |
| 170 | - if (isset($_POST['archive'])) { |
|
| 170 | + if (isset($_POST['archive'])) { |
|
| 171 | 171 | ?> |
| 172 | 172 | <?php |
| 173 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 173 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 174 | 174 | ?> |
| 175 | 175 | |
| 176 | 176 | <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script> |
| 177 | 177 | <?php |
| 178 | - } |
|
| 179 | - } else { |
|
| 178 | + } |
|
| 179 | + } else { |
|
| 180 | 180 | ?> |
| 181 | 181 | <?php |
| 182 | 182 | /* if (isset($globalBeta) && $globalBeta) { |
@@ -188,18 +188,18 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | ?> |
| 190 | 190 | <?php |
| 191 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 191 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 192 | 192 | ?> |
| 193 | 193 | <script src="<?php print $globalURL; ?>/js/leaflet-playback.js"></script> |
| 194 | 194 | <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>"></script> |
| 195 | 195 | <?php |
| 196 | - } |
|
| 196 | + } |
|
| 197 | 197 | ?> |
| 198 | 198 | <?php |
| 199 | 199 | // } |
| 200 | 200 | ?> |
| 201 | 201 | <?php |
| 202 | - } |
|
| 202 | + } |
|
| 203 | 203 | } |
| 204 | 204 | ?> |
| 205 | 205 | <?php |
@@ -359,23 +359,23 @@ discard block |
||
| 359 | 359 | <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li> |
| 360 | 360 | <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li> |
| 361 | 361 | <?php |
| 362 | - if ($globalACARS) { |
|
| 363 | - if (isset($globalDemo) && $globalDemo) { |
|
| 364 | - ?> |
|
| 362 | + if ($globalACARS) { |
|
| 363 | + if (isset($globalDemo) && $globalDemo) { |
|
| 364 | + ?> |
|
| 365 | 365 | <li><hr /></li> |
| 366 | 366 | <li><i><?php echo _('ACARS data not available publicly'); ?></i></li> |
| 367 | 367 | <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li> |
| 368 | 368 | <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li> |
| 369 | 369 | <?php |
| 370 | - } else { |
|
| 371 | - ?> |
|
| 370 | + } else { |
|
| 371 | + ?> |
|
| 372 | 372 | <li><hr /></li> |
| 373 | 373 | <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li> |
| 374 | 374 | <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li> |
| 375 | 375 | <?php |
| 376 | - } |
|
| 377 | - } |
|
| 378 | - ?> |
|
| 376 | + } |
|
| 377 | + } |
|
| 378 | + ?> |
|
| 379 | 379 | <li><hr /></li> |
| 380 | 380 | <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li> |
| 381 | 381 | <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li> |
@@ -417,14 +417,14 @@ discard block |
||
| 417 | 417 | <form> |
| 418 | 418 | <select class="selectpicker" data-width="120px" onchange="language(this);"> |
| 419 | 419 | <?php |
| 420 | - $Language = new Language(); |
|
| 421 | - $alllang = $Language->getLanguages(); |
|
| 422 | - foreach ($alllang as $key => $lang) { |
|
| 423 | - print '<option value="'.$key.'"'; |
|
| 424 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
| 425 | - print '>'.$lang[0].'</option>'; |
|
| 426 | - } |
|
| 427 | - ?> |
|
| 420 | + $Language = new Language(); |
|
| 421 | + $alllang = $Language->getLanguages(); |
|
| 422 | + foreach ($alllang as $key => $lang) { |
|
| 423 | + print '<option value="'.$key.'"'; |
|
| 424 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
| 425 | + print '>'.$lang[0].'</option>'; |
|
| 426 | + } |
|
| 427 | + ?> |
|
| 428 | 428 | </select> |
| 429 | 429 | </form> |
| 430 | 430 | </div> |
@@ -455,18 +455,18 @@ discard block |
||
| 455 | 455 | ?> |
| 456 | 456 | <div class="top-header clear" role="main"> |
| 457 | 457 | <?php |
| 458 | - if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
| 458 | + if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
| 459 | 459 | ?> |
| 460 | 460 | <div id="archive-map"></div> |
| 461 | 461 | <?php |
| 462 | - } |
|
| 462 | + } |
|
| 463 | 463 | ?> |
| 464 | 464 | </div> |
| 465 | 465 | <?php |
| 466 | 466 | } |
| 467 | 467 | if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false)) |
| 468 | 468 | { |
| 469 | - ?> |
|
| 469 | + ?> |
|
| 470 | 470 | <div class="top-header clear" role="main"> |
| 471 | 471 | <div id="map"></div> |
| 472 | 472 | <link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" /> |
@@ -477,15 +477,15 @@ discard block |
||
| 477 | 477 | var zoom = 13; |
| 478 | 478 | //create the map |
| 479 | 479 | <?php |
| 480 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
| 480 | + if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
| 481 | 481 | ?> |
| 482 | 482 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
| 483 | 483 | <?php |
| 484 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
| 484 | + } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
| 485 | 485 | ?> |
| 486 | 486 | map = L.map('map', { zoomControl:true }); |
| 487 | 487 | <?php |
| 488 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 488 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 489 | 489 | ?> |
| 490 | 490 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
| 491 | 491 | var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map); |
@@ -493,22 +493,22 @@ discard block |
||
| 493 | 493 | var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
| 494 | 494 | var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
| 495 | 495 | <?php |
| 496 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 496 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 497 | 497 | ?> |
| 498 | 498 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
| 499 | 499 | <?php |
| 500 | - } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
| 500 | + } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
| 501 | 501 | ?> |
| 502 | 502 | map = L.map('map', { zoomControl:true }); |
| 503 | 503 | <?php |
| 504 | - } |
|
| 504 | + } |
|
| 505 | 505 | ?> |
| 506 | 506 | //initialize the layer group for the aircrft markers |
| 507 | 507 | var layer_data = L.layerGroup(); |
| 508 | 508 | |
| 509 | 509 | //a few title layers |
| 510 | 510 | <?php |
| 511 | - if ($globalMapProvider == 'Mapbox') { |
|
| 511 | + if ($globalMapProvider == 'Mapbox') { |
|
| 512 | 512 | ?> |
| 513 | 513 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
| 514 | 514 | maxZoom: 18, |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | token : '<?php print $globalMapboxToken; ?>' |
| 520 | 520 | }).addTo(map); |
| 521 | 521 | <?php |
| 522 | - } elseif ($globalMapProvider == 'OpenStreetMap') { |
|
| 522 | + } elseif ($globalMapProvider == 'OpenStreetMap') { |
|
| 523 | 523 | ?> |
| 524 | 524 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
| 525 | 525 | maxZoom: 18, |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | '<a href="http://www.openstreetmap.org/copyright">Open Database Licence</a>' |
| 528 | 528 | }).addTo(map); |
| 529 | 529 | <?php |
| 530 | - } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
| 530 | + } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
| 531 | 531 | ?> |
| 532 | 532 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', { |
| 533 | 533 | maxZoom: 18, |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>' |
| 537 | 537 | }).addTo(map); |
| 538 | 538 | <?php |
| 539 | - } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
| 539 | + } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
| 540 | 540 | ?> |
| 541 | 541 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', { |
| 542 | 542 | maxZoom: 18, |
@@ -545,27 +545,27 @@ discard block |
||
| 545 | 545 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"' |
| 546 | 546 | }).addTo(map); |
| 547 | 547 | <?php |
| 548 | - } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
| 548 | + } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
| 549 | 549 | ?> |
| 550 | 550 | var googleLayer = new L.Google('ROADMAP'); |
| 551 | 551 | map.addLayer(googleLayer); |
| 552 | 552 | <?php |
| 553 | - } elseif ($globalMapProvider == 'Google-Satellite') { |
|
| 553 | + } elseif ($globalMapProvider == 'Google-Satellite') { |
|
| 554 | 554 | ?> |
| 555 | 555 | var googleLayer = new L.Google('SATELLITE'); |
| 556 | 556 | map.addLayer(googleLayer); |
| 557 | 557 | <?php |
| 558 | - } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
| 558 | + } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
| 559 | 559 | ?> |
| 560 | 560 | var googleLayer = new L.Google('HYBRID'); |
| 561 | 561 | map.addLayer(googleLayer); |
| 562 | 562 | <?php |
| 563 | - } elseif ($globalMapProvider == 'Google-Terrain') { |
|
| 563 | + } elseif ($globalMapProvider == 'Google-Terrain') { |
|
| 564 | 564 | ?> |
| 565 | 565 | var googleLayer = new L.Google('Terrain'); |
| 566 | 566 | map.addLayer(googleLayer); |
| 567 | 567 | <?php |
| 568 | - } |
|
| 568 | + } |
|
| 569 | 569 | ?> |
| 570 | 570 | </script> |
| 571 | 571 | </div> |
@@ -19,47 +19,47 @@ discard block |
||
| 19 | 19 | // Check if schema is at latest version |
| 20 | 20 | $Connection = new Connection(); |
| 21 | 21 | if ($Connection->latest() === false) { |
| 22 | - echo "You MUST update to latest schema. Run install/index.php"; |
|
| 23 | - exit(); |
|
| 22 | + echo "You MUST update to latest schema. Run install/index.php"; |
|
| 23 | + exit(); |
|
| 24 | 24 | } |
| 25 | 25 | if (PHP_SAPI != 'cli') { |
| 26 | - echo "This script MUST be called from console, not a web browser."; |
|
| 27 | - exit(); |
|
| 26 | + echo "This script MUST be called from console, not a web browser."; |
|
| 27 | + exit(); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // This is to be compatible with old version of settings.php |
| 31 | 31 | if (!isset($globalSources)) { |
| 32 | - if (isset($globalSBS1Hosts)) { |
|
| 33 | - //$hosts = $globalSBS1Hosts; |
|
| 34 | - foreach ($globalSBS1Hosts as $host) { |
|
| 35 | - $globalSources[] = array('host' => $host); |
|
| 36 | - } |
|
| 37 | - } else { |
|
| 38 | - if (!isset($globalSBS1Host)) { |
|
| 39 | - echo '$globalSources MUST be defined !'; |
|
| 40 | - die; |
|
| 32 | + if (isset($globalSBS1Hosts)) { |
|
| 33 | + //$hosts = $globalSBS1Hosts; |
|
| 34 | + foreach ($globalSBS1Hosts as $host) { |
|
| 35 | + $globalSources[] = array('host' => $host); |
|
| 36 | + } |
|
| 37 | + } else { |
|
| 38 | + if (!isset($globalSBS1Host)) { |
|
| 39 | + echo '$globalSources MUST be defined !'; |
|
| 40 | + die; |
|
| 41 | 41 | } |
| 42 | 42 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
| 43 | 43 | $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $options = getopt('s::',array('source::','server','idsource::')); |
| 48 | 48 | //if (isset($options['s'])) $hosts = array($options['s']); |
| 49 | 49 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
| 50 | 50 | if (isset($options['s'])) { |
| 51 | - $globalSources = array(); |
|
| 52 | - $globalSources[] = array('host' => $options['s']); |
|
| 51 | + $globalSources = array(); |
|
| 52 | + $globalSources[] = array('host' => $options['s']); |
|
| 53 | 53 | } elseif (isset($options['source'])) { |
| 54 | - $globalSources = array(); |
|
| 55 | - $globalSources[] = array('host' => $options['source']); |
|
| 54 | + $globalSources = array(); |
|
| 55 | + $globalSources[] = array('host' => $options['source']); |
|
| 56 | 56 | } |
| 57 | 57 | if (isset($options['server'])) $globalServer = TRUE; |
| 58 | 58 | if (isset($options['idsource'])) $id_source = $options['idsource']; |
| 59 | 59 | else $id_source = 1; |
| 60 | 60 | if (isset($globalServer) && $globalServer) { |
| 61 | - if ($globalDebug) echo "Using Server Mode\n"; |
|
| 62 | - $SI=new SpotterServer(); |
|
| 61 | + if ($globalDebug) echo "Using Server Mode\n"; |
|
| 62 | + $SI=new SpotterServer(); |
|
| 63 | 63 | } else $SI=new SpotterImport($Connection->db); |
| 64 | 64 | //$APRS=new APRS($Connection->db); |
| 65 | 65 | $SBS=new SBS(); |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | //$servertz = system('date +%Z'); |
| 70 | 70 | // signal handler - playing nice with sockets and dump1090 |
| 71 | 71 | if (function_exists('pcntl_fork')) { |
| 72 | - pcntl_signal(SIGINT, function() { |
|
| 73 | - global $sockets; |
|
| 74 | - echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
| 75 | - die("Bye!\n"); |
|
| 76 | - }); |
|
| 77 | - pcntl_signal_dispatch(); |
|
| 72 | + pcntl_signal(SIGINT, function() { |
|
| 73 | + global $sockets; |
|
| 74 | + echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
| 75 | + die("Bye!\n"); |
|
| 76 | + }); |
|
| 77 | + pcntl_signal_dispatch(); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // let's try and connect |
@@ -83,161 +83,161 @@ discard block |
||
| 83 | 83 | $aprs_full = false; |
| 84 | 84 | |
| 85 | 85 | function create_socket($host, $port, &$errno, &$errstr) { |
| 86 | - $ip = gethostbyname($host); |
|
| 87 | - $s = socket_create(AF_INET, SOCK_STREAM, 0); |
|
| 88 | - $r = @socket_connect($s, $ip, $port); |
|
| 89 | - if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
| 90 | - if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
| 91 | - return $s; |
|
| 92 | - } |
|
| 93 | - $errno = socket_last_error($s); |
|
| 94 | - $errstr = socket_strerror($errno); |
|
| 95 | - socket_close($s); |
|
| 96 | - return false; |
|
| 86 | + $ip = gethostbyname($host); |
|
| 87 | + $s = socket_create(AF_INET, SOCK_STREAM, 0); |
|
| 88 | + $r = @socket_connect($s, $ip, $port); |
|
| 89 | + if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
| 90 | + if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
| 91 | + return $s; |
|
| 92 | + } |
|
| 93 | + $errno = socket_last_error($s); |
|
| 94 | + $errstr = socket_strerror($errno); |
|
| 95 | + socket_close($s); |
|
| 96 | + return false; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | function create_socket_udp($host, $port, &$errno, &$errstr) { |
| 100 | - echo "UDP !!"; |
|
| 101 | - $ip = gethostbyname($host); |
|
| 102 | - $s = socket_create(AF_INET, SOCK_DGRAM, 0); |
|
| 103 | - $r = @socket_bind($s, $ip, $port); |
|
| 104 | - if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
| 105 | - return $s; |
|
| 106 | - } |
|
| 107 | - $errno = socket_last_error($s); |
|
| 108 | - $errstr = socket_strerror($errno); |
|
| 109 | - socket_close($s); |
|
| 110 | - return false; |
|
| 100 | + echo "UDP !!"; |
|
| 101 | + $ip = gethostbyname($host); |
|
| 102 | + $s = socket_create(AF_INET, SOCK_DGRAM, 0); |
|
| 103 | + $r = @socket_bind($s, $ip, $port); |
|
| 104 | + if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
| 105 | + return $s; |
|
| 106 | + } |
|
| 107 | + $errno = socket_last_error($s); |
|
| 108 | + $errstr = socket_strerror($errno); |
|
| 109 | + socket_close($s); |
|
| 110 | + return false; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | function connect_all($hosts) { |
| 114 | - //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
| 115 | - global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
| 116 | - if ($globalDebug) echo 'Connect to all...'."\n"; |
|
| 117 | - foreach ($hosts as $id => $value) { |
|
| 114 | + //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
| 115 | + global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
| 116 | + if ($globalDebug) echo 'Connect to all...'."\n"; |
|
| 117 | + foreach ($hosts as $id => $value) { |
|
| 118 | 118 | $host = $value['host']; |
| 119 | 119 | $globalSources[$id]['last_exec'] = 0; |
| 120 | 120 | // Here we check type of source(s) |
| 121 | 121 | if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
| 122 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
| 123 | - //$formats[$id] = 'deltadbtxt'; |
|
| 124 | - $globalSources[$id]['format'] = 'deltadbtxt'; |
|
| 125 | - //$last_exec['deltadbtxt'] = 0; |
|
| 126 | - if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
| 127 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
| 128 | - //$formats[$id] = 'vatsimtxt'; |
|
| 129 | - $globalSources[$id]['format'] = 'vatsimtxt'; |
|
| 130 | - //$last_exec['vatsimtxt'] = 0; |
|
| 131 | - if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
| 132 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
| 133 | - //$formats[$id] = 'aircraftlistjson'; |
|
| 134 | - $globalSources[$id]['format'] = 'aircraftlistjson'; |
|
| 135 | - //$last_exec['aircraftlistjson'] = 0; |
|
| 136 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 137 | - } else if (preg_match('/opensky/i',$host)) { |
|
| 138 | - //$formats[$id] = 'aircraftlistjson'; |
|
| 139 | - $globalSources[$id]['format'] = 'opensky'; |
|
| 140 | - //$last_exec['aircraftlistjson'] = 0; |
|
| 141 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 142 | - } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) { |
|
| 143 | - //$formats[$id] = 'radarvirtueljson'; |
|
| 144 | - $globalSources[$id]['format'] = 'radarvirtueljson'; |
|
| 145 | - //$last_exec['radarvirtueljson'] = 0; |
|
| 146 | - if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n"; |
|
| 147 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 148 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 149 | - exit(0); |
|
| 150 | - } |
|
| 151 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
| 152 | - //$formats[$id] = 'planeupdatefaa'; |
|
| 153 | - $globalSources[$id]['format'] = 'planeupdatefaa'; |
|
| 154 | - //$last_exec['planeupdatefaa'] = 0; |
|
| 155 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 156 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 157 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 158 | - exit(0); |
|
| 159 | - } |
|
| 160 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
| 161 | - //$formats[$id] = 'phpvmacars'; |
|
| 162 | - $globalSources[$id]['format'] = 'phpvmacars'; |
|
| 163 | - //$last_exec['phpvmacars'] = 0; |
|
| 164 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 165 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
| 166 | - //$formats[$id] = 'phpvmacars'; |
|
| 167 | - $globalSources[$id]['format'] = 'vam'; |
|
| 168 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 169 | - } else if (preg_match('/whazzup/i',$host)) { |
|
| 170 | - //$formats[$id] = 'whazzup'; |
|
| 171 | - $globalSources[$id]['format'] = 'whazzup'; |
|
| 172 | - //$last_exec['whazzup'] = 0; |
|
| 173 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 174 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
| 175 | - //$formats[$id] = 'pirepsjson'; |
|
| 176 | - $globalSources[$id]['format'] = 'pirepsjson'; |
|
| 177 | - //$last_exec['pirepsjson'] = 0; |
|
| 178 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 179 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
| 180 | - //$formats[$id] = 'fr24json'; |
|
| 181 | - $globalSources[$id]['format'] = 'fr24json'; |
|
| 182 | - //$last_exec['fr24json'] = 0; |
|
| 183 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 184 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 185 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 186 | - exit(0); |
|
| 187 | - } |
|
| 188 | - //} else if (preg_match('/10001/',$host)) { |
|
| 189 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
| 190 | - //$formats[$id] = 'tsv'; |
|
| 191 | - $globalSources[$id]['format'] = 'tsv'; |
|
| 192 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 193 | - } |
|
| 194 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 195 | - if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 196 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 197 | - $hostport = explode(':',$host); |
|
| 198 | - if (isset($hostport[1])) { |
|
| 122 | + if (preg_match('/deltadb.txt$/i',$host)) { |
|
| 123 | + //$formats[$id] = 'deltadbtxt'; |
|
| 124 | + $globalSources[$id]['format'] = 'deltadbtxt'; |
|
| 125 | + //$last_exec['deltadbtxt'] = 0; |
|
| 126 | + if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
| 127 | + } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
| 128 | + //$formats[$id] = 'vatsimtxt'; |
|
| 129 | + $globalSources[$id]['format'] = 'vatsimtxt'; |
|
| 130 | + //$last_exec['vatsimtxt'] = 0; |
|
| 131 | + if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
| 132 | + } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
| 133 | + //$formats[$id] = 'aircraftlistjson'; |
|
| 134 | + $globalSources[$id]['format'] = 'aircraftlistjson'; |
|
| 135 | + //$last_exec['aircraftlistjson'] = 0; |
|
| 136 | + if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 137 | + } else if (preg_match('/opensky/i',$host)) { |
|
| 138 | + //$formats[$id] = 'aircraftlistjson'; |
|
| 139 | + $globalSources[$id]['format'] = 'opensky'; |
|
| 140 | + //$last_exec['aircraftlistjson'] = 0; |
|
| 141 | + if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 142 | + } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) { |
|
| 143 | + //$formats[$id] = 'radarvirtueljson'; |
|
| 144 | + $globalSources[$id]['format'] = 'radarvirtueljson'; |
|
| 145 | + //$last_exec['radarvirtueljson'] = 0; |
|
| 146 | + if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n"; |
|
| 147 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 148 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 149 | + exit(0); |
|
| 150 | + } |
|
| 151 | + } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
| 152 | + //$formats[$id] = 'planeupdatefaa'; |
|
| 153 | + $globalSources[$id]['format'] = 'planeupdatefaa'; |
|
| 154 | + //$last_exec['planeupdatefaa'] = 0; |
|
| 155 | + if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 156 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 157 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 158 | + exit(0); |
|
| 159 | + } |
|
| 160 | + } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
| 161 | + //$formats[$id] = 'phpvmacars'; |
|
| 162 | + $globalSources[$id]['format'] = 'phpvmacars'; |
|
| 163 | + //$last_exec['phpvmacars'] = 0; |
|
| 164 | + if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 165 | + } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
| 166 | + //$formats[$id] = 'phpvmacars'; |
|
| 167 | + $globalSources[$id]['format'] = 'vam'; |
|
| 168 | + if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 169 | + } else if (preg_match('/whazzup/i',$host)) { |
|
| 170 | + //$formats[$id] = 'whazzup'; |
|
| 171 | + $globalSources[$id]['format'] = 'whazzup'; |
|
| 172 | + //$last_exec['whazzup'] = 0; |
|
| 173 | + if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 174 | + } else if (preg_match('/recentpireps/i',$host)) { |
|
| 175 | + //$formats[$id] = 'pirepsjson'; |
|
| 176 | + $globalSources[$id]['format'] = 'pirepsjson'; |
|
| 177 | + //$last_exec['pirepsjson'] = 0; |
|
| 178 | + if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 179 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
| 180 | + //$formats[$id] = 'fr24json'; |
|
| 181 | + $globalSources[$id]['format'] = 'fr24json'; |
|
| 182 | + //$last_exec['fr24json'] = 0; |
|
| 183 | + if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 184 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 185 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 186 | + exit(0); |
|
| 187 | + } |
|
| 188 | + //} else if (preg_match('/10001/',$host)) { |
|
| 189 | + } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
| 190 | + //$formats[$id] = 'tsv'; |
|
| 191 | + $globalSources[$id]['format'] = 'tsv'; |
|
| 192 | + if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 193 | + } |
|
| 194 | + } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 195 | + if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 196 | + } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 197 | + $hostport = explode(':',$host); |
|
| 198 | + if (isset($hostport[1])) { |
|
| 199 | 199 | $port = $hostport[1]; |
| 200 | 200 | $hostn = $hostport[0]; |
| 201 | - } else { |
|
| 201 | + } else { |
|
| 202 | 202 | $port = $globalSources[$id]['port']; |
| 203 | 203 | $hostn = $globalSources[$id]['host']; |
| 204 | - } |
|
| 205 | - if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
|
| 206 | - $s = create_socket($hostn,$port, $errno, $errstr); |
|
| 207 | - } else { |
|
| 208 | - $s = create_socket_udp($hostn,$port, $errno, $errstr); |
|
| 209 | - } |
|
| 210 | - if ($s) { |
|
| 211 | - $sockets[$id] = $s; |
|
| 212 | - if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
|
| 213 | - if (preg_match('/aprs/',$hostn)) { |
|
| 204 | + } |
|
| 205 | + if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
|
| 206 | + $s = create_socket($hostn,$port, $errno, $errstr); |
|
| 207 | + } else { |
|
| 208 | + $s = create_socket_udp($hostn,$port, $errno, $errstr); |
|
| 209 | + } |
|
| 210 | + if ($s) { |
|
| 211 | + $sockets[$id] = $s; |
|
| 212 | + if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
|
| 213 | + if (preg_match('/aprs/',$hostn)) { |
|
| 214 | 214 | //$formats[$id] = 'aprs'; |
| 215 | 215 | $globalSources[$id]['format'] = 'aprs'; |
| 216 | 216 | //$aprs_connect = 0; |
| 217 | 217 | //$use_aprs = true; |
| 218 | - } elseif ($port == '10001') { |
|
| 219 | - //$formats[$id] = 'tsv'; |
|
| 220 | - $globalSources[$id]['format'] = 'tsv'; |
|
| 221 | - } elseif ($port == '30002') { |
|
| 222 | - //$formats[$id] = 'raw'; |
|
| 223 | - $globalSources[$id]['format'] = 'raw'; |
|
| 224 | - } elseif ($port == '5001') { |
|
| 225 | - //$formats[$id] = 'raw'; |
|
| 226 | - $globalSources[$id]['format'] = 'flightgearmp'; |
|
| 227 | - } elseif ($port == '30005') { |
|
| 218 | + } elseif ($port == '10001') { |
|
| 219 | + //$formats[$id] = 'tsv'; |
|
| 220 | + $globalSources[$id]['format'] = 'tsv'; |
|
| 221 | + } elseif ($port == '30002') { |
|
| 222 | + //$formats[$id] = 'raw'; |
|
| 223 | + $globalSources[$id]['format'] = 'raw'; |
|
| 224 | + } elseif ($port == '5001') { |
|
| 225 | + //$formats[$id] = 'raw'; |
|
| 226 | + $globalSources[$id]['format'] = 'flightgearmp'; |
|
| 227 | + } elseif ($port == '30005') { |
|
| 228 | 228 | // Not yet supported |
| 229 | - //$formats[$id] = 'beast'; |
|
| 230 | - $globalSources[$id]['format'] = 'beast'; |
|
| 231 | - //} else $formats[$id] = 'sbs'; |
|
| 232 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
| 233 | - //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
|
| 229 | + //$formats[$id] = 'beast'; |
|
| 230 | + $globalSources[$id]['format'] = 'beast'; |
|
| 231 | + //} else $formats[$id] = 'sbs'; |
|
| 232 | + } else $globalSources[$id]['format'] = 'sbs'; |
|
| 233 | + //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
|
| 234 | 234 | } |
| 235 | 235 | if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
| 236 | - } else { |
|
| 236 | + } else { |
|
| 237 | 237 | if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
| 238 | - } |
|
| 239 | - } |
|
| 240 | - } |
|
| 238 | + } |
|
| 239 | + } |
|
| 240 | + } |
|
| 241 | 241 | } |
| 242 | 242 | if (!isset($globalMinFetch)) $globalMinFetch = 15; |
| 243 | 243 | |
@@ -264,18 +264,18 @@ discard block |
||
| 264 | 264 | die; |
| 265 | 265 | } |
| 266 | 266 | foreach ($globalSources as $key => $source) { |
| 267 | - if (!isset($source['format'])) { |
|
| 268 | - $globalSources[$key]['format'] = 'auto'; |
|
| 269 | - } |
|
| 267 | + if (!isset($source['format'])) { |
|
| 268 | + $globalSources[$key]['format'] = 'auto'; |
|
| 269 | + } |
|
| 270 | 270 | } |
| 271 | 271 | connect_all($globalSources); |
| 272 | 272 | foreach ($globalSources as $key => $source) { |
| 273 | - if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 273 | + if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 274 | 274 | $aprs_connect = 0; |
| 275 | 275 | $use_aprs = true; |
| 276 | 276 | if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
| 277 | 277 | break; |
| 278 | - } |
|
| 278 | + } |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | if ($use_aprs) { |
@@ -315,67 +315,67 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
| 317 | 317 | while ($i > 0) { |
| 318 | - if (!$globalDaemon) $i = $endtime-time(); |
|
| 319 | - // Delete old ATC |
|
| 320 | - if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
|
| 318 | + if (!$globalDaemon) $i = $endtime-time(); |
|
| 319 | + // Delete old ATC |
|
| 320 | + if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
|
| 321 | 321 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
| 322 | - $ATC->deleteOldATC(); |
|
| 323 | - } |
|
| 322 | + $ATC->deleteOldATC(); |
|
| 323 | + } |
|
| 324 | 324 | |
| 325 | - if (count($last_exec) > 0) { |
|
| 325 | + if (count($last_exec) > 0) { |
|
| 326 | 326 | $max = $globalMinFetch; |
| 327 | 327 | foreach ($last_exec as $last) { |
| 328 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 328 | + if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 329 | 329 | } |
| 330 | 330 | if ($max != $globalMinFetch) { |
| 331 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 332 | - sleep($globalMinFetch-$max+2); |
|
| 331 | + if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 332 | + sleep($globalMinFetch-$max+2); |
|
| 333 | + } |
|
| 333 | 334 | } |
| 334 | - } |
|
| 335 | 335 | |
| 336 | 336 | |
| 337 | - //foreach ($formats as $id => $value) { |
|
| 338 | - foreach ($globalSources as $id => $value) { |
|
| 337 | + //foreach ($formats as $id => $value) { |
|
| 338 | + foreach ($globalSources as $id => $value) { |
|
| 339 | 339 | if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; |
| 340 | 340 | if ($value['format'] == 'deltadbtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
| 341 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 342 | - $buffer = $Common->getData($value['host']); |
|
| 343 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 344 | - $buffer = explode('\n',$buffer); |
|
| 345 | - foreach ($buffer as $line) { |
|
| 346 | - if ($line != '' && count($line) > 7) { |
|
| 347 | - $line = explode(',', $line); |
|
| 348 | - $data = array(); |
|
| 349 | - $data['hex'] = $line[1]; // hex |
|
| 350 | - $data['ident'] = $line[2]; // ident |
|
| 351 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
| 352 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
| 353 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
| 354 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
| 355 | - if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
| 356 | - $data['verticalrate'] = ''; // vertical rate |
|
| 357 | - //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
|
| 358 | - $data['emergency'] = ''; // emergency |
|
| 359 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 360 | - $data['format_source'] = 'deltadbtxt'; |
|
| 361 | - $data['id_source'] = $id_source; |
|
| 362 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 363 | - if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
| 364 | - $SI->add($data); |
|
| 365 | - unset($data); |
|
| 366 | - } |
|
| 367 | - } |
|
| 368 | - $last_exec[$id]['last'] = time(); |
|
| 341 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 342 | + $buffer = $Common->getData($value['host']); |
|
| 343 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 344 | + $buffer = explode('\n',$buffer); |
|
| 345 | + foreach ($buffer as $line) { |
|
| 346 | + if ($line != '' && count($line) > 7) { |
|
| 347 | + $line = explode(',', $line); |
|
| 348 | + $data = array(); |
|
| 349 | + $data['hex'] = $line[1]; // hex |
|
| 350 | + $data['ident'] = $line[2]; // ident |
|
| 351 | + if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
| 352 | + if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
| 353 | + if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
| 354 | + if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
| 355 | + if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
| 356 | + $data['verticalrate'] = ''; // vertical rate |
|
| 357 | + //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
|
| 358 | + $data['emergency'] = ''; // emergency |
|
| 359 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 360 | + $data['format_source'] = 'deltadbtxt'; |
|
| 361 | + $data['id_source'] = $id_source; |
|
| 362 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 363 | + if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
| 364 | + $SI->add($data); |
|
| 365 | + unset($data); |
|
| 366 | + } |
|
| 367 | + } |
|
| 368 | + $last_exec[$id]['last'] = time(); |
|
| 369 | 369 | //} elseif (($value == 'whazzup' && (time() - $last_exec['whazzup'] > $globalMinFetch)) || ($value == 'vatsimtxt' && (time() - $last_exec['vatsimtxt'] > $globalMinFetch))) { |
| 370 | 370 | } elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $value[' last_exec'] > $globalMinFetch))) { |
| 371 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 372 | - $buffer = $Common->getData($value['host']); |
|
| 373 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 374 | - $buffer = explode('\n',$buffer); |
|
| 375 | - foreach ($buffer as $line) { |
|
| 376 | - if ($line != '') { |
|
| 377 | - $line = explode(':', $line); |
|
| 378 | - if (count($line) > 30 && $line[0] != 'callsign') { |
|
| 371 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 372 | + $buffer = $Common->getData($value['host']); |
|
| 373 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 374 | + $buffer = explode('\n',$buffer); |
|
| 375 | + foreach ($buffer as $line) { |
|
| 376 | + if ($line != '') { |
|
| 377 | + $line = explode(':', $line); |
|
| 378 | + if (count($line) > 30 && $line[0] != 'callsign') { |
|
| 379 | 379 | $data = array(); |
| 380 | 380 | $data['id'] = $line[1].'-'.$line[0]; |
| 381 | 381 | $data['pilot_id'] = $line[1]; |
@@ -387,36 +387,36 @@ discard block |
||
| 387 | 387 | if (isset($line[45])) $data['heading'] = $line[45]; // heading |
| 388 | 388 | elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
| 389 | 389 | $data['latitude'] = $line[5]; // lat |
| 390 | - $data['longitude'] = $line[6]; // long |
|
| 391 | - $data['verticalrate'] = ''; // vertical rate |
|
| 392 | - $data['squawk'] = ''; // squawk |
|
| 393 | - $data['emergency'] = ''; // emergency |
|
| 394 | - $data['waypoints'] = $line[30]; |
|
| 390 | + $data['longitude'] = $line[6]; // long |
|
| 391 | + $data['verticalrate'] = ''; // vertical rate |
|
| 392 | + $data['squawk'] = ''; // squawk |
|
| 393 | + $data['emergency'] = ''; // emergency |
|
| 394 | + $data['waypoints'] = $line[30]; |
|
| 395 | 395 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 396 | 396 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
| 397 | 397 | if (isset($line[37])) $data['last_update'] = $line[37]; |
| 398 | - $data['departure_airport_icao'] = $line[11]; |
|
| 399 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
| 400 | - $data['arrival_airport_icao'] = $line[13]; |
|
| 398 | + $data['departure_airport_icao'] = $line[11]; |
|
| 399 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
| 400 | + $data['arrival_airport_icao'] = $line[13]; |
|
| 401 | 401 | $data['frequency'] = $line[4]; |
| 402 | 402 | $data['type'] = $line[18]; |
| 403 | 403 | $data['range'] = $line[19]; |
| 404 | 404 | if (isset($line[35])) $data['info'] = $line[35]; |
| 405 | - $data['id_source'] = $id_source; |
|
| 406 | - //$data['arrival_airport_time'] = ; |
|
| 407 | - if ($line[9] != '') { |
|
| 408 | - $aircraft_data = explode('/',$line[9]); |
|
| 409 | - if (isset($aircraft_data[1])) { |
|
| 410 | - $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 411 | - } |
|
| 412 | - } |
|
| 413 | - /* |
|
| 405 | + $data['id_source'] = $id_source; |
|
| 406 | + //$data['arrival_airport_time'] = ; |
|
| 407 | + if ($line[9] != '') { |
|
| 408 | + $aircraft_data = explode('/',$line[9]); |
|
| 409 | + if (isset($aircraft_data[1])) { |
|
| 410 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 411 | + } |
|
| 412 | + } |
|
| 413 | + /* |
|
| 414 | 414 | if ($value == 'whazzup') $data['format_source'] = 'whazzup'; |
| 415 | 415 | elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
| 416 | 416 | */ |
| 417 | - $data['format_source'] = $value['format']; |
|
| 417 | + $data['format_source'] = $value['format']; |
|
| 418 | 418 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
| 419 | - if ($line[3] == 'PILOT') $SI->add($data); |
|
| 419 | + if ($line[3] == 'PILOT') $SI->add($data); |
|
| 420 | 420 | elseif ($line[3] == 'ATC') { |
| 421 | 421 | //print_r($data); |
| 422 | 422 | $data['info'] = str_replace('^§','<br />',$data['info']); |
@@ -434,240 +434,240 @@ discard block |
||
| 434 | 434 | |
| 435 | 435 | echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name']); |
| 436 | 436 | } |
| 437 | - unset($data); |
|
| 438 | - } |
|
| 439 | - } |
|
| 440 | - } |
|
| 441 | - //if ($value == 'whazzup') $last_exec['whazzup'] = time(); |
|
| 442 | - //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
|
| 443 | - $last_exec[$id]['last'] = time(); |
|
| 444 | - //} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) { |
|
| 445 | - } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 446 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
| 447 | - if ($buffer != '') { |
|
| 448 | - $all_data = json_decode($buffer,true); |
|
| 449 | - if (isset($all_data['acList'])) { |
|
| 437 | + unset($data); |
|
| 438 | + } |
|
| 439 | + } |
|
| 440 | + } |
|
| 441 | + //if ($value == 'whazzup') $last_exec['whazzup'] = time(); |
|
| 442 | + //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
|
| 443 | + $last_exec[$id]['last'] = time(); |
|
| 444 | + //} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) { |
|
| 445 | + } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 446 | + $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
| 447 | + if ($buffer != '') { |
|
| 448 | + $all_data = json_decode($buffer,true); |
|
| 449 | + if (isset($all_data['acList'])) { |
|
| 450 | 450 | foreach ($all_data['acList'] as $line) { |
| 451 | - $data = array(); |
|
| 452 | - $data['hex'] = $line['Icao']; // hex |
|
| 453 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 454 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 455 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 456 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 457 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 458 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 459 | - //$data['verticalrate'] = $line['']; // verticale rate |
|
| 460 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 461 | - $data['emergency'] = ''; // emergency |
|
| 462 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 463 | - /* |
|
| 451 | + $data = array(); |
|
| 452 | + $data['hex'] = $line['Icao']; // hex |
|
| 453 | + if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 454 | + if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 455 | + if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 456 | + if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 457 | + if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 458 | + if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 459 | + //$data['verticalrate'] = $line['']; // verticale rate |
|
| 460 | + if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 461 | + $data['emergency'] = ''; // emergency |
|
| 462 | + if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 463 | + /* |
|
| 464 | 464 | if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000); |
| 465 | 465 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 466 | 466 | */ |
| 467 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 468 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 469 | - $data['format_source'] = 'aircraftlistjson'; |
|
| 470 | - $data['id_source'] = $id_source; |
|
| 471 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 472 | - if (isset($data['datetime'])) $SI->add($data); |
|
| 473 | - unset($data); |
|
| 467 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 468 | + if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 469 | + $data['format_source'] = 'aircraftlistjson'; |
|
| 470 | + $data['id_source'] = $id_source; |
|
| 471 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 472 | + if (isset($data['datetime'])) $SI->add($data); |
|
| 473 | + unset($data); |
|
| 474 | 474 | } |
| 475 | - } else { |
|
| 475 | + } else { |
|
| 476 | 476 | foreach ($all_data as $line) { |
| 477 | - $data = array(); |
|
| 478 | - $data['hex'] = $line['hex']; // hex |
|
| 479 | - $data['ident'] = $line['flight']; // ident |
|
| 480 | - $data['altitude'] = $line['altitude']; // altitude |
|
| 481 | - $data['speed'] = $line['speed']; // speed |
|
| 482 | - $data['heading'] = $line['track']; // heading |
|
| 483 | - $data['latitude'] = $line['lat']; // lat |
|
| 484 | - $data['longitude'] = $line['lon']; // long |
|
| 485 | - $data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 486 | - $data['squawk'] = $line['squawk']; // squawk |
|
| 487 | - $data['emergency'] = ''; // emergency |
|
| 488 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 489 | - $data['format_source'] = 'aircraftlistjson'; |
|
| 490 | - $data['id_source'] = $id_source; |
|
| 491 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 492 | - $SI->add($data); |
|
| 493 | - unset($data); |
|
| 477 | + $data = array(); |
|
| 478 | + $data['hex'] = $line['hex']; // hex |
|
| 479 | + $data['ident'] = $line['flight']; // ident |
|
| 480 | + $data['altitude'] = $line['altitude']; // altitude |
|
| 481 | + $data['speed'] = $line['speed']; // speed |
|
| 482 | + $data['heading'] = $line['track']; // heading |
|
| 483 | + $data['latitude'] = $line['lat']; // lat |
|
| 484 | + $data['longitude'] = $line['lon']; // long |
|
| 485 | + $data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 486 | + $data['squawk'] = $line['squawk']; // squawk |
|
| 487 | + $data['emergency'] = ''; // emergency |
|
| 488 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 489 | + $data['format_source'] = 'aircraftlistjson'; |
|
| 490 | + $data['id_source'] = $id_source; |
|
| 491 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 492 | + $SI->add($data); |
|
| 493 | + unset($data); |
|
| 494 | + } |
|
| 495 | + } |
|
| 494 | 496 | } |
| 495 | - } |
|
| 496 | - } |
|
| 497 | - //$last_exec['aircraftlistjson'] = time(); |
|
| 498 | - $last_exec[$id]['last'] = time(); |
|
| 499 | - //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
|
| 500 | - } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 501 | - $buffer = $Common->getData($value['host']); |
|
| 502 | - $all_data = json_decode($buffer,true); |
|
| 503 | - if (isset($all_data['planes'])) { |
|
| 497 | + //$last_exec['aircraftlistjson'] = time(); |
|
| 498 | + $last_exec[$id]['last'] = time(); |
|
| 499 | + //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
|
| 500 | + } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 501 | + $buffer = $Common->getData($value['host']); |
|
| 502 | + $all_data = json_decode($buffer,true); |
|
| 503 | + if (isset($all_data['planes'])) { |
|
| 504 | 504 | foreach ($all_data['planes'] as $key => $line) { |
| 505 | - $data = array(); |
|
| 506 | - $data['hex'] = $key; // hex |
|
| 507 | - $data['ident'] = $line[3]; // ident |
|
| 508 | - $data['altitude'] = $line[6]; // altitude |
|
| 509 | - $data['speed'] = $line[8]; // speed |
|
| 510 | - $data['heading'] = $line[7]; // heading |
|
| 511 | - $data['latitude'] = $line[4]; // lat |
|
| 512 | - $data['longitude'] = $line[5]; // long |
|
| 513 | - //$data['verticalrate'] = $line[]; // verticale rate |
|
| 514 | - $data['squawk'] = $line[10]; // squawk |
|
| 515 | - $data['emergency'] = ''; // emergency |
|
| 516 | - $data['registration'] = $line[2]; |
|
| 517 | - $data['aircraft_icao'] = $line[0]; |
|
| 518 | - $deparr = explode('-',$line[1]); |
|
| 519 | - if (count($deparr) == 2) { |
|
| 505 | + $data = array(); |
|
| 506 | + $data['hex'] = $key; // hex |
|
| 507 | + $data['ident'] = $line[3]; // ident |
|
| 508 | + $data['altitude'] = $line[6]; // altitude |
|
| 509 | + $data['speed'] = $line[8]; // speed |
|
| 510 | + $data['heading'] = $line[7]; // heading |
|
| 511 | + $data['latitude'] = $line[4]; // lat |
|
| 512 | + $data['longitude'] = $line[5]; // long |
|
| 513 | + //$data['verticalrate'] = $line[]; // verticale rate |
|
| 514 | + $data['squawk'] = $line[10]; // squawk |
|
| 515 | + $data['emergency'] = ''; // emergency |
|
| 516 | + $data['registration'] = $line[2]; |
|
| 517 | + $data['aircraft_icao'] = $line[0]; |
|
| 518 | + $deparr = explode('-',$line[1]); |
|
| 519 | + if (count($deparr) == 2) { |
|
| 520 | 520 | $data['departure_airport_icao'] = $deparr[0]; |
| 521 | 521 | $data['arrival_airport_icao'] = $deparr[1]; |
| 522 | - } |
|
| 523 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
| 524 | - $data['format_source'] = 'planeupdatefaa'; |
|
| 525 | - $data['id_source'] = $id_source; |
|
| 526 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 527 | - $SI->add($data); |
|
| 528 | - unset($data); |
|
| 522 | + } |
|
| 523 | + $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
| 524 | + $data['format_source'] = 'planeupdatefaa'; |
|
| 525 | + $data['id_source'] = $id_source; |
|
| 526 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 527 | + $SI->add($data); |
|
| 528 | + unset($data); |
|
| 529 | 529 | } |
| 530 | - } |
|
| 531 | - //$last_exec['planeupdatefaa'] = time(); |
|
| 532 | - $last_exec[$id]['last'] = time(); |
|
| 533 | - } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 534 | - $buffer = $Common->getData($value['host']); |
|
| 535 | - $all_data = json_decode($buffer,true); |
|
| 536 | - if (isset($all_data['states'])) { |
|
| 530 | + } |
|
| 531 | + //$last_exec['planeupdatefaa'] = time(); |
|
| 532 | + $last_exec[$id]['last'] = time(); |
|
| 533 | + } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 534 | + $buffer = $Common->getData($value['host']); |
|
| 535 | + $all_data = json_decode($buffer,true); |
|
| 536 | + if (isset($all_data['states'])) { |
|
| 537 | 537 | foreach ($all_data['states'] as $key => $line) { |
| 538 | - $data = array(); |
|
| 539 | - $data['hex'] = $line[0]; // hex |
|
| 540 | - $data['ident'] = trim($line[1]); // ident |
|
| 541 | - $data['altitude'] = round($line[7]*3.28084); // altitude |
|
| 542 | - $data['speed'] = round($line[9]*1.94384); // speed |
|
| 543 | - $data['heading'] = round($line[10]); // heading |
|
| 544 | - $data['latitude'] = $line[5]; // lat |
|
| 545 | - $data['longitude'] = $line[6]; // long |
|
| 546 | - $data['verticalrate'] = $line[11]; // verticale rate |
|
| 547 | - //$data['squawk'] = $line[10]; // squawk |
|
| 548 | - //$data['emergency'] = ''; // emergency |
|
| 549 | - //$data['registration'] = $line[2]; |
|
| 550 | - //$data['aircraft_icao'] = $line[0]; |
|
| 551 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
| 552 | - $data['format_source'] = 'opensky'; |
|
| 553 | - $data['id_source'] = $id_source; |
|
| 554 | - $SI->add($data); |
|
| 555 | - unset($data); |
|
| 538 | + $data = array(); |
|
| 539 | + $data['hex'] = $line[0]; // hex |
|
| 540 | + $data['ident'] = trim($line[1]); // ident |
|
| 541 | + $data['altitude'] = round($line[7]*3.28084); // altitude |
|
| 542 | + $data['speed'] = round($line[9]*1.94384); // speed |
|
| 543 | + $data['heading'] = round($line[10]); // heading |
|
| 544 | + $data['latitude'] = $line[5]; // lat |
|
| 545 | + $data['longitude'] = $line[6]; // long |
|
| 546 | + $data['verticalrate'] = $line[11]; // verticale rate |
|
| 547 | + //$data['squawk'] = $line[10]; // squawk |
|
| 548 | + //$data['emergency'] = ''; // emergency |
|
| 549 | + //$data['registration'] = $line[2]; |
|
| 550 | + //$data['aircraft_icao'] = $line[0]; |
|
| 551 | + $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
| 552 | + $data['format_source'] = 'opensky'; |
|
| 553 | + $data['id_source'] = $id_source; |
|
| 554 | + $SI->add($data); |
|
| 555 | + unset($data); |
|
| 556 | 556 | } |
| 557 | - } |
|
| 558 | - //$last_exec['planeupdatefaa'] = time(); |
|
| 559 | - $last_exec[$id]['last'] = time(); |
|
| 560 | - //} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) { |
|
| 561 | - } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 562 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 563 | - $buffer = $Common->getData($value['host']); |
|
| 564 | - $all_data = json_decode($buffer,true); |
|
| 565 | - foreach ($all_data as $key => $line) { |
|
| 557 | + } |
|
| 558 | + //$last_exec['planeupdatefaa'] = time(); |
|
| 559 | + $last_exec[$id]['last'] = time(); |
|
| 560 | + //} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) { |
|
| 561 | + } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 562 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 563 | + $buffer = $Common->getData($value['host']); |
|
| 564 | + $all_data = json_decode($buffer,true); |
|
| 565 | + foreach ($all_data as $key => $line) { |
|
| 566 | 566 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
| 567 | - $data = array(); |
|
| 568 | - $data['hex'] = $line[0]; |
|
| 569 | - $data['ident'] = $line[16]; //$line[13] |
|
| 570 | - $data['altitude'] = $line[4]; // altitude |
|
| 571 | - $data['speed'] = $line[5]; // speed |
|
| 572 | - $data['heading'] = $line[3]; // heading |
|
| 573 | - $data['latitude'] = $line[1]; // lat |
|
| 574 | - $data['longitude'] = $line[2]; // long |
|
| 575 | - $data['verticalrate'] = $line[15]; // verticale rate |
|
| 576 | - $data['squawk'] = $line[6]; // squawk |
|
| 577 | - $data['aircraft_icao'] = $line[8]; |
|
| 578 | - $data['registration'] = $line[9]; |
|
| 579 | - $data['departure_airport_iata'] = $line[11]; |
|
| 580 | - $data['arrival_airport_iata'] = $line[12]; |
|
| 581 | - $data['emergency'] = ''; // emergency |
|
| 582 | - $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
|
| 583 | - $data['format_source'] = 'fr24json'; |
|
| 584 | - $data['id_source'] = $id_source; |
|
| 585 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 586 | - $SI->add($data); |
|
| 587 | - unset($data); |
|
| 567 | + $data = array(); |
|
| 568 | + $data['hex'] = $line[0]; |
|
| 569 | + $data['ident'] = $line[16]; //$line[13] |
|
| 570 | + $data['altitude'] = $line[4]; // altitude |
|
| 571 | + $data['speed'] = $line[5]; // speed |
|
| 572 | + $data['heading'] = $line[3]; // heading |
|
| 573 | + $data['latitude'] = $line[1]; // lat |
|
| 574 | + $data['longitude'] = $line[2]; // long |
|
| 575 | + $data['verticalrate'] = $line[15]; // verticale rate |
|
| 576 | + $data['squawk'] = $line[6]; // squawk |
|
| 577 | + $data['aircraft_icao'] = $line[8]; |
|
| 578 | + $data['registration'] = $line[9]; |
|
| 579 | + $data['departure_airport_iata'] = $line[11]; |
|
| 580 | + $data['arrival_airport_iata'] = $line[12]; |
|
| 581 | + $data['emergency'] = ''; // emergency |
|
| 582 | + $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
|
| 583 | + $data['format_source'] = 'fr24json'; |
|
| 584 | + $data['id_source'] = $id_source; |
|
| 585 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 586 | + $SI->add($data); |
|
| 587 | + unset($data); |
|
| 588 | 588 | } |
| 589 | - } |
|
| 590 | - //$last_exec['fr24json'] = time(); |
|
| 591 | - $last_exec[$id]['last'] = time(); |
|
| 592 | - //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
|
| 593 | - } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 594 | - //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
|
| 595 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
| 596 | - //echo $buffer; |
|
| 597 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
| 598 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
| 599 | - $all_data = json_decode($buffer,true); |
|
| 600 | - if (json_last_error() != JSON_ERROR_NONE) { |
|
| 589 | + } |
|
| 590 | + //$last_exec['fr24json'] = time(); |
|
| 591 | + $last_exec[$id]['last'] = time(); |
|
| 592 | + //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
|
| 593 | + } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 594 | + //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
|
| 595 | + $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
| 596 | + //echo $buffer; |
|
| 597 | + $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
| 598 | + $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
| 599 | + $all_data = json_decode($buffer,true); |
|
| 600 | + if (json_last_error() != JSON_ERROR_NONE) { |
|
| 601 | 601 | die(json_last_error_msg()); |
| 602 | - } |
|
| 603 | - if (isset($all_data['mrkrs'])) { |
|
| 602 | + } |
|
| 603 | + if (isset($all_data['mrkrs'])) { |
|
| 604 | 604 | foreach ($all_data['mrkrs'] as $key => $line) { |
| 605 | - if (isset($line['inf'])) { |
|
| 605 | + if (isset($line['inf'])) { |
|
| 606 | 606 | $data = array(); |
| 607 | 607 | $data['hex'] = $line['inf']['ia']; |
| 608 | 608 | if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
| 609 | - $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
|
| 610 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
| 611 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
| 612 | - $data['latitude'] = $line['pt'][0]; // lat |
|
| 613 | - $data['longitude'] = $line['pt'][1]; // long |
|
| 614 | - //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
|
| 615 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 616 | - //$data['aircraft_icao'] = $line[8]; |
|
| 617 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 609 | + $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
|
| 610 | + if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
| 611 | + if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
| 612 | + $data['latitude'] = $line['pt'][0]; // lat |
|
| 613 | + $data['longitude'] = $line['pt'][1]; // long |
|
| 614 | + //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
|
| 615 | + if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 616 | + //$data['aircraft_icao'] = $line[8]; |
|
| 617 | + if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 618 | 618 | //$data['departure_airport_iata'] = $line[11]; |
| 619 | 619 | //$data['arrival_airport_iata'] = $line[12]; |
| 620 | - //$data['emergency'] = ''; // emergency |
|
| 620 | + //$data['emergency'] = ''; // emergency |
|
| 621 | 621 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
| 622 | - $data['format_source'] = 'radarvirtueljson'; |
|
| 623 | - $data['id_source'] = $id_source; |
|
| 622 | + $data['format_source'] = 'radarvirtueljson'; |
|
| 623 | + $data['id_source'] = $id_source; |
|
| 624 | 624 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
| 625 | 625 | $SI->add($data); |
| 626 | 626 | unset($data); |
| 627 | - } |
|
| 627 | + } |
|
| 628 | 628 | } |
| 629 | - } |
|
| 630 | - //$last_exec['radarvirtueljson'] = time(); |
|
| 631 | - $last_exec[$id]['last'] = time(); |
|
| 632 | - //} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) { |
|
| 633 | - } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 634 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 635 | - $buffer = $Common->getData($value['host'].'?'.time()); |
|
| 636 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
| 629 | + } |
|
| 630 | + //$last_exec['radarvirtueljson'] = time(); |
|
| 631 | + $last_exec[$id]['last'] = time(); |
|
| 632 | + //} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) { |
|
| 633 | + } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 634 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 635 | + $buffer = $Common->getData($value['host'].'?'.time()); |
|
| 636 | + $all_data = json_decode(utf8_encode($buffer),true); |
|
| 637 | 637 | |
| 638 | - if (isset($all_data['pireps'])) { |
|
| 639 | - foreach ($all_data['pireps'] as $line) { |
|
| 640 | - $data = array(); |
|
| 641 | - $data['id'] = $line['id']; |
|
| 642 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
| 643 | - $data['ident'] = $line['callsign']; // ident |
|
| 644 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
| 645 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
| 646 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
| 647 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
| 648 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 649 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 650 | - $data['latitude'] = $line['lat']; // lat |
|
| 651 | - $data['longitude'] = $line['lon']; // long |
|
| 652 | - //$data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 653 | - //$data['squawk'] = $line['squawk']; // squawk |
|
| 654 | - //$data['emergency'] = ''; // emergency |
|
| 655 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
| 656 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
| 657 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
| 658 | - //$data['arrival_airport_time'] = $line['arrtime']; |
|
| 659 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
| 660 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
| 661 | - if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
| 662 | - else $data['info'] = ''; |
|
| 663 | - $data['format_source'] = 'pireps'; |
|
| 664 | - $data['id_source'] = $id_source; |
|
| 665 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 666 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 667 | - if ($line['icon'] == 'plane') { |
|
| 638 | + if (isset($all_data['pireps'])) { |
|
| 639 | + foreach ($all_data['pireps'] as $line) { |
|
| 640 | + $data = array(); |
|
| 641 | + $data['id'] = $line['id']; |
|
| 642 | + $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
| 643 | + $data['ident'] = $line['callsign']; // ident |
|
| 644 | + if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
| 645 | + if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
| 646 | + if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
| 647 | + if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
| 648 | + if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 649 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 650 | + $data['latitude'] = $line['lat']; // lat |
|
| 651 | + $data['longitude'] = $line['lon']; // long |
|
| 652 | + //$data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 653 | + //$data['squawk'] = $line['squawk']; // squawk |
|
| 654 | + //$data['emergency'] = ''; // emergency |
|
| 655 | + if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
| 656 | + if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
| 657 | + if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
| 658 | + //$data['arrival_airport_time'] = $line['arrtime']; |
|
| 659 | + if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
| 660 | + if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
| 661 | + if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
| 662 | + else $data['info'] = ''; |
|
| 663 | + $data['format_source'] = 'pireps'; |
|
| 664 | + $data['id_source'] = $id_source; |
|
| 665 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 666 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 667 | + if ($line['icon'] == 'plane') { |
|
| 668 | 668 | $SI->add($data); |
| 669 | - // print_r($data); |
|
| 670 | - } elseif ($line['icon'] == 'ct') { |
|
| 669 | + // print_r($data); |
|
| 670 | + } elseif ($line['icon'] == 'ct') { |
|
| 671 | 671 | $data['info'] = str_replace('^§','<br />',$data['info']); |
| 672 | 672 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 673 | 673 | $typec = substr($data['ident'],-3); |
@@ -682,160 +682,160 @@ discard block |
||
| 682 | 682 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
| 683 | 683 | else $data['type'] = 'Observer'; |
| 684 | 684 | echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name']); |
| 685 | - } |
|
| 686 | - unset($data); |
|
| 685 | + } |
|
| 686 | + unset($data); |
|
| 687 | 687 | } |
| 688 | - } |
|
| 689 | - //$last_exec['pirepsjson'] = time(); |
|
| 690 | - $last_exec[$id]['last'] = time(); |
|
| 691 | - //} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) { |
|
| 692 | - } elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 693 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 694 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 695 | - $buffer = $Common->getData($value['host']); |
|
| 696 | - $all_data = json_decode($buffer,true); |
|
| 697 | - if ($buffer != '' && is_array($all_data)) { |
|
| 688 | + } |
|
| 689 | + //$last_exec['pirepsjson'] = time(); |
|
| 690 | + $last_exec[$id]['last'] = time(); |
|
| 691 | + //} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) { |
|
| 692 | + } elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 693 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 694 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 695 | + $buffer = $Common->getData($value['host']); |
|
| 696 | + $all_data = json_decode($buffer,true); |
|
| 697 | + if ($buffer != '' && is_array($all_data)) { |
|
| 698 | 698 | foreach ($all_data as $line) { |
| 699 | - $data = array(); |
|
| 700 | - //$data['id'] = $line['id']; // id not usable |
|
| 701 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 702 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 703 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
| 704 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
| 705 | - $data['ident'] = $line['flightnum']; // ident |
|
| 706 | - $data['altitude'] = $line['alt']; // altitude |
|
| 707 | - $data['speed'] = $line['gs']; // speed |
|
| 708 | - $data['heading'] = $line['heading']; // heading |
|
| 709 | - $data['latitude'] = $line['lat']; // lat |
|
| 710 | - $data['longitude'] = $line['lng']; // long |
|
| 711 | - $data['verticalrate'] = ''; // verticale rate |
|
| 712 | - $data['squawk'] = ''; // squawk |
|
| 713 | - $data['emergency'] = ''; // emergency |
|
| 714 | - //$data['datetime'] = $line['lastupdate']; |
|
| 715 | - $data['last_update'] = $line['lastupdate']; |
|
| 716 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 717 | - $data['departure_airport_icao'] = $line['depicao']; |
|
| 718 | - $data['departure_airport_time'] = $line['deptime']; |
|
| 719 | - $data['arrival_airport_icao'] = $line['arricao']; |
|
| 720 | - $data['arrival_airport_time'] = $line['arrtime']; |
|
| 721 | - $data['registration'] = $line['aircraft']; |
|
| 722 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 723 | - if (isset($line['aircraftname'])) { |
|
| 699 | + $data = array(); |
|
| 700 | + //$data['id'] = $line['id']; // id not usable |
|
| 701 | + if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 702 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 703 | + if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
| 704 | + if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
| 705 | + $data['ident'] = $line['flightnum']; // ident |
|
| 706 | + $data['altitude'] = $line['alt']; // altitude |
|
| 707 | + $data['speed'] = $line['gs']; // speed |
|
| 708 | + $data['heading'] = $line['heading']; // heading |
|
| 709 | + $data['latitude'] = $line['lat']; // lat |
|
| 710 | + $data['longitude'] = $line['lng']; // long |
|
| 711 | + $data['verticalrate'] = ''; // verticale rate |
|
| 712 | + $data['squawk'] = ''; // squawk |
|
| 713 | + $data['emergency'] = ''; // emergency |
|
| 714 | + //$data['datetime'] = $line['lastupdate']; |
|
| 715 | + $data['last_update'] = $line['lastupdate']; |
|
| 716 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 717 | + $data['departure_airport_icao'] = $line['depicao']; |
|
| 718 | + $data['departure_airport_time'] = $line['deptime']; |
|
| 719 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
| 720 | + $data['arrival_airport_time'] = $line['arrtime']; |
|
| 721 | + $data['registration'] = $line['aircraft']; |
|
| 722 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 723 | + if (isset($line['aircraftname'])) { |
|
| 724 | 724 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
| 725 | 725 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
| 726 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
| 727 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 728 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 729 | - else { |
|
| 730 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
| 731 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 732 | - else $data['aircraft_icao'] = $line['aircraftname']; |
|
| 733 | - } |
|
| 734 | - } |
|
| 735 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 736 | - $data['id_source'] = $id_source; |
|
| 737 | - $data['format_source'] = 'phpvmacars'; |
|
| 738 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 739 | - $SI->add($data); |
|
| 740 | - unset($data); |
|
| 726 | + $aircraft_data = explode('-',$line['aircraftname']); |
|
| 727 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 728 | + elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 729 | + else { |
|
| 730 | + $aircraft_data = explode(' ',$line['aircraftname']); |
|
| 731 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 732 | + else $data['aircraft_icao'] = $line['aircraftname']; |
|
| 733 | + } |
|
| 734 | + } |
|
| 735 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 736 | + $data['id_source'] = $id_source; |
|
| 737 | + $data['format_source'] = 'phpvmacars'; |
|
| 738 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 739 | + $SI->add($data); |
|
| 740 | + unset($data); |
|
| 741 | 741 | } |
| 742 | 742 | if ($globalDebug) echo 'No more data...'."\n"; |
| 743 | 743 | unset($buffer); |
| 744 | 744 | unset($all_data); |
| 745 | - } |
|
| 746 | - //$last_exec['phpvmacars'] = time(); |
|
| 747 | - $last_exec[$id]['last'] = time(); |
|
| 748 | - } elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 749 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 750 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 751 | - $buffer = $Common->getData($value['host']); |
|
| 752 | - $all_data = json_decode($buffer,true); |
|
| 753 | - if ($buffer != '' && is_array($all_data)) { |
|
| 745 | + } |
|
| 746 | + //$last_exec['phpvmacars'] = time(); |
|
| 747 | + $last_exec[$id]['last'] = time(); |
|
| 748 | + } elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 749 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 750 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 751 | + $buffer = $Common->getData($value['host']); |
|
| 752 | + $all_data = json_decode($buffer,true); |
|
| 753 | + if ($buffer != '' && is_array($all_data)) { |
|
| 754 | 754 | foreach ($all_data as $line) { |
| 755 | - $data = array(); |
|
| 756 | - //$data['id'] = $line['id']; // id not usable |
|
| 757 | - $data['id'] = trim($line['flight_id']); |
|
| 758 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 759 | - $data['pilot_name'] = $line['pilot_name']; |
|
| 760 | - $data['pilot_id'] = $line['pilot_id']; |
|
| 761 | - $data['ident'] = trim($line['callsign']); // ident |
|
| 762 | - $data['altitude'] = $line['altitude']; // altitude |
|
| 763 | - $data['speed'] = $line['gs']; // speed |
|
| 764 | - $data['heading'] = $line['heading']; // heading |
|
| 765 | - $data['latitude'] = $line['latitude']; // lat |
|
| 766 | - $data['longitude'] = $line['longitude']; // long |
|
| 767 | - $data['verticalrate'] = ''; // verticale rate |
|
| 768 | - $data['squawk'] = ''; // squawk |
|
| 769 | - $data['emergency'] = ''; // emergency |
|
| 770 | - //$data['datetime'] = $line['lastupdate']; |
|
| 771 | - $data['last_update'] = $line['last_update']; |
|
| 772 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 773 | - $data['departure_airport_icao'] = $line['departure']; |
|
| 774 | - //$data['departure_airport_time'] = $line['departure_time']; |
|
| 775 | - $data['arrival_airport_icao'] = $line['arrival']; |
|
| 776 | - //$data['arrival_airport_time'] = $line['arrival_time']; |
|
| 777 | - //$data['registration'] = $line['aircraft']; |
|
| 778 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 779 | - $data['aircraft_icao'] = $line['plane_type']; |
|
| 780 | - $data['id_source'] = $id_source; |
|
| 781 | - $data['format_source'] = 'vam'; |
|
| 782 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 783 | - $SI->add($data); |
|
| 784 | - unset($data); |
|
| 755 | + $data = array(); |
|
| 756 | + //$data['id'] = $line['id']; // id not usable |
|
| 757 | + $data['id'] = trim($line['flight_id']); |
|
| 758 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 759 | + $data['pilot_name'] = $line['pilot_name']; |
|
| 760 | + $data['pilot_id'] = $line['pilot_id']; |
|
| 761 | + $data['ident'] = trim($line['callsign']); // ident |
|
| 762 | + $data['altitude'] = $line['altitude']; // altitude |
|
| 763 | + $data['speed'] = $line['gs']; // speed |
|
| 764 | + $data['heading'] = $line['heading']; // heading |
|
| 765 | + $data['latitude'] = $line['latitude']; // lat |
|
| 766 | + $data['longitude'] = $line['longitude']; // long |
|
| 767 | + $data['verticalrate'] = ''; // verticale rate |
|
| 768 | + $data['squawk'] = ''; // squawk |
|
| 769 | + $data['emergency'] = ''; // emergency |
|
| 770 | + //$data['datetime'] = $line['lastupdate']; |
|
| 771 | + $data['last_update'] = $line['last_update']; |
|
| 772 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 773 | + $data['departure_airport_icao'] = $line['departure']; |
|
| 774 | + //$data['departure_airport_time'] = $line['departure_time']; |
|
| 775 | + $data['arrival_airport_icao'] = $line['arrival']; |
|
| 776 | + //$data['arrival_airport_time'] = $line['arrival_time']; |
|
| 777 | + //$data['registration'] = $line['aircraft']; |
|
| 778 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 779 | + $data['aircraft_icao'] = $line['plane_type']; |
|
| 780 | + $data['id_source'] = $id_source; |
|
| 781 | + $data['format_source'] = 'vam'; |
|
| 782 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 783 | + $SI->add($data); |
|
| 784 | + unset($data); |
|
| 785 | 785 | } |
| 786 | 786 | if ($globalDebug) echo 'No more data...'."\n"; |
| 787 | 787 | unset($buffer); |
| 788 | 788 | unset($all_data); |
| 789 | - } |
|
| 790 | - //$last_exec['phpvmacars'] = time(); |
|
| 791 | - $last_exec[$id]['last'] = time(); |
|
| 789 | + } |
|
| 790 | + //$last_exec['phpvmacars'] = time(); |
|
| 791 | + $last_exec[$id]['last'] = time(); |
|
| 792 | 792 | //} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') { |
| 793 | 793 | } elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars' || $value['format'] == 'acarssbs3') { |
| 794 | - if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 795 | - //$last_exec[$id]['last'] = time(); |
|
| 794 | + if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 795 | + //$last_exec[$id]['last'] = time(); |
|
| 796 | 796 | |
| 797 | - //$read = array( $sockets[$id] ); |
|
| 798 | - $read = $sockets; |
|
| 799 | - $write = NULL; |
|
| 800 | - $e = NULL; |
|
| 801 | - $n = socket_select($read, $write, $e, $timeout); |
|
| 802 | - if ($e != NULL) var_dump($e); |
|
| 803 | - if ($n > 0) { |
|
| 797 | + //$read = array( $sockets[$id] ); |
|
| 798 | + $read = $sockets; |
|
| 799 | + $write = NULL; |
|
| 800 | + $e = NULL; |
|
| 801 | + $n = socket_select($read, $write, $e, $timeout); |
|
| 802 | + if ($e != NULL) var_dump($e); |
|
| 803 | + if ($n > 0) { |
|
| 804 | 804 | foreach ($read as $nb => $r) { |
| 805 | - //$value = $formats[$nb]; |
|
| 806 | - $format = $globalSources[$nb]['format']; |
|
| 807 | - if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
|
| 808 | - $buffer = socket_read($r, 6000,PHP_NORMAL_READ); |
|
| 809 | - } else { |
|
| 810 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
| 811 | - } |
|
| 812 | - //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
|
| 813 | - //echo $buffer."\n"; |
|
| 814 | - // lets play nice and handle signals such as ctrl-c/kill properly |
|
| 815 | - //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 816 | - $error = false; |
|
| 817 | - //$SI::del(); |
|
| 818 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 819 | - // SBS format is CSV format |
|
| 820 | - if ($buffer != '') { |
|
| 805 | + //$value = $formats[$nb]; |
|
| 806 | + $format = $globalSources[$nb]['format']; |
|
| 807 | + if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
|
| 808 | + $buffer = socket_read($r, 6000,PHP_NORMAL_READ); |
|
| 809 | + } else { |
|
| 810 | + $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
| 811 | + } |
|
| 812 | + //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
|
| 813 | + //echo $buffer."\n"; |
|
| 814 | + // lets play nice and handle signals such as ctrl-c/kill properly |
|
| 815 | + //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 816 | + $error = false; |
|
| 817 | + //$SI::del(); |
|
| 818 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 819 | + // SBS format is CSV format |
|
| 820 | + if ($buffer != '') { |
|
| 821 | 821 | $tt[$format] = 0; |
| 822 | 822 | if ($format == 'acarssbs3') { |
| 823 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 824 | - $ACARS->add(trim($buffer)); |
|
| 825 | - $ACARS->deleteLiveAcarsData(); |
|
| 823 | + if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 824 | + $ACARS->add(trim($buffer)); |
|
| 825 | + $ACARS->deleteLiveAcarsData(); |
|
| 826 | 826 | } elseif ($format == 'raw') { |
| 827 | - // AVR format |
|
| 828 | - $data = $SBS->parse($buffer); |
|
| 829 | - if (is_array($data)) { |
|
| 827 | + // AVR format |
|
| 828 | + $data = $SBS->parse($buffer); |
|
| 829 | + if (is_array($data)) { |
|
| 830 | 830 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 831 | 831 | $data['format_source'] = 'raw'; |
| 832 | 832 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
| 833 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 834 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 835 | - } |
|
| 836 | - } elseif ($format == 'flightgearsp') { |
|
| 837 | - //echo $buffer."\n"; |
|
| 838 | - if (strlen($buffer) > 5) { |
|
| 833 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 834 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 835 | + } |
|
| 836 | + } elseif ($format == 'flightgearsp') { |
|
| 837 | + //echo $buffer."\n"; |
|
| 838 | + if (strlen($buffer) > 5) { |
|
| 839 | 839 | $line = explode(',',$buffer); |
| 840 | 840 | $data = array(); |
| 841 | 841 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
@@ -851,114 +851,114 @@ discard block |
||
| 851 | 851 | $data['format_source'] = 'flightgearsp'; |
| 852 | 852 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
| 853 | 853 | $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 854 | - } |
|
| 855 | - } elseif ($format == 'acars') { |
|
| 856 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 857 | - $ACARS->add(trim($buffer)); |
|
| 858 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
| 859 | - $ACARS->deleteLiveAcarsData(); |
|
| 854 | + } |
|
| 855 | + } elseif ($format == 'acars') { |
|
| 856 | + if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 857 | + $ACARS->add(trim($buffer)); |
|
| 858 | + socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
| 859 | + $ACARS->deleteLiveAcarsData(); |
|
| 860 | 860 | } elseif ($format == 'flightgearmp') { |
| 861 | - if (substr($buffer,0,1) != '#') { |
|
| 861 | + if (substr($buffer,0,1) != '#') { |
|
| 862 | 862 | $data = array(); |
| 863 | 863 | //echo $buffer."\n"; |
| 864 | 864 | $line = explode(' ',$buffer); |
| 865 | 865 | if (count($line) == 11) { |
| 866 | - $userserver = explode('@',$line[0]); |
|
| 867 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
| 868 | - $data['ident'] = $userserver[0]; |
|
| 869 | - $data['registration'] = $userserver[0]; |
|
| 870 | - $data['latitude'] = $line[4]; |
|
| 871 | - $data['longitude'] = $line[5]; |
|
| 872 | - $data['altitude'] = $line[6]; |
|
| 873 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 874 | - $aircraft_type = $line[10]; |
|
| 875 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
| 876 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
| 877 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 866 | + $userserver = explode('@',$line[0]); |
|
| 867 | + $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
| 868 | + $data['ident'] = $userserver[0]; |
|
| 869 | + $data['registration'] = $userserver[0]; |
|
| 870 | + $data['latitude'] = $line[4]; |
|
| 871 | + $data['longitude'] = $line[5]; |
|
| 872 | + $data['altitude'] = $line[6]; |
|
| 873 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 874 | + $aircraft_type = $line[10]; |
|
| 875 | + $aircraft_type = preg_split(':/:',$aircraft_type); |
|
| 876 | + $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
| 877 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 878 | + } |
|
| 878 | 879 | } |
| 879 | - } |
|
| 880 | 880 | } elseif ($format == 'beast') { |
| 881 | - echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
|
| 882 | - die; |
|
| 881 | + echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
|
| 882 | + die; |
|
| 883 | 883 | } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
| 884 | - $line = explode("\t", $buffer); |
|
| 885 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
| 884 | + $line = explode("\t", $buffer); |
|
| 885 | + for($k = 0; $k < count($line); $k=$k+2) { |
|
| 886 | 886 | $key = $line[$k]; |
| 887 | - $lined[$key] = $line[$k+1]; |
|
| 888 | - } |
|
| 889 | - if (count($lined) > 3) { |
|
| 890 | - $data['hex'] = $lined['hexid']; |
|
| 891 | - //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
|
| 892 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
| 893 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
| 894 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
| 895 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
| 896 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
| 897 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
| 898 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
| 899 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
| 900 | - $data['id_source'] = $id_source; |
|
| 901 | - $data['format_source'] = 'tsv'; |
|
| 902 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 903 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 904 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 905 | - unset($lined); |
|
| 906 | - unset($data); |
|
| 907 | - } else $error = true; |
|
| 887 | + $lined[$key] = $line[$k+1]; |
|
| 888 | + } |
|
| 889 | + if (count($lined) > 3) { |
|
| 890 | + $data['hex'] = $lined['hexid']; |
|
| 891 | + //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
|
| 892 | + $data['datetime'] = date('Y-m-d H:i:s');; |
|
| 893 | + if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
| 894 | + if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
| 895 | + if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
| 896 | + if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
| 897 | + if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
| 898 | + if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
| 899 | + if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
| 900 | + $data['id_source'] = $id_source; |
|
| 901 | + $data['format_source'] = 'tsv'; |
|
| 902 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 903 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 904 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 905 | + unset($lined); |
|
| 906 | + unset($data); |
|
| 907 | + } else $error = true; |
|
| 908 | 908 | } elseif ($format == 'aprs' && $use_aprs) { |
| 909 | - if ($aprs_connect == 0) { |
|
| 909 | + if ($aprs_connect == 0) { |
|
| 910 | 910 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
| 911 | 911 | $aprs_connect = 1; |
| 912 | - } |
|
| 913 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
| 912 | + } |
|
| 913 | + if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
| 914 | 914 | $aprs_last_tx = time(); |
| 915 | 915 | $data_aprs = "# Keep alive"; |
| 916 | 916 | $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 917 | - } |
|
| 918 | - //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
|
| 919 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
| 920 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
| 921 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
| 917 | + } |
|
| 918 | + //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
|
| 919 | + $buffer = str_replace('APRS <- ','',$buffer); |
|
| 920 | + $buffer = str_replace('APRS -> ','',$buffer); |
|
| 921 | + if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
| 922 | 922 | $line = $APRS->parse($buffer); |
| 923 | 923 | if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
| 924 | - $data = array(); |
|
| 925 | - //print_r($line); |
|
| 926 | - $data['hex'] = $line['address']; |
|
| 927 | - $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 928 | - //$data['datetime'] = date('Y-m-d H:i:s'); |
|
| 929 | - $data['ident'] = $line['ident']; |
|
| 930 | - $data['latitude'] = $line['latitude']; |
|
| 931 | - $data['longitude'] = $line['longitude']; |
|
| 932 | - //$data['verticalrate'] = $line[16]; |
|
| 933 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 934 | - else $data['speed'] = 0; |
|
| 935 | - $data['altitude'] = $line['altitude']; |
|
| 936 | - if (isset($line['course'])) $data['heading'] = $line['course']; |
|
| 937 | - //else $data['heading'] = 0; |
|
| 938 | - $data['aircraft_type'] = $line['stealth']; |
|
| 939 | - if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true; |
|
| 940 | - $data['id_source'] = $id_source; |
|
| 941 | - $data['format_source'] = 'aprs'; |
|
| 942 | - $data['source_name'] = $line['source']; |
|
| 943 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 944 | - $currentdate = date('Y-m-d H:i:s'); |
|
| 945 | - $aprsdate = strtotime($data['datetime']); |
|
| 946 | - // Accept data if time <= system time + 20s |
|
| 947 | - if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) $send = $SI->add($data); |
|
| 948 | - else { |
|
| 924 | + $data = array(); |
|
| 925 | + //print_r($line); |
|
| 926 | + $data['hex'] = $line['address']; |
|
| 927 | + $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 928 | + //$data['datetime'] = date('Y-m-d H:i:s'); |
|
| 929 | + $data['ident'] = $line['ident']; |
|
| 930 | + $data['latitude'] = $line['latitude']; |
|
| 931 | + $data['longitude'] = $line['longitude']; |
|
| 932 | + //$data['verticalrate'] = $line[16]; |
|
| 933 | + if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 934 | + else $data['speed'] = 0; |
|
| 935 | + $data['altitude'] = $line['altitude']; |
|
| 936 | + if (isset($line['course'])) $data['heading'] = $line['course']; |
|
| 937 | + //else $data['heading'] = 0; |
|
| 938 | + $data['aircraft_type'] = $line['stealth']; |
|
| 939 | + if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true; |
|
| 940 | + $data['id_source'] = $id_source; |
|
| 941 | + $data['format_source'] = 'aprs'; |
|
| 942 | + $data['source_name'] = $line['source']; |
|
| 943 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 944 | + $currentdate = date('Y-m-d H:i:s'); |
|
| 945 | + $aprsdate = strtotime($data['datetime']); |
|
| 946 | + // Accept data if time <= system time + 20s |
|
| 947 | + if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) $send = $SI->add($data); |
|
| 948 | + else { |
|
| 949 | 949 | if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
| 950 | 950 | else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
| 951 | - } |
|
| 952 | - unset($data); |
|
| 951 | + } |
|
| 952 | + unset($data); |
|
| 953 | 953 | } |
| 954 | 954 | //elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
| 955 | 955 | elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
| 956 | - } |
|
| 956 | + } |
|
| 957 | 957 | } else { |
| 958 | - $line = explode(',', $buffer); |
|
| 959 | - if (count($line) > 20) { |
|
| 960 | - $data['hex'] = $line[4]; |
|
| 961 | - /* |
|
| 958 | + $line = explode(',', $buffer); |
|
| 959 | + if (count($line) > 20) { |
|
| 960 | + $data['hex'] = $line[4]; |
|
| 961 | + /* |
|
| 962 | 962 | $data['datetime'] = $line[6].' '.$line[7]; |
| 963 | 963 | date_default_timezone_set($globalTimezone); |
| 964 | 964 | $datetime = new DateTime($data['datetime']); |
@@ -966,28 +966,28 @@ discard block |
||
| 966 | 966 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 967 | 967 | date_default_timezone_set('UTC'); |
| 968 | 968 | */ |
| 969 | - // Force datetime to current UTC datetime |
|
| 970 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 971 | - $data['ident'] = trim($line[10]); |
|
| 972 | - $data['latitude'] = $line[14]; |
|
| 973 | - $data['longitude'] = $line[15]; |
|
| 974 | - $data['verticalrate'] = $line[16]; |
|
| 975 | - $data['emergency'] = $line[20]; |
|
| 976 | - $data['speed'] = $line[12]; |
|
| 977 | - $data['squawk'] = $line[17]; |
|
| 978 | - $data['altitude'] = $line[11]; |
|
| 979 | - $data['heading'] = $line[13]; |
|
| 980 | - $data['ground'] = $line[21]; |
|
| 981 | - $data['emergency'] = $line[19]; |
|
| 982 | - $data['format_source'] = 'sbs'; |
|
| 969 | + // Force datetime to current UTC datetime |
|
| 970 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 971 | + $data['ident'] = trim($line[10]); |
|
| 972 | + $data['latitude'] = $line[14]; |
|
| 973 | + $data['longitude'] = $line[15]; |
|
| 974 | + $data['verticalrate'] = $line[16]; |
|
| 975 | + $data['emergency'] = $line[20]; |
|
| 976 | + $data['speed'] = $line[12]; |
|
| 977 | + $data['squawk'] = $line[17]; |
|
| 978 | + $data['altitude'] = $line[11]; |
|
| 979 | + $data['heading'] = $line[13]; |
|
| 980 | + $data['ground'] = $line[21]; |
|
| 981 | + $data['emergency'] = $line[19]; |
|
| 982 | + $data['format_source'] = 'sbs'; |
|
| 983 | 983 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
| 984 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 985 | - $data['id_source'] = $id_source; |
|
| 986 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
| 987 | - else $error = true; |
|
| 988 | - unset($data); |
|
| 989 | - } else $error = true; |
|
| 990 | - if ($error) { |
|
| 984 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 985 | + $data['id_source'] = $id_source; |
|
| 986 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
| 987 | + else $error = true; |
|
| 988 | + unset($data); |
|
| 989 | + } else $error = true; |
|
| 990 | + if ($error) { |
|
| 991 | 991 | if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { |
| 992 | 992 | if ($globalDebug) echo "Not a message. Ignoring... \n"; |
| 993 | 993 | } else { |
@@ -1003,13 +1003,13 @@ discard block |
||
| 1003 | 1003 | connect_all($sourceer); |
| 1004 | 1004 | $sourceer = array(); |
| 1005 | 1005 | } |
| 1006 | - } |
|
| 1006 | + } |
|
| 1007 | 1007 | } |
| 1008 | 1008 | // Sleep for xxx microseconds |
| 1009 | 1009 | if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
| 1010 | - } else { |
|
| 1010 | + } else { |
|
| 1011 | 1011 | if ($format == 'flightgearmp') { |
| 1012 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 1012 | + if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 1013 | 1013 | //@socket_close($r); |
| 1014 | 1014 | sleep($globalMinFetch); |
| 1015 | 1015 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -1018,9 +1018,9 @@ discard block |
||
| 1018 | 1018 | break; |
| 1019 | 1019 | |
| 1020 | 1020 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
| 1021 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 1022 | - else $tt[$format] = 0; |
|
| 1023 | - if ($tt[$format] > 30) { |
|
| 1021 | + if (isset($tt[$format])) $tt[$format]++; |
|
| 1022 | + else $tt[$format] = 0; |
|
| 1023 | + if ($tt[$format] > 30) { |
|
| 1024 | 1024 | if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
| 1025 | 1025 | //@socket_close($r); |
| 1026 | 1026 | sleep(2); |
@@ -1031,40 +1031,40 @@ discard block |
||
| 1031 | 1031 | //connect_all($globalSources); |
| 1032 | 1032 | $tt[$format]=0; |
| 1033 | 1033 | break; |
| 1034 | - } |
|
| 1034 | + } |
|
| 1035 | + } |
|
| 1035 | 1036 | } |
| 1036 | - } |
|
| 1037 | 1037 | } |
| 1038 | - } else { |
|
| 1038 | + } else { |
|
| 1039 | 1039 | $error = socket_strerror(socket_last_error()); |
| 1040 | 1040 | if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
| 1041 | 1041 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || time() - $time >= $timeout) { |
| 1042 | 1042 | if (isset($globalDebug)) echo "Restarting...\n"; |
| 1043 | 1043 | // Restart the script if possible |
| 1044 | 1044 | if (is_array($sockets)) { |
| 1045 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 1045 | + if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 1046 | 1046 | |
| 1047 | - foreach ($sockets as $sock) { |
|
| 1047 | + foreach ($sockets as $sock) { |
|
| 1048 | 1048 | @socket_shutdown($sock,2); |
| 1049 | 1049 | @socket_close($sock); |
| 1050 | - } |
|
| 1050 | + } |
|
| 1051 | 1051 | |
| 1052 | 1052 | } |
| 1053 | - if ($globalDebug) echo "Restart all connections..."; |
|
| 1054 | - sleep(2); |
|
| 1055 | - $time = time(); |
|
| 1056 | - //connect_all($hosts); |
|
| 1057 | - $aprs_connect = 0; |
|
| 1058 | - connect_all($globalSources); |
|
| 1053 | + if ($globalDebug) echo "Restart all connections..."; |
|
| 1054 | + sleep(2); |
|
| 1055 | + $time = time(); |
|
| 1056 | + //connect_all($hosts); |
|
| 1057 | + $aprs_connect = 0; |
|
| 1058 | + connect_all($globalSources); |
|
| 1059 | 1059 | |
| 1060 | 1060 | } |
| 1061 | - } |
|
| 1061 | + } |
|
| 1062 | 1062 | } |
| 1063 | 1063 | if ($globalDaemon === false) { |
| 1064 | - if ($globalDebug) echo 'Check all...'."\n"; |
|
| 1065 | - $SI->checkAll(); |
|
| 1064 | + if ($globalDebug) echo 'Check all...'."\n"; |
|
| 1065 | + $SI->checkAll(); |
|
| 1066 | + } |
|
| 1066 | 1067 | } |
| 1067 | - } |
|
| 1068 | 1068 | } |
| 1069 | 1069 | |
| 1070 | 1070 | ?> |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
| 40 | 40 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
| 41 | 41 | } |
| 42 | - ?> |
|
| 42 | + ?> |
|
| 43 | 43 | </div> |
| 44 | 44 | <?php |
| 45 | 45 | // print_r($Stats->getAllAirlineNames()); |
| 46 | - ?> |
|
| 46 | + ?> |
|
| 47 | 47 | <?php include('statistics-sub-menu.php'); ?> |
| 48 | 48 | <div class="row global-stats"> |
| 49 | 49 | <div class="col-md-2"><span class="type"><?php echo _("Flights"); ?></span><span><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name)); ?></span></div> |
@@ -51,23 +51,23 @@ discard block |
||
| 51 | 51 | <div class="col-md-2"><span class="type"><?php echo _("Arrivals seen"); ?></span><span><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name)); ?></span></div> |
| 52 | 52 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 53 | 53 | <?php |
| 54 | - if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
| 54 | + if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
| 55 | 55 | ?> |
| 56 | 56 | <div class="col-md-2"><span class="type"><?php echo _("Pilots"); ?></span><span><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name)); ?></span></div> |
| 57 | 57 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 58 | 58 | <?php |
| 59 | - } else { |
|
| 60 | - ?> |
|
| 59 | + } else { |
|
| 60 | + ?> |
|
| 61 | 61 | <div class="col-md-2"><span class="type"><?php echo _("Owners"); ?></span><span><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name)); ?></span></div> |
| 62 | 62 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 63 | 63 | <?php |
| 64 | - } |
|
| 65 | - ?> |
|
| 64 | + } |
|
| 65 | + ?> |
|
| 66 | 66 | <div class="col-md-2"><span class="type"><?php echo _("Aircrafts"); ?></span><span><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name)); ?></span></div> |
| 67 | 67 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 68 | 68 | <?php |
| 69 | - if ($airline_icao == '') { |
|
| 70 | - ?> |
|
| 69 | + if ($airline_icao == '') { |
|
| 70 | + ?> |
|
| 71 | 71 | <div class="col-md-2"><span class="type"><?php echo _("Airlines"); ?></span><span><?php print number_format($Stats->countOverallAirlines($filter_name)); ?></span></div> |
| 72 | 72 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 73 | 73 | <?php |
@@ -88,25 +88,25 @@ discard block |
||
| 88 | 88 | <div class="col-md-6"> |
| 89 | 89 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
| 90 | 90 | <?php |
| 91 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name); |
|
| 92 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
| 93 | - else { |
|
| 91 | + $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name); |
|
| 92 | + if (count($aircraft_array) == 0) print _("No data available"); |
|
| 93 | + else { |
|
| 94 | 94 | |
| 95 | - print '<div id="chart1" class="chart" width="100%"></div> |
|
| 95 | + print '<div id="chart1" class="chart" width="100%"></div> |
|
| 96 | 96 | <script> |
| 97 | 97 | google.load("visualization", "1", {packages:["corechart"]}); |
| 98 | 98 | google.setOnLoadCallback(drawChart1); |
| 99 | 99 | function drawChart1() { |
| 100 | 100 | var data = google.visualization.arrayToDataTable([ |
| 101 | 101 | ["'._("Aircraft").'", "'._("# of times").'"], '; |
| 102 | - $aircraft_data = ''; |
|
| 103 | - foreach($aircraft_array as $aircraft_item) |
|
| 104 | - { |
|
| 105 | - $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
| 106 | - } |
|
| 107 | - $aircraft_data = substr($aircraft_data, 0, -1); |
|
| 108 | - print $aircraft_data; |
|
| 109 | - print ']); |
|
| 102 | + $aircraft_data = ''; |
|
| 103 | + foreach($aircraft_array as $aircraft_item) |
|
| 104 | + { |
|
| 105 | + $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
| 106 | + } |
|
| 107 | + $aircraft_data = substr($aircraft_data, 0, -1); |
|
| 108 | + print $aircraft_data; |
|
| 109 | + print ']); |
|
| 110 | 110 | |
| 111 | 111 | var options = { |
| 112 | 112 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | drawChart1(); |
| 122 | 122 | }); |
| 123 | 123 | </script>'; |
| 124 | - } |
|
| 125 | - ?> |
|
| 124 | + } |
|
| 125 | + ?> |
|
| 126 | 126 | <div class="more"> |
| 127 | 127 | <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 128 | 128 | </div> |
@@ -130,30 +130,30 @@ discard block |
||
| 130 | 130 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 131 | 131 | <?php |
| 132 | 132 | // echo $airline_icao; |
| 133 | - if ($airline_icao == '' || $airline_icao == 'all') { |
|
| 133 | + if ($airline_icao == '' || $airline_icao == 'all') { |
|
| 134 | 134 | ?> |
| 135 | 135 | <div class="col-md-6"> |
| 136 | 136 | <h2><?php echo _("Top 10 Most Common Airline"); ?></h2> |
| 137 | 137 | <?php |
| 138 | - $airline_array = $Stats->countAllAirlines(true,$filter_name); |
|
| 139 | - if (count($airline_array) == 0) print _("No data available"); |
|
| 140 | - else { |
|
| 138 | + $airline_array = $Stats->countAllAirlines(true,$filter_name); |
|
| 139 | + if (count($airline_array) == 0) print _("No data available"); |
|
| 140 | + else { |
|
| 141 | 141 | |
| 142 | - print '<div id="chart2" class="chart" width="100%"></div> |
|
| 142 | + print '<div id="chart2" class="chart" width="100%"></div> |
|
| 143 | 143 | <script> |
| 144 | 144 | google.load("visualization", "1", {packages:["corechart"]}); |
| 145 | 145 | google.setOnLoadCallback(drawChart2); |
| 146 | 146 | function drawChart2() { |
| 147 | 147 | var data = google.visualization.arrayToDataTable([ |
| 148 | 148 | ["'._("Airline").'", "'._("# of times").'"], '; |
| 149 | - $airline_data = ''; |
|
| 150 | - foreach($airline_array as $airline_item) |
|
| 151 | - { |
|
| 152 | - $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
|
| 153 | - } |
|
| 154 | - $airline_data = substr($airline_data, 0, -1); |
|
| 155 | - print $airline_data; |
|
| 156 | - print ']); |
|
| 149 | + $airline_data = ''; |
|
| 150 | + foreach($airline_array as $airline_item) |
|
| 151 | + { |
|
| 152 | + $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
|
| 153 | + } |
|
| 154 | + $airline_data = substr($airline_data, 0, -1); |
|
| 155 | + print $airline_data; |
|
| 156 | + print ']); |
|
| 157 | 157 | |
| 158 | 158 | var options = { |
| 159 | 159 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | drawChart2(); |
| 169 | 169 | }); |
| 170 | 170 | </script>'; |
| 171 | - } |
|
| 172 | - ?> |
|
| 171 | + } |
|
| 172 | + ?> |
|
| 173 | 173 | <div class="more"> |
| 174 | 174 | <a href="<?php print $globalURL; ?>/statistics/airline" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 175 | 175 | </div> |
@@ -177,44 +177,44 @@ discard block |
||
| 177 | 177 | </div> |
| 178 | 178 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 179 | 179 | <?php |
| 180 | - } |
|
| 180 | + } |
|
| 181 | 181 | ?> |
| 182 | 182 | <div class="row column"> |
| 183 | 183 | |
| 184 | 184 | <?php |
| 185 | - $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name); |
|
| 185 | + $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name); |
|
| 186 | 186 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
| 187 | - if (empty($flightover_array)) { |
|
| 188 | - ?> |
|
| 187 | + if (empty($flightover_array)) { |
|
| 188 | + ?> |
|
| 189 | 189 | <div class="col-md-12"> |
| 190 | 190 | <?php |
| 191 | - } else { |
|
| 192 | - ?> |
|
| 191 | + } else { |
|
| 192 | + ?> |
|
| 193 | 193 | <div class="col-md-6"> |
| 194 | 194 | <?php |
| 195 | - } |
|
| 196 | - ?> |
|
| 195 | + } |
|
| 196 | + ?> |
|
| 197 | 197 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
| 198 | 198 | <?php |
| 199 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name); |
|
| 200 | - if (count($pilot_array) == 0) print _("No data available"); |
|
| 201 | - else { |
|
| 199 | + $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name); |
|
| 200 | + if (count($pilot_array) == 0) print _("No data available"); |
|
| 201 | + else { |
|
| 202 | 202 | |
| 203 | - print '<div id="chart7" class="chart" width="100%"></div> |
|
| 203 | + print '<div id="chart7" class="chart" width="100%"></div> |
|
| 204 | 204 | <script> |
| 205 | 205 | google.load("visualization", "1", {packages:["corechart"]}); |
| 206 | 206 | google.setOnLoadCallback(drawChart7); |
| 207 | 207 | function drawChart7() { |
| 208 | 208 | var data = google.visualization.arrayToDataTable([ |
| 209 | 209 | ["'._("Pilots").'", "'._("# of times").'"], '; |
| 210 | - $pilot_data = ''; |
|
| 211 | - foreach($pilot_array as $pilot_item) |
|
| 212 | - { |
|
| 213 | - $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
|
| 214 | - } |
|
| 215 | - $pilot_data = substr($pilot_data, 0, -1); |
|
| 216 | - print $pilot_data; |
|
| 217 | - print ']); |
|
| 210 | + $pilot_data = ''; |
|
| 211 | + foreach($pilot_array as $pilot_item) |
|
| 212 | + { |
|
| 213 | + $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
|
| 214 | + } |
|
| 215 | + $pilot_data = substr($pilot_data, 0, -1); |
|
| 216 | + print $pilot_data; |
|
| 217 | + print ']); |
|
| 218 | 218 | |
| 219 | 219 | var options = { |
| 220 | 220 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -229,8 +229,8 @@ discard block |
||
| 229 | 229 | drawChart7(); |
| 230 | 230 | }); |
| 231 | 231 | </script>'; |
| 232 | - } |
|
| 233 | - ?> |
|
| 232 | + } |
|
| 233 | + ?> |
|
| 234 | 234 | <div class="more"> |
| 235 | 235 | <a href="<?php print $globalURL; ?>/statistics/pilot" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 236 | 236 | </div> |
@@ -238,30 +238,30 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 240 | 240 | <?php |
| 241 | - } else { |
|
| 242 | - ?> |
|
| 241 | + } else { |
|
| 242 | + ?> |
|
| 243 | 243 | <div class="col-md-6"> |
| 244 | 244 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
| 245 | 245 | <?php |
| 246 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name); |
|
| 247 | - if (count($owner_array) == 0) print _("No data available"); |
|
| 248 | - else { |
|
| 246 | + $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name); |
|
| 247 | + if (count($owner_array) == 0) print _("No data available"); |
|
| 248 | + else { |
|
| 249 | 249 | |
| 250 | - print '<div id="chart7" class="chart" width="100%"></div> |
|
| 250 | + print '<div id="chart7" class="chart" width="100%"></div> |
|
| 251 | 251 | <script> |
| 252 | 252 | google.load("visualization", "1", {packages:["corechart"]}); |
| 253 | 253 | google.setOnLoadCallback(drawChart7); |
| 254 | 254 | function drawChart7() { |
| 255 | 255 | var data = google.visualization.arrayToDataTable([ |
| 256 | 256 | ["'._("Owner").'", "'._("# of times").'"], '; |
| 257 | - $owner_data = ''; |
|
| 258 | - foreach($owner_array as $owner_item) |
|
| 259 | - { |
|
| 260 | - $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
|
| 261 | - } |
|
| 262 | - $owner_data = substr($owner_data, 0, -1); |
|
| 263 | - print $owner_data; |
|
| 264 | - print ']); |
|
| 257 | + $owner_data = ''; |
|
| 258 | + foreach($owner_array as $owner_item) |
|
| 259 | + { |
|
| 260 | + $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
|
| 261 | + } |
|
| 262 | + $owner_data = substr($owner_data, 0, -1); |
|
| 263 | + print $owner_data; |
|
| 264 | + print ']); |
|
| 265 | 265 | |
| 266 | 266 | var options = { |
| 267 | 267 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -276,8 +276,8 @@ discard block |
||
| 276 | 276 | drawChart7(); |
| 277 | 277 | }); |
| 278 | 278 | </script>'; |
| 279 | - } |
|
| 280 | - ?> |
|
| 279 | + } |
|
| 280 | + ?> |
|
| 281 | 281 | <div class="more"> |
| 282 | 282 | <a href="<?php print $globalURL; ?>/statistics/owner" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 283 | 283 | </div> |
@@ -285,32 +285,32 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 287 | 287 | <?php |
| 288 | - } |
|
| 289 | - if (!empty($flightover_array)) { |
|
| 290 | - ?> |
|
| 288 | + } |
|
| 289 | + if (!empty($flightover_array)) { |
|
| 290 | + ?> |
|
| 291 | 291 | |
| 292 | 292 | <div class="col-md-6"> |
| 293 | 293 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
| 294 | 294 | <?php |
| 295 | - //$flightover_array = $Stats->countAllFlightOverCountries(); |
|
| 296 | - if (count($flightover_array) == 0) print _("No data available"); |
|
| 297 | - else { |
|
| 295 | + //$flightover_array = $Stats->countAllFlightOverCountries(); |
|
| 296 | + if (count($flightover_array) == 0) print _("No data available"); |
|
| 297 | + else { |
|
| 298 | 298 | |
| 299 | - print '<div id="chart10" class="chart" width="100%"></div> |
|
| 299 | + print '<div id="chart10" class="chart" width="100%"></div> |
|
| 300 | 300 | <script> |
| 301 | 301 | google.load("visualization", "1", {packages:["corechart"]}); |
| 302 | 302 | google.setOnLoadCallback(drawChart10); |
| 303 | 303 | function drawChart10() { |
| 304 | 304 | var data = google.visualization.arrayToDataTable([ |
| 305 | 305 | ["'._("Country").'", "'._("# of times").'"], '; |
| 306 | - $flightover_data = ''; |
|
| 307 | - foreach($flightover_array as $flightover_item) |
|
| 308 | - { |
|
| 309 | - $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],'; |
|
| 310 | - } |
|
| 311 | - $flightover_data = substr($flightover_data, 0, -1); |
|
| 312 | - print $flightover_data; |
|
| 313 | - print ']); |
|
| 306 | + $flightover_data = ''; |
|
| 307 | + foreach($flightover_array as $flightover_item) |
|
| 308 | + { |
|
| 309 | + $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],'; |
|
| 310 | + } |
|
| 311 | + $flightover_data = substr($flightover_data, 0, -1); |
|
| 312 | + print $flightover_data; |
|
| 313 | + print ']); |
|
| 314 | 314 | |
| 315 | 315 | var options = { |
| 316 | 316 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -327,15 +327,15 @@ discard block |
||
| 327 | 327 | drawChart10(); |
| 328 | 328 | }); |
| 329 | 329 | </script>'; |
| 330 | - } |
|
| 331 | - ?> |
|
| 330 | + } |
|
| 331 | + ?> |
|
| 332 | 332 | <div class="more"> |
| 333 | 333 | <a href="<?php print $globalURL; ?>/statistics/country" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 334 | 334 | </div> |
| 335 | 335 | </div> |
| 336 | 336 | <?php |
| 337 | - } |
|
| 338 | - ?> |
|
| 337 | + } |
|
| 338 | + ?> |
|
| 339 | 339 | </div> |
| 340 | 340 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 341 | 341 | |
@@ -345,11 +345,11 @@ discard block |
||
| 345 | 345 | <div class="col-md-6"> |
| 346 | 346 | <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2> |
| 347 | 347 | <?php |
| 348 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name); |
|
| 349 | - if (count($airport_airport_array) == 0) print _("No data available"); |
|
| 350 | - else { |
|
| 348 | + $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name); |
|
| 349 | + if (count($airport_airport_array) == 0) print _("No data available"); |
|
| 350 | + else { |
|
| 351 | 351 | |
| 352 | - print '<div id="chart3" class="chart" width="100%"></div> |
|
| 352 | + print '<div id="chart3" class="chart" width="100%"></div> |
|
| 353 | 353 | <script> |
| 354 | 354 | google.load("visualization", "1", {packages:["geochart"]}); |
| 355 | 355 | google.setOnLoadCallback(drawCharts3); |
@@ -360,17 +360,17 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | var data = google.visualization.arrayToDataTable([ |
| 362 | 362 | ["'._("Airport").'", "'._("# of times").'"],'; |
| 363 | - $airport_data = ''; |
|
| 364 | - foreach($airport_airport_array as $airport_item) |
|
| 365 | - { |
|
| 366 | - $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
|
| 367 | - $name = str_replace("'", "", $name); |
|
| 368 | - $name = str_replace('"', "", $name); |
|
| 369 | - $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],'; |
|
| 370 | - } |
|
| 371 | - $airport_data = substr($airport_data, 0, -1); |
|
| 372 | - print $airport_data; |
|
| 373 | - print ']); |
|
| 363 | + $airport_data = ''; |
|
| 364 | + foreach($airport_airport_array as $airport_item) |
|
| 365 | + { |
|
| 366 | + $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
|
| 367 | + $name = str_replace("'", "", $name); |
|
| 368 | + $name = str_replace('"', "", $name); |
|
| 369 | + $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],'; |
|
| 370 | + } |
|
| 371 | + $airport_data = substr($airport_data, 0, -1); |
|
| 372 | + print $airport_data; |
|
| 373 | + print ']); |
|
| 374 | 374 | |
| 375 | 375 | var options = { |
| 376 | 376 | legend: {position: "none"}, |
@@ -384,8 +384,8 @@ discard block |
||
| 384 | 384 | chart.draw(data, options); |
| 385 | 385 | } |
| 386 | 386 | </script>'; |
| 387 | - } |
|
| 388 | - ?> |
|
| 387 | + } |
|
| 388 | + ?> |
|
| 389 | 389 | <div class="more"> |
| 390 | 390 | <a href="<?php print $globalURL; ?>/statistics/airport-departure" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 391 | 391 | </div> |
@@ -395,11 +395,11 @@ discard block |
||
| 395 | 395 | <div class="col-md-6"> |
| 396 | 396 | <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2> |
| 397 | 397 | <?php |
| 398 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name); |
|
| 399 | - if (count($airport_airport_array2) == 0) print _("No data available"); |
|
| 400 | - else { |
|
| 398 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name); |
|
| 399 | + if (count($airport_airport_array2) == 0) print _("No data available"); |
|
| 400 | + else { |
|
| 401 | 401 | |
| 402 | - print '<div id="chart4" class="chart" width="100%"></div> |
|
| 402 | + print '<div id="chart4" class="chart" width="100%"></div> |
|
| 403 | 403 | <script> |
| 404 | 404 | google.load("visualization", "1", {packages:["geochart"]}); |
| 405 | 405 | google.setOnLoadCallback(drawCharts4); |
@@ -410,17 +410,17 @@ discard block |
||
| 410 | 410 | |
| 411 | 411 | var data = google.visualization.arrayToDataTable([ |
| 412 | 412 | ["'._("Airport").'", "'._("# of times").'"],'; |
| 413 | - $airport_data2 = ''; |
|
| 414 | - foreach($airport_airport_array2 as $airport_item2) |
|
| 415 | - { |
|
| 416 | - $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')'; |
|
| 417 | - $name2 = str_replace("'", "", $name2); |
|
| 418 | - $name2 = str_replace('"', "", $name2); |
|
| 419 | - $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],'; |
|
| 420 | - } |
|
| 421 | - $airport_data2 = substr($airport_data2, 0, -1); |
|
| 422 | - print $airport_data2; |
|
| 423 | - print ']); |
|
| 413 | + $airport_data2 = ''; |
|
| 414 | + foreach($airport_airport_array2 as $airport_item2) |
|
| 415 | + { |
|
| 416 | + $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')'; |
|
| 417 | + $name2 = str_replace("'", "", $name2); |
|
| 418 | + $name2 = str_replace('"', "", $name2); |
|
| 419 | + $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],'; |
|
| 420 | + } |
|
| 421 | + $airport_data2 = substr($airport_data2, 0, -1); |
|
| 422 | + print $airport_data2; |
|
| 423 | + print ']); |
|
| 424 | 424 | |
| 425 | 425 | var options = { |
| 426 | 426 | legend: {position: "none"}, |
@@ -434,8 +434,8 @@ discard block |
||
| 434 | 434 | chart.draw(data, options); |
| 435 | 435 | } |
| 436 | 436 | </script>'; |
| 437 | - } |
|
| 438 | - ?> |
|
| 437 | + } |
|
| 438 | + ?> |
|
| 439 | 439 | <div class="more"> |
| 440 | 440 | <a href="<?php print $globalURL; ?>/statistics/airport-arrival" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 441 | 441 | </div> |
@@ -447,24 +447,24 @@ discard block |
||
| 447 | 447 | <div class="col-md-6"> |
| 448 | 448 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 449 | 449 | <?php |
| 450 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
| 451 | - if (count($year_array) == 0) print _("No data available"); |
|
| 452 | - else { |
|
| 453 | - print '<div id="chart8" class="chart" width="100%"></div> |
|
| 450 | + $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
| 451 | + if (count($year_array) == 0) print _("No data available"); |
|
| 452 | + else { |
|
| 453 | + print '<div id="chart8" class="chart" width="100%"></div> |
|
| 454 | 454 | <script> |
| 455 | 455 | google.load("visualization", "1", {packages:["corechart"]}); |
| 456 | 456 | google.setOnLoadCallback(drawChart8); |
| 457 | 457 | function drawChart8() { |
| 458 | 458 | var data = google.visualization.arrayToDataTable([ |
| 459 | 459 | ["'._("Month").'", "'._("# of Flights").'"], '; |
| 460 | - $year_data = ''; |
|
| 461 | - foreach($year_array as $year_item) |
|
| 462 | - { |
|
| 463 | - $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],'; |
|
| 464 | - } |
|
| 465 | - $year_data = substr($year_data, 0, -1); |
|
| 466 | - print $year_data; |
|
| 467 | - print ']); |
|
| 460 | + $year_data = ''; |
|
| 461 | + foreach($year_array as $year_item) |
|
| 462 | + { |
|
| 463 | + $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],'; |
|
| 464 | + } |
|
| 465 | + $year_data = substr($year_data, 0, -1); |
|
| 466 | + print $year_data; |
|
| 467 | + print ']); |
|
| 468 | 468 | |
| 469 | 469 | var options = { |
| 470 | 470 | legend: {position: "none"}, |
@@ -482,8 +482,8 @@ discard block |
||
| 482 | 482 | drawChart8(); |
| 483 | 483 | }); |
| 484 | 484 | </script>'; |
| 485 | - } |
|
| 486 | - ?> |
|
| 485 | + } |
|
| 486 | + ?> |
|
| 487 | 487 | <div class="more"> |
| 488 | 488 | <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 489 | 489 | </div> |
@@ -493,24 +493,24 @@ discard block |
||
| 493 | 493 | <div class="col-md-6"> |
| 494 | 494 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 495 | 495 | <?php |
| 496 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
| 497 | - if (count($month_array) == 0) print _("No data available"); |
|
| 498 | - else { |
|
| 499 | - print '<div id="chart9" class="chart" width="100%"></div> |
|
| 496 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
| 497 | + if (count($month_array) == 0) print _("No data available"); |
|
| 498 | + else { |
|
| 499 | + print '<div id="chart9" class="chart" width="100%"></div> |
|
| 500 | 500 | <script> |
| 501 | 501 | google.load("visualization", "1", {packages:["corechart"]}); |
| 502 | 502 | google.setOnLoadCallback(drawChart9); |
| 503 | 503 | function drawChart9() { |
| 504 | 504 | var data = google.visualization.arrayToDataTable([ |
| 505 | 505 | ["'._("Day").'", "'._("# of Flights").'"], '; |
| 506 | - $month_data = ''; |
|
| 507 | - foreach($month_array as $month_item) |
|
| 508 | - { |
|
| 509 | - $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],'; |
|
| 510 | - } |
|
| 511 | - $month_data = substr($month_data, 0, -1); |
|
| 512 | - print $month_data; |
|
| 513 | - print ']); |
|
| 506 | + $month_data = ''; |
|
| 507 | + foreach($month_array as $month_item) |
|
| 508 | + { |
|
| 509 | + $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],'; |
|
| 510 | + } |
|
| 511 | + $month_data = substr($month_data, 0, -1); |
|
| 512 | + print $month_data; |
|
| 513 | + print ']); |
|
| 514 | 514 | |
| 515 | 515 | var options = { |
| 516 | 516 | legend: {position: "none"}, |
@@ -528,8 +528,8 @@ discard block |
||
| 528 | 528 | drawChart9(); |
| 529 | 529 | }); |
| 530 | 530 | </script>'; |
| 531 | - } |
|
| 532 | - ?> |
|
| 531 | + } |
|
| 532 | + ?> |
|
| 533 | 533 | <div class="more"> |
| 534 | 534 | <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 535 | 535 | </div> |
@@ -539,25 +539,25 @@ discard block |
||
| 539 | 539 | <div class="col-md-6"> |
| 540 | 540 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
| 541 | 541 | <?php |
| 542 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
| 543 | - if (empty($date_array)) print _("No data available"); |
|
| 544 | - else { |
|
| 545 | - print '<div id="chart5" class="chart" width="100%"></div> |
|
| 542 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
| 543 | + if (empty($date_array)) print _("No data available"); |
|
| 544 | + else { |
|
| 545 | + print '<div id="chart5" class="chart" width="100%"></div> |
|
| 546 | 546 | <script> |
| 547 | 547 | google.load("visualization", "1", {packages:["corechart"]}); |
| 548 | 548 | google.setOnLoadCallback(drawChart5); |
| 549 | 549 | function drawChart5() { |
| 550 | 550 | var data = google.visualization.arrayToDataTable([ |
| 551 | 551 | ["'._("Date").'", "'._("# of Flights").'"], '; |
| 552 | - $date_data = ''; |
|
| 552 | + $date_data = ''; |
|
| 553 | 553 | |
| 554 | - foreach($date_array as $date_item) |
|
| 555 | - { |
|
| 556 | - $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],'; |
|
| 557 | - } |
|
| 558 | - $date_data = substr($date_data, 0, -1); |
|
| 559 | - print $date_data; |
|
| 560 | - print ']); |
|
| 554 | + foreach($date_array as $date_item) |
|
| 555 | + { |
|
| 556 | + $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],'; |
|
| 557 | + } |
|
| 558 | + $date_data = substr($date_data, 0, -1); |
|
| 559 | + print $date_data; |
|
| 560 | + print ']); |
|
| 561 | 561 | |
| 562 | 562 | var options = { |
| 563 | 563 | legend: {position: "none"}, |
@@ -575,8 +575,8 @@ discard block |
||
| 575 | 575 | drawChart5(); |
| 576 | 576 | }); |
| 577 | 577 | </script>'; |
| 578 | - } |
|
| 579 | - ?> |
|
| 578 | + } |
|
| 579 | + ?> |
|
| 580 | 580 | <div class="more"> |
| 581 | 581 | <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 582 | 582 | </div> |
@@ -586,25 +586,25 @@ discard block |
||
| 586 | 586 | <div class="col-md-6"> |
| 587 | 587 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 588 | 588 | <?php |
| 589 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
| 590 | - if (empty($hour_array)) print _("No data available"); |
|
| 591 | - else { |
|
| 589 | + $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
| 590 | + if (empty($hour_array)) print _("No data available"); |
|
| 591 | + else { |
|
| 592 | 592 | |
| 593 | - print '<div id="chart6" class="chart" width="100%"></div> |
|
| 593 | + print '<div id="chart6" class="chart" width="100%"></div> |
|
| 594 | 594 | <script> |
| 595 | 595 | google.load("visualization", "1", {packages:["corechart"]}); |
| 596 | 596 | google.setOnLoadCallback(drawChart6); |
| 597 | 597 | function drawChart6() { |
| 598 | 598 | var data = google.visualization.arrayToDataTable([ |
| 599 | 599 | ["'._("Hour").'", "'._("# of Flights").'"], '; |
| 600 | - $hour_data = ''; |
|
| 601 | - foreach($hour_array as $hour_item) |
|
| 602 | - { |
|
| 603 | - $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],'; |
|
| 604 | - } |
|
| 605 | - $hour_data = substr($hour_data, 0, -1); |
|
| 606 | - print $hour_data; |
|
| 607 | - print ']); |
|
| 600 | + $hour_data = ''; |
|
| 601 | + foreach($hour_array as $hour_item) |
|
| 602 | + { |
|
| 603 | + $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],'; |
|
| 604 | + } |
|
| 605 | + $hour_data = substr($hour_data, 0, -1); |
|
| 606 | + print $hour_data; |
|
| 607 | + print ']); |
|
| 608 | 608 | |
| 609 | 609 | var options = { |
| 610 | 610 | legend: {position: "none"}, |
@@ -622,8 +622,8 @@ discard block |
||
| 622 | 622 | drawChart6(); |
| 623 | 623 | }); |
| 624 | 624 | </script>'; |
| 625 | - } |
|
| 626 | - ?> |
|
| 625 | + } |
|
| 626 | + ?> |
|
| 627 | 627 | <div class="more"> |
| 628 | 628 | <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 629 | 629 | </div> |
@@ -631,21 +631,21 @@ discard block |
||
| 631 | 631 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 632 | 632 | </div> |
| 633 | 633 | <?php |
| 634 | - if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') { |
|
| 634 | + if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') { |
|
| 635 | 635 | ?> |
| 636 | 636 | <div class="row column"> |
| 637 | 637 | <?php |
| 638 | - $polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
|
| 639 | - if (!empty($polar)) { |
|
| 640 | - print '<h2>'._("Coverage pattern").'</h2>'; |
|
| 641 | - foreach ($polar as $eachpolar) { |
|
| 642 | - unset($polar_data); |
|
| 643 | - $Spotter = new Spotter(); |
|
| 644 | - $data = json_decode($eachpolar['source_data']); |
|
| 645 | - foreach($data as $value => $key) { |
|
| 646 | - $direction = $Spotter->parseDirection(($value*22.5)); |
|
| 647 | - $distance = $key; |
|
| 648 | - $unit = 'km'; |
|
| 638 | + $polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
|
| 639 | + if (!empty($polar)) { |
|
| 640 | + print '<h2>'._("Coverage pattern").'</h2>'; |
|
| 641 | + foreach ($polar as $eachpolar) { |
|
| 642 | + unset($polar_data); |
|
| 643 | + $Spotter = new Spotter(); |
|
| 644 | + $data = json_decode($eachpolar['source_data']); |
|
| 645 | + foreach($data as $value => $key) { |
|
| 646 | + $direction = $Spotter->parseDirection(($value*22.5)); |
|
| 647 | + $distance = $key; |
|
| 648 | + $unit = 'km'; |
|
| 649 | 649 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 650 | 650 | $distance = round($distance*0.539957); |
| 651 | 651 | $unit = 'nm'; |
@@ -656,10 +656,10 @@ discard block |
||
| 656 | 656 | $distance = $distance; |
| 657 | 657 | $unit = 'km'; |
| 658 | 658 | } |
| 659 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 660 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 661 | - } |
|
| 662 | - ?> |
|
| 659 | + if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 660 | + else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 661 | + } |
|
| 662 | + ?> |
|
| 663 | 663 | <div class="col-md-6"> |
| 664 | 664 | <h4><?php print $eachpolar['source_name']; ?></h4> |
| 665 | 665 | <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
@@ -691,22 +691,22 @@ discard block |
||
| 691 | 691 | </script> |
| 692 | 692 | </div> |
| 693 | 693 | <?php |
| 694 | - } |
|
| 695 | - } |
|
| 696 | - ?> |
|
| 694 | + } |
|
| 695 | + } |
|
| 696 | + ?> |
|
| 697 | 697 | </div> |
| 698 | 698 | <div class="row column"> |
| 699 | 699 | <div class="col-md-6"> |
| 700 | 700 | <?php |
| 701 | - $msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
|
| 702 | - if (!empty($msg)) { |
|
| 703 | - print '<h2>'._("Messages received").'</h2>'; |
|
| 704 | - foreach ($msg as $eachmsg) { |
|
| 705 | - //$eachmsg = $msg[0]; |
|
| 706 | - $data = $eachmsg['source_data']; |
|
| 707 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
| 708 | - else $max = 500; |
|
| 709 | - ?> |
|
| 701 | + $msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
|
| 702 | + if (!empty($msg)) { |
|
| 703 | + print '<h2>'._("Messages received").'</h2>'; |
|
| 704 | + foreach ($msg as $eachmsg) { |
|
| 705 | + //$eachmsg = $msg[0]; |
|
| 706 | + $data = $eachmsg['source_data']; |
|
| 707 | + if ($data > 500) $max = (round(($data+100)/100))*100; |
|
| 708 | + else $max = 500; |
|
| 709 | + ?> |
|
| 710 | 710 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
| 711 | 711 | <script> |
| 712 | 712 | var g = new JustGage({ |
@@ -722,9 +722,9 @@ discard block |
||
| 722 | 722 | }); |
| 723 | 723 | </script> |
| 724 | 724 | <?php |
| 725 | - } |
|
| 726 | - } |
|
| 727 | - ?> |
|
| 725 | + } |
|
| 726 | + } |
|
| 727 | + ?> |
|
| 728 | 728 | </div> |
| 729 | 729 | </div> |
| 730 | 730 | <div class="row column"> |
@@ -751,19 +751,19 @@ discard block |
||
| 751 | 751 | $hist_data .= '[ "'.$distance.'",'.$nb.'],'; |
| 752 | 752 | } |
| 753 | 753 | $hist_data = substr($hist_data, 0, -1); |
| 754 | - ?> |
|
| 754 | + ?> |
|
| 755 | 755 | <div class="col-md-6"> |
| 756 | 756 | <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2> |
| 757 | 757 | <?php |
| 758 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div> |
|
| 758 | + print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div> |
|
| 759 | 759 | <script> |
| 760 | 760 | google.load("visualization", "1", {packages:["corechart"]}); |
| 761 | 761 | google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).'); |
| 762 | 762 | function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() { |
| 763 | 763 | var data = google.visualization.arrayToDataTable([ |
| 764 | 764 | ["'._("Distance").'", "'._("# of Flights").'"], '; |
| 765 | - print $hist_data; |
|
| 766 | - print ']); |
|
| 765 | + print $hist_data; |
|
| 766 | + print ']); |
|
| 767 | 767 | |
| 768 | 768 | var options = { |
| 769 | 769 | legend: {position: "none"}, |
@@ -781,15 +781,15 @@ discard block |
||
| 781 | 781 | drawCharthist_'.str_replace(' ','_',strtolower($source)).'(); |
| 782 | 782 | }); |
| 783 | 783 | </script>'; |
| 784 | - ?> |
|
| 784 | + ?> |
|
| 785 | 785 | </div> |
| 786 | 786 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 787 | 787 | <?php |
| 788 | - } |
|
| 789 | - ?> |
|
| 788 | + } |
|
| 789 | + ?> |
|
| 790 | 790 | </div> |
| 791 | 791 | <?php |
| 792 | - } |
|
| 792 | + } |
|
| 793 | 793 | ?> |
| 794 | 794 | </div> |
| 795 | 795 | </div> |