@@ -5,7 +5,7 @@ |
||
| 5 | 5 | |
| 6 | 6 | if ($_POST['registration'] != "") |
| 7 | 7 | { |
| 8 | - $registration = filter_input(INPUT_POST,'registration',FILTER_SANITIZE_STRING); |
|
| 8 | + $registration = filter_input(INPUT_POST, 'registration', FILTER_SANITIZE_STRING); |
|
| 9 | 9 | header('Location: '.$globalURL.'/registration/'.$registration); |
| 10 | 10 | } else { |
| 11 | 11 | header('Location: '.$globalURL); |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | require_once('../require/settings.php'); |
| 3 | 3 | require_once('../require/class.Language.php'); |
| 4 | 4 | |
| 5 | -setcookie("MapFormat",'2d'); |
|
| 5 | +setcookie("MapFormat", '2d'); |
|
| 6 | 6 | |
| 7 | 7 | // Compressed GeoJson is used if true |
| 8 | 8 | if (!isset($globalJsonCompress)) $compress = true; |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | $lastupd = $_GET['archivespeed']*$archiveupdatetime; |
| 19 | 19 | if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate']; |
| 20 | 20 | else $enddate = time(); |
| 21 | - setcookie("archive_begin",$begindate); |
|
| 22 | - setcookie("archive_end",$enddate); |
|
| 23 | - setcookie("archive_update",$lastupd); |
|
| 24 | - setcookie("archive_speed",$archivespeed); |
|
| 21 | + setcookie("archive_begin", $begindate); |
|
| 22 | + setcookie("archive_end", $enddate); |
|
| 23 | + setcookie("archive_update", $lastupd); |
|
| 24 | + setcookie("archive_speed", $archivespeed); |
|
| 25 | 25 | ?> |
| 26 | 26 | document.cookie = 'archive_begin=<?php print $begindate; ?>; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'; |
| 27 | 27 | document.cookie = 'archive_end=<?php print $enddate; ?>; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'; |
@@ -92,16 +92,16 @@ discard block |
||
| 92 | 92 | <?php |
| 93 | 93 | } |
| 94 | 94 | if (isset($_GET['ident'])) { |
| 95 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 95 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
| 96 | 96 | } |
| 97 | 97 | if (isset($_GET['flightaware_id'])) { |
| 98 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 98 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
| 99 | 99 | } |
| 100 | 100 | if (isset($_GET['latitude'])) { |
| 101 | - $latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_STRING); |
|
| 101 | + $latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_STRING); |
|
| 102 | 102 | } |
| 103 | 103 | if (isset($_GET['longitude'])) { |
| 104 | - $longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_STRING); |
|
| 104 | + $longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_STRING); |
|
| 105 | 105 | } |
| 106 | 106 | ?> |
| 107 | 107 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | || navigator.userAgent.match(/BlackBerry/i) |
| 137 | 137 | || navigator.userAgent.match(/Windows Phone/i)) |
| 138 | 138 | { |
| 139 | - var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom-1; else print '8'; ?>; |
|
| 139 | + var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom - 1; else print '8'; ?>; |
|
| 140 | 140 | } else { |
| 141 | 141 | var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>; |
| 142 | 142 | } |
@@ -230,19 +230,19 @@ discard block |
||
| 230 | 230 | map.addLayer(yandexLayer); |
| 231 | 231 | <?php |
| 232 | 232 | } elseif ($MapType == 'Bing-Aerial') { |
| 233 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
| 233 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap'); |
|
| 234 | 234 | ?> |
| 235 | 235 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'}); |
| 236 | 236 | map.addLayer(bingLayer); |
| 237 | 237 | <?php |
| 238 | 238 | } elseif ($MapType == 'Bing-Hybrid') { |
| 239 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
| 239 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap'); |
|
| 240 | 240 | ?> |
| 241 | 241 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'}); |
| 242 | 242 | map.addLayer(bingLayer); |
| 243 | 243 | <?php |
| 244 | 244 | } elseif ($MapType == 'Bing-Road') { |
| 245 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
| 245 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap'); |
|
| 246 | 246 | ?> |
| 247 | 247 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'}); |
| 248 | 248 | map.addLayer(bingLayer); |
@@ -534,10 +534,10 @@ discard block |
||
| 534 | 534 | }; |
| 535 | 535 | archive.update = function (props) { |
| 536 | 536 | if (typeof props != 'undefined') { |
| 537 | - //this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' + '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i> <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a> <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>'; |
|
| 538 | - this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' + '<b>' + props.archive_date + ' UTC </b>' + '<br/><a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>'; |
|
| 537 | + //this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' + '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i> <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a> <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>'; |
|
| 538 | + this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' + '<b>' + props.archive_date + ' UTC </b>' + '<br/><a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>'; |
|
| 539 | 539 | } else { |
| 540 | - this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' + '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>'; |
|
| 540 | + this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' + '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>'; |
|
| 541 | 541 | } |
| 542 | 542 | |
| 543 | 543 | }; |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | <?php |
| 738 | 738 | } else { |
| 739 | 739 | ?> |
| 740 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 740 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
| 741 | 741 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 742 | 742 | <?php |
| 743 | 743 | } |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | /* |
| 754 | 754 | shadowUrl: iconURLShadowpath, |
| 755 | 755 | shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>], |
| 756 | - shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>] |
|
| 756 | + shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>] |
|
| 757 | 757 | */ |
| 758 | 758 | }) |
| 759 | 759 | }) |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | <?php |
| 787 | 787 | } else { |
| 788 | 788 | ?> |
| 789 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 789 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
| 790 | 790 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 791 | 791 | <?php |
| 792 | 792 | } |
@@ -834,7 +834,7 @@ discard block |
||
| 834 | 834 | <?php |
| 835 | 835 | } else { |
| 836 | 836 | ?> |
| 837 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 837 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
| 838 | 838 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 839 | 839 | <?php |
| 840 | 840 | } |
@@ -1460,23 +1460,23 @@ discard block |
||
| 1460 | 1460 | airs.push(air.value); |
| 1461 | 1461 | } |
| 1462 | 1462 | } |
| 1463 | - document.cookie = 'filter_Airlines='+airs.join()+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m") , date("d")+1, date("Y"))); ?>; path=/' |
|
| 1463 | + document.cookie = 'filter_Airlines='+airs.join()+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"))); ?>; path=/' |
|
| 1464 | 1464 | } |
| 1465 | 1465 | function airlinestype(selectObj) { |
| 1466 | 1466 | var idx = selectObj.selectedIndex; |
| 1467 | 1467 | var airtype = selectObj.options[idx].value; |
| 1468 | - document.cookie = 'filter_airlinestype='+airtype+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m") , date("d")+1, date("Y"))); ?>; path=/' |
|
| 1468 | + document.cookie = 'filter_airlinestype='+airtype+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"))); ?>; path=/' |
|
| 1469 | 1469 | } |
| 1470 | 1470 | function alliance(selectObj) { |
| 1471 | 1471 | var idx = selectObj.selectedIndex; |
| 1472 | 1472 | var alliance = selectObj.options[idx].value; |
| 1473 | - document.cookie = 'filter_alliance='+alliance+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m") , date("d")+1, date("Y"))); ?>; path=/' |
|
| 1473 | + document.cookie = 'filter_alliance='+alliance+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"))); ?>; path=/' |
|
| 1474 | 1474 | } |
| 1475 | 1475 | |
| 1476 | 1476 | function identfilter() { |
| 1477 | 1477 | var ident = $('#identfilter').val(); |
| 1478 | 1478 | console.log('Filter with '+ident); |
| 1479 | - document.cookie = 'filter_ident='+ident+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m") , date("d")+2, date("Y"))); ?>; path=/' |
|
| 1479 | + document.cookie = 'filter_ident='+ident+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/' |
|
| 1480 | 1480 | } |
| 1481 | 1481 | function removefilters() { |
| 1482 | 1482 | // Get an array of all cookie names (the regex matches what we don't want) |
@@ -1498,7 +1498,7 @@ discard block |
||
| 1498 | 1498 | } |
| 1499 | 1499 | } |
| 1500 | 1500 | //document.cookie = 'Sources='+sources.join()+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' |
| 1501 | - document.cookie = 'filter_Sources='+sources.join()+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m") , date("d")+1, date("Y"))); ?>; path=/' |
|
| 1501 | + document.cookie = 'filter_Sources='+sources.join()+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"))); ?>; path=/' |
|
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | 1504 | function show3D() { |
@@ -1521,23 +1521,23 @@ discard block |
||
| 1521 | 1521 | |
| 1522 | 1522 | function clickVATSIM(cb) { |
| 1523 | 1523 | //document.cookie = 'ShowVATSIM='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' |
| 1524 | - document.cookie = 'filter_ShowVATSIM='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m") , date("d")+2, date("Y"))); ?>; path=/' |
|
| 1524 | + document.cookie = 'filter_ShowVATSIM='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/' |
|
| 1525 | 1525 | } |
| 1526 | 1526 | function clickIVAO(cb) { |
| 1527 | 1527 | //document.cookie = 'ShowIVAO='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' |
| 1528 | - document.cookie = 'filter_ShowIVAO='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m") , date("d")+2, date("Y"))); ?>; path=/' |
|
| 1528 | + document.cookie = 'filter_ShowIVAO='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/' |
|
| 1529 | 1529 | } |
| 1530 | 1530 | function clickphpVMS(cb) { |
| 1531 | 1531 | //document.cookie = 'ShowVMS='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' |
| 1532 | - document.cookie = 'filter_ShowVMS='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m") , date("d")+2, date("Y"))); ?>; path=/' |
|
| 1532 | + document.cookie = 'filter_ShowVMS='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/' |
|
| 1533 | 1533 | } |
| 1534 | 1534 | function clickSBS1(cb) { |
| 1535 | 1535 | //document.cookie = 'ShowSBS1='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' |
| 1536 | - document.cookie = 'filter_ShowSBS1='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m") , date("d")+2, date("Y"))); ?>; path=/' |
|
| 1536 | + document.cookie = 'filter_ShowSBS1='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/' |
|
| 1537 | 1537 | } |
| 1538 | 1538 | function clickAPRS(cb) { |
| 1539 | 1539 | //document.cookie = 'ShowAPRS='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' |
| 1540 | - document.cookie = 'filter_ShowAPRS='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m") , date("d")+2, date("Y"))); ?>; path=/' |
|
| 1540 | + document.cookie = 'filter_ShowAPRS='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/' |
|
| 1541 | 1541 | } |
| 1542 | 1542 | function clickFlightPopup(cb) { |
| 1543 | 1543 | document.cookie = 'flightpopup='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' |
@@ -5,8 +5,11 @@ discard block |
||
| 5 | 5 | setcookie("MapFormat",'2d'); |
| 6 | 6 | |
| 7 | 7 | // Compressed GeoJson is used if true |
| 8 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 9 | -else $compress = $globalJsonCompress; |
|
| 8 | +if (!isset($globalJsonCompress)) { |
|
| 9 | + $compress = true; |
|
| 10 | +} else { |
|
| 11 | + $compress = $globalJsonCompress; |
|
| 12 | +} |
|
| 10 | 13 | if (isset($_GET['archive'])) { |
| 11 | 14 | //$archiveupdatetime = 50; |
| 12 | 15 | $archiveupdatetime = $globalMapRefresh; |
@@ -16,8 +19,11 @@ discard block |
||
| 16 | 19 | //$lastupd = round(($_GET['enddate']-$_GET['begindate'])/(($_GET['during']*60)/10)); |
| 17 | 20 | //$lastupd = 20; |
| 18 | 21 | $lastupd = $_GET['archivespeed']*$archiveupdatetime; |
| 19 | - if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate']; |
|
| 20 | - else $enddate = time(); |
|
| 22 | + if (isset($_GET['enddate']) && $_GET['enddate'] != '') { |
|
| 23 | + $enddate = $_GET['enddate']; |
|
| 24 | + } else { |
|
| 25 | + $enddate = time(); |
|
| 26 | + } |
|
| 21 | 27 | setcookie("archive_begin",$begindate); |
| 22 | 28 | setcookie("archive_end",$enddate); |
| 23 | 29 | setcookie("archive_update",$lastupd); |
@@ -123,7 +129,17 @@ discard block |
||
| 123 | 129 | } |
| 124 | 130 | |
| 125 | 131 | //create the map |
| 126 | - map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom); |
|
| 132 | + map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) { |
|
| 133 | + print $latitude; |
|
| 134 | +} else { |
|
| 135 | + print $globalCenterLatitude; |
|
| 136 | +} |
|
| 137 | +?>,<?php if (isset($longitude)) { |
|
| 138 | + print $longitude; |
|
| 139 | +} else { |
|
| 140 | + print $globalCenterLongitude; |
|
| 141 | +} |
|
| 142 | +?>], zoom); |
|
| 127 | 143 | <?php |
| 128 | 144 | } else { |
| 129 | 145 | ?> |
@@ -136,9 +152,19 @@ discard block |
||
| 136 | 152 | || navigator.userAgent.match(/BlackBerry/i) |
| 137 | 153 | || navigator.userAgent.match(/Windows Phone/i)) |
| 138 | 154 | { |
| 139 | - var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom-1; else print '8'; ?>; |
|
| 155 | + var zoom = <?php if (isset($globalLiveZoom)) { |
|
| 156 | + print $globalLiveZoom-1; |
|
| 157 | +} else { |
|
| 158 | + print '8'; |
|
| 159 | +} |
|
| 160 | +?>; |
|
| 140 | 161 | } else { |
| 141 | - var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>; |
|
| 162 | + var zoom = <?php if (isset($globalLiveZoom)) { |
|
| 163 | + print $globalLiveZoom; |
|
| 164 | +} else { |
|
| 165 | + print '9'; |
|
| 166 | +} |
|
| 167 | +?>; |
|
| 142 | 168 | } |
| 143 | 169 | |
| 144 | 170 | //create the map |
@@ -163,16 +189,27 @@ discard block |
||
| 163 | 189 | bounds = L.latLngBounds(southWest,northEast); |
| 164 | 190 | //a few title layers |
| 165 | 191 | <?php |
| 166 | - if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType']; |
|
| 167 | - else $MapType = $globalMapProvider; |
|
| 192 | + if (isset($_COOKIE['MapType'])) { |
|
| 193 | + $MapType = $_COOKIE['MapType']; |
|
| 194 | + } else { |
|
| 195 | + $MapType = $globalMapProvider; |
|
| 196 | + } |
|
| 168 | 197 | |
| 169 | 198 | if ($MapType == 'Mapbox') { |
| 170 | - if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId; |
|
| 171 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
| 172 | -?> |
|
| 199 | + if ($_COOKIE['MapTypeId'] == 'default') { |
|
| 200 | + $MapBoxId = $globalMapboxId; |
|
| 201 | + } else { |
|
| 202 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
| 203 | + } |
|
| 204 | + ?> |
|
| 173 | 205 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
| 174 | 206 | maxZoom: 18, |
| 175 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
| 207 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
| 208 | + print 'false'; |
|
| 209 | +} else { |
|
| 210 | + print 'true'; |
|
| 211 | +} |
|
| 212 | +?>, |
|
| 176 | 213 | attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
| 177 | 214 | '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + |
| 178 | 215 | 'Imagery © <a href="http://mapbox.com">Mapbox</a>', |
@@ -184,7 +221,12 @@ discard block |
||
| 184 | 221 | ?> |
| 185 | 222 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
| 186 | 223 | maxZoom: 18, |
| 187 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
| 224 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
| 225 | + print 'false'; |
|
| 226 | +} else { |
|
| 227 | + print 'true'; |
|
| 228 | +} |
|
| 229 | +?>, |
|
| 188 | 230 | attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
| 189 | 231 | '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>' |
| 190 | 232 | }).addTo(map); |
@@ -230,20 +272,26 @@ discard block |
||
| 230 | 272 | map.addLayer(yandexLayer); |
| 231 | 273 | <?php |
| 232 | 274 | } elseif ($MapType == 'Bing-Aerial') { |
| 233 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
| 234 | -?> |
|
| 275 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
| 276 | + setcookie('MapType','OpenStreetMap'); |
|
| 277 | + } |
|
| 278 | + ?> |
|
| 235 | 279 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'}); |
| 236 | 280 | map.addLayer(bingLayer); |
| 237 | 281 | <?php |
| 238 | 282 | } elseif ($MapType == 'Bing-Hybrid') { |
| 239 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
| 240 | -?> |
|
| 283 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
| 284 | + setcookie('MapType','OpenStreetMap'); |
|
| 285 | + } |
|
| 286 | + ?> |
|
| 241 | 287 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'}); |
| 242 | 288 | map.addLayer(bingLayer); |
| 243 | 289 | <?php |
| 244 | 290 | } elseif ($MapType == 'Bing-Road') { |
| 245 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
| 246 | -?> |
|
| 291 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
| 292 | + setcookie('MapType','OpenStreetMap'); |
|
| 293 | + } |
|
| 294 | + ?> |
|
| 247 | 295 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'}); |
| 248 | 296 | map.addLayer(bingLayer); |
| 249 | 297 | <?php |
@@ -291,7 +339,12 @@ discard block |
||
| 291 | 339 | } |
| 292 | 340 | } elseif ($globalBounding == 'circle') { |
| 293 | 341 | ?> |
| 294 | - var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{ |
|
| 342 | + var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) { |
|
| 343 | + print $globalBoundingCircleSize; |
|
| 344 | +} else { |
|
| 345 | + print '70000'; |
|
| 346 | +} |
|
| 347 | +?>,{ |
|
| 295 | 348 | color: '#92C7D1', |
| 296 | 349 | fillColor: '#92C7D1', |
| 297 | 350 | fillOpacity: 0.3, |
@@ -350,8 +403,11 @@ discard block |
||
| 350 | 403 | |
| 351 | 404 | function update_airportsLayer() { |
| 352 | 405 | <?php |
| 353 | - if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom']; |
|
| 354 | - else $getZoom = '7'; |
|
| 406 | + if (isset($_COOKIE['AirportZoom'])) { |
|
| 407 | + $getZoom = $_COOKIE['AirportZoom']; |
|
| 408 | + } else { |
|
| 409 | + $getZoom = '7'; |
|
| 410 | + } |
|
| 355 | 411 | ?> |
| 356 | 412 | //if (map.getZoom() <= <?php print $getZoom; ?>) { |
| 357 | 413 | if (typeof airportsLayer != 'undefined') { |
@@ -687,9 +743,13 @@ discard block |
||
| 687 | 743 | if (callsign != ""){ markerLabel += callsign; } |
| 688 | 744 | if (departure_airport_code != "" && arrival_airport_code != "" && departure_airport_code != "NA" && arrival_airport_code != "NA"){ markerLabel += ' ( '+departure_airport_code+' - '+arrival_airport_code+' )'; } |
| 689 | 745 | <?php |
| 690 | - if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor']; |
|
| 691 | - elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor; |
|
| 692 | - else $IconColor = '1a3151'; |
|
| 746 | + if (isset($_COOKIE['IconColor'])) { |
|
| 747 | + $IconColor = $_COOKIE['IconColor']; |
|
| 748 | + } elseif (isset($globalAircraftIconColor)) { |
|
| 749 | + $IconColor = $globalAircraftIconColor; |
|
| 750 | + } else { |
|
| 751 | + $IconColor = '1a3151'; |
|
| 752 | + } |
|
| 693 | 753 | if (!isset($ident) && !isset($flightaware_id)) { |
| 694 | 754 | ?> |
| 695 | 755 | info_update(feature.properties.fc); |
@@ -737,7 +797,12 @@ discard block |
||
| 737 | 797 | <?php |
| 738 | 798 | } else { |
| 739 | 799 | ?> |
| 740 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 800 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 801 | + print $archiveupdatetime*1000; |
|
| 802 | +} else { |
|
| 803 | + print $globalMapRefresh*1000+20000; |
|
| 804 | +} |
|
| 805 | +?>+feature.properties.sqt*1000); |
|
| 741 | 806 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 742 | 807 | <?php |
| 743 | 808 | } |
@@ -786,7 +851,12 @@ discard block |
||
| 786 | 851 | <?php |
| 787 | 852 | } else { |
| 788 | 853 | ?> |
| 789 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 854 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 855 | + print $archiveupdatetime*1000; |
|
| 856 | +} else { |
|
| 857 | + print $globalMapRefresh*1000+20000; |
|
| 858 | +} |
|
| 859 | +?>+feature.properties.sqt*1000); |
|
| 790 | 860 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 791 | 861 | <?php |
| 792 | 862 | } |
@@ -834,7 +904,12 @@ discard block |
||
| 834 | 904 | <?php |
| 835 | 905 | } else { |
| 836 | 906 | ?> |
| 837 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 907 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 908 | + print $archiveupdatetime*1000; |
|
| 909 | +} else { |
|
| 910 | + print $globalMapRefresh*1000+20000; |
|
| 911 | +} |
|
| 912 | +?>+feature.properties.sqt*1000); |
|
| 838 | 913 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 839 | 914 | <?php |
| 840 | 915 | } |
@@ -1177,14 +1252,24 @@ discard block |
||
| 1177 | 1252 | if (isset($_GET['archive'])) { |
| 1178 | 1253 | ?> |
| 1179 | 1254 | //then load it again every 30 seconds |
| 1180 | -// var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>); |
|
| 1255 | +// var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) { |
|
| 1256 | + print ($globalMapRefresh*1000)/2; |
|
| 1257 | +} else { |
|
| 1258 | + print '15000'; |
|
| 1259 | +} |
|
| 1260 | +?>); |
|
| 1181 | 1261 | reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php print $archiveupdatetime*1000; ?>); |
| 1182 | 1262 | <?php |
| 1183 | 1263 | } else { |
| 1184 | 1264 | ?> |
| 1185 | 1265 | //then load it again every 30 seconds |
| 1186 | 1266 | reloadPage = setInterval( |
| 1187 | - function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
| 1267 | + function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) { |
|
| 1268 | + print $globalMapRefresh*1000; |
|
| 1269 | +} else { |
|
| 1270 | + print '30000'; |
|
| 1271 | +} |
|
| 1272 | +?>); |
|
| 1188 | 1273 | var currentdate = new Date(); |
| 1189 | 1274 | var currentyear = new Date().getFullYear(); |
| 1190 | 1275 | var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0)); |
@@ -1196,7 +1281,12 @@ discard block |
||
| 1196 | 1281 | if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
| 1197 | 1282 | ?> |
| 1198 | 1283 | update_polarLayer(); |
| 1199 | -setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
| 1284 | +setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) { |
|
| 1285 | + print $globalMapRefresh*1000*2; |
|
| 1286 | +} else { |
|
| 1287 | + print '60000'; |
|
| 1288 | +} |
|
| 1289 | +?>); |
|
| 1200 | 1290 | <?php |
| 1201 | 1291 | } |
| 1202 | 1292 | ?> |
@@ -1212,7 +1302,12 @@ discard block |
||
| 1212 | 1302 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
| 1213 | 1303 | ?> |
| 1214 | 1304 | update_atcLayer(); |
| 1215 | -setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
| 1305 | +setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) { |
|
| 1306 | + print $globalMapRefresh*1000*2; |
|
| 1307 | +} else { |
|
| 1308 | + print '60000'; |
|
| 1309 | +} |
|
| 1310 | +?>); |
|
| 1216 | 1311 | <?php |
| 1217 | 1312 | } |
| 1218 | 1313 | ?> |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | <?php |
| 353 | 353 | if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom']; |
| 354 | 354 | else $getZoom = '7'; |
| 355 | - ?> |
|
| 355 | + ?> |
|
| 356 | 356 | //if (map.getZoom() <= <?php print $getZoom; ?>) { |
| 357 | 357 | if (typeof airportsLayer != 'undefined') { |
| 358 | 358 | if (map.hasLayer(airportsLayer) == true) { |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | update_locationsLayer(); |
| 513 | 513 | |
| 514 | 514 | <?php |
| 515 | - if (!isset($ident) && !isset($flightaware_id)) { |
|
| 515 | + if (!isset($ident) && !isset($flightaware_id)) { |
|
| 516 | 516 | ?> |
| 517 | 517 | |
| 518 | 518 | function info_update (props) { |
@@ -520,11 +520,11 @@ discard block |
||
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | <?php |
| 523 | - } |
|
| 523 | + } |
|
| 524 | 524 | ?> |
| 525 | 525 | |
| 526 | 526 | <?php |
| 527 | - if (isset($_GET['archive'])) { |
|
| 527 | + if (isset($_GET['archive'])) { |
|
| 528 | 528 | ?> |
| 529 | 529 | var archive = L.control(); |
| 530 | 530 | archive.onAdd = function (map) { |
@@ -543,12 +543,12 @@ discard block |
||
| 543 | 543 | }; |
| 544 | 544 | archive.addTo(map); |
| 545 | 545 | <?php |
| 546 | - } |
|
| 546 | + } |
|
| 547 | 547 | ?> |
| 548 | 548 | |
| 549 | 549 | |
| 550 | 550 | <?php |
| 551 | - //if ((isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'false') || (isset($globalMapPopup) && !$globalMapPopup)) { |
|
| 551 | + //if ((isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'false') || (isset($globalMapPopup) && !$globalMapPopup)) { |
|
| 552 | 552 | ?> |
| 553 | 553 | |
| 554 | 554 | $(".showdetails").on("click",".close",function(){ |
@@ -1041,15 +1041,15 @@ discard block |
||
| 1041 | 1041 | if (map.getZoom() > 7) { |
| 1042 | 1042 | var style = { |
| 1043 | 1043 | <?php |
| 1044 | - if (isset($globalMapAltitudeColor) && !$globalMapAltitudeColor) { |
|
| 1044 | + if (isset($globalMapAltitudeColor) && !$globalMapAltitudeColor) { |
|
| 1045 | 1045 | ?> |
| 1046 | 1046 | "color": "#1a3151", |
| 1047 | 1047 | <?php |
| 1048 | - } else { |
|
| 1048 | + } else { |
|
| 1049 | 1049 | ?> |
| 1050 | 1050 | "color": getAltitudeColor(altitude), |
| 1051 | 1051 | <?php |
| 1052 | - } |
|
| 1052 | + } |
|
| 1053 | 1053 | ?> |
| 1054 | 1054 | "weight": 3, |
| 1055 | 1055 | "opacity": 1 |
@@ -1059,15 +1059,15 @@ discard block |
||
| 1059 | 1059 | } else { |
| 1060 | 1060 | var style = { |
| 1061 | 1061 | <?php |
| 1062 | - if (isset($globalMapAltitudeColor) && !$globalMapAltitudeColor) { |
|
| 1062 | + if (isset($globalMapAltitudeColor) && !$globalMapAltitudeColor) { |
|
| 1063 | 1063 | ?> |
| 1064 | 1064 | "color": "#1a3151", |
| 1065 | 1065 | <?php |
| 1066 | - } else { |
|
| 1066 | + } else { |
|
| 1067 | 1067 | ?> |
| 1068 | 1068 | "color": getAltitudeColor(altitude), |
| 1069 | 1069 | <?php |
| 1070 | - } |
|
| 1070 | + } |
|
| 1071 | 1071 | ?> |
| 1072 | 1072 | "weight": 2, |
| 1073 | 1073 | "opacity": 1 |
@@ -1079,15 +1079,15 @@ discard block |
||
| 1079 | 1079 | if (map.getZoom() > 7) { |
| 1080 | 1080 | var style = { |
| 1081 | 1081 | <?php |
| 1082 | - if (isset($globalMapAltitudeColor) && !$globalMapAltitudeColor) { |
|
| 1082 | + if (isset($globalMapAltitudeColor) && !$globalMapAltitudeColor) { |
|
| 1083 | 1083 | ?> |
| 1084 | 1084 | "color": "#1a3151", |
| 1085 | 1085 | <?php |
| 1086 | - } else { |
|
| 1086 | + } else { |
|
| 1087 | 1087 | ?> |
| 1088 | 1088 | "color": getAltitudeColor(altitude), |
| 1089 | 1089 | <?php |
| 1090 | - } |
|
| 1090 | + } |
|
| 1091 | 1091 | ?> |
| 1092 | 1092 | "weight": 3, |
| 1093 | 1093 | "opacity": 0.6 |
@@ -1097,15 +1097,15 @@ discard block |
||
| 1097 | 1097 | } else { |
| 1098 | 1098 | var style = { |
| 1099 | 1099 | <?php |
| 1100 | - if (isset($globalMapAltitudeColor) && !$globalMapAltitudeColor) { |
|
| 1100 | + if (isset($globalMapAltitudeColor) && !$globalMapAltitudeColor) { |
|
| 1101 | 1101 | ?> |
| 1102 | 1102 | "color": "#1a3151", |
| 1103 | 1103 | <?php |
| 1104 | - } else { |
|
| 1104 | + } else { |
|
| 1105 | 1105 | ?> |
| 1106 | 1106 | "color": getAltitudeColor(altitude), |
| 1107 | 1107 | <?php |
| 1108 | - } |
|
| 1108 | + } |
|
| 1109 | 1109 | ?> |
| 1110 | 1110 | "weight": 2, |
| 1111 | 1111 | "opacity": 0.6 |
@@ -1115,21 +1115,21 @@ discard block |
||
| 1115 | 1115 | } |
| 1116 | 1116 | } |
| 1117 | 1117 | <?php |
| 1118 | - } else { |
|
| 1119 | - ?> |
|
| 1118 | + } else { |
|
| 1119 | + ?> |
|
| 1120 | 1120 | if (map.getZoom() > 7) { |
| 1121 | 1121 | var style = { |
| 1122 | 1122 | <?php |
| 1123 | 1123 | if (isset($globalMapAltitudeColor) && !$globalMapAltitudeColor) { |
| 1124 | - ?> |
|
| 1124 | + ?> |
|
| 1125 | 1125 | "color": "#1a3151", |
| 1126 | 1126 | <?php |
| 1127 | 1127 | } else { |
| 1128 | - ?> |
|
| 1128 | + ?> |
|
| 1129 | 1129 | "color": getAltitudeColor(altitude), |
| 1130 | 1130 | <?php |
| 1131 | 1131 | } |
| 1132 | - ?> |
|
| 1132 | + ?> |
|
| 1133 | 1133 | "weight": 3, |
| 1134 | 1134 | "opacity": 0.6 |
| 1135 | 1135 | }; |
@@ -1139,15 +1139,15 @@ discard block |
||
| 1139 | 1139 | var style = { |
| 1140 | 1140 | <?php |
| 1141 | 1141 | if (isset($globalMapAltitudeColor) && !$globalMapAltitudeColor) { |
| 1142 | - ?> |
|
| 1142 | + ?> |
|
| 1143 | 1143 | "color": "#1a3151", |
| 1144 | 1144 | <?php |
| 1145 | 1145 | } else { |
| 1146 | - ?> |
|
| 1146 | + ?> |
|
| 1147 | 1147 | "color": getAltitudeColor(altitude), |
| 1148 | 1148 | <?php |
| 1149 | 1149 | } |
| 1150 | - ?> |
|
| 1150 | + ?> |
|
| 1151 | 1151 | "weight": 2, |
| 1152 | 1152 | "opacity": 0.6 |
| 1153 | 1153 | }; |
@@ -1155,7 +1155,7 @@ discard block |
||
| 1155 | 1155 | layer_data.addLayer(layer); |
| 1156 | 1156 | } |
| 1157 | 1157 | <?php |
| 1158 | - } |
|
| 1158 | + } |
|
| 1159 | 1159 | ?> |
| 1160 | 1160 | } |
| 1161 | 1161 | } |
@@ -1220,10 +1220,10 @@ discard block |
||
| 1220 | 1220 | |
| 1221 | 1221 | |
| 1222 | 1222 | <?php |
| 1223 | - // Add support for custom json via $globalMapJson |
|
| 1224 | - if (isset($globalMapJson) && is_array($globalMapJson)) { |
|
| 1223 | + // Add support for custom json via $globalMapJson |
|
| 1224 | + if (isset($globalMapJson) && is_array($globalMapJson)) { |
|
| 1225 | 1225 | foreach ($globalMapJson as $json) { |
| 1226 | - if (isset($json['url'])) { |
|
| 1226 | + if (isset($json['url'])) { |
|
| 1227 | 1227 | ?> |
| 1228 | 1228 | update_genLayer('<?php print $json['url']; ?>'); |
| 1229 | 1229 | <?php |
@@ -1232,9 +1232,9 @@ discard block |
||
| 1232 | 1232 | setInterval(function(){update_genLayer('<?php print $json['url']; ?>')}, <?php print $json['refresh']; ?>); |
| 1233 | 1233 | <?php |
| 1234 | 1234 | } |
| 1235 | - } |
|
| 1235 | + } |
|
| 1236 | + } |
|
| 1236 | 1237 | } |
| 1237 | - } |
|
| 1238 | 1238 | |
| 1239 | 1239 | ?> |
| 1240 | 1240 | |
@@ -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,59 +317,59 @@ 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 | - } |
|
| 329 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
| 328 | + } |
|
| 329 | + if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
| 330 | 330 | ?> |
| 331 | 331 | <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li> |
| 332 | 332 | <?php |
| 333 | - } |
|
| 333 | + } |
|
| 334 | 334 | ?> |
| 335 | 335 | |
| 336 | 336 | <?php |
| 337 | 337 | if (function_exists('array_column')) { |
| 338 | - if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
| 339 | - ?> |
|
| 338 | + if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
| 339 | + ?> |
|
| 340 | 340 | <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> |
| 341 | 341 | <?php |
| 342 | - } |
|
| 342 | + } |
|
| 343 | 343 | } elseif (isset($globalSources)) { |
| 344 | - $dispolar = false; |
|
| 345 | - foreach ($globalSources as $testsource) { |
|
| 346 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
| 347 | - } |
|
| 348 | - if ($dispolar) { |
|
| 349 | - ?> |
|
| 344 | + $dispolar = false; |
|
| 345 | + foreach ($globalSources as $testsource) { |
|
| 346 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
| 347 | + } |
|
| 348 | + if ($dispolar) { |
|
| 349 | + ?> |
|
| 350 | 350 | <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> |
| 351 | 351 | <?php |
| 352 | - } |
|
| 353 | - } |
|
| 354 | - ?> |
|
| 352 | + } |
|
| 353 | + } |
|
| 354 | + ?> |
|
| 355 | 355 | <?php |
| 356 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
| 356 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
| 357 | 357 | ?> |
| 358 | 358 | |
| 359 | 359 | <?php |
| 360 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
| 361 | - ?> |
|
| 360 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
| 361 | + ?> |
|
| 362 | 362 | <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> |
| 363 | 363 | <?php |
| 364 | 364 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
| 365 | - ?> |
|
| 365 | + ?> |
|
| 366 | 366 | <li><?php echo _("Aircraft icon color:"); ?> |
| 367 | 367 | <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'; ?>"> |
| 368 | 368 | </li> |
| 369 | 369 | <?php |
| 370 | - } |
|
| 371 | - } |
|
| 372 | - ?> |
|
| 370 | + } |
|
| 371 | + } |
|
| 372 | + ?> |
|
| 373 | 373 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
| 374 | 374 | <div class="range"> |
| 375 | 375 | <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'; ?>"> |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | </div> |
| 378 | 378 | </li> |
| 379 | 379 | <?php |
| 380 | - } |
|
| 380 | + } |
|
| 381 | 381 | ?> |
| 382 | 382 | <li><?php echo _("Distance unit:"); ?> |
| 383 | 383 | <select class="selectpicker" onchange="unitdistance(this);"> |
@@ -410,16 +410,16 @@ discard block |
||
| 410 | 410 | <ul> |
| 411 | 411 | <?php |
| 412 | 412 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
| 413 | - ?> |
|
| 413 | + ?> |
|
| 414 | 414 | <?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 } ?> |
| 415 | 415 | <?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 } ?> |
| 416 | 416 | <?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 } ?> |
| 417 | 417 | <?php |
| 418 | 418 | } |
| 419 | - ?> |
|
| 419 | + ?> |
|
| 420 | 420 | <?php |
| 421 | 421 | if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
| 422 | - ?> |
|
| 422 | + ?> |
|
| 423 | 423 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
| 424 | 424 | <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> |
| 425 | 425 | <?php } ?> |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | <?php } ?> |
| 429 | 429 | <?php |
| 430 | 430 | } |
| 431 | - ?> |
|
| 431 | + ?> |
|
| 432 | 432 | <li><?php echo _("Display airlines:"); ?> |
| 433 | 433 | <br/> |
| 434 | 434 | <select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines"> |
@@ -448,14 +448,14 @@ discard block |
||
| 448 | 448 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
| 449 | 449 | } |
| 450 | 450 | } |
| 451 | - ?> |
|
| 451 | + ?> |
|
| 452 | 452 | </select> |
| 453 | 453 | </li> |
| 454 | 454 | <?php |
| 455 | 455 | $Spotter = new Spotter(); |
| 456 | 456 | $allalliancenames = $Spotter->getAllAllianceNames(); |
| 457 | 457 | if (!empty($allalliancenames)) { |
| 458 | - ?> |
|
| 458 | + ?> |
|
| 459 | 459 | <li><?php echo _("Display alliance:"); ?> |
| 460 | 460 | <br/> |
| 461 | 461 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
@@ -469,15 +469,15 @@ discard block |
||
| 469 | 469 | echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>'; |
| 470 | 470 | } |
| 471 | 471 | } |
| 472 | - ?> |
|
| 472 | + ?> |
|
| 473 | 473 | </select> |
| 474 | 474 | </li> |
| 475 | 475 | <?php |
| 476 | 476 | } |
| 477 | - ?> |
|
| 477 | + ?> |
|
| 478 | 478 | <?php |
| 479 | 479 | if (isset($globalAPRS) && $globalAPRS) { |
| 480 | - ?> |
|
| 480 | + ?> |
|
| 481 | 481 | <li><?php echo _("Display APRS sources name:"); ?> |
| 482 | 482 | <select class="selectpicker" multiple onchange="sources(this);"> |
| 483 | 483 | <?php |
@@ -489,15 +489,15 @@ discard block |
||
| 489 | 489 | echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>'; |
| 490 | 490 | } |
| 491 | 491 | } |
| 492 | - ?> |
|
| 492 | + ?> |
|
| 493 | 493 | </select> |
| 494 | 494 | </li> |
| 495 | 495 | <?php |
| 496 | 496 | } |
| 497 | - ?> |
|
| 497 | + ?> |
|
| 498 | 498 | <?php |
| 499 | 499 | if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
| 500 | - ?> |
|
| 500 | + ?> |
|
| 501 | 501 | <li><?php echo _("Display airlines of type:"); ?><br/> |
| 502 | 502 | <select class="selectpicker" onchange="airlinestype(this);"> |
| 503 | 503 | <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | </li> |
| 509 | 509 | <?php |
| 510 | 510 | } |
| 511 | - ?> |
|
| 511 | + ?> |
|
| 512 | 512 | <li> |
| 513 | 513 | <?php echo _("Display flight with ident:"); ?> |
| 514 | 514 | <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | </form> |
| 522 | 522 | </div> |
| 523 | 523 | <?php |
| 524 | - if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 524 | + if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 525 | 525 | ?> |
| 526 | 526 | <div class="sidebar-pane" id="satellites"> |
| 527 | 527 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -561,14 +561,14 @@ discard block |
||
| 561 | 561 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
| 562 | 562 | } |
| 563 | 563 | } |
| 564 | - ?> |
|
| 564 | + ?> |
|
| 565 | 565 | </select> |
| 566 | 566 | </li> |
| 567 | 567 | </ul> |
| 568 | 568 | </form> |
| 569 | 569 | </div> |
| 570 | 570 | <?php |
| 571 | - } |
|
| 571 | + } |
|
| 572 | 572 | ?> |
| 573 | 573 | </div> |
| 574 | 574 | </div> |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | require_once('require/class.Language.php'); |
| 5 | 5 | require_once('require/class.Satellite.php'); |
| 6 | 6 | |
| 7 | -$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING); |
|
| 7 | +$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING); |
|
| 8 | 8 | if ($trackident != '') { |
| 9 | 9 | require_once('require/class.SpotterLive.php'); |
| 10 | 10 | $SpotterLive = new SpotterLive(); |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident); |
| 15 | 15 | header('Location: '.$globalURL.'/flightid/'.$spotterid); |
| 16 | 16 | } else { |
| 17 | - setcookie('MapTrack',$resulttrackident[0]['flightaware_id']); |
|
| 17 | + setcookie('MapTrack', $resulttrackident[0]['flightaware_id']); |
|
| 18 | 18 | } |
| 19 | 19 | } else { |
| 20 | 20 | unset($_COOKIE['MapTrack']); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | <div class="form-group"> |
| 168 | 168 | <label>From (UTC):</label> |
| 169 | 169 | <div class='input-group date' id='datetimepicker1'> |
| 170 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required /> |
|
| 170 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a", $_COOKIE['archive_begin']); ?>" required /> |
|
| 171 | 171 | <span class="input-group-addon"> |
| 172 | 172 | <span class="glyphicon glyphicon-calendar"></span> |
| 173 | 173 | </span> |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | <div class="form-group"> |
| 177 | 177 | <label>To (UTC):</label> |
| 178 | 178 | <div class='input-group date' id='datetimepicker2'> |
| 179 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" /> |
|
| 179 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a", $_COOKIE['archive_end']); ?>" /> |
|
| 180 | 180 | <span class="input-group-addon"> |
| 181 | 181 | <span class="glyphicon glyphicon-calendar"></span> |
| 182 | 182 | </span> |
@@ -301,8 +301,8 @@ discard block |
||
| 301 | 301 | <li><?php echo _("Type of Terrain:"); ?> |
| 302 | 302 | <select class="selectpicker" onchange="terrainType(this);"> |
| 303 | 303 | <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
| 304 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
| 305 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
| 304 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option> |
|
| 305 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option> |
|
| 306 | 306 | </select> |
| 307 | 307 | </li> |
| 308 | 308 | <?php |
@@ -326,7 +326,7 @@ discard block |
||
| 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 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
| 329 | + if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) { |
|
| 330 | 330 | ?> |
| 331 | 331 | <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li> |
| 332 | 332 | <?php |
@@ -439,10 +439,10 @@ discard block |
||
| 439 | 439 | $Spotter = new Spotter(); |
| 440 | 440 | $allairlinenames = $Spotter->getAllAirlineNames(); |
| 441 | 441 | } |
| 442 | - foreach($allairlinenames as $airline) { |
|
| 442 | + foreach ($allairlinenames as $airline) { |
|
| 443 | 443 | $airline_name = $airline['airline_name']; |
| 444 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
| 445 | - if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
|
| 444 | + if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...'; |
|
| 445 | + if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) { |
|
| 446 | 446 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
| 447 | 447 | } else { |
| 448 | 448 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
| 462 | 462 | <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
| 463 | 463 | <?php |
| 464 | - foreach($allalliancenames as $alliance) { |
|
| 464 | + foreach ($allalliancenames as $alliance) { |
|
| 465 | 465 | $alliance_name = $alliance['alliance']; |
| 466 | 466 | if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) { |
| 467 | 467 | echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>'; |
@@ -482,8 +482,8 @@ discard block |
||
| 482 | 482 | <select class="selectpicker" multiple onchange="sources(this);"> |
| 483 | 483 | <?php |
| 484 | 484 | $Spotter = new Spotter(); |
| 485 | - foreach($Spotter->getAllSourceName('aprs') as $source) { |
|
| 486 | - if (isset($_COOKIE['filter_Sources']) && in_array($source['source_name'],explode(',',$_COOKIE['filter_Sources']))) { |
|
| 485 | + foreach ($Spotter->getAllSourceName('aprs') as $source) { |
|
| 486 | + if (isset($_COOKIE['filter_Sources']) && in_array($source['source_name'], explode(',', $_COOKIE['filter_Sources']))) { |
|
| 487 | 487 | echo '<option value="'.$source['source_name'].'" selected>'.$source['source_name'].'</option>'; |
| 488 | 488 | } else { |
| 489 | 489 | echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>'; |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
| 556 | 556 | else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
| 557 | 557 | |
| 558 | - if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
|
| 558 | + if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) { |
|
| 559 | 559 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
| 560 | 560 | } else { |
| 561 | 561 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
@@ -135,11 +135,26 @@ discard block |
||
| 135 | 135 | <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li> |
| 136 | 136 | <li><?php echo _("NOTAM scope:"); ?> |
| 137 | 137 | <select class="selectpicker" onchange="notamscope(this);"> |
| 138 | - <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option> |
|
| 139 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option> |
|
| 140 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option> |
|
| 141 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option> |
|
| 142 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option> |
|
| 138 | + <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') { |
|
| 139 | + print ' selected'; |
|
| 140 | +} |
|
| 141 | +?>>All</option> |
|
| 142 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') { |
|
| 143 | + print ' selected'; |
|
| 144 | +} |
|
| 145 | +?>>Airport/Enroute warning</option> |
|
| 146 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') { |
|
| 147 | + print ' selected'; |
|
| 148 | +} |
|
| 149 | +?>>Airport warning</option> |
|
| 150 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') { |
|
| 151 | + print ' selected'; |
|
| 152 | +} |
|
| 153 | +?>>Navigation warning</option> |
|
| 154 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') { |
|
| 155 | + print ' selected'; |
|
| 156 | +} |
|
| 157 | +?>>Enroute warning</option> |
|
| 143 | 158 | </select |
| 144 | 159 | </li> |
| 145 | 160 | </ul> |
@@ -167,7 +182,12 @@ discard block |
||
| 167 | 182 | <div class="form-group"> |
| 168 | 183 | <label>From (UTC):</label> |
| 169 | 184 | <div class='input-group date' id='datetimepicker1'> |
| 170 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required /> |
|
| 185 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) { |
|
| 186 | + print $_POST['start_date']; |
|
| 187 | +} elseif (isset($_COOKIE['archive_begin'])) { |
|
| 188 | + print date("m/d/Y h:i a",$_COOKIE['archive_begin']); |
|
| 189 | +} |
|
| 190 | +?>" required /> |
|
| 171 | 191 | <span class="input-group-addon"> |
| 172 | 192 | <span class="glyphicon glyphicon-calendar"></span> |
| 173 | 193 | </span> |
@@ -176,7 +196,12 @@ discard block |
||
| 176 | 196 | <div class="form-group"> |
| 177 | 197 | <label>To (UTC):</label> |
| 178 | 198 | <div class='input-group date' id='datetimepicker2'> |
| 179 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" /> |
|
| 199 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) { |
|
| 200 | + print $_POST['end_date']; |
|
| 201 | +} elseif (isset($_COOKIE['archive_end'])) { |
|
| 202 | + print date("m/d/Y h:i a",$_COOKIE['archive_end']); |
|
| 203 | +} |
|
| 204 | +?>" /> |
|
| 180 | 205 | <span class="input-group-addon"> |
| 181 | 206 | <span class="glyphicon glyphicon-calendar"></span> |
| 182 | 207 | </span> |
@@ -202,8 +227,20 @@ discard block |
||
| 202 | 227 | |
| 203 | 228 | <li><?php echo _("Playback speed:"); ?> |
| 204 | 229 | <div class="range"> |
| 205 | - <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>"> |
|
| 206 | - <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output> |
|
| 230 | + <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) { |
|
| 231 | + print $_POST['archivespeed']; |
|
| 232 | +} elseif (isset($_COOKIE['archive_speed'])) { |
|
| 233 | + print $_COOKIE['archive_speed']; |
|
| 234 | +} else { |
|
| 235 | + print '1'; |
|
| 236 | +} |
|
| 237 | +?>"> |
|
| 238 | + <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) { |
|
| 239 | + print $_COOKIE['archive_speed']; |
|
| 240 | +} else { |
|
| 241 | + print '1'; |
|
| 242 | +} |
|
| 243 | +?></output> |
|
| 207 | 244 | </div> |
| 208 | 245 | </li> |
| 209 | 246 | <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li> |
@@ -225,15 +262,27 @@ discard block |
||
| 225 | 262 | <li><?php echo _("Type of Map:"); ?> |
| 226 | 263 | <select class="selectpicker" onchange="mapType(this);"> |
| 227 | 264 | <?php |
| 228 | - if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
|
| 229 | - else $MapType = $_COOKIE['MapType']; |
|
| 265 | + if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') { |
|
| 266 | + $MapType = $globalMapProvider; |
|
| 267 | + } else { |
|
| 268 | + $MapType = $_COOKIE['MapType']; |
|
| 269 | + } |
|
| 230 | 270 | ?> |
| 231 | 271 | <?php |
| 232 | 272 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
| 233 | 273 | ?> |
| 234 | - <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
|
| 235 | - <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
|
| 236 | - <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
|
| 274 | + <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') { |
|
| 275 | + print ' selected'; |
|
| 276 | +} |
|
| 277 | +?>>Bing-Aerial</option> |
|
| 278 | + <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') { |
|
| 279 | + print ' selected'; |
|
| 280 | +} |
|
| 281 | +?>>Bing-Hybrid</option> |
|
| 282 | + <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') { |
|
| 283 | + print ' selected'; |
|
| 284 | +} |
|
| 285 | +?>>Bing-Road</option> |
|
| 237 | 286 | <?php |
| 238 | 287 | } |
| 239 | 288 | ?> |
@@ -243,56 +292,131 @@ discard block |
||
| 243 | 292 | <?php |
| 244 | 293 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
| 245 | 294 | ?> |
| 246 | - <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
|
| 247 | - <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
|
| 248 | - <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
|
| 295 | + <option value="Here-Aerial"<?php if ($MapType == 'Here') { |
|
| 296 | + print ' selected'; |
|
| 297 | +} |
|
| 298 | +?>>Here-Aerial</option> |
|
| 299 | + <option value="Here-Hybrid"<?php if ($MapType == 'Here') { |
|
| 300 | + print ' selected'; |
|
| 301 | +} |
|
| 302 | +?>>Here-Hybrid</option> |
|
| 303 | + <option value="Here-Road"<?php if ($MapType == 'Here') { |
|
| 304 | + print ' selected'; |
|
| 305 | +} |
|
| 306 | +?>>Here-Road</option> |
|
| 249 | 307 | <?php |
| 250 | 308 | } |
| 251 | 309 | ?> |
| 252 | 310 | <?php |
| 253 | 311 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
| 254 | 312 | ?> |
| 255 | - <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
|
| 256 | - <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
|
| 257 | - <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
|
| 258 | - <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
|
| 313 | + <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') { |
|
| 314 | + print ' selected'; |
|
| 315 | +} |
|
| 316 | +?>>Google Roadmap</option> |
|
| 317 | + <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') { |
|
| 318 | + print ' selected'; |
|
| 319 | +} |
|
| 320 | +?>>Google Satellite</option> |
|
| 321 | + <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') { |
|
| 322 | + print ' selected'; |
|
| 323 | +} |
|
| 324 | +?>>Google Hybrid</option> |
|
| 325 | + <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') { |
|
| 326 | + print ' selected'; |
|
| 327 | +} |
|
| 328 | +?>>Google Terrain</option> |
|
| 259 | 329 | <?php |
| 260 | 330 | } |
| 261 | 331 | ?> |
| 262 | 332 | <?php |
| 263 | 333 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
| 264 | 334 | ?> |
| 265 | - <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
|
| 266 | - <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
|
| 267 | - <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
|
| 335 | + <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') { |
|
| 336 | + print ' selected'; |
|
| 337 | +} |
|
| 338 | +?>>MapQuest-OSM</option> |
|
| 339 | + <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') { |
|
| 340 | + print ' selected'; |
|
| 341 | +} |
|
| 342 | +?>>MapQuest-Aerial</option> |
|
| 343 | + <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') { |
|
| 344 | + print ' selected'; |
|
| 345 | +} |
|
| 346 | +?>>MapQuest-Hybrid</option> |
|
| 268 | 347 | <?php |
| 269 | 348 | } |
| 270 | 349 | ?> |
| 271 | - <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
|
| 350 | + <option value="Yandex"<?php if ($MapType == 'Yandex') { |
|
| 351 | + print ' selected'; |
|
| 352 | +} |
|
| 353 | +?>>Yandex</option> |
|
| 272 | 354 | <?php |
| 273 | 355 | } |
| 274 | 356 | ?> |
| 275 | 357 | <?php |
| 276 | 358 | if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
| 277 | - if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
|
| 278 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
| 359 | + if (!isset($_COOKIE['MapTypeId'])) { |
|
| 360 | + $MapBoxId = 'default'; |
|
| 361 | + } else { |
|
| 362 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
| 363 | + } |
|
| 279 | 364 | ?> |
| 280 | - <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
|
| 281 | - <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
|
| 282 | - <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
|
| 283 | - <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option> |
|
| 284 | - <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option> |
|
| 285 | - <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option> |
|
| 286 | - <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option> |
|
| 287 | - <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option> |
|
| 288 | - <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option> |
|
| 289 | - <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option> |
|
| 290 | - <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
|
| 291 | - <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
|
| 365 | + <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') { |
|
| 366 | + print ' selected'; |
|
| 367 | +} |
|
| 368 | +?>>Mapbox default</option> |
|
| 369 | + <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') { |
|
| 370 | + print ' selected'; |
|
| 371 | +} |
|
| 372 | +?>>Mapbox streets</option> |
|
| 373 | + <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') { |
|
| 374 | + print ' selected'; |
|
| 375 | +} |
|
| 376 | +?>>Mapbox light</option> |
|
| 377 | + <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') { |
|
| 378 | + print ' selected'; |
|
| 379 | +} |
|
| 380 | +?>>Mapbox dark</option> |
|
| 381 | + <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') { |
|
| 382 | + print ' selected'; |
|
| 383 | +} |
|
| 384 | +?>>Mapbox satellite</option> |
|
| 385 | + <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') { |
|
| 386 | + print ' selected'; |
|
| 387 | +} |
|
| 388 | +?>>Mapbox streets-satellite</option> |
|
| 389 | + <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') { |
|
| 390 | + print ' selected'; |
|
| 391 | +} |
|
| 392 | +?>>Mapbox streets-basic</option> |
|
| 393 | + <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') { |
|
| 394 | + print ' selected'; |
|
| 395 | +} |
|
| 396 | +?>>Mapbox comic</option> |
|
| 397 | + <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') { |
|
| 398 | + print ' selected'; |
|
| 399 | +} |
|
| 400 | +?>>Mapbox outdoors</option> |
|
| 401 | + <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') { |
|
| 402 | + print ' selected'; |
|
| 403 | +} |
|
| 404 | +?>>Mapbox pencil</option> |
|
| 405 | + <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') { |
|
| 406 | + print ' selected'; |
|
| 407 | +} |
|
| 408 | +?>>Mapbox pirates</option> |
|
| 409 | + <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') { |
|
| 410 | + print ' selected'; |
|
| 411 | +} |
|
| 412 | +?>>Mapbox emerald</option> |
|
| 292 | 413 | <?php |
| 293 | 414 | } |
| 294 | 415 | ?> |
| 295 | - <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
|
| 416 | + <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') { |
|
| 417 | + print ' selected'; |
|
| 418 | +} |
|
| 419 | +?>>OpenStreetMap</option> |
|
| 296 | 420 | </select> |
| 297 | 421 | </li> |
| 298 | 422 | <?php |
@@ -300,9 +424,18 @@ discard block |
||
| 300 | 424 | ?> |
| 301 | 425 | <li><?php echo _("Type of Terrain:"); ?> |
| 302 | 426 | <select class="selectpicker" onchange="terrainType(this);"> |
| 303 | - <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
|
| 304 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
| 305 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
| 427 | + <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') { |
|
| 428 | + print ' selected'; |
|
| 429 | +} |
|
| 430 | +?>>stk terrain</option> |
|
| 431 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') { |
|
| 432 | + print ' selected'; |
|
| 433 | +} |
|
| 434 | +?>>ellipsoid</option> |
|
| 435 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') { |
|
| 436 | + print ' selected'; |
|
| 437 | +} |
|
| 438 | +?>>vr terrain</option> |
|
| 306 | 439 | </select> |
| 307 | 440 | </li> |
| 308 | 441 | <?php |
@@ -312,18 +445,36 @@ discard block |
||
| 312 | 445 | if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
| 313 | 446 | ?> |
| 314 | 447 | |
| 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> |
|
| 316 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
| 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 | - <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> |
|
| 448 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') { |
|
| 449 | + print 'checked'; |
|
| 450 | +} |
|
| 451 | +?> ><?php echo _("Display flight info as popup"); ?></label></div></li> |
|
| 452 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) { |
|
| 453 | + print 'checked'; |
|
| 454 | +} |
|
| 455 | +?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
| 456 | + <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'])) { |
|
| 457 | + print 'checked'; |
|
| 458 | +} |
|
| 459 | +?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
| 460 | + <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)) { |
|
| 461 | + print 'checked'; |
|
| 462 | +} |
|
| 463 | +?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
| 319 | 464 | <?php |
| 320 | 465 | } |
| 321 | 466 | ?> |
| 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> |
|
| 467 | + <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') { |
|
| 468 | + print 'checked'; |
|
| 469 | +} |
|
| 470 | +?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
| 323 | 471 | <?php |
| 324 | 472 | if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
| 325 | 473 | ?> |
| 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> |
|
| 474 | + <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')) { |
|
| 475 | + print 'checked'; |
|
| 476 | +} |
|
| 477 | +?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
| 327 | 478 | <?php |
| 328 | 479 | } |
| 329 | 480 | if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
@@ -337,17 +488,25 @@ discard block |
||
| 337 | 488 | if (function_exists('array_column')) { |
| 338 | 489 | if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
| 339 | 490 | ?> |
| 340 | - <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> |
|
| 491 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
| 492 | + print 'checked'; |
|
| 493 | +} |
|
| 494 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 341 | 495 | <?php |
| 342 | 496 | } |
| 343 | 497 | } elseif (isset($globalSources)) { |
| 344 | 498 | $dispolar = false; |
| 345 | 499 | foreach ($globalSources as $testsource) { |
| 346 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
| 500 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) { |
|
| 501 | + $dispolar = true; |
|
| 502 | + } |
|
| 347 | 503 | } |
| 348 | 504 | if ($dispolar) { |
| 349 | 505 | ?> |
| 350 | - <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> |
|
| 506 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
| 507 | + print 'checked'; |
|
| 508 | +} |
|
| 509 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 351 | 510 | <?php |
| 352 | 511 | } |
| 353 | 512 | } |
@@ -359,12 +518,22 @@ discard block |
||
| 359 | 518 | <?php |
| 360 | 519 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 361 | 520 | ?> |
| 362 | - <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> |
|
| 521 | + <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') { |
|
| 522 | + print 'checked'; |
|
| 523 | +} |
|
| 524 | +?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
| 363 | 525 | <?php |
| 364 | 526 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
| 365 | 527 | ?> |
| 366 | 528 | <li><?php echo _("Aircraft icon color:"); ?> |
| 367 | - <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'; ?>"> |
|
| 529 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
| 530 | + print $_COOKIE['IconColor']; |
|
| 531 | +} elseif (isset($globalAircraftIconColor)) { |
|
| 532 | + print $globalAircraftIconColor; |
|
| 533 | +} else { |
|
| 534 | + print '1a3151'; |
|
| 535 | +} |
|
| 536 | +?>"> |
|
| 368 | 537 | </li> |
| 369 | 538 | <?php |
| 370 | 539 | } |
@@ -372,8 +541,22 @@ discard block |
||
| 372 | 541 | ?> |
| 373 | 542 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
| 374 | 543 | <div class="range"> |
| 375 | - <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'; ?>"> |
|
| 376 | - <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output> |
|
| 544 | + <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) { |
|
| 545 | + print $_COOKIE['AirportZoom']; |
|
| 546 | +} elseif (isset($globalAirportZoom)) { |
|
| 547 | + print $globalAirportZoom; |
|
| 548 | +} else { |
|
| 549 | + print '7'; |
|
| 550 | +} |
|
| 551 | +?>"> |
|
| 552 | + <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) { |
|
| 553 | + print $_COOKIE['AirportZoom']; |
|
| 554 | +} elseif (isset($globalAirportZoom)) { |
|
| 555 | + print $globalAirportZoom; |
|
| 556 | +} else { |
|
| 557 | + print '7'; |
|
| 558 | +} |
|
| 559 | +?></output> |
|
| 377 | 560 | </div> |
| 378 | 561 | </li> |
| 379 | 562 | <?php |
@@ -381,22 +564,46 @@ discard block |
||
| 381 | 564 | ?> |
| 382 | 565 | <li><?php echo _("Distance unit:"); ?> |
| 383 | 566 | <select class="selectpicker" onchange="unitdistance(this);"> |
| 384 | - <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option> |
|
| 385 | - <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option> |
|
| 386 | - <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option> |
|
| 567 | + <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
| 568 | + echo ' selected'; |
|
| 569 | +} |
|
| 570 | +?>>km</option> |
|
| 571 | + <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
| 572 | + echo ' selected'; |
|
| 573 | +} |
|
| 574 | +?>>nm</option> |
|
| 575 | + <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
| 576 | + echo ' selected'; |
|
| 577 | +} |
|
| 578 | +?>>mi</option> |
|
| 387 | 579 | </select> |
| 388 | 580 | </li> |
| 389 | 581 | <li><?php echo _("Altitude unit:"); ?> |
| 390 | 582 | <select class="selectpicker" onchange="unitaltitude(this);"> |
| 391 | - <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option> |
|
| 392 | - <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option> |
|
| 583 | + <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) { |
|
| 584 | + echo ' selected'; |
|
| 585 | +} |
|
| 586 | +?>>m</option> |
|
| 587 | + <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
|
| 588 | + echo ' selected'; |
|
| 589 | +} |
|
| 590 | +?>>feet</option> |
|
| 393 | 591 | </select> |
| 394 | 592 | </li> |
| 395 | 593 | <li><?php echo _("Speed unit:"); ?> |
| 396 | 594 | <select class="selectpicker" onchange="unitspeed(this);"> |
| 397 | - <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option> |
|
| 398 | - <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option> |
|
| 399 | - <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option> |
|
| 595 | + <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) { |
|
| 596 | + echo ' selected'; |
|
| 597 | +} |
|
| 598 | +?>>km/h</option> |
|
| 599 | + <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
|
| 600 | + echo ' selected'; |
|
| 601 | +} |
|
| 602 | +?>>mph</option> |
|
| 603 | + <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
|
| 604 | + echo ' selected'; |
|
| 605 | +} |
|
| 606 | +?>>knots</option> |
|
| 400 | 607 | </select> |
| 401 | 608 | </li> |
| 402 | 609 | |
@@ -411,9 +618,18 @@ discard block |
||
| 411 | 618 | <?php |
| 412 | 619 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
| 413 | 620 | ?> |
| 414 | - <?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 } ?> |
|
| 415 | - <?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 } ?> |
|
| 416 | - <?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 } ?> |
|
| 621 | + <?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'])) { |
|
| 622 | + print 'checked'; |
|
| 623 | +} |
|
| 624 | +?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
| 625 | + <?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'])) { |
|
| 626 | + print 'checked'; |
|
| 627 | +} |
|
| 628 | +?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
| 629 | + <?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'])) { |
|
| 630 | + print 'checked'; |
|
| 631 | +} |
|
| 632 | +?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
| 417 | 633 | <?php |
| 418 | 634 | } |
| 419 | 635 | ?> |
@@ -421,10 +637,16 @@ discard block |
||
| 421 | 637 | if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
| 422 | 638 | ?> |
| 423 | 639 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
| 424 | - <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> |
|
| 640 | + <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'])) { |
|
| 641 | + print 'checked'; |
|
| 642 | +} |
|
| 643 | +?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
| 425 | 644 | <?php } ?> |
| 426 | 645 | <?php if (isset($globalAPRS) && $globalAPRS) { ?> |
| 427 | - <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
| 646 | + <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) { |
|
| 647 | + print 'checked'; |
|
| 648 | +} |
|
| 649 | +?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
| 428 | 650 | <?php } ?> |
| 429 | 651 | <?php |
| 430 | 652 | } |
@@ -441,7 +663,9 @@ discard block |
||
| 441 | 663 | } |
| 442 | 664 | foreach($allairlinenames as $airline) { |
| 443 | 665 | $airline_name = $airline['airline_name']; |
| 444 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
| 666 | + if (strlen($airline_name) > 30) { |
|
| 667 | + $airline_name = substr($airline_name,0,30).'...'; |
|
| 668 | + } |
|
| 445 | 669 | if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
| 446 | 670 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
| 447 | 671 | } else { |
@@ -459,7 +683,10 @@ discard block |
||
| 459 | 683 | <li><?php echo _("Display alliance:"); ?> |
| 460 | 684 | <br/> |
| 461 | 685 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
| 462 | - <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
| 686 | + <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') { |
|
| 687 | + echo ' selected'; |
|
| 688 | +} |
|
| 689 | +?>><?php echo _("All"); ?></option> |
|
| 463 | 690 | <?php |
| 464 | 691 | foreach($allalliancenames as $alliance) { |
| 465 | 692 | $alliance_name = $alliance['alliance']; |
@@ -500,10 +727,22 @@ discard block |
||
| 500 | 727 | ?> |
| 501 | 728 | <li><?php echo _("Display airlines of type:"); ?><br/> |
| 502 | 729 | <select class="selectpicker" onchange="airlinestype(this);"> |
| 503 | - <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
| 504 | - <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option> |
|
| 505 | - <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option> |
|
| 506 | - <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option> |
|
| 730 | + <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') { |
|
| 731 | + echo ' selected'; |
|
| 732 | +} |
|
| 733 | +?>><?php echo _("All"); ?></option> |
|
| 734 | + <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') { |
|
| 735 | + echo ' selected'; |
|
| 736 | +} |
|
| 737 | +?>><?php echo _("Passenger"); ?></option> |
|
| 738 | + <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') { |
|
| 739 | + echo ' selected'; |
|
| 740 | +} |
|
| 741 | +?>><?php echo _("Cargo"); ?></option> |
|
| 742 | + <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') { |
|
| 743 | + echo ' selected'; |
|
| 744 | +} |
|
| 745 | +?>><?php echo _("Military"); ?></option> |
|
| 507 | 746 | </select> |
| 508 | 747 | </li> |
| 509 | 748 | <?php |
@@ -511,7 +750,10 @@ discard block |
||
| 511 | 750 | ?> |
| 512 | 751 | <li> |
| 513 | 752 | <?php echo _("Display flight with ident:"); ?> |
| 514 | - <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
|
| 753 | + <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) { |
|
| 754 | + print $_COOKIE['filter_ident']; |
|
| 755 | +} |
|
| 756 | +?>" /> |
|
| 515 | 757 | </li> |
| 516 | 758 | </ul> |
| 517 | 759 | </form> |
@@ -527,7 +769,10 @@ discard block |
||
| 527 | 769 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
| 528 | 770 | <form> |
| 529 | 771 | <ul> |
| 530 | - <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
| 772 | + <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') { |
|
| 773 | + print 'checked'; |
|
| 774 | +} |
|
| 775 | +?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
| 531 | 776 | <li><?php echo _("Type:"); ?> |
| 532 | 777 | <select class="selectpicker" multiple onchange="sattypes(this);"> |
| 533 | 778 | <?php |
@@ -535,25 +780,45 @@ discard block |
||
| 535 | 780 | $types = $Satellite->get_tle_types(); |
| 536 | 781 | foreach ($types as $type) { |
| 537 | 782 | $type_name = $type['tle_type']; |
| 538 | - if ($type_name == 'musson') $type_name = 'Russian LEO Navigation'; |
|
| 539 | - else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System'; |
|
| 540 | - else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System'; |
|
| 541 | - else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational'; |
|
| 542 | - else if ($type_name == 'gps-ops') $type_name = 'GPS Operational'; |
|
| 543 | - else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System'; |
|
| 544 | - else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System'; |
|
| 545 | - else if ($type_name == 'sarsat') $type_name = 'Search & Rescue'; |
|
| 546 | - else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring'; |
|
| 547 | - else if ($type_name == 'resource') $type_name = 'Earth Resources'; |
|
| 548 | - else if ($type_name == 'stations') $type_name = 'Space Stations'; |
|
| 549 | - else if ($type_name == 'geo') $type_name = 'Geostationary'; |
|
| 550 | - else if ($type_name == 'amateur') $type_name = 'Amateur Radio'; |
|
| 551 | - else if ($type_name == 'x-comm') $type_name = 'Experimental'; |
|
| 552 | - else if ($type_name == 'other-comm') $type_name = 'Other Comm'; |
|
| 553 | - else if ($type_name == 'science') $type_name = 'Space & Earth Science'; |
|
| 554 | - else if ($type_name == 'military') $type_name = 'Miscellaneous Military'; |
|
| 555 | - else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
|
| 556 | - else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
|
| 783 | + if ($type_name == 'musson') { |
|
| 784 | + $type_name = 'Russian LEO Navigation'; |
|
| 785 | + } else if ($type_name == 'nnss') { |
|
| 786 | + $type_name = 'Navi Navigation Satellite System'; |
|
| 787 | + } else if ($type_name == 'sbas') { |
|
| 788 | + $type_name = 'Satellite-Based Augmentation System'; |
|
| 789 | + } else if ($type_name == 'glo-ops') { |
|
| 790 | + $type_name = 'Glonass Operational'; |
|
| 791 | + } else if ($type_name == 'gps-ops') { |
|
| 792 | + $type_name = 'GPS Operational'; |
|
| 793 | + } else if ($type_name == 'argos') { |
|
| 794 | + $type_name = 'ARGOS Data Collection System'; |
|
| 795 | + } else if ($type_name == 'tdrss') { |
|
| 796 | + $type_name = 'Tracking and Data Relay Satellite System'; |
|
| 797 | + } else if ($type_name == 'sarsat') { |
|
| 798 | + $type_name = 'Search & Rescue'; |
|
| 799 | + } else if ($type_name == 'dmc') { |
|
| 800 | + $type_name = 'Disaster Monitoring'; |
|
| 801 | + } else if ($type_name == 'resource') { |
|
| 802 | + $type_name = 'Earth Resources'; |
|
| 803 | + } else if ($type_name == 'stations') { |
|
| 804 | + $type_name = 'Space Stations'; |
|
| 805 | + } else if ($type_name == 'geo') { |
|
| 806 | + $type_name = 'Geostationary'; |
|
| 807 | + } else if ($type_name == 'amateur') { |
|
| 808 | + $type_name = 'Amateur Radio'; |
|
| 809 | + } else if ($type_name == 'x-comm') { |
|
| 810 | + $type_name = 'Experimental'; |
|
| 811 | + } else if ($type_name == 'other-comm') { |
|
| 812 | + $type_name = 'Other Comm'; |
|
| 813 | + } else if ($type_name == 'science') { |
|
| 814 | + $type_name = 'Space & Earth Science'; |
|
| 815 | + } else if ($type_name == 'military') { |
|
| 816 | + $type_name = 'Miscellaneous Military'; |
|
| 817 | + } else if ($type_name == 'radar') { |
|
| 818 | + $type_name = 'Radar Calibration'; |
|
| 819 | + } else if ($type_name == 'tle-new') { |
|
| 820 | + $type_name = 'Last 30 days launches'; |
|
| 821 | + } |
|
| 557 | 822 | |
| 558 | 823 | if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
| 559 | 824 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
@@ -24,13 +24,21 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | print '<div class="select-item"><form action="'.$globalURL.'/airline" method="post"><select name="airline_type" class="selectpicker" data-live-search="true">'; |
| 26 | 26 | print '<option value="all"'; |
| 27 | - if ($airline_type == 'all') print 'selected="selected" '; |
|
| 27 | + if ($airline_type == 'all') { |
|
| 28 | + print 'selected="selected" '; |
|
| 29 | + } |
|
| 28 | 30 | print '>'._("All").'</option><option value="passenger"'; |
| 29 | - if ($airline_type == 'passenger') print 'selected="selected" '; |
|
| 31 | + if ($airline_type == 'passenger') { |
|
| 32 | + print 'selected="selected" '; |
|
| 33 | + } |
|
| 30 | 34 | print '>'._("Passenger").'</option><option value="cargo"'; |
| 31 | - if ($airline_type == 'cargo') print 'selected="selected" '; |
|
| 35 | + if ($airline_type == 'cargo') { |
|
| 36 | + print 'selected="selected" '; |
|
| 37 | + } |
|
| 32 | 38 | print '>'._("Cargo").'</option><option value="military"'; |
| 33 | - if ($airline_type == 'military') print 'selected="selected" '; |
|
| 39 | + if ($airline_type == 'military') { |
|
| 40 | + print 'selected="selected" '; |
|
| 41 | + } |
|
| 34 | 42 | print '>'._("Military").'</option></select>'; |
| 35 | 43 | print '<button type="submit"><i class="fa fa-angle-double-right"></i></button></form></div>'; |
| 36 | 44 | |
@@ -57,7 +65,9 @@ discard block |
||
| 57 | 65 | $firstLetter = mb_strtoupper(mb_substr($value['airline_name'], 0, 1),'UTF-8'); |
| 58 | 66 | if($previous !== $firstLetter) |
| 59 | 67 | { |
| 60 | - if ($previous !== null) print ' | '; |
|
| 68 | + if ($previous !== null) { |
|
| 69 | + print ' | '; |
|
| 70 | + } |
|
| 61 | 71 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
| 62 | 72 | } |
| 63 | 73 | $previous = $firstLetter; |
@@ -70,7 +80,9 @@ discard block |
||
| 70 | 80 | { |
| 71 | 81 | if($previous !== $firstLetter) |
| 72 | 82 | { |
| 73 | - if ($previous !== null) print '</div>'; |
|
| 83 | + if ($previous !== null) { |
|
| 84 | + print '</div>'; |
|
| 85 | + } |
|
| 74 | 86 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
| 75 | 87 | } |
| 76 | 88 | $previous = $firstLetter; |
@@ -82,10 +94,14 @@ discard block |
||
| 82 | 94 | } elseif (@getimagesize('images/airlines/'.$value['airline_icao'].'.png') || @getimagesize($globalURL.'/images/airlines/'.$value['airline_icao'].'.png')) |
| 83 | 95 | { |
| 84 | 96 | print '<img src="'.$globalURL.'/images/airlines/'.$value['airline_icao'].'.png" alt="'._("Click to see airline activity").'" title="'._("Click to see airline activity").'" /> '; |
| 85 | - if (isset($value['ban_eu']) && $value['ban_eu'] == 1) print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> '; |
|
| 97 | + if (isset($value['ban_eu']) && $value['ban_eu'] == 1) { |
|
| 98 | + print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> '; |
|
| 99 | + } |
|
| 86 | 100 | } else { |
| 87 | 101 | print $value['airline_name']; |
| 88 | - if (isset($value['ban_eu']) && $value['ban_eu'] == 1) print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> '; |
|
| 102 | + if (isset($value['ban_eu']) && $value['ban_eu'] == 1) { |
|
| 103 | + print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> '; |
|
| 104 | + } |
|
| 89 | 105 | } |
| 90 | 106 | print '</a>'; |
| 91 | 107 | print '</div>'; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | print '<div class="column">'; |
| 16 | 16 | print '<h1>'._("Airlines").'</h1>'; |
| 17 | 17 | if (isset($_POST['airline_type'])) { |
| 18 | - $airline_type = filter_input(INPUT_POST,'airline_type',FILTER_SANITIZE_STRING); |
|
| 18 | + $airline_type = filter_input(INPUT_POST, 'airline_type', FILTER_SANITIZE_STRING); |
|
| 19 | 19 | //$airline_names = $Spotter->getAllAirlineNames($airline_type); |
| 20 | 20 | } else { |
| 21 | 21 | //$airline_names = $Spotter->getAllAirlineNames(); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $Stats = new Stats(); |
| 38 | 38 | if (isset($_POST['airline_type'])) |
| 39 | 39 | { |
| 40 | - $airline_type = filter_input(INPUT_POST,'airline_type',FILTER_SANITIZE_STRING); |
|
| 40 | + $airline_type = filter_input(INPUT_POST, 'airline_type', FILTER_SANITIZE_STRING); |
|
| 41 | 41 | //$airline_names = $Stats->getAllAirlineNames($airline_type); |
| 42 | 42 | $airline_names = $Spotter->getAllAirlineNames($airline_type); |
| 43 | 43 | } else { |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | $previous = null; |
| 52 | 52 | print '<div class="alphabet-legend">'; |
| 53 | - foreach($airline_names as $value) |
|
| 53 | + foreach ($airline_names as $value) |
|
| 54 | 54 | { |
| 55 | 55 | //echo $value['airline_name']."\n"; |
| 56 | 56 | //echo mb_substr($value['airline_name'],0,1).' - '.$value['airline_name']."\n"; |
| 57 | - $firstLetter = mb_strtoupper(mb_substr($value['airline_name'], 0, 1),'UTF-8'); |
|
| 58 | - if($previous !== $firstLetter) |
|
| 57 | + $firstLetter = mb_strtoupper(mb_substr($value['airline_name'], 0, 1), 'UTF-8'); |
|
| 58 | + if ($previous !== $firstLetter) |
|
| 59 | 59 | { |
| 60 | 60 | if ($previous !== null) print ' | '; |
| 61 | 61 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
@@ -64,11 +64,11 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | print '</div>'; |
| 66 | 66 | $previous = null; |
| 67 | - foreach($airline_names as $value) { |
|
| 67 | + foreach ($airline_names as $value) { |
|
| 68 | 68 | $firstLetter = strtoupper(substr($value['airline_name'], 0, 1)); |
| 69 | 69 | if ($firstLetter != "") |
| 70 | 70 | { |
| 71 | - if($previous !== $firstLetter) |
|
| 71 | + if ($previous !== $firstLetter) |
|
| 72 | 72 | { |
| 73 | 73 | if ($previous !== null) print '</div>'; |
| 74 | 74 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $limit_start = 0; |
| 15 | 15 | $limit_end = 25; |
| 16 | 16 | $absolute_difference = 25; |
| 17 | - } else { |
|
| 17 | + } else { |
|
| 18 | 18 | $limit_explode = explode(",", $_GET['limit']); |
| 19 | 19 | $limit_start = $limit_explode[0]; |
| 20 | 20 | $limit_end = $limit_explode[1]; |
@@ -38,7 +38,9 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | if (isset($spotter_array[0]['airline_name']) && isset($spotter_array[0]['airline_icao'])) { |
| 40 | 40 | $title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
| 41 | - } else $title = ''; |
|
| 41 | + } else { |
|
| 42 | + $title = ''; |
|
| 43 | + } |
|
| 42 | 44 | require_once('header.php'); |
| 43 | 45 | |
| 44 | 46 | print '<div class="select-item">'; |
@@ -47,7 +49,9 @@ discard block |
||
| 47 | 49 | print '<option></option>'; |
| 48 | 50 | $Stats = new Stats(); |
| 49 | 51 | $airline_names = $Stats->getAllAirlineNames(); |
| 50 | - if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
|
| 52 | + if (empty($airline_names)) { |
|
| 53 | + $airline_names = $Spotter->getAllAirlineNames(); |
|
| 54 | + } |
|
| 51 | 55 | foreach($airline_names as $airline_name) |
| 52 | 56 | { |
| 53 | 57 | if($_GET['airline'] == $airline_name['airline_icao']) |
@@ -76,10 +80,16 @@ discard block |
||
| 76 | 80 | print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['airline_name'].'</div>'; |
| 77 | 81 | print '<div><span class="label">'._("Country").'</span>'.$spotter_array[0]['airline_country'].'</div>'; |
| 78 | 82 | print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['airline_icao'].'</div>'; |
| 79 | - if (isset($spotter_array[0]['airline_iata'])) print '<div><span class="label">'._("IATA").'</span>'.$spotter_array[0]['airline_iata'].'</div>'; |
|
| 80 | - if (isset($spotter_array[0]['airline_callsign'])) print '<div><span class="label">'._("Callsign").'</span>'.$spotter_array[0]['airline_callsign'].'</div>'; |
|
| 83 | + if (isset($spotter_array[0]['airline_iata'])) { |
|
| 84 | + print '<div><span class="label">'._("IATA").'</span>'.$spotter_array[0]['airline_iata'].'</div>'; |
|
| 85 | + } |
|
| 86 | + if (isset($spotter_array[0]['airline_callsign'])) { |
|
| 87 | + print '<div><span class="label">'._("Callsign").'</span>'.$spotter_array[0]['airline_callsign'].'</div>'; |
|
| 88 | + } |
|
| 81 | 89 | print '<div><span class="label">'._("Type").'</span>'.ucwords($spotter_array[0]['airline_type']).'</div>'; |
| 82 | - if (isset($spotter_array[0]['ban_eu']) && $spotter_array[0]['ban_eu'] == 1) print '<div><img src="'.$globalURL.'/images/baneu.png" alt="'._("This airline is banned in Europe").'" title="'._("This airline is banned in Europe").'" /></div>'; |
|
| 90 | + if (isset($spotter_array[0]['ban_eu']) && $spotter_array[0]['ban_eu'] == 1) { |
|
| 91 | + print '<div><img src="'.$globalURL.'/images/baneu.png" alt="'._("This airline is banned in Europe").'" title="'._("This airline is banned in Europe").'" /></div>'; |
|
| 92 | + } |
|
| 83 | 93 | print '</div>'; |
| 84 | 94 | } else { |
| 85 | 95 | print '<div class="alert alert-warning">'._("This special airline profile shows all flights that do <u>not</u> have a airline associated with them.").'</div>'; |
@@ -4,17 +4,17 @@ discard block |
||
| 4 | 4 | require_once('require/class.Stats.php'); |
| 5 | 5 | require_once('require/class.Language.php'); |
| 6 | 6 | |
| 7 | -if (!isset($_GET['airline'])){ |
|
| 7 | +if (!isset($_GET['airline'])) { |
|
| 8 | 8 | header('Location: '.$globalURL.'/airline'); |
| 9 | -} else{ |
|
| 9 | +} else { |
|
| 10 | 10 | $Spotter = new Spotter(); |
| 11 | 11 | //calculuation for the pagination |
| 12 | - if(!isset($_GET['limit']) || $_GET['limit'] == "") |
|
| 12 | + if (!isset($_GET['limit']) || $_GET['limit'] == "") |
|
| 13 | 13 | { |
| 14 | 14 | $limit_start = 0; |
| 15 | 15 | $limit_end = 25; |
| 16 | 16 | $absolute_difference = 25; |
| 17 | - } else { |
|
| 17 | + } else { |
|
| 18 | 18 | $limit_explode = explode(",", $_GET['limit']); |
| 19 | 19 | $limit_start = $limit_explode[0]; |
| 20 | 20 | $limit_end = $limit_explode[1]; |
@@ -28,16 +28,16 @@ discard block |
||
| 28 | 28 | $limit_previous_1 = $limit_start - $absolute_difference; |
| 29 | 29 | $limit_previous_2 = $limit_end - $absolute_difference; |
| 30 | 30 | |
| 31 | - $airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 31 | + $airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 32 | 32 | $page_url = $globalURL.'/airline/'.$airline; |
| 33 | 33 | |
| 34 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 35 | - $spotter_array = $Spotter->getSpotterDataByAirline($_GET['airline'],$limit_start.",".$absolute_difference, $sort); |
|
| 34 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 35 | + $spotter_array = $Spotter->getSpotterDataByAirline($_GET['airline'], $limit_start.",".$absolute_difference, $sort); |
|
| 36 | 36 | |
| 37 | 37 | if (!empty($spotter_array)) |
| 38 | 38 | { |
| 39 | 39 | if (isset($spotter_array[0]['airline_name']) && isset($spotter_array[0]['airline_icao'])) { |
| 40 | - $title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
|
| 40 | + $title = sprintf(_("Detailed View for %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']); |
|
| 41 | 41 | } else $title = ''; |
| 42 | 42 | require_once('header.php'); |
| 43 | 43 | |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | $Stats = new Stats(); |
| 49 | 49 | $airline_names = $Stats->getAllAirlineNames(); |
| 50 | 50 | if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
| 51 | - foreach($airline_names as $airline_name) |
|
| 51 | + foreach ($airline_names as $airline_name) |
|
| 52 | 52 | { |
| 53 | - if($_GET['airline'] == $airline_name['airline_icao']) |
|
| 53 | + if ($_GET['airline'] == $airline_name['airline_icao']) |
|
| 54 | 54 | { |
| 55 | 55 | print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>'; |
| 56 | 56 | } else { |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | include('airline-sub-menu.php'); |
| 89 | 89 | print '<div class="table column">'; |
| 90 | 90 | if (isset($spotter_array[0]['airline_name'])) { |
| 91 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>'; |
|
| 91 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>'; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | include('table-output.php'); |
@@ -8,18 +8,18 @@ discard block |
||
| 8 | 8 | class update_schema { |
| 9 | 9 | |
| 10 | 10 | public static function update_schedule() { |
| 11 | - $Connection = new Connection(); |
|
| 12 | - $Schedule = new Schedule(); |
|
| 13 | - $query = "SELECT * FROM schedule"; |
|
| 14 | - try { |
|
| 15 | - $sth = $Connection->db->prepare($query); |
|
| 11 | + $Connection = new Connection(); |
|
| 12 | + $Schedule = new Schedule(); |
|
| 13 | + $query = "SELECT * FROM schedule"; |
|
| 14 | + try { |
|
| 15 | + $sth = $Connection->db->prepare($query); |
|
| 16 | 16 | $sth->execute(); |
| 17 | - } catch(PDOException $e) { |
|
| 17 | + } catch(PDOException $e) { |
|
| 18 | 18 | return "error : ".$e->getMessage()."\n"; |
| 19 | - } |
|
| 20 | - while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 21 | - $Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']); |
|
| 22 | - } |
|
| 19 | + } |
|
| 20 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 21 | + $Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | 24 | } |
| 25 | 25 | /* |
@@ -43,198 +43,198 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | */ |
| 45 | 45 | private static function update_from_1() { |
| 46 | - $Connection = new Connection(); |
|
| 47 | - // Add new column to routes table |
|
| 48 | - //$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME"; |
|
| 46 | + $Connection = new Connection(); |
|
| 47 | + // Add new column to routes table |
|
| 48 | + //$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME"; |
|
| 49 | 49 | $query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10) NULL , ADD `ToAirport_Time` VARCHAR(10) NULL , ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP, ADD `date_modified` timestamp NULL, ADD `date_lastseen` timestamp NULL"; |
| 50 | - try { |
|
| 51 | - $sth = $Connection->db->prepare($query); |
|
| 52 | - $sth->execute(); |
|
| 53 | - } catch(PDOException $e) { |
|
| 54 | - return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
|
| 55 | - } |
|
| 56 | - // Copy schedules data to routes table |
|
| 57 | - self::update_schedule(); |
|
| 58 | - // Delete schedule table |
|
| 50 | + try { |
|
| 51 | + $sth = $Connection->db->prepare($query); |
|
| 52 | + $sth->execute(); |
|
| 53 | + } catch(PDOException $e) { |
|
| 54 | + return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
|
| 55 | + } |
|
| 56 | + // Copy schedules data to routes table |
|
| 57 | + self::update_schedule(); |
|
| 58 | + // Delete schedule table |
|
| 59 | 59 | $query = "DROP TABLE `schedule`"; |
| 60 | - try { |
|
| 61 | - $sth = $Connection->db->prepare($query); |
|
| 62 | - $sth->execute(); |
|
| 63 | - } catch(PDOException $e) { |
|
| 64 | - return "error (delete schedule table) : ".$e->getMessage()."\n"; |
|
| 65 | - } |
|
| 66 | - // Add source column |
|
| 67 | - $query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL"; |
|
| 68 | - try { |
|
| 69 | - $sth = $Connection->db->prepare($query); |
|
| 70 | - $sth->execute(); |
|
| 71 | - } catch(PDOException $e) { |
|
| 72 | - return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n"; |
|
| 73 | - } |
|
| 60 | + try { |
|
| 61 | + $sth = $Connection->db->prepare($query); |
|
| 62 | + $sth->execute(); |
|
| 63 | + } catch(PDOException $e) { |
|
| 64 | + return "error (delete schedule table) : ".$e->getMessage()."\n"; |
|
| 65 | + } |
|
| 66 | + // Add source column |
|
| 67 | + $query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL"; |
|
| 68 | + try { |
|
| 69 | + $sth = $Connection->db->prepare($query); |
|
| 70 | + $sth->execute(); |
|
| 71 | + } catch(PDOException $e) { |
|
| 72 | + return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n"; |
|
| 73 | + } |
|
| 74 | 74 | // Delete unused column |
| 75 | 75 | $query = "ALTER TABLE `aircraft_modes` DROP `SerialNo`, DROP `OperatorFlagCode`, DROP `Manufacturer`, DROP `Type`, DROP `FirstRegDate`, DROP `CurrentRegDate`, DROP `Country`, DROP `PreviousID`, DROP `DeRegDate`, DROP `Status`, DROP `PopularName`, DROP `GenericName`, DROP `AircraftClass`, DROP `Engines`, DROP `OwnershipStatus`, DROP `RegisteredOwners`, DROP `MTOW`, DROP `TotalHours`, DROP `YearBuilt`, DROP `CofACategory`, DROP `CofAExpiry`, DROP `UserNotes`, DROP `Interested`, DROP `UserTag`, DROP `InfoUrl`, DROP `PictureUrl1`, DROP `PictureUrl2`, DROP `PictureUrl3`, DROP `UserBool1`, DROP `UserBool2`, DROP `UserBool3`, DROP `UserBool4`, DROP `UserBool5`, DROP `UserString1`, DROP `UserString2`, DROP `UserString3`, DROP `UserString4`, DROP `UserString5`, DROP `UserInt1`, DROP `UserInt2`, DROP `UserInt3`, DROP `UserInt4`, DROP `UserInt5`"; |
| 76 | - try { |
|
| 77 | - $sth = $Connection->db->prepare($query); |
|
| 78 | - $sth->execute(); |
|
| 79 | - } catch(PDOException $e) { |
|
| 80 | - return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n"; |
|
| 81 | - } |
|
| 76 | + try { |
|
| 77 | + $sth = $Connection->db->prepare($query); |
|
| 78 | + $sth->execute(); |
|
| 79 | + } catch(PDOException $e) { |
|
| 80 | + return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n"; |
|
| 81 | + } |
|
| 82 | 82 | // Add ModeS column |
| 83 | 83 | $query = "ALTER TABLE `spotter_output` ADD `ModeS` VARCHAR(255) NULL"; |
| 84 | - try { |
|
| 85 | - $sth = $Connection->db->prepare($query); |
|
| 86 | - $sth->execute(); |
|
| 87 | - } catch(PDOException $e) { |
|
| 88 | - return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n"; |
|
| 89 | - } |
|
| 84 | + try { |
|
| 85 | + $sth = $Connection->db->prepare($query); |
|
| 86 | + $sth->execute(); |
|
| 87 | + } catch(PDOException $e) { |
|
| 88 | + return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n"; |
|
| 89 | + } |
|
| 90 | 90 | $query = "ALTER TABLE `spotter_live` ADD `ModeS` VARCHAR(255)"; |
| 91 | - try { |
|
| 92 | - $sth = $Connection->db->prepare($query); |
|
| 93 | - $sth->execute(); |
|
| 94 | - } catch(PDOException $e) { |
|
| 95 | - return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n"; |
|
| 96 | - } |
|
| 97 | - // Add auto_increment for aircraft_modes |
|
| 98 | - $query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT"; |
|
| 99 | - try { |
|
| 100 | - $sth = $Connection->db->prepare($query); |
|
| 101 | - $sth->execute(); |
|
| 102 | - } catch(PDOException $e) { |
|
| 103 | - return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n"; |
|
| 104 | - } |
|
| 105 | - $error = ''; |
|
| 91 | + try { |
|
| 92 | + $sth = $Connection->db->prepare($query); |
|
| 93 | + $sth->execute(); |
|
| 94 | + } catch(PDOException $e) { |
|
| 95 | + return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n"; |
|
| 96 | + } |
|
| 97 | + // Add auto_increment for aircraft_modes |
|
| 98 | + $query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT"; |
|
| 99 | + try { |
|
| 100 | + $sth = $Connection->db->prepare($query); |
|
| 101 | + $sth->execute(); |
|
| 102 | + } catch(PDOException $e) { |
|
| 103 | + return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n"; |
|
| 104 | + } |
|
| 105 | + $error = ''; |
|
| 106 | 106 | $error .= create_db::import_file('../db/acars_live.sql'); |
| 107 | 107 | $error .= create_db::import_file('../db/config.sql'); |
| 108 | 108 | // Update schema_version to 2 |
| 109 | 109 | $query = "UPDATE `config` SET `value` = '2' WHERE `name` = 'schema_version'"; |
| 110 | - try { |
|
| 111 | - $sth = $Connection->db->prepare($query); |
|
| 112 | - $sth->execute(); |
|
| 113 | - } catch(PDOException $e) { |
|
| 114 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 115 | - } |
|
| 110 | + try { |
|
| 111 | + $sth = $Connection->db->prepare($query); |
|
| 112 | + $sth->execute(); |
|
| 113 | + } catch(PDOException $e) { |
|
| 114 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 115 | + } |
|
| 116 | 116 | return $error; |
| 117 | - } |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | 119 | private static function update_from_2() { |
| 120 | - $Connection = new Connection(); |
|
| 121 | - // Add new column decode to acars_live table |
|
| 120 | + $Connection = new Connection(); |
|
| 121 | + // Add new column decode to acars_live table |
|
| 122 | 122 | $query = "ALTER TABLE `acars_live` ADD `decode` TEXT"; |
| 123 | - try { |
|
| 124 | - $sth = $Connection->db->prepare($query); |
|
| 125 | - $sth->execute(); |
|
| 126 | - } catch(PDOException $e) { |
|
| 127 | - return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
|
| 128 | - } |
|
| 129 | - $error = ''; |
|
| 130 | - // Create table acars_archive |
|
| 123 | + try { |
|
| 124 | + $sth = $Connection->db->prepare($query); |
|
| 125 | + $sth->execute(); |
|
| 126 | + } catch(PDOException $e) { |
|
| 127 | + return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
|
| 128 | + } |
|
| 129 | + $error = ''; |
|
| 130 | + // Create table acars_archive |
|
| 131 | 131 | $error .= create_db::import_file('../db/acars_archive.sql'); |
| 132 | 132 | // Update schema_version to 3 |
| 133 | 133 | $query = "UPDATE `config` SET `value` = '3' WHERE `name` = 'schema_version'"; |
| 134 | - try { |
|
| 135 | - $sth = $Connection->db->prepare($query); |
|
| 136 | - $sth->execute(); |
|
| 137 | - } catch(PDOException $e) { |
|
| 138 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 139 | - } |
|
| 134 | + try { |
|
| 135 | + $sth = $Connection->db->prepare($query); |
|
| 136 | + $sth->execute(); |
|
| 137 | + } catch(PDOException $e) { |
|
| 138 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 139 | + } |
|
| 140 | 140 | return $error; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | private static function update_from_3() { |
| 144 | - $Connection = new Connection(); |
|
| 145 | - // Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated |
|
| 144 | + $Connection = new Connection(); |
|
| 145 | + // Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated |
|
| 146 | 146 | $query = "ALTER TABLE `aircraft_modes` CHANGE `FirstCreated` `FirstCreated` timestamp DEFAULT CURRENT_TIMESTAMP"; |
| 147 | - try { |
|
| 148 | - $sth = $Connection->db->prepare($query); |
|
| 149 | - $sth->execute(); |
|
| 150 | - } catch(PDOException $e) { |
|
| 151 | - return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n"; |
|
| 152 | - } |
|
| 153 | - // Add image_source_website column to spotter_image |
|
| 147 | + try { |
|
| 148 | + $sth = $Connection->db->prepare($query); |
|
| 149 | + $sth->execute(); |
|
| 150 | + } catch(PDOException $e) { |
|
| 151 | + return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n"; |
|
| 152 | + } |
|
| 153 | + // Add image_source_website column to spotter_image |
|
| 154 | 154 | $query = "ALTER TABLE `spotter_image` ADD `image_source_website` VARCHAR(999) NULL"; |
| 155 | - try { |
|
| 156 | - $sth = $Connection->db->prepare($query); |
|
| 157 | - $sth->execute(); |
|
| 158 | - } catch(PDOException $e) { |
|
| 159 | - return "error (add new columns to spotter_image) : ".$e->getMessage()."\n"; |
|
| 160 | - } |
|
| 161 | - $error = ''; |
|
| 155 | + try { |
|
| 156 | + $sth = $Connection->db->prepare($query); |
|
| 157 | + $sth->execute(); |
|
| 158 | + } catch(PDOException $e) { |
|
| 159 | + return "error (add new columns to spotter_image) : ".$e->getMessage()."\n"; |
|
| 160 | + } |
|
| 161 | + $error = ''; |
|
| 162 | 162 | // Update schema_version to 4 |
| 163 | 163 | $query = "UPDATE `config` SET `value` = '4' WHERE `name` = 'schema_version'"; |
| 164 | - try { |
|
| 165 | - $sth = $Connection->db->prepare($query); |
|
| 166 | - $sth->execute(); |
|
| 167 | - } catch(PDOException $e) { |
|
| 168 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 169 | - } |
|
| 164 | + try { |
|
| 165 | + $sth = $Connection->db->prepare($query); |
|
| 166 | + $sth->execute(); |
|
| 167 | + } catch(PDOException $e) { |
|
| 168 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 169 | + } |
|
| 170 | 170 | return $error; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | private static function update_from_4() { |
| 174 | - $Connection = new Connection(); |
|
| 174 | + $Connection = new Connection(); |
|
| 175 | 175 | |
| 176 | - $error = ''; |
|
| 177 | - // Create table acars_label |
|
| 176 | + $error = ''; |
|
| 177 | + // Create table acars_label |
|
| 178 | 178 | $error .= create_db::import_file('../db/acars_label.sql'); |
| 179 | 179 | if ($error == '') { |
| 180 | - // Update schema_version to 5 |
|
| 181 | - $query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'"; |
|
| 182 | - try { |
|
| 183 | - $sth = $Connection->db->prepare($query); |
|
| 180 | + // Update schema_version to 5 |
|
| 181 | + $query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'"; |
|
| 182 | + try { |
|
| 183 | + $sth = $Connection->db->prepare($query); |
|
| 184 | 184 | $sth->execute(); |
| 185 | - } catch(PDOException $e) { |
|
| 185 | + } catch(PDOException $e) { |
|
| 186 | 186 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 187 | - } |
|
| 188 | - } |
|
| 187 | + } |
|
| 188 | + } |
|
| 189 | 189 | return $error; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | private static function update_from_5() { |
| 193 | - $Connection = new Connection(); |
|
| 194 | - // Add columns to translation |
|
| 193 | + $Connection = new Connection(); |
|
| 194 | + // Add columns to translation |
|
| 195 | 195 | $query = "ALTER TABLE `translation` ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP , ADD `date_modified` timestamp DEFAULT CURRENT_TIMESTAMP ;"; |
| 196 | - try { |
|
| 197 | - $sth = $Connection->db->prepare($query); |
|
| 198 | - $sth->execute(); |
|
| 199 | - } catch(PDOException $e) { |
|
| 200 | - return "error (add new columns to translation) : ".$e->getMessage()."\n"; |
|
| 201 | - } |
|
| 202 | - // Add aircraft_shadow column to aircraft |
|
| 203 | - $query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL"; |
|
| 204 | - try { |
|
| 205 | - $sth = $Connection->db->prepare($query); |
|
| 206 | - $sth->execute(); |
|
| 207 | - } catch(PDOException $e) { |
|
| 208 | - return "error (add new column to aircraft) : ".$e->getMessage()."\n"; |
|
| 209 | - } |
|
| 210 | - // Add aircraft_shadow column to spotter_live |
|
| 211 | - $query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL"; |
|
| 212 | - try { |
|
| 213 | - $sth = $Connection->db->prepare($query); |
|
| 214 | - $sth->execute(); |
|
| 215 | - } catch(PDOException $e) { |
|
| 216 | - return "error (add new column to spotter_live) : ".$e->getMessage()."\n"; |
|
| 217 | - } |
|
| 218 | - $error = ''; |
|
| 219 | - // Update table aircraft |
|
| 196 | + try { |
|
| 197 | + $sth = $Connection->db->prepare($query); |
|
| 198 | + $sth->execute(); |
|
| 199 | + } catch(PDOException $e) { |
|
| 200 | + return "error (add new columns to translation) : ".$e->getMessage()."\n"; |
|
| 201 | + } |
|
| 202 | + // Add aircraft_shadow column to aircraft |
|
| 203 | + $query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL"; |
|
| 204 | + try { |
|
| 205 | + $sth = $Connection->db->prepare($query); |
|
| 206 | + $sth->execute(); |
|
| 207 | + } catch(PDOException $e) { |
|
| 208 | + return "error (add new column to aircraft) : ".$e->getMessage()."\n"; |
|
| 209 | + } |
|
| 210 | + // Add aircraft_shadow column to spotter_live |
|
| 211 | + $query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL"; |
|
| 212 | + try { |
|
| 213 | + $sth = $Connection->db->prepare($query); |
|
| 214 | + $sth->execute(); |
|
| 215 | + } catch(PDOException $e) { |
|
| 216 | + return "error (add new column to spotter_live) : ".$e->getMessage()."\n"; |
|
| 217 | + } |
|
| 218 | + $error = ''; |
|
| 219 | + // Update table aircraft |
|
| 220 | 220 | $error .= create_db::import_file('../db/aircraft.sql'); |
| 221 | 221 | $error .= create_db::import_file('../db/spotter_archive.sql'); |
| 222 | 222 | |
| 223 | 223 | // Update schema_version to 6 |
| 224 | 224 | $query = "UPDATE `config` SET `value` = '6' WHERE `name` = 'schema_version'"; |
| 225 | - try { |
|
| 226 | - $sth = $Connection->db->prepare($query); |
|
| 227 | - $sth->execute(); |
|
| 228 | - } catch(PDOException $e) { |
|
| 229 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 230 | - } |
|
| 225 | + try { |
|
| 226 | + $sth = $Connection->db->prepare($query); |
|
| 227 | + $sth->execute(); |
|
| 228 | + } catch(PDOException $e) { |
|
| 229 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 230 | + } |
|
| 231 | 231 | return $error; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | private static function update_from_6() { |
| 235 | - $Connection = new Connection(); |
|
| 236 | - if (!$Connection->indexExists('spotter_output','flightaware_id')) { |
|
| 237 | - $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id); |
|
| 235 | + $Connection = new Connection(); |
|
| 236 | + if (!$Connection->indexExists('spotter_output','flightaware_id')) { |
|
| 237 | + $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id); |
|
| 238 | 238 | ALTER TABLE spotter_output ADD INDEX(date); |
| 239 | 239 | ALTER TABLE spotter_output ADD INDEX(ident); |
| 240 | 240 | ALTER TABLE spotter_live ADD INDEX(flightaware_id); |
@@ -247,147 +247,147 @@ discard block |
||
| 247 | 247 | ALTER TABLE aircraft ADD INDEX(icao); |
| 248 | 248 | ALTER TABLE airport ADD INDEX(icao); |
| 249 | 249 | ALTER TABLE translation ADD INDEX(Operator);"; |
| 250 | - try { |
|
| 251 | - $sth = $Connection->db->prepare($query); |
|
| 250 | + try { |
|
| 251 | + $sth = $Connection->db->prepare($query); |
|
| 252 | 252 | $sth->execute(); |
| 253 | - } catch(PDOException $e) { |
|
| 253 | + } catch(PDOException $e) { |
|
| 254 | 254 | return "error (add some indexes) : ".$e->getMessage()."\n"; |
| 255 | - } |
|
| 256 | - } |
|
| 257 | - $error = ''; |
|
| 258 | - // Update table countries |
|
| 259 | - if ($Connection->tableExists('airspace')) { |
|
| 260 | - $error .= update_db::update_countries(); |
|
| 261 | - if ($error != '') return $error; |
|
| 255 | + } |
|
| 256 | + } |
|
| 257 | + $error = ''; |
|
| 258 | + // Update table countries |
|
| 259 | + if ($Connection->tableExists('airspace')) { |
|
| 260 | + $error .= update_db::update_countries(); |
|
| 261 | + if ($error != '') return $error; |
|
| 262 | 262 | } |
| 263 | 263 | // Update schema_version to 7 |
| 264 | 264 | $query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'"; |
| 265 | - try { |
|
| 266 | - $sth = $Connection->db->prepare($query); |
|
| 267 | - $sth->execute(); |
|
| 268 | - } catch(PDOException $e) { |
|
| 269 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 270 | - } |
|
| 265 | + try { |
|
| 266 | + $sth = $Connection->db->prepare($query); |
|
| 267 | + $sth->execute(); |
|
| 268 | + } catch(PDOException $e) { |
|
| 269 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 270 | + } |
|
| 271 | 271 | return $error; |
| 272 | - } |
|
| 272 | + } |
|
| 273 | 273 | |
| 274 | 274 | private static function update_from_7() { |
| 275 | 275 | global $globalDBname, $globalDBdriver; |
| 276 | - $Connection = new Connection(); |
|
| 277 | - $query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
|
| 276 | + $Connection = new Connection(); |
|
| 277 | + $query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
|
| 278 | 278 | ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;"; |
| 279 | - try { |
|
| 280 | - $sth = $Connection->db->prepare($query); |
|
| 281 | - $sth->execute(); |
|
| 282 | - } catch(PDOException $e) { |
|
| 283 | - return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
|
| 284 | - } |
|
| 285 | - if ($globalDBdriver == 'mysql') { |
|
| 286 | - $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'"; |
|
| 287 | - try { |
|
| 288 | - $sth = $Connection->db->prepare($query); |
|
| 279 | + try { |
|
| 280 | + $sth = $Connection->db->prepare($query); |
|
| 281 | + $sth->execute(); |
|
| 282 | + } catch(PDOException $e) { |
|
| 283 | + return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
|
| 284 | + } |
|
| 285 | + if ($globalDBdriver == 'mysql') { |
|
| 286 | + $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'"; |
|
| 287 | + try { |
|
| 288 | + $sth = $Connection->db->prepare($query); |
|
| 289 | 289 | $sth->execute(); |
| 290 | - } catch(PDOException $e) { |
|
| 290 | + } catch(PDOException $e) { |
|
| 291 | 291 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
| 292 | - } |
|
| 293 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 294 | - if ($row['engine'] == 'ARCHIVE') { |
|
| 292 | + } |
|
| 293 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 294 | + if ($row['engine'] == 'ARCHIVE') { |
|
| 295 | 295 | $query = "CREATE TABLE copy LIKE spotter_archive; |
| 296 | 296 | ALTER TABLE copy ENGINE=ARCHIVE; |
| 297 | 297 | ALTER TABLE copy ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
| 298 | 298 | INSERT INTO copy SELECT *, '' as pilot_name, '' as pilot_id FROM spotter_archive ORDER BY `spotter_archive_id`; |
| 299 | 299 | DROP TABLE spotter_archive; |
| 300 | 300 | RENAME TABLE copy TO spotter_archive;"; |
| 301 | - } else { |
|
| 302 | - $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
| 303 | - } |
|
| 304 | - } else { |
|
| 305 | - $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
| 306 | - } |
|
| 307 | - try { |
|
| 308 | - $sth = $Connection->db->prepare($query); |
|
| 309 | - $sth->execute(); |
|
| 310 | - } catch(PDOException $e) { |
|
| 311 | - return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n"; |
|
| 312 | - } |
|
| 301 | + } else { |
|
| 302 | + $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
| 303 | + } |
|
| 304 | + } else { |
|
| 305 | + $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
| 306 | + } |
|
| 307 | + try { |
|
| 308 | + $sth = $Connection->db->prepare($query); |
|
| 309 | + $sth->execute(); |
|
| 310 | + } catch(PDOException $e) { |
|
| 311 | + return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n"; |
|
| 312 | + } |
|
| 313 | 313 | |
| 314 | - $error = ''; |
|
| 315 | - // Update table aircraft |
|
| 314 | + $error = ''; |
|
| 315 | + // Update table aircraft |
|
| 316 | 316 | $error .= create_db::import_file('../db/source_location.sql'); |
| 317 | 317 | if ($error != '') return $error; |
| 318 | 318 | // Update schema_version to 6 |
| 319 | 319 | $query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'"; |
| 320 | - try { |
|
| 321 | - $sth = $Connection->db->prepare($query); |
|
| 322 | - $sth->execute(); |
|
| 323 | - } catch(PDOException $e) { |
|
| 324 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 325 | - } |
|
| 320 | + try { |
|
| 321 | + $sth = $Connection->db->prepare($query); |
|
| 322 | + $sth->execute(); |
|
| 323 | + } catch(PDOException $e) { |
|
| 324 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 325 | + } |
|
| 326 | 326 | return $error; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | private static function update_from_8() { |
| 330 | - $Connection = new Connection(); |
|
| 331 | - $error = ''; |
|
| 332 | - // Update table aircraft |
|
| 330 | + $Connection = new Connection(); |
|
| 331 | + $error = ''; |
|
| 332 | + // Update table aircraft |
|
| 333 | 333 | $error .= create_db::import_file('../db/notam.sql'); |
| 334 | 334 | if ($error != '') return $error; |
| 335 | 335 | $query = "DELETE FROM config WHERE name = 'last_update_db'; |
| 336 | 336 | INSERT INTO config (name,value) VALUES ('last_update_db',NOW()); |
| 337 | 337 | DELETE FROM config WHERE name = 'last_update_notam_db'; |
| 338 | 338 | INSERT INTO config (name,value) VALUES ('last_update_notam_db',NOW());"; |
| 339 | - try { |
|
| 340 | - $sth = $Connection->db->prepare($query); |
|
| 341 | - $sth->execute(); |
|
| 342 | - } catch(PDOException $e) { |
|
| 343 | - return "error (insert last_update values) : ".$e->getMessage()."\n"; |
|
| 344 | - } |
|
| 339 | + try { |
|
| 340 | + $sth = $Connection->db->prepare($query); |
|
| 341 | + $sth->execute(); |
|
| 342 | + } catch(PDOException $e) { |
|
| 343 | + return "error (insert last_update values) : ".$e->getMessage()."\n"; |
|
| 344 | + } |
|
| 345 | 345 | $query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'"; |
| 346 | - try { |
|
| 347 | - $sth = $Connection->db->prepare($query); |
|
| 348 | - $sth->execute(); |
|
| 349 | - } catch(PDOException $e) { |
|
| 350 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 351 | - } |
|
| 346 | + try { |
|
| 347 | + $sth = $Connection->db->prepare($query); |
|
| 348 | + $sth->execute(); |
|
| 349 | + } catch(PDOException $e) { |
|
| 350 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 351 | + } |
|
| 352 | 352 | return $error; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | private static function update_from_9() { |
| 356 | - $Connection = new Connection(); |
|
| 357 | - $query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL; |
|
| 356 | + $Connection = new Connection(); |
|
| 357 | + $query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL; |
|
| 358 | 358 | ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;"; |
| 359 | - try { |
|
| 360 | - $sth = $Connection->db->prepare($query); |
|
| 361 | - $sth->execute(); |
|
| 362 | - } catch(PDOException $e) { |
|
| 363 | - return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
|
| 364 | - } |
|
| 359 | + try { |
|
| 360 | + $sth = $Connection->db->prepare($query); |
|
| 361 | + $sth->execute(); |
|
| 362 | + } catch(PDOException $e) { |
|
| 363 | + return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
|
| 364 | + } |
|
| 365 | 365 | $error = ''; |
| 366 | - // Update table atc |
|
| 366 | + // Update table atc |
|
| 367 | 367 | $error .= create_db::import_file('../db/atc.sql'); |
| 368 | 368 | if ($error != '') return $error; |
| 369 | 369 | |
| 370 | 370 | $query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'"; |
| 371 | - try { |
|
| 372 | - $sth = $Connection->db->prepare($query); |
|
| 373 | - $sth->execute(); |
|
| 374 | - } catch(PDOException $e) { |
|
| 375 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 376 | - } |
|
| 371 | + try { |
|
| 372 | + $sth = $Connection->db->prepare($query); |
|
| 373 | + $sth->execute(); |
|
| 374 | + } catch(PDOException $e) { |
|
| 375 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 376 | + } |
|
| 377 | 377 | return $error; |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | private static function update_from_10() { |
| 381 | - $Connection = new Connection(); |
|
| 382 | - $query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; |
|
| 383 | - try { |
|
| 384 | - $sth = $Connection->db->prepare($query); |
|
| 385 | - $sth->execute(); |
|
| 386 | - } catch(PDOException $e) { |
|
| 387 | - return "error (add new enum to ATC table) : ".$e->getMessage()."\n"; |
|
| 388 | - } |
|
| 381 | + $Connection = new Connection(); |
|
| 382 | + $query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; |
|
| 383 | + try { |
|
| 384 | + $sth = $Connection->db->prepare($query); |
|
| 385 | + $sth->execute(); |
|
| 386 | + } catch(PDOException $e) { |
|
| 387 | + return "error (add new enum to ATC table) : ".$e->getMessage()."\n"; |
|
| 388 | + } |
|
| 389 | 389 | $error = ''; |
| 390 | - // Add tables |
|
| 390 | + // Add tables |
|
| 391 | 391 | $error .= create_db::import_file('../db/aircraft_owner.sql'); |
| 392 | 392 | if ($error != '') return $error; |
| 393 | 393 | $error .= create_db::import_file('../db/metar.sql'); |
@@ -398,76 +398,76 @@ discard block |
||
| 398 | 398 | if ($error != '') return $error; |
| 399 | 399 | |
| 400 | 400 | $query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'"; |
| 401 | - try { |
|
| 402 | - $sth = $Connection->db->prepare($query); |
|
| 403 | - $sth->execute(); |
|
| 404 | - } catch(PDOException $e) { |
|
| 405 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 406 | - } |
|
| 401 | + try { |
|
| 402 | + $sth = $Connection->db->prepare($query); |
|
| 403 | + $sth->execute(); |
|
| 404 | + } catch(PDOException $e) { |
|
| 405 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 406 | + } |
|
| 407 | 407 | return $error; |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | private static function update_from_11() { |
| 411 | 411 | global $globalDBdriver, $globalDBname; |
| 412 | - $Connection = new Connection(); |
|
| 413 | - $query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)"; |
|
| 414 | - try { |
|
| 415 | - $sth = $Connection->db->prepare($query); |
|
| 416 | - $sth->execute(); |
|
| 417 | - } catch(PDOException $e) { |
|
| 418 | - return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n"; |
|
| 419 | - } |
|
| 420 | - $query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 421 | - try { |
|
| 422 | - $sth = $Connection->db->prepare($query); |
|
| 423 | - $sth->execute(); |
|
| 424 | - } catch(PDOException $e) { |
|
| 425 | - return "error (format_source column to spotter_live) : ".$e->getMessage()."\n"; |
|
| 426 | - } |
|
| 427 | - if ($globalDBdriver == 'mysql') { |
|
| 428 | - $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'"; |
|
| 429 | - try { |
|
| 430 | - $sth = $Connection->db->prepare($query); |
|
| 412 | + $Connection = new Connection(); |
|
| 413 | + $query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)"; |
|
| 414 | + try { |
|
| 415 | + $sth = $Connection->db->prepare($query); |
|
| 431 | 416 | $sth->execute(); |
| 432 | - } catch(PDOException $e) { |
|
| 417 | + } catch(PDOException $e) { |
|
| 418 | + return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n"; |
|
| 419 | + } |
|
| 420 | + $query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 421 | + try { |
|
| 422 | + $sth = $Connection->db->prepare($query); |
|
| 423 | + $sth->execute(); |
|
| 424 | + } catch(PDOException $e) { |
|
| 425 | + return "error (format_source column to spotter_live) : ".$e->getMessage()."\n"; |
|
| 426 | + } |
|
| 427 | + if ($globalDBdriver == 'mysql') { |
|
| 428 | + $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'"; |
|
| 429 | + try { |
|
| 430 | + $sth = $Connection->db->prepare($query); |
|
| 431 | + $sth->execute(); |
|
| 432 | + } catch(PDOException $e) { |
|
| 433 | 433 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
| 434 | - } |
|
| 435 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 436 | - if ($row['engine'] == 'ARCHIVE') { |
|
| 434 | + } |
|
| 435 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 436 | + if ($row['engine'] == 'ARCHIVE') { |
|
| 437 | 437 | $query = "CREATE TABLE copy LIKE spotter_archive; |
| 438 | 438 | ALTER TABLE copy ENGINE=ARCHIVE; |
| 439 | 439 | ALTER TABLE copy ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE; |
| 440 | 440 | INSERT INTO copy SELECT *, '' as verticalrate, '' as format_source, '0' as ground FROM spotter_archive ORDER BY `spotter_archive_id`; |
| 441 | 441 | DROP TABLE spotter_archive; |
| 442 | 442 | RENAME TABLE copy TO spotter_archive;"; |
| 443 | - } else { |
|
| 444 | - $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 445 | - } |
|
| 446 | - } else { |
|
| 447 | - $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 448 | - } |
|
| 449 | - try { |
|
| 450 | - $sth = $Connection->db->prepare($query); |
|
| 451 | - $sth->execute(); |
|
| 452 | - } catch(PDOException $e) { |
|
| 453 | - return "error (add columns to spotter_archive) : ".$e->getMessage()."\n"; |
|
| 454 | - } |
|
| 443 | + } else { |
|
| 444 | + $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 445 | + } |
|
| 446 | + } else { |
|
| 447 | + $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 448 | + } |
|
| 449 | + try { |
|
| 450 | + $sth = $Connection->db->prepare($query); |
|
| 451 | + $sth->execute(); |
|
| 452 | + } catch(PDOException $e) { |
|
| 453 | + return "error (add columns to spotter_archive) : ".$e->getMessage()."\n"; |
|
| 454 | + } |
|
| 455 | 455 | |
| 456 | 456 | $error = ''; |
| 457 | 457 | |
| 458 | 458 | $query = "UPDATE `config` SET `value` = '12' WHERE `name` = 'schema_version'"; |
| 459 | - try { |
|
| 460 | - $sth = $Connection->db->prepare($query); |
|
| 461 | - $sth->execute(); |
|
| 462 | - } catch(PDOException $e) { |
|
| 463 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 464 | - } |
|
| 459 | + try { |
|
| 460 | + $sth = $Connection->db->prepare($query); |
|
| 461 | + $sth->execute(); |
|
| 462 | + } catch(PDOException $e) { |
|
| 463 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 464 | + } |
|
| 465 | 465 | return $error; |
| 466 | 466 | } |
| 467 | 467 | private static function update_from_12() { |
| 468 | - $Connection = new Connection(); |
|
| 468 | + $Connection = new Connection(); |
|
| 469 | 469 | $error = ''; |
| 470 | - // Add tables |
|
| 470 | + // Add tables |
|
| 471 | 471 | $error .= create_db::import_file('../db/stats.sql'); |
| 472 | 472 | if ($error != '') return $error; |
| 473 | 473 | $error .= create_db::import_file('../db/stats_aircraft.sql'); |
@@ -484,166 +484,166 @@ discard block |
||
| 484 | 484 | if ($error != '') return $error; |
| 485 | 485 | |
| 486 | 486 | $query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'"; |
| 487 | - try { |
|
| 488 | - $sth = $Connection->db->prepare($query); |
|
| 489 | - $sth->execute(); |
|
| 490 | - } catch(PDOException $e) { |
|
| 491 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 492 | - } |
|
| 487 | + try { |
|
| 488 | + $sth = $Connection->db->prepare($query); |
|
| 489 | + $sth->execute(); |
|
| 490 | + } catch(PDOException $e) { |
|
| 491 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 492 | + } |
|
| 493 | 493 | return $error; |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | private static function update_from_13() { |
| 497 | - $Connection = new Connection(); |
|
| 498 | - if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) { |
|
| 499 | - $query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)"; |
|
| 497 | + $Connection = new Connection(); |
|
| 498 | + if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) { |
|
| 499 | + $query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)"; |
|
| 500 | 500 | try { |
| 501 | 501 | $sth = $Connection->db->prepare($query); |
| 502 | 502 | $sth->execute(); |
| 503 | - } catch(PDOException $e) { |
|
| 503 | + } catch(PDOException $e) { |
|
| 504 | 504 | return "error (update spotter_archive_output) : ".$e->getMessage()."\n"; |
| 505 | - } |
|
| 505 | + } |
|
| 506 | 506 | } |
| 507 | - $error = ''; |
|
| 507 | + $error = ''; |
|
| 508 | 508 | $query = "UPDATE `config` SET `value` = '14' WHERE `name` = 'schema_version'"; |
| 509 | - try { |
|
| 510 | - $sth = $Connection->db->prepare($query); |
|
| 511 | - $sth->execute(); |
|
| 512 | - } catch(PDOException $e) { |
|
| 513 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 514 | - } |
|
| 509 | + try { |
|
| 510 | + $sth = $Connection->db->prepare($query); |
|
| 511 | + $sth->execute(); |
|
| 512 | + } catch(PDOException $e) { |
|
| 513 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 514 | + } |
|
| 515 | 515 | return $error; |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | private static function update_from_14() { |
| 519 | - $Connection = new Connection(); |
|
| 519 | + $Connection = new Connection(); |
|
| 520 | 520 | $error = ''; |
| 521 | - // Add tables |
|
| 522 | - if (!$Connection->tableExists('stats_flight')) { |
|
| 521 | + // Add tables |
|
| 522 | + if (!$Connection->tableExists('stats_flight')) { |
|
| 523 | 523 | $error .= create_db::import_file('../db/stats_flight.sql'); |
| 524 | 524 | if ($error != '') return $error; |
| 525 | 525 | } |
| 526 | 526 | $query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'"; |
| 527 | - try { |
|
| 528 | - $sth = $Connection->db->prepare($query); |
|
| 529 | - $sth->execute(); |
|
| 530 | - } catch(PDOException $e) { |
|
| 531 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 532 | - } |
|
| 527 | + try { |
|
| 528 | + $sth = $Connection->db->prepare($query); |
|
| 529 | + $sth->execute(); |
|
| 530 | + } catch(PDOException $e) { |
|
| 531 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 532 | + } |
|
| 533 | 533 | return $error; |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | |
| 537 | 537 | private static function update_from_15() { |
| 538 | - $Connection = new Connection(); |
|
| 538 | + $Connection = new Connection(); |
|
| 539 | 539 | $error = ''; |
| 540 | - // Add tables |
|
| 541 | - $query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"; |
|
| 542 | - try { |
|
| 543 | - $sth = $Connection->db->prepare($query); |
|
| 544 | - $sth->execute(); |
|
| 545 | - } catch(PDOException $e) { |
|
| 546 | - return "error (update stats) : ".$e->getMessage()."\n"; |
|
| 547 | - } |
|
| 540 | + // Add tables |
|
| 541 | + $query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"; |
|
| 542 | + try { |
|
| 543 | + $sth = $Connection->db->prepare($query); |
|
| 544 | + $sth->execute(); |
|
| 545 | + } catch(PDOException $e) { |
|
| 546 | + return "error (update stats) : ".$e->getMessage()."\n"; |
|
| 547 | + } |
|
| 548 | 548 | if ($error != '') return $error; |
| 549 | 549 | $query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'"; |
| 550 | - try { |
|
| 551 | - $sth = $Connection->db->prepare($query); |
|
| 552 | - $sth->execute(); |
|
| 553 | - } catch(PDOException $e) { |
|
| 554 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 555 | - } |
|
| 550 | + try { |
|
| 551 | + $sth = $Connection->db->prepare($query); |
|
| 552 | + $sth->execute(); |
|
| 553 | + } catch(PDOException $e) { |
|
| 554 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 555 | + } |
|
| 556 | 556 | return $error; |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | private static function update_from_16() { |
| 560 | - $Connection = new Connection(); |
|
| 560 | + $Connection = new Connection(); |
|
| 561 | 561 | $error = ''; |
| 562 | - // Add tables |
|
| 563 | - if (!$Connection->tableExists('stats_registration')) { |
|
| 562 | + // Add tables |
|
| 563 | + if (!$Connection->tableExists('stats_registration')) { |
|
| 564 | 564 | $error .= create_db::import_file('../db/stats_registration.sql'); |
| 565 | 565 | } |
| 566 | - if (!$Connection->tableExists('stats_callsign')) { |
|
| 566 | + if (!$Connection->tableExists('stats_callsign')) { |
|
| 567 | 567 | $error .= create_db::import_file('../db/stats_callsign.sql'); |
| 568 | 568 | } |
| 569 | 569 | if ($error != '') return $error; |
| 570 | 570 | $query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'"; |
| 571 | - try { |
|
| 572 | - $sth = $Connection->db->prepare($query); |
|
| 573 | - $sth->execute(); |
|
| 574 | - } catch(PDOException $e) { |
|
| 575 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 576 | - } |
|
| 571 | + try { |
|
| 572 | + $sth = $Connection->db->prepare($query); |
|
| 573 | + $sth->execute(); |
|
| 574 | + } catch(PDOException $e) { |
|
| 575 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 576 | + } |
|
| 577 | 577 | return $error; |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | private static function update_from_17() { |
| 581 | - $Connection = new Connection(); |
|
| 581 | + $Connection = new Connection(); |
|
| 582 | 582 | $error = ''; |
| 583 | - // Add tables |
|
| 584 | - if (!$Connection->tableExists('stats_country')) { |
|
| 583 | + // Add tables |
|
| 584 | + if (!$Connection->tableExists('stats_country')) { |
|
| 585 | 585 | $error .= create_db::import_file('../db/stats_country.sql'); |
| 586 | 586 | } |
| 587 | 587 | if ($error != '') return $error; |
| 588 | 588 | $query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'"; |
| 589 | - try { |
|
| 590 | - $sth = $Connection->db->prepare($query); |
|
| 591 | - $sth->execute(); |
|
| 592 | - } catch(PDOException $e) { |
|
| 593 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 594 | - } |
|
| 589 | + try { |
|
| 590 | + $sth = $Connection->db->prepare($query); |
|
| 591 | + $sth->execute(); |
|
| 592 | + } catch(PDOException $e) { |
|
| 593 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 594 | + } |
|
| 595 | 595 | return $error; |
| 596 | 596 | } |
| 597 | 597 | private static function update_from_18() { |
| 598 | - $Connection = new Connection(); |
|
| 598 | + $Connection = new Connection(); |
|
| 599 | 599 | $error = ''; |
| 600 | - // Modify stats_airport table |
|
| 601 | - if (!$Connection->checkColumnName('stats_airport','airport_name')) { |
|
| 602 | - $query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)"; |
|
| 603 | - try { |
|
| 604 | - $sth = $Connection->db->prepare($query); |
|
| 605 | - $sth->execute(); |
|
| 606 | - } catch(PDOException $e) { |
|
| 607 | - return "error (update stats) : ".$e->getMessage()."\n"; |
|
| 608 | - } |
|
| 609 | - } |
|
| 600 | + // Modify stats_airport table |
|
| 601 | + if (!$Connection->checkColumnName('stats_airport','airport_name')) { |
|
| 602 | + $query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)"; |
|
| 603 | + try { |
|
| 604 | + $sth = $Connection->db->prepare($query); |
|
| 605 | + $sth->execute(); |
|
| 606 | + } catch(PDOException $e) { |
|
| 607 | + return "error (update stats) : ".$e->getMessage()."\n"; |
|
| 608 | + } |
|
| 609 | + } |
|
| 610 | 610 | if ($error != '') return $error; |
| 611 | 611 | $query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'"; |
| 612 | - try { |
|
| 613 | - $sth = $Connection->db->prepare($query); |
|
| 614 | - $sth->execute(); |
|
| 615 | - } catch(PDOException $e) { |
|
| 616 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 617 | - } |
|
| 612 | + try { |
|
| 613 | + $sth = $Connection->db->prepare($query); |
|
| 614 | + $sth->execute(); |
|
| 615 | + } catch(PDOException $e) { |
|
| 616 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 617 | + } |
|
| 618 | 618 | return $error; |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | private static function update_from_19() { |
| 622 | - $Connection = new Connection(); |
|
| 622 | + $Connection = new Connection(); |
|
| 623 | 623 | $error = ''; |
| 624 | - // Update airport table |
|
| 624 | + // Update airport table |
|
| 625 | 625 | $error .= create_db::import_file('../db/airport.sql'); |
| 626 | 626 | if ($error != '') return 'Import airport.sql : '.$error; |
| 627 | 627 | // Remove primary key on Spotter_Archive |
| 628 | 628 | $query = "alter table spotter_archive drop spotter_archive_id"; |
| 629 | - try { |
|
| 630 | - $sth = $Connection->db->prepare($query); |
|
| 631 | - $sth->execute(); |
|
| 632 | - } catch(PDOException $e) { |
|
| 633 | - return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n"; |
|
| 634 | - } |
|
| 629 | + try { |
|
| 630 | + $sth = $Connection->db->prepare($query); |
|
| 631 | + $sth->execute(); |
|
| 632 | + } catch(PDOException $e) { |
|
| 633 | + return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n"; |
|
| 634 | + } |
|
| 635 | 635 | $query = "alter table spotter_archive add spotter_archive_id INT(11)"; |
| 636 | - try { |
|
| 637 | - $sth = $Connection->db->prepare($query); |
|
| 638 | - $sth->execute(); |
|
| 639 | - } catch(PDOException $e) { |
|
| 640 | - return "error (add id again on spotter_archive) : ".$e->getMessage()."\n"; |
|
| 641 | - } |
|
| 636 | + try { |
|
| 637 | + $sth = $Connection->db->prepare($query); |
|
| 638 | + $sth->execute(); |
|
| 639 | + } catch(PDOException $e) { |
|
| 640 | + return "error (add id again on spotter_archive) : ".$e->getMessage()."\n"; |
|
| 641 | + } |
|
| 642 | 642 | if (!$Connection->checkColumnName('spotter_archive','over_country')) { |
| 643 | 643 | // Add column over_country |
| 644 | - $query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
|
| 644 | + $query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
|
| 645 | 645 | try { |
| 646 | - $sth = $Connection->db->prepare($query); |
|
| 646 | + $sth = $Connection->db->prepare($query); |
|
| 647 | 647 | $sth->execute(); |
| 648 | 648 | } catch(PDOException $e) { |
| 649 | 649 | return "error (add over_country) : ".$e->getMessage()."\n"; |
@@ -651,9 +651,9 @@ discard block |
||
| 651 | 651 | } |
| 652 | 652 | if (!$Connection->checkColumnName('spotter_live','over_country')) { |
| 653 | 653 | // Add column over_country |
| 654 | - $query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
|
| 654 | + $query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
|
| 655 | 655 | try { |
| 656 | - $sth = $Connection->db->prepare($query); |
|
| 656 | + $sth = $Connection->db->prepare($query); |
|
| 657 | 657 | $sth->execute(); |
| 658 | 658 | } catch(PDOException $e) { |
| 659 | 659 | return "error (add over_country) : ".$e->getMessage()."\n"; |
@@ -661,74 +661,74 @@ discard block |
||
| 661 | 661 | } |
| 662 | 662 | if (!$Connection->checkColumnName('spotter_output','source_name')) { |
| 663 | 663 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
| 664 | - $query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
| 664 | + $query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
| 665 | 665 | try { |
| 666 | 666 | $sth = $Connection->db->prepare($query); |
| 667 | 667 | $sth->execute(); |
| 668 | 668 | } catch(PDOException $e) { |
| 669 | 669 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 670 | - } |
|
| 671 | - } |
|
| 670 | + } |
|
| 671 | + } |
|
| 672 | 672 | if (!$Connection->checkColumnName('spotter_live','source_name')) { |
| 673 | 673 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
| 674 | - $query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
| 674 | + $query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
| 675 | 675 | try { |
| 676 | 676 | $sth = $Connection->db->prepare($query); |
| 677 | 677 | $sth->execute(); |
| 678 | 678 | } catch(PDOException $e) { |
| 679 | 679 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 680 | - } |
|
| 681 | - } |
|
| 680 | + } |
|
| 681 | + } |
|
| 682 | 682 | if (!$Connection->checkColumnName('spotter_archive_output','source_name')) { |
| 683 | 683 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
| 684 | - $query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
| 684 | + $query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
| 685 | 685 | try { |
| 686 | 686 | $sth = $Connection->db->prepare($query); |
| 687 | 687 | $sth->execute(); |
| 688 | 688 | } catch(PDOException $e) { |
| 689 | 689 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 690 | - } |
|
| 691 | - } |
|
| 690 | + } |
|
| 691 | + } |
|
| 692 | 692 | if (!$Connection->checkColumnName('spotter_archive','source_name')) { |
| 693 | 693 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
| 694 | - $query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;"; |
|
| 694 | + $query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;"; |
|
| 695 | 695 | try { |
| 696 | 696 | $sth = $Connection->db->prepare($query); |
| 697 | 697 | $sth->execute(); |
| 698 | 698 | } catch(PDOException $e) { |
| 699 | 699 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 700 | - } |
|
| 701 | - } |
|
| 700 | + } |
|
| 701 | + } |
|
| 702 | 702 | if ($error != '') return $error; |
| 703 | 703 | $query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'"; |
| 704 | - try { |
|
| 705 | - $sth = $Connection->db->prepare($query); |
|
| 706 | - $sth->execute(); |
|
| 707 | - } catch(PDOException $e) { |
|
| 708 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 709 | - } |
|
| 704 | + try { |
|
| 705 | + $sth = $Connection->db->prepare($query); |
|
| 706 | + $sth->execute(); |
|
| 707 | + } catch(PDOException $e) { |
|
| 708 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 709 | + } |
|
| 710 | 710 | return $error; |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | private static function update_from_20() { |
| 714 | 714 | global $globalIVAO, $globalVATSIM, $globalphpVMS; |
| 715 | - $Connection = new Connection(); |
|
| 715 | + $Connection = new Connection(); |
|
| 716 | 716 | $error = ''; |
| 717 | - // Update airline table |
|
| 718 | - if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
|
| 717 | + // Update airline table |
|
| 718 | + if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
|
| 719 | 719 | $error .= create_db::import_file('../db/airlines.sql'); |
| 720 | 720 | if ($error != '') return 'Import airlines.sql : '.$error; |
| 721 | 721 | } |
| 722 | 722 | if (!$Connection->checkColumnName('aircraft_modes','type_flight')) { |
| 723 | 723 | // Add column over_country |
| 724 | - $query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;"; |
|
| 725 | - try { |
|
| 724 | + $query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;"; |
|
| 725 | + try { |
|
| 726 | 726 | $sth = $Connection->db->prepare($query); |
| 727 | 727 | $sth->execute(); |
| 728 | 728 | } catch(PDOException $e) { |
| 729 | 729 | return "error (add over_country) : ".$e->getMessage()."\n"; |
| 730 | - } |
|
| 731 | - } |
|
| 730 | + } |
|
| 731 | + } |
|
| 732 | 732 | if ($error != '') return $error; |
| 733 | 733 | /* |
| 734 | 734 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
@@ -738,12 +738,12 @@ discard block |
||
| 738 | 738 | } |
| 739 | 739 | */ |
| 740 | 740 | $query = "UPDATE `config` SET `value` = '21' WHERE `name` = 'schema_version'"; |
| 741 | - try { |
|
| 742 | - $sth = $Connection->db->prepare($query); |
|
| 743 | - $sth->execute(); |
|
| 744 | - } catch(PDOException $e) { |
|
| 745 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 746 | - } |
|
| 741 | + try { |
|
| 742 | + $sth = $Connection->db->prepare($query); |
|
| 743 | + $sth->execute(); |
|
| 744 | + } catch(PDOException $e) { |
|
| 745 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 746 | + } |
|
| 747 | 747 | return $error; |
| 748 | 748 | } |
| 749 | 749 | |
@@ -762,35 +762,35 @@ discard block |
||
| 762 | 762 | if ($error != '') return $error; |
| 763 | 763 | } |
| 764 | 764 | $query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'"; |
| 765 | - try { |
|
| 766 | - $sth = $Connection->db->prepare($query); |
|
| 767 | - $sth->execute(); |
|
| 768 | - } catch(PDOException $e) { |
|
| 769 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 770 | - } |
|
| 765 | + try { |
|
| 766 | + $sth = $Connection->db->prepare($query); |
|
| 767 | + $sth->execute(); |
|
| 768 | + } catch(PDOException $e) { |
|
| 769 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 770 | + } |
|
| 771 | 771 | return $error; |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | private static function update_from_22() { |
| 775 | 775 | global $globalDBdriver; |
| 776 | - $Connection = new Connection(); |
|
| 776 | + $Connection = new Connection(); |
|
| 777 | 777 | $error = ''; |
| 778 | 778 | // Add table stats polar |
| 779 | - if (!$Connection->tableExists('stats_source')) { |
|
| 779 | + if (!$Connection->tableExists('stats_source')) { |
|
| 780 | 780 | if ($globalDBdriver == 'mysql') { |
| 781 | - $error .= create_db::import_file('../db/stats_source.sql'); |
|
| 781 | + $error .= create_db::import_file('../db/stats_source.sql'); |
|
| 782 | 782 | } else { |
| 783 | 783 | $error .= create_db::import_file('../db/pgsql/stats_source.sql'); |
| 784 | 784 | } |
| 785 | 785 | if ($error != '') return $error; |
| 786 | 786 | } |
| 787 | 787 | $query = "UPDATE config SET value = '23' WHERE name = 'schema_version'"; |
| 788 | - try { |
|
| 789 | - $sth = $Connection->db->prepare($query); |
|
| 790 | - $sth->execute(); |
|
| 791 | - } catch(PDOException $e) { |
|
| 792 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 793 | - } |
|
| 788 | + try { |
|
| 789 | + $sth = $Connection->db->prepare($query); |
|
| 790 | + $sth->execute(); |
|
| 791 | + } catch(PDOException $e) { |
|
| 792 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 793 | + } |
|
| 794 | 794 | return $error; |
| 795 | 795 | } |
| 796 | 796 | |
@@ -821,14 +821,14 @@ discard block |
||
| 821 | 821 | } |
| 822 | 822 | if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) { |
| 823 | 823 | // Add aircraft_manufacturer to stats_aircraft |
| 824 | - $query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL"; |
|
| 824 | + $query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL"; |
|
| 825 | 825 | try { |
| 826 | 826 | $sth = $Connection->db->prepare($query); |
| 827 | 827 | $sth->execute(); |
| 828 | 828 | } catch(PDOException $e) { |
| 829 | 829 | return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n"; |
| 830 | - } |
|
| 831 | - } |
|
| 830 | + } |
|
| 831 | + } |
|
| 832 | 832 | |
| 833 | 833 | $query = "UPDATE config SET value = '24' WHERE name = 'schema_version'"; |
| 834 | 834 | try { |
@@ -1176,7 +1176,7 @@ discard block |
||
| 1176 | 1176 | } catch(PDOException $e) { |
| 1177 | 1177 | return "error (add index latitude,longitude on spotter_live) : ".$e->getMessage()."\n"; |
| 1178 | 1178 | } |
| 1179 | - } |
|
| 1179 | + } |
|
| 1180 | 1180 | if (!$Connection->checkColumnName('aircraft','mfr')) { |
| 1181 | 1181 | // Add mfr to aircraft |
| 1182 | 1182 | $query = "ALTER TABLE aircraft ADD mfr VARCHAR(255) NULL"; |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | } catch(PDOException $e) { |
| 1251 | 1251 | return "error (add index ref on notam) : ".$e->getMessage()."\n"; |
| 1252 | 1252 | } |
| 1253 | - } |
|
| 1253 | + } |
|
| 1254 | 1254 | if (!$Connection->indexExists('accidents','registration_idx')) { |
| 1255 | 1255 | // Add index key |
| 1256 | 1256 | $query = "create index registration_idx on accidents (registration)"; |
@@ -1260,7 +1260,7 @@ discard block |
||
| 1260 | 1260 | } catch(PDOException $e) { |
| 1261 | 1261 | return "error (add index registration on accidents) : ".$e->getMessage()."\n"; |
| 1262 | 1262 | } |
| 1263 | - } |
|
| 1263 | + } |
|
| 1264 | 1264 | if (!$Connection->indexExists('accidents','rdts')) { |
| 1265 | 1265 | // Add index key |
| 1266 | 1266 | $query = "create index rdts on accidents (registration,date,type,source)"; |
@@ -1270,7 +1270,7 @@ discard block |
||
| 1270 | 1270 | } catch(PDOException $e) { |
| 1271 | 1271 | return "error (add index registration, date, type & source on accidents) : ".$e->getMessage()."\n"; |
| 1272 | 1272 | } |
| 1273 | - } |
|
| 1273 | + } |
|
| 1274 | 1274 | |
| 1275 | 1275 | $query = "UPDATE config SET value = '31' WHERE name = 'schema_version'"; |
| 1276 | 1276 | try { |
@@ -1384,161 +1384,161 @@ discard block |
||
| 1384 | 1384 | } |
| 1385 | 1385 | |
| 1386 | 1386 | |
| 1387 | - public static function check_version($update = false) { |
|
| 1388 | - global $globalDBname; |
|
| 1389 | - $version = 0; |
|
| 1390 | - $Connection = new Connection(); |
|
| 1391 | - if ($Connection->tableExists('aircraft')) { |
|
| 1392 | - if (!$Connection->tableExists('config')) { |
|
| 1393 | - $version = '1'; |
|
| 1394 | - if ($update) return self::update_from_1(); |
|
| 1395 | - else return $version; |
|
| 1387 | + public static function check_version($update = false) { |
|
| 1388 | + global $globalDBname; |
|
| 1389 | + $version = 0; |
|
| 1390 | + $Connection = new Connection(); |
|
| 1391 | + if ($Connection->tableExists('aircraft')) { |
|
| 1392 | + if (!$Connection->tableExists('config')) { |
|
| 1393 | + $version = '1'; |
|
| 1394 | + if ($update) return self::update_from_1(); |
|
| 1395 | + else return $version; |
|
| 1396 | 1396 | } else { |
| 1397 | - $Connection = new Connection(); |
|
| 1398 | - $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
|
| 1399 | - try { |
|
| 1400 | - $sth = $Connection->db->prepare($query); |
|
| 1401 | - $sth->execute(); |
|
| 1402 | - } catch(PDOException $e) { |
|
| 1397 | + $Connection = new Connection(); |
|
| 1398 | + $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
|
| 1399 | + try { |
|
| 1400 | + $sth = $Connection->db->prepare($query); |
|
| 1401 | + $sth->execute(); |
|
| 1402 | + } catch(PDOException $e) { |
|
| 1403 | 1403 | return "error : ".$e->getMessage()."\n"; |
| 1404 | - } |
|
| 1405 | - $result = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1406 | - if ($update) { |
|
| 1407 | - if ($result['value'] == '2') { |
|
| 1408 | - $error = self::update_from_2(); |
|
| 1409 | - if ($error != '') return $error; |
|
| 1410 | - else return self::check_version(true); |
|
| 1411 | - } elseif ($result['value'] == '3') { |
|
| 1412 | - $error = self::update_from_3(); |
|
| 1413 | - if ($error != '') return $error; |
|
| 1414 | - else return self::check_version(true); |
|
| 1415 | - } elseif ($result['value'] == '4') { |
|
| 1416 | - $error = self::update_from_4(); |
|
| 1417 | - if ($error != '') return $error; |
|
| 1418 | - else return self::check_version(true); |
|
| 1419 | - } elseif ($result['value'] == '5') { |
|
| 1420 | - $error = self::update_from_5(); |
|
| 1421 | - if ($error != '') return $error; |
|
| 1422 | - else return self::check_version(true); |
|
| 1423 | - } elseif ($result['value'] == '6') { |
|
| 1424 | - $error = self::update_from_6(); |
|
| 1425 | - if ($error != '') return $error; |
|
| 1426 | - else return self::check_version(true); |
|
| 1427 | - } elseif ($result['value'] == '7') { |
|
| 1428 | - $error = self::update_from_7(); |
|
| 1429 | - if ($error != '') return $error; |
|
| 1430 | - else return self::check_version(true); |
|
| 1431 | - } elseif ($result['value'] == '8') { |
|
| 1432 | - $error = self::update_from_8(); |
|
| 1433 | - if ($error != '') return $error; |
|
| 1434 | - else return self::check_version(true); |
|
| 1435 | - } elseif ($result['value'] == '9') { |
|
| 1436 | - $error = self::update_from_9(); |
|
| 1437 | - if ($error != '') return $error; |
|
| 1438 | - else return self::check_version(true); |
|
| 1439 | - } elseif ($result['value'] == '10') { |
|
| 1440 | - $error = self::update_from_10(); |
|
| 1441 | - if ($error != '') return $error; |
|
| 1442 | - else return self::check_version(true); |
|
| 1443 | - } elseif ($result['value'] == '11') { |
|
| 1444 | - $error = self::update_from_11(); |
|
| 1445 | - if ($error != '') return $error; |
|
| 1446 | - else return self::check_version(true); |
|
| 1447 | - } elseif ($result['value'] == '12') { |
|
| 1448 | - $error = self::update_from_12(); |
|
| 1449 | - if ($error != '') return $error; |
|
| 1450 | - else return self::check_version(true); |
|
| 1451 | - } elseif ($result['value'] == '13') { |
|
| 1452 | - $error = self::update_from_13(); |
|
| 1453 | - if ($error != '') return $error; |
|
| 1454 | - else return self::check_version(true); |
|
| 1455 | - } elseif ($result['value'] == '14') { |
|
| 1456 | - $error = self::update_from_14(); |
|
| 1457 | - if ($error != '') return $error; |
|
| 1458 | - else return self::check_version(true); |
|
| 1459 | - } elseif ($result['value'] == '15') { |
|
| 1460 | - $error = self::update_from_15(); |
|
| 1461 | - if ($error != '') return $error; |
|
| 1462 | - else return self::check_version(true); |
|
| 1463 | - } elseif ($result['value'] == '16') { |
|
| 1464 | - $error = self::update_from_16(); |
|
| 1465 | - if ($error != '') return $error; |
|
| 1466 | - else return self::check_version(true); |
|
| 1467 | - } elseif ($result['value'] == '17') { |
|
| 1468 | - $error = self::update_from_17(); |
|
| 1469 | - if ($error != '') return $error; |
|
| 1470 | - else return self::check_version(true); |
|
| 1471 | - } elseif ($result['value'] == '18') { |
|
| 1472 | - $error = self::update_from_18(); |
|
| 1473 | - if ($error != '') return $error; |
|
| 1474 | - else return self::check_version(true); |
|
| 1475 | - } elseif ($result['value'] == '19') { |
|
| 1476 | - $error = self::update_from_19(); |
|
| 1477 | - if ($error != '') return $error; |
|
| 1478 | - else return self::check_version(true); |
|
| 1479 | - } elseif ($result['value'] == '20') { |
|
| 1480 | - $error = self::update_from_20(); |
|
| 1481 | - if ($error != '') return $error; |
|
| 1482 | - else return self::check_version(true); |
|
| 1483 | - } elseif ($result['value'] == '21') { |
|
| 1484 | - $error = self::update_from_21(); |
|
| 1485 | - if ($error != '') return $error; |
|
| 1486 | - else return self::check_version(true); |
|
| 1487 | - } elseif ($result['value'] == '22') { |
|
| 1488 | - $error = self::update_from_22(); |
|
| 1489 | - if ($error != '') return $error; |
|
| 1490 | - else return self::check_version(true); |
|
| 1491 | - } elseif ($result['value'] == '23') { |
|
| 1492 | - $error = self::update_from_23(); |
|
| 1493 | - if ($error != '') return $error; |
|
| 1494 | - else return self::check_version(true); |
|
| 1495 | - } elseif ($result['value'] == '24') { |
|
| 1496 | - $error = self::update_from_24(); |
|
| 1497 | - if ($error != '') return $error; |
|
| 1498 | - else return self::check_version(true); |
|
| 1499 | - } elseif ($result['value'] == '25') { |
|
| 1500 | - $error = self::update_from_25(); |
|
| 1501 | - if ($error != '') return $error; |
|
| 1502 | - else return self::check_version(true); |
|
| 1503 | - } elseif ($result['value'] == '26') { |
|
| 1504 | - $error = self::update_from_26(); |
|
| 1505 | - if ($error != '') return $error; |
|
| 1506 | - else return self::check_version(true); |
|
| 1507 | - } elseif ($result['value'] == '27') { |
|
| 1508 | - $error = self::update_from_27(); |
|
| 1509 | - if ($error != '') return $error; |
|
| 1510 | - else return self::check_version(true); |
|
| 1511 | - } elseif ($result['value'] == '28') { |
|
| 1512 | - $error = self::update_from_28(); |
|
| 1513 | - if ($error != '') return $error; |
|
| 1514 | - else return self::check_version(true); |
|
| 1515 | - } elseif ($result['value'] == '29') { |
|
| 1516 | - $error = self::update_from_29(); |
|
| 1517 | - if ($error != '') return $error; |
|
| 1518 | - else return self::check_version(true); |
|
| 1519 | - } elseif ($result['value'] == '30') { |
|
| 1520 | - $error = self::update_from_30(); |
|
| 1521 | - if ($error != '') return $error; |
|
| 1522 | - else return self::check_version(true); |
|
| 1523 | - } elseif ($result['value'] == '31') { |
|
| 1524 | - $error = self::update_from_31(); |
|
| 1525 | - if ($error != '') return $error; |
|
| 1526 | - else return self::check_version(true); |
|
| 1527 | - } elseif ($result['value'] == '32') { |
|
| 1528 | - $error = self::update_from_32(); |
|
| 1529 | - if ($error != '') return $error; |
|
| 1530 | - else return self::check_version(true); |
|
| 1531 | - } elseif ($result['value'] == '33') { |
|
| 1532 | - $error = self::update_from_33(); |
|
| 1533 | - if ($error != '') return $error; |
|
| 1534 | - else return self::check_version(true); |
|
| 1535 | - } else return ''; |
|
| 1536 | - } |
|
| 1537 | - else return $result['value']; |
|
| 1404 | + } |
|
| 1405 | + $result = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1406 | + if ($update) { |
|
| 1407 | + if ($result['value'] == '2') { |
|
| 1408 | + $error = self::update_from_2(); |
|
| 1409 | + if ($error != '') return $error; |
|
| 1410 | + else return self::check_version(true); |
|
| 1411 | + } elseif ($result['value'] == '3') { |
|
| 1412 | + $error = self::update_from_3(); |
|
| 1413 | + if ($error != '') return $error; |
|
| 1414 | + else return self::check_version(true); |
|
| 1415 | + } elseif ($result['value'] == '4') { |
|
| 1416 | + $error = self::update_from_4(); |
|
| 1417 | + if ($error != '') return $error; |
|
| 1418 | + else return self::check_version(true); |
|
| 1419 | + } elseif ($result['value'] == '5') { |
|
| 1420 | + $error = self::update_from_5(); |
|
| 1421 | + if ($error != '') return $error; |
|
| 1422 | + else return self::check_version(true); |
|
| 1423 | + } elseif ($result['value'] == '6') { |
|
| 1424 | + $error = self::update_from_6(); |
|
| 1425 | + if ($error != '') return $error; |
|
| 1426 | + else return self::check_version(true); |
|
| 1427 | + } elseif ($result['value'] == '7') { |
|
| 1428 | + $error = self::update_from_7(); |
|
| 1429 | + if ($error != '') return $error; |
|
| 1430 | + else return self::check_version(true); |
|
| 1431 | + } elseif ($result['value'] == '8') { |
|
| 1432 | + $error = self::update_from_8(); |
|
| 1433 | + if ($error != '') return $error; |
|
| 1434 | + else return self::check_version(true); |
|
| 1435 | + } elseif ($result['value'] == '9') { |
|
| 1436 | + $error = self::update_from_9(); |
|
| 1437 | + if ($error != '') return $error; |
|
| 1438 | + else return self::check_version(true); |
|
| 1439 | + } elseif ($result['value'] == '10') { |
|
| 1440 | + $error = self::update_from_10(); |
|
| 1441 | + if ($error != '') return $error; |
|
| 1442 | + else return self::check_version(true); |
|
| 1443 | + } elseif ($result['value'] == '11') { |
|
| 1444 | + $error = self::update_from_11(); |
|
| 1445 | + if ($error != '') return $error; |
|
| 1446 | + else return self::check_version(true); |
|
| 1447 | + } elseif ($result['value'] == '12') { |
|
| 1448 | + $error = self::update_from_12(); |
|
| 1449 | + if ($error != '') return $error; |
|
| 1450 | + else return self::check_version(true); |
|
| 1451 | + } elseif ($result['value'] == '13') { |
|
| 1452 | + $error = self::update_from_13(); |
|
| 1453 | + if ($error != '') return $error; |
|
| 1454 | + else return self::check_version(true); |
|
| 1455 | + } elseif ($result['value'] == '14') { |
|
| 1456 | + $error = self::update_from_14(); |
|
| 1457 | + if ($error != '') return $error; |
|
| 1458 | + else return self::check_version(true); |
|
| 1459 | + } elseif ($result['value'] == '15') { |
|
| 1460 | + $error = self::update_from_15(); |
|
| 1461 | + if ($error != '') return $error; |
|
| 1462 | + else return self::check_version(true); |
|
| 1463 | + } elseif ($result['value'] == '16') { |
|
| 1464 | + $error = self::update_from_16(); |
|
| 1465 | + if ($error != '') return $error; |
|
| 1466 | + else return self::check_version(true); |
|
| 1467 | + } elseif ($result['value'] == '17') { |
|
| 1468 | + $error = self::update_from_17(); |
|
| 1469 | + if ($error != '') return $error; |
|
| 1470 | + else return self::check_version(true); |
|
| 1471 | + } elseif ($result['value'] == '18') { |
|
| 1472 | + $error = self::update_from_18(); |
|
| 1473 | + if ($error != '') return $error; |
|
| 1474 | + else return self::check_version(true); |
|
| 1475 | + } elseif ($result['value'] == '19') { |
|
| 1476 | + $error = self::update_from_19(); |
|
| 1477 | + if ($error != '') return $error; |
|
| 1478 | + else return self::check_version(true); |
|
| 1479 | + } elseif ($result['value'] == '20') { |
|
| 1480 | + $error = self::update_from_20(); |
|
| 1481 | + if ($error != '') return $error; |
|
| 1482 | + else return self::check_version(true); |
|
| 1483 | + } elseif ($result['value'] == '21') { |
|
| 1484 | + $error = self::update_from_21(); |
|
| 1485 | + if ($error != '') return $error; |
|
| 1486 | + else return self::check_version(true); |
|
| 1487 | + } elseif ($result['value'] == '22') { |
|
| 1488 | + $error = self::update_from_22(); |
|
| 1489 | + if ($error != '') return $error; |
|
| 1490 | + else return self::check_version(true); |
|
| 1491 | + } elseif ($result['value'] == '23') { |
|
| 1492 | + $error = self::update_from_23(); |
|
| 1493 | + if ($error != '') return $error; |
|
| 1494 | + else return self::check_version(true); |
|
| 1495 | + } elseif ($result['value'] == '24') { |
|
| 1496 | + $error = self::update_from_24(); |
|
| 1497 | + if ($error != '') return $error; |
|
| 1498 | + else return self::check_version(true); |
|
| 1499 | + } elseif ($result['value'] == '25') { |
|
| 1500 | + $error = self::update_from_25(); |
|
| 1501 | + if ($error != '') return $error; |
|
| 1502 | + else return self::check_version(true); |
|
| 1503 | + } elseif ($result['value'] == '26') { |
|
| 1504 | + $error = self::update_from_26(); |
|
| 1505 | + if ($error != '') return $error; |
|
| 1506 | + else return self::check_version(true); |
|
| 1507 | + } elseif ($result['value'] == '27') { |
|
| 1508 | + $error = self::update_from_27(); |
|
| 1509 | + if ($error != '') return $error; |
|
| 1510 | + else return self::check_version(true); |
|
| 1511 | + } elseif ($result['value'] == '28') { |
|
| 1512 | + $error = self::update_from_28(); |
|
| 1513 | + if ($error != '') return $error; |
|
| 1514 | + else return self::check_version(true); |
|
| 1515 | + } elseif ($result['value'] == '29') { |
|
| 1516 | + $error = self::update_from_29(); |
|
| 1517 | + if ($error != '') return $error; |
|
| 1518 | + else return self::check_version(true); |
|
| 1519 | + } elseif ($result['value'] == '30') { |
|
| 1520 | + $error = self::update_from_30(); |
|
| 1521 | + if ($error != '') return $error; |
|
| 1522 | + else return self::check_version(true); |
|
| 1523 | + } elseif ($result['value'] == '31') { |
|
| 1524 | + $error = self::update_from_31(); |
|
| 1525 | + if ($error != '') return $error; |
|
| 1526 | + else return self::check_version(true); |
|
| 1527 | + } elseif ($result['value'] == '32') { |
|
| 1528 | + $error = self::update_from_32(); |
|
| 1529 | + if ($error != '') return $error; |
|
| 1530 | + else return self::check_version(true); |
|
| 1531 | + } elseif ($result['value'] == '33') { |
|
| 1532 | + $error = self::update_from_33(); |
|
| 1533 | + if ($error != '') return $error; |
|
| 1534 | + else return self::check_version(true); |
|
| 1535 | + } else return ''; |
|
| 1536 | + } |
|
| 1537 | + else return $result['value']; |
|
| 1538 | 1538 | } |
| 1539 | 1539 | |
| 1540 | - } else return $version; |
|
| 1541 | - } |
|
| 1540 | + } else return $version; |
|
| 1541 | + } |
|
| 1542 | 1542 | |
| 1543 | 1543 | } |
| 1544 | 1544 | //echo update_schema::check_version(); |
@@ -14,11 +14,11 @@ discard block |
||
| 14 | 14 | try { |
| 15 | 15 | $sth = $Connection->db->prepare($query); |
| 16 | 16 | $sth->execute(); |
| 17 | - } catch(PDOException $e) { |
|
| 17 | + } catch (PDOException $e) { |
|
| 18 | 18 | return "error : ".$e->getMessage()."\n"; |
| 19 | 19 | } |
| 20 | 20 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 21 | - $Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']); |
|
| 21 | + $Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | try { |
| 51 | 51 | $sth = $Connection->db->prepare($query); |
| 52 | 52 | $sth->execute(); |
| 53 | - } catch(PDOException $e) { |
|
| 53 | + } catch (PDOException $e) { |
|
| 54 | 54 | return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
| 55 | 55 | } |
| 56 | 56 | // Copy schedules data to routes table |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | try { |
| 61 | 61 | $sth = $Connection->db->prepare($query); |
| 62 | 62 | $sth->execute(); |
| 63 | - } catch(PDOException $e) { |
|
| 63 | + } catch (PDOException $e) { |
|
| 64 | 64 | return "error (delete schedule table) : ".$e->getMessage()."\n"; |
| 65 | 65 | } |
| 66 | 66 | // Add source column |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | try { |
| 69 | 69 | $sth = $Connection->db->prepare($query); |
| 70 | 70 | $sth->execute(); |
| 71 | - } catch(PDOException $e) { |
|
| 71 | + } catch (PDOException $e) { |
|
| 72 | 72 | return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n"; |
| 73 | 73 | } |
| 74 | 74 | // Delete unused column |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | try { |
| 77 | 77 | $sth = $Connection->db->prepare($query); |
| 78 | 78 | $sth->execute(); |
| 79 | - } catch(PDOException $e) { |
|
| 79 | + } catch (PDOException $e) { |
|
| 80 | 80 | return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n"; |
| 81 | 81 | } |
| 82 | 82 | // Add ModeS column |
@@ -84,14 +84,14 @@ discard block |
||
| 84 | 84 | try { |
| 85 | 85 | $sth = $Connection->db->prepare($query); |
| 86 | 86 | $sth->execute(); |
| 87 | - } catch(PDOException $e) { |
|
| 87 | + } catch (PDOException $e) { |
|
| 88 | 88 | return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n"; |
| 89 | 89 | } |
| 90 | 90 | $query = "ALTER TABLE `spotter_live` ADD `ModeS` VARCHAR(255)"; |
| 91 | 91 | try { |
| 92 | 92 | $sth = $Connection->db->prepare($query); |
| 93 | 93 | $sth->execute(); |
| 94 | - } catch(PDOException $e) { |
|
| 94 | + } catch (PDOException $e) { |
|
| 95 | 95 | return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n"; |
| 96 | 96 | } |
| 97 | 97 | // Add auto_increment for aircraft_modes |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | try { |
| 100 | 100 | $sth = $Connection->db->prepare($query); |
| 101 | 101 | $sth->execute(); |
| 102 | - } catch(PDOException $e) { |
|
| 102 | + } catch (PDOException $e) { |
|
| 103 | 103 | return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n"; |
| 104 | 104 | } |
| 105 | 105 | $error = ''; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | try { |
| 111 | 111 | $sth = $Connection->db->prepare($query); |
| 112 | 112 | $sth->execute(); |
| 113 | - } catch(PDOException $e) { |
|
| 113 | + } catch (PDOException $e) { |
|
| 114 | 114 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 115 | 115 | } |
| 116 | 116 | return $error; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | try { |
| 124 | 124 | $sth = $Connection->db->prepare($query); |
| 125 | 125 | $sth->execute(); |
| 126 | - } catch(PDOException $e) { |
|
| 126 | + } catch (PDOException $e) { |
|
| 127 | 127 | return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
| 128 | 128 | } |
| 129 | 129 | $error = ''; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | try { |
| 135 | 135 | $sth = $Connection->db->prepare($query); |
| 136 | 136 | $sth->execute(); |
| 137 | - } catch(PDOException $e) { |
|
| 137 | + } catch (PDOException $e) { |
|
| 138 | 138 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 139 | 139 | } |
| 140 | 140 | return $error; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | try { |
| 148 | 148 | $sth = $Connection->db->prepare($query); |
| 149 | 149 | $sth->execute(); |
| 150 | - } catch(PDOException $e) { |
|
| 150 | + } catch (PDOException $e) { |
|
| 151 | 151 | return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n"; |
| 152 | 152 | } |
| 153 | 153 | // Add image_source_website column to spotter_image |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | try { |
| 156 | 156 | $sth = $Connection->db->prepare($query); |
| 157 | 157 | $sth->execute(); |
| 158 | - } catch(PDOException $e) { |
|
| 158 | + } catch (PDOException $e) { |
|
| 159 | 159 | return "error (add new columns to spotter_image) : ".$e->getMessage()."\n"; |
| 160 | 160 | } |
| 161 | 161 | $error = ''; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | try { |
| 165 | 165 | $sth = $Connection->db->prepare($query); |
| 166 | 166 | $sth->execute(); |
| 167 | - } catch(PDOException $e) { |
|
| 167 | + } catch (PDOException $e) { |
|
| 168 | 168 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 169 | 169 | } |
| 170 | 170 | return $error; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | try { |
| 183 | 183 | $sth = $Connection->db->prepare($query); |
| 184 | 184 | $sth->execute(); |
| 185 | - } catch(PDOException $e) { |
|
| 185 | + } catch (PDOException $e) { |
|
| 186 | 186 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 187 | 187 | } |
| 188 | 188 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | try { |
| 197 | 197 | $sth = $Connection->db->prepare($query); |
| 198 | 198 | $sth->execute(); |
| 199 | - } catch(PDOException $e) { |
|
| 199 | + } catch (PDOException $e) { |
|
| 200 | 200 | return "error (add new columns to translation) : ".$e->getMessage()."\n"; |
| 201 | 201 | } |
| 202 | 202 | // Add aircraft_shadow column to aircraft |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | try { |
| 205 | 205 | $sth = $Connection->db->prepare($query); |
| 206 | 206 | $sth->execute(); |
| 207 | - } catch(PDOException $e) { |
|
| 207 | + } catch (PDOException $e) { |
|
| 208 | 208 | return "error (add new column to aircraft) : ".$e->getMessage()."\n"; |
| 209 | 209 | } |
| 210 | 210 | // Add aircraft_shadow column to spotter_live |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | try { |
| 213 | 213 | $sth = $Connection->db->prepare($query); |
| 214 | 214 | $sth->execute(); |
| 215 | - } catch(PDOException $e) { |
|
| 215 | + } catch (PDOException $e) { |
|
| 216 | 216 | return "error (add new column to spotter_live) : ".$e->getMessage()."\n"; |
| 217 | 217 | } |
| 218 | 218 | $error = ''; |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | try { |
| 226 | 226 | $sth = $Connection->db->prepare($query); |
| 227 | 227 | $sth->execute(); |
| 228 | - } catch(PDOException $e) { |
|
| 228 | + } catch (PDOException $e) { |
|
| 229 | 229 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 230 | 230 | } |
| 231 | 231 | return $error; |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | private static function update_from_6() { |
| 235 | 235 | $Connection = new Connection(); |
| 236 | - if (!$Connection->indexExists('spotter_output','flightaware_id')) { |
|
| 236 | + if (!$Connection->indexExists('spotter_output', 'flightaware_id')) { |
|
| 237 | 237 | $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id); |
| 238 | 238 | ALTER TABLE spotter_output ADD INDEX(date); |
| 239 | 239 | ALTER TABLE spotter_output ADD INDEX(ident); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | try { |
| 251 | 251 | $sth = $Connection->db->prepare($query); |
| 252 | 252 | $sth->execute(); |
| 253 | - } catch(PDOException $e) { |
|
| 253 | + } catch (PDOException $e) { |
|
| 254 | 254 | return "error (add some indexes) : ".$e->getMessage()."\n"; |
| 255 | 255 | } |
| 256 | 256 | } |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | try { |
| 266 | 266 | $sth = $Connection->db->prepare($query); |
| 267 | 267 | $sth->execute(); |
| 268 | - } catch(PDOException $e) { |
|
| 268 | + } catch (PDOException $e) { |
|
| 269 | 269 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 270 | 270 | } |
| 271 | 271 | return $error; |
@@ -274,12 +274,12 @@ discard block |
||
| 274 | 274 | private static function update_from_7() { |
| 275 | 275 | global $globalDBname, $globalDBdriver; |
| 276 | 276 | $Connection = new Connection(); |
| 277 | - $query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
|
| 277 | + $query = "ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
|
| 278 | 278 | ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;"; |
| 279 | 279 | try { |
| 280 | 280 | $sth = $Connection->db->prepare($query); |
| 281 | 281 | $sth->execute(); |
| 282 | - } catch(PDOException $e) { |
|
| 282 | + } catch (PDOException $e) { |
|
| 283 | 283 | return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
| 284 | 284 | } |
| 285 | 285 | if ($globalDBdriver == 'mysql') { |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | try { |
| 288 | 288 | $sth = $Connection->db->prepare($query); |
| 289 | 289 | $sth->execute(); |
| 290 | - } catch(PDOException $e) { |
|
| 290 | + } catch (PDOException $e) { |
|
| 291 | 291 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
| 292 | 292 | } |
| 293 | 293 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -299,15 +299,15 @@ discard block |
||
| 299 | 299 | DROP TABLE spotter_archive; |
| 300 | 300 | RENAME TABLE copy TO spotter_archive;"; |
| 301 | 301 | } else { |
| 302 | - $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
| 302 | + $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
| 303 | 303 | } |
| 304 | 304 | } else { |
| 305 | - $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
| 305 | + $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
| 306 | 306 | } |
| 307 | 307 | try { |
| 308 | 308 | $sth = $Connection->db->prepare($query); |
| 309 | 309 | $sth->execute(); |
| 310 | - } catch(PDOException $e) { |
|
| 310 | + } catch (PDOException $e) { |
|
| 311 | 311 | return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n"; |
| 312 | 312 | } |
| 313 | 313 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | try { |
| 321 | 321 | $sth = $Connection->db->prepare($query); |
| 322 | 322 | $sth->execute(); |
| 323 | - } catch(PDOException $e) { |
|
| 323 | + } catch (PDOException $e) { |
|
| 324 | 324 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 325 | 325 | } |
| 326 | 326 | return $error; |
@@ -339,14 +339,14 @@ discard block |
||
| 339 | 339 | try { |
| 340 | 340 | $sth = $Connection->db->prepare($query); |
| 341 | 341 | $sth->execute(); |
| 342 | - } catch(PDOException $e) { |
|
| 342 | + } catch (PDOException $e) { |
|
| 343 | 343 | return "error (insert last_update values) : ".$e->getMessage()."\n"; |
| 344 | 344 | } |
| 345 | 345 | $query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'"; |
| 346 | 346 | try { |
| 347 | 347 | $sth = $Connection->db->prepare($query); |
| 348 | 348 | $sth->execute(); |
| 349 | - } catch(PDOException $e) { |
|
| 349 | + } catch (PDOException $e) { |
|
| 350 | 350 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 351 | 351 | } |
| 352 | 352 | return $error; |
@@ -354,12 +354,12 @@ discard block |
||
| 354 | 354 | |
| 355 | 355 | private static function update_from_9() { |
| 356 | 356 | $Connection = new Connection(); |
| 357 | - $query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL; |
|
| 357 | + $query = "ALTER TABLE spotter_live ADD verticalrate INT(11) NULL; |
|
| 358 | 358 | ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;"; |
| 359 | 359 | try { |
| 360 | 360 | $sth = $Connection->db->prepare($query); |
| 361 | 361 | $sth->execute(); |
| 362 | - } catch(PDOException $e) { |
|
| 362 | + } catch (PDOException $e) { |
|
| 363 | 363 | return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
| 364 | 364 | } |
| 365 | 365 | $error = ''; |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | try { |
| 372 | 372 | $sth = $Connection->db->prepare($query); |
| 373 | 373 | $sth->execute(); |
| 374 | - } catch(PDOException $e) { |
|
| 374 | + } catch (PDOException $e) { |
|
| 375 | 375 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 376 | 376 | } |
| 377 | 377 | return $error; |
@@ -379,11 +379,11 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | private static function update_from_10() { |
| 381 | 381 | $Connection = new Connection(); |
| 382 | - $query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; |
|
| 382 | + $query = "ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; |
|
| 383 | 383 | try { |
| 384 | 384 | $sth = $Connection->db->prepare($query); |
| 385 | 385 | $sth->execute(); |
| 386 | - } catch(PDOException $e) { |
|
| 386 | + } catch (PDOException $e) { |
|
| 387 | 387 | return "error (add new enum to ATC table) : ".$e->getMessage()."\n"; |
| 388 | 388 | } |
| 389 | 389 | $error = ''; |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | try { |
| 402 | 402 | $sth = $Connection->db->prepare($query); |
| 403 | 403 | $sth->execute(); |
| 404 | - } catch(PDOException $e) { |
|
| 404 | + } catch (PDOException $e) { |
|
| 405 | 405 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 406 | 406 | } |
| 407 | 407 | return $error; |
@@ -410,18 +410,18 @@ discard block |
||
| 410 | 410 | private static function update_from_11() { |
| 411 | 411 | global $globalDBdriver, $globalDBname; |
| 412 | 412 | $Connection = new Connection(); |
| 413 | - $query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)"; |
|
| 413 | + $query = "ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)"; |
|
| 414 | 414 | try { |
| 415 | 415 | $sth = $Connection->db->prepare($query); |
| 416 | 416 | $sth->execute(); |
| 417 | - } catch(PDOException $e) { |
|
| 417 | + } catch (PDOException $e) { |
|
| 418 | 418 | return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n"; |
| 419 | 419 | } |
| 420 | - $query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 420 | + $query = "ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 421 | 421 | try { |
| 422 | 422 | $sth = $Connection->db->prepare($query); |
| 423 | 423 | $sth->execute(); |
| 424 | - } catch(PDOException $e) { |
|
| 424 | + } catch (PDOException $e) { |
|
| 425 | 425 | return "error (format_source column to spotter_live) : ".$e->getMessage()."\n"; |
| 426 | 426 | } |
| 427 | 427 | if ($globalDBdriver == 'mysql') { |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | try { |
| 430 | 430 | $sth = $Connection->db->prepare($query); |
| 431 | 431 | $sth->execute(); |
| 432 | - } catch(PDOException $e) { |
|
| 432 | + } catch (PDOException $e) { |
|
| 433 | 433 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
| 434 | 434 | } |
| 435 | 435 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -441,15 +441,15 @@ discard block |
||
| 441 | 441 | DROP TABLE spotter_archive; |
| 442 | 442 | RENAME TABLE copy TO spotter_archive;"; |
| 443 | 443 | } else { |
| 444 | - $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 444 | + $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 445 | 445 | } |
| 446 | 446 | } else { |
| 447 | - $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 447 | + $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 448 | 448 | } |
| 449 | 449 | try { |
| 450 | 450 | $sth = $Connection->db->prepare($query); |
| 451 | 451 | $sth->execute(); |
| 452 | - } catch(PDOException $e) { |
|
| 452 | + } catch (PDOException $e) { |
|
| 453 | 453 | return "error (add columns to spotter_archive) : ".$e->getMessage()."\n"; |
| 454 | 454 | } |
| 455 | 455 | |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | try { |
| 460 | 460 | $sth = $Connection->db->prepare($query); |
| 461 | 461 | $sth->execute(); |
| 462 | - } catch(PDOException $e) { |
|
| 462 | + } catch (PDOException $e) { |
|
| 463 | 463 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 464 | 464 | } |
| 465 | 465 | return $error; |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | try { |
| 488 | 488 | $sth = $Connection->db->prepare($query); |
| 489 | 489 | $sth->execute(); |
| 490 | - } catch(PDOException $e) { |
|
| 490 | + } catch (PDOException $e) { |
|
| 491 | 491 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 492 | 492 | } |
| 493 | 493 | return $error; |
@@ -495,12 +495,12 @@ discard block |
||
| 495 | 495 | |
| 496 | 496 | private static function update_from_13() { |
| 497 | 497 | $Connection = new Connection(); |
| 498 | - if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) { |
|
| 499 | - $query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)"; |
|
| 498 | + if (!$Connection->checkColumnName('spotter_archive_output', 'real_departure_airport_icao')) { |
|
| 499 | + $query = "ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)"; |
|
| 500 | 500 | try { |
| 501 | 501 | $sth = $Connection->db->prepare($query); |
| 502 | 502 | $sth->execute(); |
| 503 | - } catch(PDOException $e) { |
|
| 503 | + } catch (PDOException $e) { |
|
| 504 | 504 | return "error (update spotter_archive_output) : ".$e->getMessage()."\n"; |
| 505 | 505 | } |
| 506 | 506 | } |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | try { |
| 510 | 510 | $sth = $Connection->db->prepare($query); |
| 511 | 511 | $sth->execute(); |
| 512 | - } catch(PDOException $e) { |
|
| 512 | + } catch (PDOException $e) { |
|
| 513 | 513 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 514 | 514 | } |
| 515 | 515 | return $error; |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | try { |
| 528 | 528 | $sth = $Connection->db->prepare($query); |
| 529 | 529 | $sth->execute(); |
| 530 | - } catch(PDOException $e) { |
|
| 530 | + } catch (PDOException $e) { |
|
| 531 | 531 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 532 | 532 | } |
| 533 | 533 | return $error; |
@@ -538,11 +538,11 @@ discard block |
||
| 538 | 538 | $Connection = new Connection(); |
| 539 | 539 | $error = ''; |
| 540 | 540 | // Add tables |
| 541 | - $query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"; |
|
| 541 | + $query = "ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"; |
|
| 542 | 542 | try { |
| 543 | 543 | $sth = $Connection->db->prepare($query); |
| 544 | 544 | $sth->execute(); |
| 545 | - } catch(PDOException $e) { |
|
| 545 | + } catch (PDOException $e) { |
|
| 546 | 546 | return "error (update stats) : ".$e->getMessage()."\n"; |
| 547 | 547 | } |
| 548 | 548 | if ($error != '') return $error; |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | try { |
| 551 | 551 | $sth = $Connection->db->prepare($query); |
| 552 | 552 | $sth->execute(); |
| 553 | - } catch(PDOException $e) { |
|
| 553 | + } catch (PDOException $e) { |
|
| 554 | 554 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 555 | 555 | } |
| 556 | 556 | return $error; |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | try { |
| 572 | 572 | $sth = $Connection->db->prepare($query); |
| 573 | 573 | $sth->execute(); |
| 574 | - } catch(PDOException $e) { |
|
| 574 | + } catch (PDOException $e) { |
|
| 575 | 575 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 576 | 576 | } |
| 577 | 577 | return $error; |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | try { |
| 590 | 590 | $sth = $Connection->db->prepare($query); |
| 591 | 591 | $sth->execute(); |
| 592 | - } catch(PDOException $e) { |
|
| 592 | + } catch (PDOException $e) { |
|
| 593 | 593 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 594 | 594 | } |
| 595 | 595 | return $error; |
@@ -598,12 +598,12 @@ discard block |
||
| 598 | 598 | $Connection = new Connection(); |
| 599 | 599 | $error = ''; |
| 600 | 600 | // Modify stats_airport table |
| 601 | - if (!$Connection->checkColumnName('stats_airport','airport_name')) { |
|
| 601 | + if (!$Connection->checkColumnName('stats_airport', 'airport_name')) { |
|
| 602 | 602 | $query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)"; |
| 603 | 603 | try { |
| 604 | 604 | $sth = $Connection->db->prepare($query); |
| 605 | 605 | $sth->execute(); |
| 606 | - } catch(PDOException $e) { |
|
| 606 | + } catch (PDOException $e) { |
|
| 607 | 607 | return "error (update stats) : ".$e->getMessage()."\n"; |
| 608 | 608 | } |
| 609 | 609 | } |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | try { |
| 613 | 613 | $sth = $Connection->db->prepare($query); |
| 614 | 614 | $sth->execute(); |
| 615 | - } catch(PDOException $e) { |
|
| 615 | + } catch (PDOException $e) { |
|
| 616 | 616 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 617 | 617 | } |
| 618 | 618 | return $error; |
@@ -629,73 +629,73 @@ discard block |
||
| 629 | 629 | try { |
| 630 | 630 | $sth = $Connection->db->prepare($query); |
| 631 | 631 | $sth->execute(); |
| 632 | - } catch(PDOException $e) { |
|
| 632 | + } catch (PDOException $e) { |
|
| 633 | 633 | return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n"; |
| 634 | 634 | } |
| 635 | 635 | $query = "alter table spotter_archive add spotter_archive_id INT(11)"; |
| 636 | 636 | try { |
| 637 | 637 | $sth = $Connection->db->prepare($query); |
| 638 | 638 | $sth->execute(); |
| 639 | - } catch(PDOException $e) { |
|
| 639 | + } catch (PDOException $e) { |
|
| 640 | 640 | return "error (add id again on spotter_archive) : ".$e->getMessage()."\n"; |
| 641 | 641 | } |
| 642 | - if (!$Connection->checkColumnName('spotter_archive','over_country')) { |
|
| 642 | + if (!$Connection->checkColumnName('spotter_archive', 'over_country')) { |
|
| 643 | 643 | // Add column over_country |
| 644 | 644 | $query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
| 645 | 645 | try { |
| 646 | 646 | $sth = $Connection->db->prepare($query); |
| 647 | 647 | $sth->execute(); |
| 648 | - } catch(PDOException $e) { |
|
| 648 | + } catch (PDOException $e) { |
|
| 649 | 649 | return "error (add over_country) : ".$e->getMessage()."\n"; |
| 650 | 650 | } |
| 651 | 651 | } |
| 652 | - if (!$Connection->checkColumnName('spotter_live','over_country')) { |
|
| 652 | + if (!$Connection->checkColumnName('spotter_live', 'over_country')) { |
|
| 653 | 653 | // Add column over_country |
| 654 | 654 | $query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
| 655 | 655 | try { |
| 656 | 656 | $sth = $Connection->db->prepare($query); |
| 657 | 657 | $sth->execute(); |
| 658 | - } catch(PDOException $e) { |
|
| 658 | + } catch (PDOException $e) { |
|
| 659 | 659 | return "error (add over_country) : ".$e->getMessage()."\n"; |
| 660 | 660 | } |
| 661 | 661 | } |
| 662 | - if (!$Connection->checkColumnName('spotter_output','source_name')) { |
|
| 662 | + if (!$Connection->checkColumnName('spotter_output', 'source_name')) { |
|
| 663 | 663 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
| 664 | 664 | $query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
| 665 | 665 | try { |
| 666 | 666 | $sth = $Connection->db->prepare($query); |
| 667 | 667 | $sth->execute(); |
| 668 | - } catch(PDOException $e) { |
|
| 668 | + } catch (PDOException $e) { |
|
| 669 | 669 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | - if (!$Connection->checkColumnName('spotter_live','source_name')) { |
|
| 672 | + if (!$Connection->checkColumnName('spotter_live', 'source_name')) { |
|
| 673 | 673 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
| 674 | 674 | $query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
| 675 | 675 | try { |
| 676 | 676 | $sth = $Connection->db->prepare($query); |
| 677 | 677 | $sth->execute(); |
| 678 | - } catch(PDOException $e) { |
|
| 678 | + } catch (PDOException $e) { |
|
| 679 | 679 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 680 | 680 | } |
| 681 | 681 | } |
| 682 | - if (!$Connection->checkColumnName('spotter_archive_output','source_name')) { |
|
| 682 | + if (!$Connection->checkColumnName('spotter_archive_output', 'source_name')) { |
|
| 683 | 683 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
| 684 | 684 | $query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
| 685 | 685 | try { |
| 686 | 686 | $sth = $Connection->db->prepare($query); |
| 687 | 687 | $sth->execute(); |
| 688 | - } catch(PDOException $e) { |
|
| 688 | + } catch (PDOException $e) { |
|
| 689 | 689 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 690 | 690 | } |
| 691 | 691 | } |
| 692 | - if (!$Connection->checkColumnName('spotter_archive','source_name')) { |
|
| 692 | + if (!$Connection->checkColumnName('spotter_archive', 'source_name')) { |
|
| 693 | 693 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
| 694 | 694 | $query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;"; |
| 695 | 695 | try { |
| 696 | 696 | $sth = $Connection->db->prepare($query); |
| 697 | 697 | $sth->execute(); |
| 698 | - } catch(PDOException $e) { |
|
| 698 | + } catch (PDOException $e) { |
|
| 699 | 699 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 700 | 700 | } |
| 701 | 701 | } |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | try { |
| 705 | 705 | $sth = $Connection->db->prepare($query); |
| 706 | 706 | $sth->execute(); |
| 707 | - } catch(PDOException $e) { |
|
| 707 | + } catch (PDOException $e) { |
|
| 708 | 708 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 709 | 709 | } |
| 710 | 710 | return $error; |
@@ -719,13 +719,13 @@ discard block |
||
| 719 | 719 | $error .= create_db::import_file('../db/airlines.sql'); |
| 720 | 720 | if ($error != '') return 'Import airlines.sql : '.$error; |
| 721 | 721 | } |
| 722 | - if (!$Connection->checkColumnName('aircraft_modes','type_flight')) { |
|
| 722 | + if (!$Connection->checkColumnName('aircraft_modes', 'type_flight')) { |
|
| 723 | 723 | // Add column over_country |
| 724 | 724 | $query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;"; |
| 725 | 725 | try { |
| 726 | 726 | $sth = $Connection->db->prepare($query); |
| 727 | 727 | $sth->execute(); |
| 728 | - } catch(PDOException $e) { |
|
| 728 | + } catch (PDOException $e) { |
|
| 729 | 729 | return "error (add over_country) : ".$e->getMessage()."\n"; |
| 730 | 730 | } |
| 731 | 731 | } |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | try { |
| 742 | 742 | $sth = $Connection->db->prepare($query); |
| 743 | 743 | $sth->execute(); |
| 744 | - } catch(PDOException $e) { |
|
| 744 | + } catch (PDOException $e) { |
|
| 745 | 745 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 746 | 746 | } |
| 747 | 747 | return $error; |
@@ -750,13 +750,13 @@ discard block |
||
| 750 | 750 | private static function update_from_21() { |
| 751 | 751 | $Connection = new Connection(); |
| 752 | 752 | $error = ''; |
| 753 | - if (!$Connection->checkColumnName('stats_airport','stats_type')) { |
|
| 753 | + if (!$Connection->checkColumnName('stats_airport', 'stats_type')) { |
|
| 754 | 754 | // Rename type to stats_type |
| 755 | 755 | $query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);"; |
| 756 | 756 | try { |
| 757 | 757 | $sth = $Connection->db->prepare($query); |
| 758 | 758 | $sth->execute(); |
| 759 | - } catch(PDOException $e) { |
|
| 759 | + } catch (PDOException $e) { |
|
| 760 | 760 | return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n"; |
| 761 | 761 | } |
| 762 | 762 | if ($error != '') return $error; |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | try { |
| 766 | 766 | $sth = $Connection->db->prepare($query); |
| 767 | 767 | $sth->execute(); |
| 768 | - } catch(PDOException $e) { |
|
| 768 | + } catch (PDOException $e) { |
|
| 769 | 769 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 770 | 770 | } |
| 771 | 771 | return $error; |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | try { |
| 789 | 789 | $sth = $Connection->db->prepare($query); |
| 790 | 790 | $sth->execute(); |
| 791 | - } catch(PDOException $e) { |
|
| 791 | + } catch (PDOException $e) { |
|
| 792 | 792 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 793 | 793 | } |
| 794 | 794 | return $error; |
@@ -815,17 +815,17 @@ discard block |
||
| 815 | 815 | try { |
| 816 | 816 | $sth = $Connection->db->prepare($query); |
| 817 | 817 | $sth->execute(); |
| 818 | - } catch(PDOException $e) { |
|
| 818 | + } catch (PDOException $e) { |
|
| 819 | 819 | return "error (create index on spotter_archive) : ".$e->getMessage()."\n"; |
| 820 | 820 | } |
| 821 | 821 | } |
| 822 | - if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) { |
|
| 822 | + if (!$Connection->checkColumnName('stats_aircraft', 'aircraft_manufacturer')) { |
|
| 823 | 823 | // Add aircraft_manufacturer to stats_aircraft |
| 824 | 824 | $query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL"; |
| 825 | 825 | try { |
| 826 | 826 | $sth = $Connection->db->prepare($query); |
| 827 | 827 | $sth->execute(); |
| 828 | - } catch(PDOException $e) { |
|
| 828 | + } catch (PDOException $e) { |
|
| 829 | 829 | return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n"; |
| 830 | 830 | } |
| 831 | 831 | } |
@@ -834,7 +834,7 @@ discard block |
||
| 834 | 834 | try { |
| 835 | 835 | $sth = $Connection->db->prepare($query); |
| 836 | 836 | $sth->execute(); |
| 837 | - } catch(PDOException $e) { |
|
| 837 | + } catch (PDOException $e) { |
|
| 838 | 838 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 839 | 839 | } |
| 840 | 840 | return $error; |
@@ -850,23 +850,23 @@ discard block |
||
| 850 | 850 | $error .= create_db::import_file('../db/pgsql/airlines.sql'); |
| 851 | 851 | } |
| 852 | 852 | if ($error != '') return 'Import airlines.sql : '.$error; |
| 853 | - if (!$Connection->checkColumnName('airlines','forsource')) { |
|
| 853 | + if (!$Connection->checkColumnName('airlines', 'forsource')) { |
|
| 854 | 854 | // Add forsource to airlines |
| 855 | 855 | $query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL"; |
| 856 | 856 | try { |
| 857 | 857 | $sth = $Connection->db->prepare($query); |
| 858 | 858 | $sth->execute(); |
| 859 | - } catch(PDOException $e) { |
|
| 859 | + } catch (PDOException $e) { |
|
| 860 | 860 | return "error (add forsource column) : ".$e->getMessage()."\n"; |
| 861 | 861 | } |
| 862 | 862 | } |
| 863 | - if (!$Connection->checkColumnName('stats_aircraft','stats_airline')) { |
|
| 863 | + if (!$Connection->checkColumnName('stats_aircraft', 'stats_airline')) { |
|
| 864 | 864 | // Add forsource to airlines |
| 865 | 865 | $query = "ALTER TABLE stats_aircraft ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 866 | 866 | try { |
| 867 | 867 | $sth = $Connection->db->prepare($query); |
| 868 | 868 | $sth->execute(); |
| 869 | - } catch(PDOException $e) { |
|
| 869 | + } catch (PDOException $e) { |
|
| 870 | 870 | return "error (add stats_airline & filter_name column in stats_aircraft) : ".$e->getMessage()."\n"; |
| 871 | 871 | } |
| 872 | 872 | // Add unique key |
@@ -878,17 +878,17 @@ discard block |
||
| 878 | 878 | try { |
| 879 | 879 | $sth = $Connection->db->prepare($query); |
| 880 | 880 | $sth->execute(); |
| 881 | - } catch(PDOException $e) { |
|
| 881 | + } catch (PDOException $e) { |
|
| 882 | 882 | return "error (add unique key in stats_aircraft) : ".$e->getMessage()."\n"; |
| 883 | 883 | } |
| 884 | 884 | } |
| 885 | - if (!$Connection->checkColumnName('stats_airport','stats_airline')) { |
|
| 885 | + if (!$Connection->checkColumnName('stats_airport', 'stats_airline')) { |
|
| 886 | 886 | // Add forsource to airlines |
| 887 | 887 | $query = "ALTER TABLE stats_airport ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 888 | 888 | try { |
| 889 | 889 | $sth = $Connection->db->prepare($query); |
| 890 | 890 | $sth->execute(); |
| 891 | - } catch(PDOException $e) { |
|
| 891 | + } catch (PDOException $e) { |
|
| 892 | 892 | return "error (add filter_name column in stats_airport) : ".$e->getMessage()."\n"; |
| 893 | 893 | } |
| 894 | 894 | // Add unique key |
@@ -900,17 +900,17 @@ discard block |
||
| 900 | 900 | try { |
| 901 | 901 | $sth = $Connection->db->prepare($query); |
| 902 | 902 | $sth->execute(); |
| 903 | - } catch(PDOException $e) { |
|
| 903 | + } catch (PDOException $e) { |
|
| 904 | 904 | return "error (add unique key in stats_airport) : ".$e->getMessage()."\n"; |
| 905 | 905 | } |
| 906 | 906 | } |
| 907 | - if (!$Connection->checkColumnName('stats_country','stats_airline')) { |
|
| 907 | + if (!$Connection->checkColumnName('stats_country', 'stats_airline')) { |
|
| 908 | 908 | // Add forsource to airlines |
| 909 | 909 | $query = "ALTER TABLE stats_country ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 910 | 910 | try { |
| 911 | 911 | $sth = $Connection->db->prepare($query); |
| 912 | 912 | $sth->execute(); |
| 913 | - } catch(PDOException $e) { |
|
| 913 | + } catch (PDOException $e) { |
|
| 914 | 914 | return "error (add stats_airline & filter_name column in stats_country) : ".$e->getMessage()."\n"; |
| 915 | 915 | } |
| 916 | 916 | // Add unique key |
@@ -922,36 +922,36 @@ discard block |
||
| 922 | 922 | try { |
| 923 | 923 | $sth = $Connection->db->prepare($query); |
| 924 | 924 | $sth->execute(); |
| 925 | - } catch(PDOException $e) { |
|
| 925 | + } catch (PDOException $e) { |
|
| 926 | 926 | return "error (add unique key in stats_airline) : ".$e->getMessage()."\n"; |
| 927 | 927 | } |
| 928 | 928 | } |
| 929 | - if (!$Connection->checkColumnName('stats_flight','stats_airline')) { |
|
| 929 | + if (!$Connection->checkColumnName('stats_flight', 'stats_airline')) { |
|
| 930 | 930 | // Add forsource to airlines |
| 931 | 931 | $query = "ALTER TABLE stats_flight ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 932 | 932 | try { |
| 933 | 933 | $sth = $Connection->db->prepare($query); |
| 934 | 934 | $sth->execute(); |
| 935 | - } catch(PDOException $e) { |
|
| 935 | + } catch (PDOException $e) { |
|
| 936 | 936 | return "error (add stats_airline & filter_name column in stats_flight) : ".$e->getMessage()."\n"; |
| 937 | 937 | } |
| 938 | 938 | } |
| 939 | - if (!$Connection->checkColumnName('stats','stats_airline')) { |
|
| 939 | + if (!$Connection->checkColumnName('stats', 'stats_airline')) { |
|
| 940 | 940 | // Add forsource to airlines |
| 941 | 941 | $query = "ALTER TABLE stats ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 942 | 942 | try { |
| 943 | 943 | $sth = $Connection->db->prepare($query); |
| 944 | 944 | $sth->execute(); |
| 945 | - } catch(PDOException $e) { |
|
| 945 | + } catch (PDOException $e) { |
|
| 946 | 946 | return "error (add stats_airline & filter_name column in stats) : ".$e->getMessage()."\n"; |
| 947 | 947 | } |
| 948 | - if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats','type')) { |
|
| 948 | + if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats', 'type')) { |
|
| 949 | 949 | // Add unique key |
| 950 | 950 | $query = "drop index type on stats;ALTER TABLE stats ADD UNIQUE stats_type (stats_type,stats_date,stats_airline,filter_name);"; |
| 951 | 951 | try { |
| 952 | 952 | $sth = $Connection->db->prepare($query); |
| 953 | 953 | $sth->execute(); |
| 954 | - } catch(PDOException $e) { |
|
| 954 | + } catch (PDOException $e) { |
|
| 955 | 955 | return "error (add unique key in stats) : ".$e->getMessage()."\n"; |
| 956 | 956 | } |
| 957 | 957 | } else { |
@@ -964,18 +964,18 @@ discard block |
||
| 964 | 964 | try { |
| 965 | 965 | $sth = $Connection->db->prepare($query); |
| 966 | 966 | $sth->execute(); |
| 967 | - } catch(PDOException $e) { |
|
| 967 | + } catch (PDOException $e) { |
|
| 968 | 968 | return "error (add unique key in stats) : ".$e->getMessage()."\n"; |
| 969 | 969 | } |
| 970 | 970 | } |
| 971 | 971 | } |
| 972 | - if (!$Connection->checkColumnName('stats_registration','stats_airline')) { |
|
| 972 | + if (!$Connection->checkColumnName('stats_registration', 'stats_airline')) { |
|
| 973 | 973 | // Add forsource to airlines |
| 974 | 974 | $query = "ALTER TABLE stats_registration ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 975 | 975 | try { |
| 976 | 976 | $sth = $Connection->db->prepare($query); |
| 977 | 977 | $sth->execute(); |
| 978 | - } catch(PDOException $e) { |
|
| 978 | + } catch (PDOException $e) { |
|
| 979 | 979 | return "error (add stats_airline & filter_name column in stats_registration) : ".$e->getMessage()."\n"; |
| 980 | 980 | } |
| 981 | 981 | // Add unique key |
@@ -987,17 +987,17 @@ discard block |
||
| 987 | 987 | try { |
| 988 | 988 | $sth = $Connection->db->prepare($query); |
| 989 | 989 | $sth->execute(); |
| 990 | - } catch(PDOException $e) { |
|
| 990 | + } catch (PDOException $e) { |
|
| 991 | 991 | return "error (add unique key in stats_registration) : ".$e->getMessage()."\n"; |
| 992 | 992 | } |
| 993 | 993 | } |
| 994 | - if (!$Connection->checkColumnName('stats_callsign','filter_name')) { |
|
| 994 | + if (!$Connection->checkColumnName('stats_callsign', 'filter_name')) { |
|
| 995 | 995 | // Add forsource to airlines |
| 996 | 996 | $query = "ALTER TABLE stats_callsign ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 997 | 997 | try { |
| 998 | 998 | $sth = $Connection->db->prepare($query); |
| 999 | 999 | $sth->execute(); |
| 1000 | - } catch(PDOException $e) { |
|
| 1000 | + } catch (PDOException $e) { |
|
| 1001 | 1001 | return "error (add filter_name column in stats_callsign) : ".$e->getMessage()."\n"; |
| 1002 | 1002 | } |
| 1003 | 1003 | // Add unique key |
@@ -1009,17 +1009,17 @@ discard block |
||
| 1009 | 1009 | try { |
| 1010 | 1010 | $sth = $Connection->db->prepare($query); |
| 1011 | 1011 | $sth->execute(); |
| 1012 | - } catch(PDOException $e) { |
|
| 1012 | + } catch (PDOException $e) { |
|
| 1013 | 1013 | return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n"; |
| 1014 | 1014 | } |
| 1015 | 1015 | } |
| 1016 | - if (!$Connection->checkColumnName('stats_airline','filter_name')) { |
|
| 1016 | + if (!$Connection->checkColumnName('stats_airline', 'filter_name')) { |
|
| 1017 | 1017 | // Add forsource to airlines |
| 1018 | 1018 | $query = "ALTER TABLE stats_airline ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 1019 | 1019 | try { |
| 1020 | 1020 | $sth = $Connection->db->prepare($query); |
| 1021 | 1021 | $sth->execute(); |
| 1022 | - } catch(PDOException $e) { |
|
| 1022 | + } catch (PDOException $e) { |
|
| 1023 | 1023 | return "error (add filter_name column in stats_airline) : ".$e->getMessage()."\n"; |
| 1024 | 1024 | } |
| 1025 | 1025 | // Add unique key |
@@ -1031,7 +1031,7 @@ discard block |
||
| 1031 | 1031 | try { |
| 1032 | 1032 | $sth = $Connection->db->prepare($query); |
| 1033 | 1033 | $sth->execute(); |
| 1034 | - } catch(PDOException $e) { |
|
| 1034 | + } catch (PDOException $e) { |
|
| 1035 | 1035 | return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n"; |
| 1036 | 1036 | } |
| 1037 | 1037 | } |
@@ -1040,7 +1040,7 @@ discard block |
||
| 1040 | 1040 | try { |
| 1041 | 1041 | $sth = $Connection->db->prepare($query); |
| 1042 | 1042 | $sth->execute(); |
| 1043 | - } catch(PDOException $e) { |
|
| 1043 | + } catch (PDOException $e) { |
|
| 1044 | 1044 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 1045 | 1045 | } |
| 1046 | 1046 | return $error; |
@@ -1050,13 +1050,13 @@ discard block |
||
| 1050 | 1050 | global $globalDBdriver; |
| 1051 | 1051 | $Connection = new Connection(); |
| 1052 | 1052 | $error = ''; |
| 1053 | - if (!$Connection->checkColumnName('stats_owner','stats_airline')) { |
|
| 1053 | + if (!$Connection->checkColumnName('stats_owner', 'stats_airline')) { |
|
| 1054 | 1054 | // Add forsource to airlines |
| 1055 | 1055 | $query = "ALTER TABLE stats_owner ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 1056 | 1056 | try { |
| 1057 | 1057 | $sth = $Connection->db->prepare($query); |
| 1058 | 1058 | $sth->execute(); |
| 1059 | - } catch(PDOException $e) { |
|
| 1059 | + } catch (PDOException $e) { |
|
| 1060 | 1060 | return "error (add stats_airline & filter_name column in stats_owner) : ".$e->getMessage()."\n"; |
| 1061 | 1061 | } |
| 1062 | 1062 | // Add unique key |
@@ -1068,17 +1068,17 @@ discard block |
||
| 1068 | 1068 | try { |
| 1069 | 1069 | $sth = $Connection->db->prepare($query); |
| 1070 | 1070 | $sth->execute(); |
| 1071 | - } catch(PDOException $e) { |
|
| 1071 | + } catch (PDOException $e) { |
|
| 1072 | 1072 | return "error (add unique key in stats_owner) : ".$e->getMessage()."\n"; |
| 1073 | 1073 | } |
| 1074 | 1074 | } |
| 1075 | - if (!$Connection->checkColumnName('stats_pilot','stats_airline')) { |
|
| 1075 | + if (!$Connection->checkColumnName('stats_pilot', 'stats_airline')) { |
|
| 1076 | 1076 | // Add forsource to airlines |
| 1077 | 1077 | $query = "ALTER TABLE stats_pilot ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 1078 | 1078 | try { |
| 1079 | 1079 | $sth = $Connection->db->prepare($query); |
| 1080 | 1080 | $sth->execute(); |
| 1081 | - } catch(PDOException $e) { |
|
| 1081 | + } catch (PDOException $e) { |
|
| 1082 | 1082 | return "error (add stats_airline & filter_name column in stats_pilot) : ".$e->getMessage()."\n"; |
| 1083 | 1083 | } |
| 1084 | 1084 | // Add unique key |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | try { |
| 1091 | 1091 | $sth = $Connection->db->prepare($query); |
| 1092 | 1092 | $sth->execute(); |
| 1093 | - } catch(PDOException $e) { |
|
| 1093 | + } catch (PDOException $e) { |
|
| 1094 | 1094 | return "error (add unique key in stats_pilot) : ".$e->getMessage()."\n"; |
| 1095 | 1095 | } |
| 1096 | 1096 | } |
@@ -1098,7 +1098,7 @@ discard block |
||
| 1098 | 1098 | try { |
| 1099 | 1099 | $sth = $Connection->db->prepare($query); |
| 1100 | 1100 | $sth->execute(); |
| 1101 | - } catch(PDOException $e) { |
|
| 1101 | + } catch (PDOException $e) { |
|
| 1102 | 1102 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 1103 | 1103 | } |
| 1104 | 1104 | return $error; |
@@ -1108,12 +1108,12 @@ discard block |
||
| 1108 | 1108 | global $globalDBdriver; |
| 1109 | 1109 | $Connection = new Connection(); |
| 1110 | 1110 | $error = ''; |
| 1111 | - if (!$Connection->checkColumnName('atc','format_source')) { |
|
| 1111 | + if (!$Connection->checkColumnName('atc', 'format_source')) { |
|
| 1112 | 1112 | $query = "ALTER TABLE atc ADD format_source VARCHAR(255) DEFAULT NULL, ADD source_name VARCHAR(255) DEFAULT NULL"; |
| 1113 | 1113 | try { |
| 1114 | 1114 | $sth = $Connection->db->prepare($query); |
| 1115 | 1115 | $sth->execute(); |
| 1116 | - } catch(PDOException $e) { |
|
| 1116 | + } catch (PDOException $e) { |
|
| 1117 | 1117 | return "error (add format_source & source_name column in atc) : ".$e->getMessage()."\n"; |
| 1118 | 1118 | } |
| 1119 | 1119 | } |
@@ -1121,7 +1121,7 @@ discard block |
||
| 1121 | 1121 | try { |
| 1122 | 1122 | $sth = $Connection->db->prepare($query); |
| 1123 | 1123 | $sth->execute(); |
| 1124 | - } catch(PDOException $e) { |
|
| 1124 | + } catch (PDOException $e) { |
|
| 1125 | 1125 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 1126 | 1126 | } |
| 1127 | 1127 | return $error; |
@@ -1131,13 +1131,13 @@ discard block |
||
| 1131 | 1131 | global $globalDBdriver; |
| 1132 | 1132 | $Connection = new Connection(); |
| 1133 | 1133 | $error = ''; |
| 1134 | - if (!$Connection->checkColumnName('stats_pilot','format_source')) { |
|
| 1134 | + if (!$Connection->checkColumnName('stats_pilot', 'format_source')) { |
|
| 1135 | 1135 | // Add forsource to airlines |
| 1136 | 1136 | $query = "ALTER TABLE stats_pilot ADD format_source VARCHAR(255) NULL DEFAULT ''"; |
| 1137 | 1137 | try { |
| 1138 | 1138 | $sth = $Connection->db->prepare($query); |
| 1139 | 1139 | $sth->execute(); |
| 1140 | - } catch(PDOException $e) { |
|
| 1140 | + } catch (PDOException $e) { |
|
| 1141 | 1141 | return "error (add format_source column in stats_pilot) : ".$e->getMessage()."\n"; |
| 1142 | 1142 | } |
| 1143 | 1143 | // Add unique key |
@@ -1149,7 +1149,7 @@ discard block |
||
| 1149 | 1149 | try { |
| 1150 | 1150 | $sth = $Connection->db->prepare($query); |
| 1151 | 1151 | $sth->execute(); |
| 1152 | - } catch(PDOException $e) { |
|
| 1152 | + } catch (PDOException $e) { |
|
| 1153 | 1153 | return "error (modify unique key in stats_pilot) : ".$e->getMessage()."\n"; |
| 1154 | 1154 | } |
| 1155 | 1155 | } |
@@ -1157,7 +1157,7 @@ discard block |
||
| 1157 | 1157 | try { |
| 1158 | 1158 | $sth = $Connection->db->prepare($query); |
| 1159 | 1159 | $sth->execute(); |
| 1160 | - } catch(PDOException $e) { |
|
| 1160 | + } catch (PDOException $e) { |
|
| 1161 | 1161 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 1162 | 1162 | } |
| 1163 | 1163 | return $error; |
@@ -1167,23 +1167,23 @@ discard block |
||
| 1167 | 1167 | global $globalDBdriver; |
| 1168 | 1168 | $Connection = new Connection(); |
| 1169 | 1169 | $error = ''; |
| 1170 | - if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live','latitude')) { |
|
| 1170 | + if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live', 'latitude')) { |
|
| 1171 | 1171 | // Add unique key |
| 1172 | 1172 | $query = "alter table spotter_live add index(latitude,longitude)"; |
| 1173 | 1173 | try { |
| 1174 | 1174 | $sth = $Connection->db->prepare($query); |
| 1175 | 1175 | $sth->execute(); |
| 1176 | - } catch(PDOException $e) { |
|
| 1176 | + } catch (PDOException $e) { |
|
| 1177 | 1177 | return "error (add index latitude,longitude on spotter_live) : ".$e->getMessage()."\n"; |
| 1178 | 1178 | } |
| 1179 | 1179 | } |
| 1180 | - if (!$Connection->checkColumnName('aircraft','mfr')) { |
|
| 1180 | + if (!$Connection->checkColumnName('aircraft', 'mfr')) { |
|
| 1181 | 1181 | // Add mfr to aircraft |
| 1182 | 1182 | $query = "ALTER TABLE aircraft ADD mfr VARCHAR(255) NULL"; |
| 1183 | 1183 | try { |
| 1184 | 1184 | $sth = $Connection->db->prepare($query); |
| 1185 | 1185 | $sth->execute(); |
| 1186 | - } catch(PDOException $e) { |
|
| 1186 | + } catch (PDOException $e) { |
|
| 1187 | 1187 | return "error (add mfr column in aircraft) : ".$e->getMessage()."\n"; |
| 1188 | 1188 | } |
| 1189 | 1189 | } |
@@ -1199,7 +1199,7 @@ discard block |
||
| 1199 | 1199 | try { |
| 1200 | 1200 | $sth = $Connection->db->prepare($query); |
| 1201 | 1201 | $sth->execute(); |
| 1202 | - } catch(PDOException $e) { |
|
| 1202 | + } catch (PDOException $e) { |
|
| 1203 | 1203 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 1204 | 1204 | } |
| 1205 | 1205 | return $error; |
@@ -1209,13 +1209,13 @@ discard block |
||
| 1209 | 1209 | global $globalDBdriver; |
| 1210 | 1210 | $Connection = new Connection(); |
| 1211 | 1211 | $error = ''; |
| 1212 | - if ($Connection->checkColumnName('aircraft','mfr')) { |
|
| 1212 | + if ($Connection->checkColumnName('aircraft', 'mfr')) { |
|
| 1213 | 1213 | // drop mfr to aircraft |
| 1214 | 1214 | $query = "ALTER TABLE aircraft DROP COLUMN mfr"; |
| 1215 | 1215 | try { |
| 1216 | 1216 | $sth = $Connection->db->prepare($query); |
| 1217 | 1217 | $sth->execute(); |
| 1218 | - } catch(PDOException $e) { |
|
| 1218 | + } catch (PDOException $e) { |
|
| 1219 | 1219 | return "error (drop mfr column in aircraft) : ".$e->getMessage()."\n"; |
| 1220 | 1220 | } |
| 1221 | 1221 | } |
@@ -1231,7 +1231,7 @@ discard block |
||
| 1231 | 1231 | try { |
| 1232 | 1232 | $sth = $Connection->db->prepare($query); |
| 1233 | 1233 | $sth->execute(); |
| 1234 | - } catch(PDOException $e) { |
|
| 1234 | + } catch (PDOException $e) { |
|
| 1235 | 1235 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 1236 | 1236 | } |
| 1237 | 1237 | return $error; |
@@ -1241,33 +1241,33 @@ discard block |
||
| 1241 | 1241 | global $globalDBdriver; |
| 1242 | 1242 | $Connection = new Connection(); |
| 1243 | 1243 | $error = ''; |
| 1244 | - if (!$Connection->indexExists('notam','ref_idx')) { |
|
| 1244 | + if (!$Connection->indexExists('notam', 'ref_idx')) { |
|
| 1245 | 1245 | // Add index key |
| 1246 | 1246 | $query = "create index ref_idx on notam (ref)"; |
| 1247 | 1247 | try { |
| 1248 | 1248 | $sth = $Connection->db->prepare($query); |
| 1249 | 1249 | $sth->execute(); |
| 1250 | - } catch(PDOException $e) { |
|
| 1250 | + } catch (PDOException $e) { |
|
| 1251 | 1251 | return "error (add index ref on notam) : ".$e->getMessage()."\n"; |
| 1252 | 1252 | } |
| 1253 | 1253 | } |
| 1254 | - if (!$Connection->indexExists('accidents','registration_idx')) { |
|
| 1254 | + if (!$Connection->indexExists('accidents', 'registration_idx')) { |
|
| 1255 | 1255 | // Add index key |
| 1256 | 1256 | $query = "create index registration_idx on accidents (registration)"; |
| 1257 | 1257 | try { |
| 1258 | 1258 | $sth = $Connection->db->prepare($query); |
| 1259 | 1259 | $sth->execute(); |
| 1260 | - } catch(PDOException $e) { |
|
| 1260 | + } catch (PDOException $e) { |
|
| 1261 | 1261 | return "error (add index registration on accidents) : ".$e->getMessage()."\n"; |
| 1262 | 1262 | } |
| 1263 | 1263 | } |
| 1264 | - if (!$Connection->indexExists('accidents','rdts')) { |
|
| 1264 | + if (!$Connection->indexExists('accidents', 'rdts')) { |
|
| 1265 | 1265 | // Add index key |
| 1266 | 1266 | $query = "create index rdts on accidents (registration,date,type,source)"; |
| 1267 | 1267 | try { |
| 1268 | 1268 | $sth = $Connection->db->prepare($query); |
| 1269 | 1269 | $sth->execute(); |
| 1270 | - } catch(PDOException $e) { |
|
| 1270 | + } catch (PDOException $e) { |
|
| 1271 | 1271 | return "error (add index registration, date, type & source on accidents) : ".$e->getMessage()."\n"; |
| 1272 | 1272 | } |
| 1273 | 1273 | } |
@@ -1276,7 +1276,7 @@ discard block |
||
| 1276 | 1276 | try { |
| 1277 | 1277 | $sth = $Connection->db->prepare($query); |
| 1278 | 1278 | $sth->execute(); |
| 1279 | - } catch(PDOException $e) { |
|
| 1279 | + } catch (PDOException $e) { |
|
| 1280 | 1280 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 1281 | 1281 | } |
| 1282 | 1282 | return $error; |
@@ -1286,23 +1286,23 @@ discard block |
||
| 1286 | 1286 | global $globalDBdriver; |
| 1287 | 1287 | $Connection = new Connection(); |
| 1288 | 1288 | $error = ''; |
| 1289 | - if (!$Connection->checkColumnName('accidents','airline_name')) { |
|
| 1289 | + if (!$Connection->checkColumnName('accidents', 'airline_name')) { |
|
| 1290 | 1290 | // Add airline_name to accidents |
| 1291 | 1291 | $query = "ALTER TABLE accidents ADD airline_name VARCHAR(255) NULL"; |
| 1292 | 1292 | try { |
| 1293 | 1293 | $sth = $Connection->db->prepare($query); |
| 1294 | 1294 | $sth->execute(); |
| 1295 | - } catch(PDOException $e) { |
|
| 1295 | + } catch (PDOException $e) { |
|
| 1296 | 1296 | return "error (add airline_name column in accidents) : ".$e->getMessage()."\n"; |
| 1297 | 1297 | } |
| 1298 | 1298 | } |
| 1299 | - if (!$Connection->checkColumnName('accidents','airline_icao')) { |
|
| 1299 | + if (!$Connection->checkColumnName('accidents', 'airline_icao')) { |
|
| 1300 | 1300 | // Add airline_icao to accidents |
| 1301 | 1301 | $query = "ALTER TABLE accidents ADD airline_icao VARCHAR(10) NULL"; |
| 1302 | 1302 | try { |
| 1303 | 1303 | $sth = $Connection->db->prepare($query); |
| 1304 | 1304 | $sth->execute(); |
| 1305 | - } catch(PDOException $e) { |
|
| 1305 | + } catch (PDOException $e) { |
|
| 1306 | 1306 | return "error (add airline_icao column in accidents) : ".$e->getMessage()."\n"; |
| 1307 | 1307 | } |
| 1308 | 1308 | } |
@@ -1310,7 +1310,7 @@ discard block |
||
| 1310 | 1310 | try { |
| 1311 | 1311 | $sth = $Connection->db->prepare($query); |
| 1312 | 1312 | $sth->execute(); |
| 1313 | - } catch(PDOException $e) { |
|
| 1313 | + } catch (PDOException $e) { |
|
| 1314 | 1314 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 1315 | 1315 | } |
| 1316 | 1316 | return $error; |
@@ -1320,13 +1320,13 @@ discard block |
||
| 1320 | 1320 | global $globalDBdriver, $globalVATSIM, $globalIVAO; |
| 1321 | 1321 | $Connection = new Connection(); |
| 1322 | 1322 | $error = ''; |
| 1323 | - if (!$Connection->checkColumnName('airlines','alliance')) { |
|
| 1323 | + if (!$Connection->checkColumnName('airlines', 'alliance')) { |
|
| 1324 | 1324 | // Add alliance to airlines |
| 1325 | 1325 | $query = "ALTER TABLE airlines ADD alliance VARCHAR(255) NULL"; |
| 1326 | 1326 | try { |
| 1327 | 1327 | $sth = $Connection->db->prepare($query); |
| 1328 | 1328 | $sth->execute(); |
| 1329 | - } catch(PDOException $e) { |
|
| 1329 | + } catch (PDOException $e) { |
|
| 1330 | 1330 | return "error (add alliance column in airlines) : ".$e->getMessage()."\n"; |
| 1331 | 1331 | } |
| 1332 | 1332 | } |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | try { |
| 1354 | 1354 | $sth = $Connection->db->prepare($query); |
| 1355 | 1355 | $sth->execute(); |
| 1356 | - } catch(PDOException $e) { |
|
| 1356 | + } catch (PDOException $e) { |
|
| 1357 | 1357 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 1358 | 1358 | } |
| 1359 | 1359 | return $error; |
@@ -1363,13 +1363,13 @@ discard block |
||
| 1363 | 1363 | global $globalDBdriver, $globalVATSIM, $globalIVAO; |
| 1364 | 1364 | $Connection = new Connection(); |
| 1365 | 1365 | $error = ''; |
| 1366 | - if (!$Connection->checkColumnName('airlines','ban_eu')) { |
|
| 1366 | + if (!$Connection->checkColumnName('airlines', 'ban_eu')) { |
|
| 1367 | 1367 | // Add ban_eu to airlines |
| 1368 | 1368 | $query = "ALTER TABLE airlines ADD ban_eu INTEGER NOT NULL DEFAULT '0'"; |
| 1369 | 1369 | try { |
| 1370 | 1370 | $sth = $Connection->db->prepare($query); |
| 1371 | 1371 | $sth->execute(); |
| 1372 | - } catch(PDOException $e) { |
|
| 1372 | + } catch (PDOException $e) { |
|
| 1373 | 1373 | return "error (add ban_eu column in airlines) : ".$e->getMessage()."\n"; |
| 1374 | 1374 | } |
| 1375 | 1375 | } |
@@ -1377,7 +1377,7 @@ discard block |
||
| 1377 | 1377 | try { |
| 1378 | 1378 | $sth = $Connection->db->prepare($query); |
| 1379 | 1379 | $sth->execute(); |
| 1380 | - } catch(PDOException $e) { |
|
| 1380 | + } catch (PDOException $e) { |
|
| 1381 | 1381 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 1382 | 1382 | } |
| 1383 | 1383 | return $error; |
@@ -1399,7 +1399,7 @@ discard block |
||
| 1399 | 1399 | try { |
| 1400 | 1400 | $sth = $Connection->db->prepare($query); |
| 1401 | 1401 | $sth->execute(); |
| 1402 | - } catch(PDOException $e) { |
|
| 1402 | + } catch (PDOException $e) { |
|
| 1403 | 1403 | return "error : ".$e->getMessage()."\n"; |
| 1404 | 1404 | } |
| 1405 | 1405 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -258,7 +258,9 @@ discard block |
||
| 258 | 258 | // Update table countries |
| 259 | 259 | if ($Connection->tableExists('airspace')) { |
| 260 | 260 | $error .= update_db::update_countries(); |
| 261 | - if ($error != '') return $error; |
|
| 261 | + if ($error != '') { |
|
| 262 | + return $error; |
|
| 263 | + } |
|
| 262 | 264 | } |
| 263 | 265 | // Update schema_version to 7 |
| 264 | 266 | $query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'"; |
@@ -314,7 +316,9 @@ discard block |
||
| 314 | 316 | $error = ''; |
| 315 | 317 | // Update table aircraft |
| 316 | 318 | $error .= create_db::import_file('../db/source_location.sql'); |
| 317 | - if ($error != '') return $error; |
|
| 319 | + if ($error != '') { |
|
| 320 | + return $error; |
|
| 321 | + } |
|
| 318 | 322 | // Update schema_version to 6 |
| 319 | 323 | $query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'"; |
| 320 | 324 | try { |
@@ -331,7 +335,9 @@ discard block |
||
| 331 | 335 | $error = ''; |
| 332 | 336 | // Update table aircraft |
| 333 | 337 | $error .= create_db::import_file('../db/notam.sql'); |
| 334 | - if ($error != '') return $error; |
|
| 338 | + if ($error != '') { |
|
| 339 | + return $error; |
|
| 340 | + } |
|
| 335 | 341 | $query = "DELETE FROM config WHERE name = 'last_update_db'; |
| 336 | 342 | INSERT INTO config (name,value) VALUES ('last_update_db',NOW()); |
| 337 | 343 | DELETE FROM config WHERE name = 'last_update_notam_db'; |
@@ -365,7 +371,9 @@ discard block |
||
| 365 | 371 | $error = ''; |
| 366 | 372 | // Update table atc |
| 367 | 373 | $error .= create_db::import_file('../db/atc.sql'); |
| 368 | - if ($error != '') return $error; |
|
| 374 | + if ($error != '') { |
|
| 375 | + return $error; |
|
| 376 | + } |
|
| 369 | 377 | |
| 370 | 378 | $query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'"; |
| 371 | 379 | try { |
@@ -389,13 +397,21 @@ discard block |
||
| 389 | 397 | $error = ''; |
| 390 | 398 | // Add tables |
| 391 | 399 | $error .= create_db::import_file('../db/aircraft_owner.sql'); |
| 392 | - if ($error != '') return $error; |
|
| 400 | + if ($error != '') { |
|
| 401 | + return $error; |
|
| 402 | + } |
|
| 393 | 403 | $error .= create_db::import_file('../db/metar.sql'); |
| 394 | - if ($error != '') return $error; |
|
| 404 | + if ($error != '') { |
|
| 405 | + return $error; |
|
| 406 | + } |
|
| 395 | 407 | $error .= create_db::import_file('../db/taf.sql'); |
| 396 | - if ($error != '') return $error; |
|
| 408 | + if ($error != '') { |
|
| 409 | + return $error; |
|
| 410 | + } |
|
| 397 | 411 | $error .= create_db::import_file('../db/airport.sql'); |
| 398 | - if ($error != '') return $error; |
|
| 412 | + if ($error != '') { |
|
| 413 | + return $error; |
|
| 414 | + } |
|
| 399 | 415 | |
| 400 | 416 | $query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'"; |
| 401 | 417 | try { |
@@ -469,19 +485,33 @@ discard block |
||
| 469 | 485 | $error = ''; |
| 470 | 486 | // Add tables |
| 471 | 487 | $error .= create_db::import_file('../db/stats.sql'); |
| 472 | - if ($error != '') return $error; |
|
| 488 | + if ($error != '') { |
|
| 489 | + return $error; |
|
| 490 | + } |
|
| 473 | 491 | $error .= create_db::import_file('../db/stats_aircraft.sql'); |
| 474 | - if ($error != '') return $error; |
|
| 492 | + if ($error != '') { |
|
| 493 | + return $error; |
|
| 494 | + } |
|
| 475 | 495 | $error .= create_db::import_file('../db/stats_airline.sql'); |
| 476 | - if ($error != '') return $error; |
|
| 496 | + if ($error != '') { |
|
| 497 | + return $error; |
|
| 498 | + } |
|
| 477 | 499 | $error .= create_db::import_file('../db/stats_airport.sql'); |
| 478 | - if ($error != '') return $error; |
|
| 500 | + if ($error != '') { |
|
| 501 | + return $error; |
|
| 502 | + } |
|
| 479 | 503 | $error .= create_db::import_file('../db/stats_owner.sql'); |
| 480 | - if ($error != '') return $error; |
|
| 504 | + if ($error != '') { |
|
| 505 | + return $error; |
|
| 506 | + } |
|
| 481 | 507 | $error .= create_db::import_file('../db/stats_pilot.sql'); |
| 482 | - if ($error != '') return $error; |
|
| 508 | + if ($error != '') { |
|
| 509 | + return $error; |
|
| 510 | + } |
|
| 483 | 511 | $error .= create_db::import_file('../db/spotter_archive_output.sql'); |
| 484 | - if ($error != '') return $error; |
|
| 512 | + if ($error != '') { |
|
| 513 | + return $error; |
|
| 514 | + } |
|
| 485 | 515 | |
| 486 | 516 | $query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'"; |
| 487 | 517 | try { |
@@ -521,7 +551,9 @@ discard block |
||
| 521 | 551 | // Add tables |
| 522 | 552 | if (!$Connection->tableExists('stats_flight')) { |
| 523 | 553 | $error .= create_db::import_file('../db/stats_flight.sql'); |
| 524 | - if ($error != '') return $error; |
|
| 554 | + if ($error != '') { |
|
| 555 | + return $error; |
|
| 556 | + } |
|
| 525 | 557 | } |
| 526 | 558 | $query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'"; |
| 527 | 559 | try { |
@@ -545,7 +577,9 @@ discard block |
||
| 545 | 577 | } catch(PDOException $e) { |
| 546 | 578 | return "error (update stats) : ".$e->getMessage()."\n"; |
| 547 | 579 | } |
| 548 | - if ($error != '') return $error; |
|
| 580 | + if ($error != '') { |
|
| 581 | + return $error; |
|
| 582 | + } |
|
| 549 | 583 | $query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'"; |
| 550 | 584 | try { |
| 551 | 585 | $sth = $Connection->db->prepare($query); |
@@ -566,7 +600,9 @@ discard block |
||
| 566 | 600 | if (!$Connection->tableExists('stats_callsign')) { |
| 567 | 601 | $error .= create_db::import_file('../db/stats_callsign.sql'); |
| 568 | 602 | } |
| 569 | - if ($error != '') return $error; |
|
| 603 | + if ($error != '') { |
|
| 604 | + return $error; |
|
| 605 | + } |
|
| 570 | 606 | $query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'"; |
| 571 | 607 | try { |
| 572 | 608 | $sth = $Connection->db->prepare($query); |
@@ -584,7 +620,9 @@ discard block |
||
| 584 | 620 | if (!$Connection->tableExists('stats_country')) { |
| 585 | 621 | $error .= create_db::import_file('../db/stats_country.sql'); |
| 586 | 622 | } |
| 587 | - if ($error != '') return $error; |
|
| 623 | + if ($error != '') { |
|
| 624 | + return $error; |
|
| 625 | + } |
|
| 588 | 626 | $query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'"; |
| 589 | 627 | try { |
| 590 | 628 | $sth = $Connection->db->prepare($query); |
@@ -607,7 +645,9 @@ discard block |
||
| 607 | 645 | return "error (update stats) : ".$e->getMessage()."\n"; |
| 608 | 646 | } |
| 609 | 647 | } |
| 610 | - if ($error != '') return $error; |
|
| 648 | + if ($error != '') { |
|
| 649 | + return $error; |
|
| 650 | + } |
|
| 611 | 651 | $query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'"; |
| 612 | 652 | try { |
| 613 | 653 | $sth = $Connection->db->prepare($query); |
@@ -623,7 +663,9 @@ discard block |
||
| 623 | 663 | $error = ''; |
| 624 | 664 | // Update airport table |
| 625 | 665 | $error .= create_db::import_file('../db/airport.sql'); |
| 626 | - if ($error != '') return 'Import airport.sql : '.$error; |
|
| 666 | + if ($error != '') { |
|
| 667 | + return 'Import airport.sql : '.$error; |
|
| 668 | + } |
|
| 627 | 669 | // Remove primary key on Spotter_Archive |
| 628 | 670 | $query = "alter table spotter_archive drop spotter_archive_id"; |
| 629 | 671 | try { |
@@ -699,7 +741,9 @@ discard block |
||
| 699 | 741 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 700 | 742 | } |
| 701 | 743 | } |
| 702 | - if ($error != '') return $error; |
|
| 744 | + if ($error != '') { |
|
| 745 | + return $error; |
|
| 746 | + } |
|
| 703 | 747 | $query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'"; |
| 704 | 748 | try { |
| 705 | 749 | $sth = $Connection->db->prepare($query); |
@@ -717,7 +761,9 @@ discard block |
||
| 717 | 761 | // Update airline table |
| 718 | 762 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
| 719 | 763 | $error .= create_db::import_file('../db/airlines.sql'); |
| 720 | - if ($error != '') return 'Import airlines.sql : '.$error; |
|
| 764 | + if ($error != '') { |
|
| 765 | + return 'Import airlines.sql : '.$error; |
|
| 766 | + } |
|
| 721 | 767 | } |
| 722 | 768 | if (!$Connection->checkColumnName('aircraft_modes','type_flight')) { |
| 723 | 769 | // Add column over_country |
@@ -729,7 +775,9 @@ discard block |
||
| 729 | 775 | return "error (add over_country) : ".$e->getMessage()."\n"; |
| 730 | 776 | } |
| 731 | 777 | } |
| 732 | - if ($error != '') return $error; |
|
| 778 | + if ($error != '') { |
|
| 779 | + return $error; |
|
| 780 | + } |
|
| 733 | 781 | /* |
| 734 | 782 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
| 735 | 783 | // Force update ModeS (this will put type_flight data |
@@ -759,7 +807,9 @@ discard block |
||
| 759 | 807 | } catch(PDOException $e) { |
| 760 | 808 | return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n"; |
| 761 | 809 | } |
| 762 | - if ($error != '') return $error; |
|
| 810 | + if ($error != '') { |
|
| 811 | + return $error; |
|
| 812 | + } |
|
| 763 | 813 | } |
| 764 | 814 | $query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'"; |
| 765 | 815 | try { |
@@ -782,7 +832,9 @@ discard block |
||
| 782 | 832 | } else { |
| 783 | 833 | $error .= create_db::import_file('../db/pgsql/stats_source.sql'); |
| 784 | 834 | } |
| 785 | - if ($error != '') return $error; |
|
| 835 | + if ($error != '') { |
|
| 836 | + return $error; |
|
| 837 | + } |
|
| 786 | 838 | } |
| 787 | 839 | $query = "UPDATE config SET value = '23' WHERE name = 'schema_version'"; |
| 788 | 840 | try { |
@@ -804,12 +856,16 @@ discard block |
||
| 804 | 856 | if ($globalDBdriver == 'mysql') { |
| 805 | 857 | if (!$Connection->tableExists('tle')) { |
| 806 | 858 | $error .= create_db::import_file('../db/tle.sql'); |
| 807 | - if ($error != '') return $error; |
|
| 859 | + if ($error != '') { |
|
| 860 | + return $error; |
|
| 861 | + } |
|
| 808 | 862 | } |
| 809 | 863 | } else { |
| 810 | 864 | if (!$Connection->tableExists('tle')) { |
| 811 | 865 | $error .= create_db::import_file('../db/pgsql/tle.sql'); |
| 812 | - if ($error != '') return $error; |
|
| 866 | + if ($error != '') { |
|
| 867 | + return $error; |
|
| 868 | + } |
|
| 813 | 869 | } |
| 814 | 870 | $query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)"; |
| 815 | 871 | try { |
@@ -849,7 +905,9 @@ discard block |
||
| 849 | 905 | } else { |
| 850 | 906 | $error .= create_db::import_file('../db/pgsql/airlines.sql'); |
| 851 | 907 | } |
| 852 | - if ($error != '') return 'Import airlines.sql : '.$error; |
|
| 908 | + if ($error != '') { |
|
| 909 | + return 'Import airlines.sql : '.$error; |
|
| 910 | + } |
|
| 853 | 911 | if (!$Connection->checkColumnName('airlines','forsource')) { |
| 854 | 912 | // Add forsource to airlines |
| 855 | 913 | $query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL"; |
@@ -1332,20 +1390,28 @@ discard block |
||
| 1332 | 1390 | } |
| 1333 | 1391 | if ($globalDBdriver == 'mysql') { |
| 1334 | 1392 | $error .= create_db::import_file('../db/airlines.sql'); |
| 1335 | - if ($error != '') return $error; |
|
| 1393 | + if ($error != '') { |
|
| 1394 | + return $error; |
|
| 1395 | + } |
|
| 1336 | 1396 | } else { |
| 1337 | 1397 | $error .= create_db::import_file('../db/pgsql/airlines.sql'); |
| 1338 | - if ($error != '') return $error; |
|
| 1398 | + if ($error != '') { |
|
| 1399 | + return $error; |
|
| 1400 | + } |
|
| 1339 | 1401 | } |
| 1340 | 1402 | if ((isset($globalVATSIM) && $globalVATSIM) || (isset($globalIVAO) && $globalIVAO)) { |
| 1341 | 1403 | include_once('class/class.update_db.php'); |
| 1342 | 1404 | if (isset($globalVATSIM) && $globalVATSIM) { |
| 1343 | 1405 | $error .= update_db::update_vatsim(); |
| 1344 | - if ($error != '') return $error; |
|
| 1406 | + if ($error != '') { |
|
| 1407 | + return $error; |
|
| 1408 | + } |
|
| 1345 | 1409 | } |
| 1346 | 1410 | if (isset($globalIVAO) && $globalIVAO && file_exists('tmp/ivae_feb2013.zip')) { |
| 1347 | 1411 | $error .= update_db::update_IVAO(); |
| 1348 | - if ($error != '') return $error; |
|
| 1412 | + if ($error != '') { |
|
| 1413 | + return $error; |
|
| 1414 | + } |
|
| 1349 | 1415 | } |
| 1350 | 1416 | } |
| 1351 | 1417 | |
@@ -1391,8 +1457,11 @@ discard block |
||
| 1391 | 1457 | if ($Connection->tableExists('aircraft')) { |
| 1392 | 1458 | if (!$Connection->tableExists('config')) { |
| 1393 | 1459 | $version = '1'; |
| 1394 | - if ($update) return self::update_from_1(); |
|
| 1395 | - else return $version; |
|
| 1460 | + if ($update) { |
|
| 1461 | + return self::update_from_1(); |
|
| 1462 | + } else { |
|
| 1463 | + return $version; |
|
| 1464 | + } |
|
| 1396 | 1465 | } else { |
| 1397 | 1466 | $Connection = new Connection(); |
| 1398 | 1467 | $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
@@ -1406,138 +1475,239 @@ discard block |
||
| 1406 | 1475 | if ($update) { |
| 1407 | 1476 | if ($result['value'] == '2') { |
| 1408 | 1477 | $error = self::update_from_2(); |
| 1409 | - if ($error != '') return $error; |
|
| 1410 | - else return self::check_version(true); |
|
| 1478 | + if ($error != '') { |
|
| 1479 | + return $error; |
|
| 1480 | + } else { |
|
| 1481 | + return self::check_version(true); |
|
| 1482 | + } |
|
| 1411 | 1483 | } elseif ($result['value'] == '3') { |
| 1412 | 1484 | $error = self::update_from_3(); |
| 1413 | - if ($error != '') return $error; |
|
| 1414 | - else return self::check_version(true); |
|
| 1485 | + if ($error != '') { |
|
| 1486 | + return $error; |
|
| 1487 | + } else { |
|
| 1488 | + return self::check_version(true); |
|
| 1489 | + } |
|
| 1415 | 1490 | } elseif ($result['value'] == '4') { |
| 1416 | 1491 | $error = self::update_from_4(); |
| 1417 | - if ($error != '') return $error; |
|
| 1418 | - else return self::check_version(true); |
|
| 1492 | + if ($error != '') { |
|
| 1493 | + return $error; |
|
| 1494 | + } else { |
|
| 1495 | + return self::check_version(true); |
|
| 1496 | + } |
|
| 1419 | 1497 | } elseif ($result['value'] == '5') { |
| 1420 | 1498 | $error = self::update_from_5(); |
| 1421 | - if ($error != '') return $error; |
|
| 1422 | - else return self::check_version(true); |
|
| 1499 | + if ($error != '') { |
|
| 1500 | + return $error; |
|
| 1501 | + } else { |
|
| 1502 | + return self::check_version(true); |
|
| 1503 | + } |
|
| 1423 | 1504 | } elseif ($result['value'] == '6') { |
| 1424 | 1505 | $error = self::update_from_6(); |
| 1425 | - if ($error != '') return $error; |
|
| 1426 | - else return self::check_version(true); |
|
| 1506 | + if ($error != '') { |
|
| 1507 | + return $error; |
|
| 1508 | + } else { |
|
| 1509 | + return self::check_version(true); |
|
| 1510 | + } |
|
| 1427 | 1511 | } elseif ($result['value'] == '7') { |
| 1428 | 1512 | $error = self::update_from_7(); |
| 1429 | - if ($error != '') return $error; |
|
| 1430 | - else return self::check_version(true); |
|
| 1513 | + if ($error != '') { |
|
| 1514 | + return $error; |
|
| 1515 | + } else { |
|
| 1516 | + return self::check_version(true); |
|
| 1517 | + } |
|
| 1431 | 1518 | } elseif ($result['value'] == '8') { |
| 1432 | 1519 | $error = self::update_from_8(); |
| 1433 | - if ($error != '') return $error; |
|
| 1434 | - else return self::check_version(true); |
|
| 1520 | + if ($error != '') { |
|
| 1521 | + return $error; |
|
| 1522 | + } else { |
|
| 1523 | + return self::check_version(true); |
|
| 1524 | + } |
|
| 1435 | 1525 | } elseif ($result['value'] == '9') { |
| 1436 | 1526 | $error = self::update_from_9(); |
| 1437 | - if ($error != '') return $error; |
|
| 1438 | - else return self::check_version(true); |
|
| 1527 | + if ($error != '') { |
|
| 1528 | + return $error; |
|
| 1529 | + } else { |
|
| 1530 | + return self::check_version(true); |
|
| 1531 | + } |
|
| 1439 | 1532 | } elseif ($result['value'] == '10') { |
| 1440 | 1533 | $error = self::update_from_10(); |
| 1441 | - if ($error != '') return $error; |
|
| 1442 | - else return self::check_version(true); |
|
| 1534 | + if ($error != '') { |
|
| 1535 | + return $error; |
|
| 1536 | + } else { |
|
| 1537 | + return self::check_version(true); |
|
| 1538 | + } |
|
| 1443 | 1539 | } elseif ($result['value'] == '11') { |
| 1444 | 1540 | $error = self::update_from_11(); |
| 1445 | - if ($error != '') return $error; |
|
| 1446 | - else return self::check_version(true); |
|
| 1541 | + if ($error != '') { |
|
| 1542 | + return $error; |
|
| 1543 | + } else { |
|
| 1544 | + return self::check_version(true); |
|
| 1545 | + } |
|
| 1447 | 1546 | } elseif ($result['value'] == '12') { |
| 1448 | 1547 | $error = self::update_from_12(); |
| 1449 | - if ($error != '') return $error; |
|
| 1450 | - else return self::check_version(true); |
|
| 1548 | + if ($error != '') { |
|
| 1549 | + return $error; |
|
| 1550 | + } else { |
|
| 1551 | + return self::check_version(true); |
|
| 1552 | + } |
|
| 1451 | 1553 | } elseif ($result['value'] == '13') { |
| 1452 | 1554 | $error = self::update_from_13(); |
| 1453 | - if ($error != '') return $error; |
|
| 1454 | - else return self::check_version(true); |
|
| 1555 | + if ($error != '') { |
|
| 1556 | + return $error; |
|
| 1557 | + } else { |
|
| 1558 | + return self::check_version(true); |
|
| 1559 | + } |
|
| 1455 | 1560 | } elseif ($result['value'] == '14') { |
| 1456 | 1561 | $error = self::update_from_14(); |
| 1457 | - if ($error != '') return $error; |
|
| 1458 | - else return self::check_version(true); |
|
| 1562 | + if ($error != '') { |
|
| 1563 | + return $error; |
|
| 1564 | + } else { |
|
| 1565 | + return self::check_version(true); |
|
| 1566 | + } |
|
| 1459 | 1567 | } elseif ($result['value'] == '15') { |
| 1460 | 1568 | $error = self::update_from_15(); |
| 1461 | - if ($error != '') return $error; |
|
| 1462 | - else return self::check_version(true); |
|
| 1569 | + if ($error != '') { |
|
| 1570 | + return $error; |
|
| 1571 | + } else { |
|
| 1572 | + return self::check_version(true); |
|
| 1573 | + } |
|
| 1463 | 1574 | } elseif ($result['value'] == '16') { |
| 1464 | 1575 | $error = self::update_from_16(); |
| 1465 | - if ($error != '') return $error; |
|
| 1466 | - else return self::check_version(true); |
|
| 1576 | + if ($error != '') { |
|
| 1577 | + return $error; |
|
| 1578 | + } else { |
|
| 1579 | + return self::check_version(true); |
|
| 1580 | + } |
|
| 1467 | 1581 | } elseif ($result['value'] == '17') { |
| 1468 | 1582 | $error = self::update_from_17(); |
| 1469 | - if ($error != '') return $error; |
|
| 1470 | - else return self::check_version(true); |
|
| 1583 | + if ($error != '') { |
|
| 1584 | + return $error; |
|
| 1585 | + } else { |
|
| 1586 | + return self::check_version(true); |
|
| 1587 | + } |
|
| 1471 | 1588 | } elseif ($result['value'] == '18') { |
| 1472 | 1589 | $error = self::update_from_18(); |
| 1473 | - if ($error != '') return $error; |
|
| 1474 | - else return self::check_version(true); |
|
| 1590 | + if ($error != '') { |
|
| 1591 | + return $error; |
|
| 1592 | + } else { |
|
| 1593 | + return self::check_version(true); |
|
| 1594 | + } |
|
| 1475 | 1595 | } elseif ($result['value'] == '19') { |
| 1476 | 1596 | $error = self::update_from_19(); |
| 1477 | - if ($error != '') return $error; |
|
| 1478 | - else return self::check_version(true); |
|
| 1597 | + if ($error != '') { |
|
| 1598 | + return $error; |
|
| 1599 | + } else { |
|
| 1600 | + return self::check_version(true); |
|
| 1601 | + } |
|
| 1479 | 1602 | } elseif ($result['value'] == '20') { |
| 1480 | 1603 | $error = self::update_from_20(); |
| 1481 | - if ($error != '') return $error; |
|
| 1482 | - else return self::check_version(true); |
|
| 1604 | + if ($error != '') { |
|
| 1605 | + return $error; |
|
| 1606 | + } else { |
|
| 1607 | + return self::check_version(true); |
|
| 1608 | + } |
|
| 1483 | 1609 | } elseif ($result['value'] == '21') { |
| 1484 | 1610 | $error = self::update_from_21(); |
| 1485 | - if ($error != '') return $error; |
|
| 1486 | - else return self::check_version(true); |
|
| 1611 | + if ($error != '') { |
|
| 1612 | + return $error; |
|
| 1613 | + } else { |
|
| 1614 | + return self::check_version(true); |
|
| 1615 | + } |
|
| 1487 | 1616 | } elseif ($result['value'] == '22') { |
| 1488 | 1617 | $error = self::update_from_22(); |
| 1489 | - if ($error != '') return $error; |
|
| 1490 | - else return self::check_version(true); |
|
| 1618 | + if ($error != '') { |
|
| 1619 | + return $error; |
|
| 1620 | + } else { |
|
| 1621 | + return self::check_version(true); |
|
| 1622 | + } |
|
| 1491 | 1623 | } elseif ($result['value'] == '23') { |
| 1492 | 1624 | $error = self::update_from_23(); |
| 1493 | - if ($error != '') return $error; |
|
| 1494 | - else return self::check_version(true); |
|
| 1625 | + if ($error != '') { |
|
| 1626 | + return $error; |
|
| 1627 | + } else { |
|
| 1628 | + return self::check_version(true); |
|
| 1629 | + } |
|
| 1495 | 1630 | } elseif ($result['value'] == '24') { |
| 1496 | 1631 | $error = self::update_from_24(); |
| 1497 | - if ($error != '') return $error; |
|
| 1498 | - else return self::check_version(true); |
|
| 1632 | + if ($error != '') { |
|
| 1633 | + return $error; |
|
| 1634 | + } else { |
|
| 1635 | + return self::check_version(true); |
|
| 1636 | + } |
|
| 1499 | 1637 | } elseif ($result['value'] == '25') { |
| 1500 | 1638 | $error = self::update_from_25(); |
| 1501 | - if ($error != '') return $error; |
|
| 1502 | - else return self::check_version(true); |
|
| 1639 | + if ($error != '') { |
|
| 1640 | + return $error; |
|
| 1641 | + } else { |
|
| 1642 | + return self::check_version(true); |
|
| 1643 | + } |
|
| 1503 | 1644 | } elseif ($result['value'] == '26') { |
| 1504 | 1645 | $error = self::update_from_26(); |
| 1505 | - if ($error != '') return $error; |
|
| 1506 | - else return self::check_version(true); |
|
| 1646 | + if ($error != '') { |
|
| 1647 | + return $error; |
|
| 1648 | + } else { |
|
| 1649 | + return self::check_version(true); |
|
| 1650 | + } |
|
| 1507 | 1651 | } elseif ($result['value'] == '27') { |
| 1508 | 1652 | $error = self::update_from_27(); |
| 1509 | - if ($error != '') return $error; |
|
| 1510 | - else return self::check_version(true); |
|
| 1653 | + if ($error != '') { |
|
| 1654 | + return $error; |
|
| 1655 | + } else { |
|
| 1656 | + return self::check_version(true); |
|
| 1657 | + } |
|
| 1511 | 1658 | } elseif ($result['value'] == '28') { |
| 1512 | 1659 | $error = self::update_from_28(); |
| 1513 | - if ($error != '') return $error; |
|
| 1514 | - else return self::check_version(true); |
|
| 1660 | + if ($error != '') { |
|
| 1661 | + return $error; |
|
| 1662 | + } else { |
|
| 1663 | + return self::check_version(true); |
|
| 1664 | + } |
|
| 1515 | 1665 | } elseif ($result['value'] == '29') { |
| 1516 | 1666 | $error = self::update_from_29(); |
| 1517 | - if ($error != '') return $error; |
|
| 1518 | - else return self::check_version(true); |
|
| 1667 | + if ($error != '') { |
|
| 1668 | + return $error; |
|
| 1669 | + } else { |
|
| 1670 | + return self::check_version(true); |
|
| 1671 | + } |
|
| 1519 | 1672 | } elseif ($result['value'] == '30') { |
| 1520 | 1673 | $error = self::update_from_30(); |
| 1521 | - if ($error != '') return $error; |
|
| 1522 | - else return self::check_version(true); |
|
| 1674 | + if ($error != '') { |
|
| 1675 | + return $error; |
|
| 1676 | + } else { |
|
| 1677 | + return self::check_version(true); |
|
| 1678 | + } |
|
| 1523 | 1679 | } elseif ($result['value'] == '31') { |
| 1524 | 1680 | $error = self::update_from_31(); |
| 1525 | - if ($error != '') return $error; |
|
| 1526 | - else return self::check_version(true); |
|
| 1681 | + if ($error != '') { |
|
| 1682 | + return $error; |
|
| 1683 | + } else { |
|
| 1684 | + return self::check_version(true); |
|
| 1685 | + } |
|
| 1527 | 1686 | } elseif ($result['value'] == '32') { |
| 1528 | 1687 | $error = self::update_from_32(); |
| 1529 | - if ($error != '') return $error; |
|
| 1530 | - else return self::check_version(true); |
|
| 1688 | + if ($error != '') { |
|
| 1689 | + return $error; |
|
| 1690 | + } else { |
|
| 1691 | + return self::check_version(true); |
|
| 1692 | + } |
|
| 1531 | 1693 | } elseif ($result['value'] == '33') { |
| 1532 | 1694 | $error = self::update_from_33(); |
| 1533 | - if ($error != '') return $error; |
|
| 1534 | - else return self::check_version(true); |
|
| 1535 | - } else return ''; |
|
| 1695 | + if ($error != '') { |
|
| 1696 | + return $error; |
|
| 1697 | + } else { |
|
| 1698 | + return self::check_version(true); |
|
| 1699 | + } |
|
| 1700 | + } else { |
|
| 1701 | + return ''; |
|
| 1702 | + } |
|
| 1703 | + } else { |
|
| 1704 | + return $result['value']; |
|
| 1536 | 1705 | } |
| 1537 | - else return $result['value']; |
|
| 1538 | 1706 | } |
| 1539 | 1707 | |
| 1540 | - } else return $version; |
|
| 1708 | + } else { |
|
| 1709 | + return $version; |
|
| 1710 | + } |
|
| 1541 | 1711 | } |
| 1542 | 1712 | |
| 1543 | 1713 | } |
@@ -6,6 +6,9 @@ discard block |
||
| 6 | 6 | public $dbs = array(); |
| 7 | 7 | public $latest_schema = 34; |
| 8 | 8 | |
| 9 | + /** |
|
| 10 | + * @param string $dbname |
|
| 11 | + */ |
|
| 9 | 12 | public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
| 10 | 13 | global $globalDBdriver; |
| 11 | 14 | if ($dbc === null) { |
@@ -132,6 +135,9 @@ discard block |
||
| 132 | 135 | return true; |
| 133 | 136 | } |
| 134 | 137 | |
| 138 | + /** |
|
| 139 | + * @param string $table |
|
| 140 | + */ |
|
| 135 | 141 | public function tableExists($table) |
| 136 | 142 | { |
| 137 | 143 | global $globalDBdriver, $globalDBname; |
@@ -181,6 +187,11 @@ discard block |
||
| 181 | 187 | /* |
| 182 | 188 | * Check if index exist |
| 183 | 189 | */ |
| 190 | + |
|
| 191 | + /** |
|
| 192 | + * @param string $table |
|
| 193 | + * @param string $index |
|
| 194 | + */ |
|
| 184 | 195 | public function indexExists($table,$index) |
| 185 | 196 | { |
| 186 | 197 | global $globalDBdriver, $globalDBname; |
@@ -227,6 +238,11 @@ discard block |
||
| 227 | 238 | * Check if a column name exist in a table |
| 228 | 239 | * @return Boolean column exist or not |
| 229 | 240 | */ |
| 241 | + |
|
| 242 | + /** |
|
| 243 | + * @param string $table |
|
| 244 | + * @param string $name |
|
| 245 | + */ |
|
| 230 | 246 | public function checkColumnName($table,$name) |
| 231 | 247 | { |
| 232 | 248 | global $globalDBdriver, $globalDBname; |
@@ -7,18 +7,18 @@ discard block |
||
| 7 | 7 | public $latest_schema = 34; |
| 8 | 8 | |
| 9 | 9 | public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
| 10 | - global $globalDBdriver; |
|
| 11 | - if ($dbc === null) { |
|
| 10 | + global $globalDBdriver; |
|
| 11 | + if ($dbc === null) { |
|
| 12 | 12 | if ($this->db === null && $dbname === null) { |
| 13 | - if ($user === null && $pass === null) { |
|
| 13 | + if ($user === null && $pass === null) { |
|
| 14 | 14 | $this->createDBConnection(); |
| 15 | - } else { |
|
| 15 | + } else { |
|
| 16 | 16 | $this->createDBConnection(null,$user,$pass); |
| 17 | - } |
|
| 17 | + } |
|
| 18 | 18 | } else { |
| 19 | - $this->createDBConnection($dbname); |
|
| 19 | + $this->createDBConnection($dbname); |
|
| 20 | 20 | } |
| 21 | - } elseif ($dbname === null || $dbname === 'default') { |
|
| 21 | + } elseif ($dbname === null || $dbname === 'default') { |
|
| 22 | 22 | $this->db = $dbc; |
| 23 | 23 | if ($this->connectionExists() === false) { |
| 24 | 24 | /* |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | $this->createDBConnection(); |
| 30 | 30 | } |
| 31 | - } else { |
|
| 31 | + } else { |
|
| 32 | 32 | //$this->connectionExists(); |
| 33 | 33 | $this->dbs[$dbname] = $dbc; |
| 34 | - } |
|
| 34 | + } |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function db() { |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * Creates the database connection |
|
| 51 | - * |
|
| 52 | - * @return Boolean of the database connection |
|
| 53 | - * |
|
| 54 | - */ |
|
| 50 | + * Creates the database connection |
|
| 51 | + * |
|
| 52 | + * @return Boolean of the database connection |
|
| 53 | + * |
|
| 54 | + */ |
|
| 55 | 55 | |
| 56 | 56 | public function createDBConnection($DBname = null, $user = null, $pass = null) |
| 57 | 57 | { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | return false; |
| 149 | 149 | } |
| 150 | 150 | if($results->rowCount()>0) { |
| 151 | - return true; |
|
| 151 | + return true; |
|
| 152 | 152 | } |
| 153 | 153 | else return false; |
| 154 | 154 | } |
@@ -165,14 +165,14 @@ discard block |
||
| 165 | 165 | $sum = $sum->fetchColumn(0); |
| 166 | 166 | } else $sum = 0; |
| 167 | 167 | if (intval($sum) !== 2) { |
| 168 | - return false; |
|
| 168 | + return false; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | } catch(PDOException $e) { |
| 172 | 172 | if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
| 173 | - throw $e; |
|
| 174 | - } |
|
| 175 | - //echo 'error ! '.$e->getMessage(); |
|
| 173 | + throw $e; |
|
| 174 | + } |
|
| 175 | + //echo 'error ! '.$e->getMessage(); |
|
| 176 | 176 | return false; |
| 177 | 177 | } |
| 178 | 178 | return true; |
@@ -270,8 +270,8 @@ discard block |
||
| 270 | 270 | $version = 0; |
| 271 | 271 | if ($this->tableExists('aircraft')) { |
| 272 | 272 | if (!$this->tableExists('config')) { |
| 273 | - $version = '1'; |
|
| 274 | - return $version; |
|
| 273 | + $version = '1'; |
|
| 274 | + return $version; |
|
| 275 | 275 | } else { |
| 276 | 276 | $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
| 277 | 277 | try { |
@@ -292,8 +292,8 @@ discard block |
||
| 292 | 292 | * @return Boolean if latest version or not |
| 293 | 293 | */ |
| 294 | 294 | public function latest() { |
| 295 | - if ($this->check_schema_version() == $this->latest_schema) return true; |
|
| 296 | - else return false; |
|
| 295 | + if ($this->check_schema_version() == $this->latest_schema) return true; |
|
| 296 | + else return false; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | } |
@@ -1,19 +1,19 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | require_once(dirname(__FILE__).'/settings.php'); |
| 3 | 3 | |
| 4 | -class Connection{ |
|
| 4 | +class Connection { |
|
| 5 | 5 | public $db = null; |
| 6 | 6 | public $dbs = array(); |
| 7 | 7 | public $latest_schema = 34; |
| 8 | 8 | |
| 9 | - public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
|
| 9 | + public function __construct($dbc = null, $dbname = null, $user = null, $pass = null) { |
|
| 10 | 10 | global $globalDBdriver; |
| 11 | 11 | if ($dbc === null) { |
| 12 | 12 | if ($this->db === null && $dbname === null) { |
| 13 | 13 | if ($user === null && $pass === null) { |
| 14 | 14 | $this->createDBConnection(); |
| 15 | 15 | } else { |
| 16 | - $this->createDBConnection(null,$user,$pass); |
|
| 16 | + $this->createDBConnection(null, $user, $pass); |
|
| 17 | 17 | } |
| 18 | 18 | } else { |
| 19 | 19 | $this->createDBConnection($dbname); |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | while (true) { |
| 92 | 92 | try { |
| 93 | 93 | if ($globalDBSdriver == 'mysql') { |
| 94 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
| 94 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
| 95 | 95 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 96 | 96 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 97 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
| 98 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
| 99 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 100 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 101 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 97 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
| 98 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 500); |
|
| 99 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
| 100 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
| 101 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
| 102 | 102 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 103 | 103 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
| 104 | 104 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -108,19 +108,19 @@ discard block |
||
| 108 | 108 | $this->dbs[$DBname]->exec('SET SESSION time_zone = "+00:00"'); |
| 109 | 109 | //$this->dbs[$DBname]->exec('SET @@session.time_zone = "+00:00"'); |
| 110 | 110 | } else { |
| 111 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
| 111 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
| 112 | 112 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 113 | 113 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 114 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
| 115 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
| 116 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 117 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 118 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 114 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
| 115 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 200); |
|
| 116 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
| 117 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
| 118 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
| 119 | 119 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 120 | 120 | $this->dbs[$DBname]->exec('SET timezone="UTC"'); |
| 121 | 121 | } |
| 122 | 122 | break; |
| 123 | - } catch(PDOException $e) { |
|
| 123 | + } catch (PDOException $e) { |
|
| 124 | 124 | $i++; |
| 125 | 125 | if (isset($globalDebug) && $globalDebug) echo $e->getMessage()."\n"; |
| 126 | 126 | //exit; |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | try { |
| 145 | 145 | //$Connection = new Connection(); |
| 146 | 146 | $results = $this->db->query($query); |
| 147 | - } catch(PDOException $e) { |
|
| 147 | + } catch (PDOException $e) { |
|
| 148 | 148 | return false; |
| 149 | 149 | } |
| 150 | - if($results->rowCount()>0) { |
|
| 150 | + if ($results->rowCount() > 0) { |
|
| 151 | 151 | return true; |
| 152 | 152 | } |
| 153 | 153 | else return false; |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | return false; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - } catch(PDOException $e) { |
|
| 172 | - if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
| 171 | + } catch (PDOException $e) { |
|
| 172 | + if ($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
| 173 | 173 | throw $e; |
| 174 | 174 | } |
| 175 | 175 | //echo 'error ! '.$e->getMessage(); |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | /* |
| 182 | 182 | * Check if index exist |
| 183 | 183 | */ |
| 184 | - public function indexExists($table,$index) |
|
| 184 | + public function indexExists($table, $index) |
|
| 185 | 185 | { |
| 186 | 186 | global $globalDBdriver, $globalDBname; |
| 187 | 187 | if ($globalDBdriver == 'mysql') { |
@@ -192,11 +192,11 @@ discard block |
||
| 192 | 192 | try { |
| 193 | 193 | //$Connection = new Connection(); |
| 194 | 194 | $results = $this->db->query($query); |
| 195 | - } catch(PDOException $e) { |
|
| 195 | + } catch (PDOException $e) { |
|
| 196 | 196 | return false; |
| 197 | 197 | } |
| 198 | 198 | $nb = $results->fetchAll(PDO::FETCH_ASSOC); |
| 199 | - if($nb[0]['nb'] > 0) { |
|
| 199 | + if ($nb[0]['nb'] > 0) { |
|
| 200 | 200 | return true; |
| 201 | 201 | } |
| 202 | 202 | else return false; |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
| 212 | 212 | try { |
| 213 | 213 | $results = $this->db->query($query); |
| 214 | - } catch(PDOException $e) { |
|
| 214 | + } catch (PDOException $e) { |
|
| 215 | 215 | return "error : ".$e->getMessage()."\n"; |
| 216 | 216 | } |
| 217 | 217 | $columns = array(); |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | * Check if a column name exist in a table |
| 228 | 228 | * @return Boolean column exist or not |
| 229 | 229 | */ |
| 230 | - public function checkColumnName($table,$name) |
|
| 230 | + public function checkColumnName($table, $name) |
|
| 231 | 231 | { |
| 232 | 232 | global $globalDBdriver, $globalDBname; |
| 233 | 233 | if ($globalDBdriver == 'mysql') { |
@@ -237,8 +237,8 @@ discard block |
||
| 237 | 237 | } |
| 238 | 238 | try { |
| 239 | 239 | $sth = $this->db()->prepare($query); |
| 240 | - $sth->execute(array(':database' => $globalDBname,':table' => $table,':name' => $name)); |
|
| 241 | - } catch(PDOException $e) { |
|
| 240 | + $sth->execute(array(':database' => $globalDBname, ':table' => $table, ':name' => $name)); |
|
| 241 | + } catch (PDOException $e) { |
|
| 242 | 242 | echo "error : ".$e->getMessage()."\n"; |
| 243 | 243 | } |
| 244 | 244 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | try { |
| 278 | 278 | $sth = $this->db->prepare($query); |
| 279 | 279 | $sth->execute(); |
| 280 | - } catch(PDOException $e) { |
|
| 280 | + } catch (PDOException $e) { |
|
| 281 | 281 | return "error : ".$e->getMessage()."\n"; |
| 282 | 282 | } |
| 283 | 283 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -64,8 +64,11 @@ discard block |
||
| 64 | 64 | $globalDBSname = $globalDBname; |
| 65 | 65 | $globalDBSuser = $globalDBuser; |
| 66 | 66 | $globalDBSpass = $globalDBpass; |
| 67 | - if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306; |
|
| 68 | - else $globalDBSport = $globalDBport; |
|
| 67 | + if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') { |
|
| 68 | + $globalDBSport = 3306; |
|
| 69 | + } else { |
|
| 70 | + $globalDBSport = $globalDBport; |
|
| 71 | + } |
|
| 69 | 72 | } else { |
| 70 | 73 | $DBname = 'default'; |
| 71 | 74 | $globalDBSdriver = $globalDBdriver; |
@@ -73,8 +76,11 @@ discard block |
||
| 73 | 76 | $globalDBSname = $globalDBname; |
| 74 | 77 | $globalDBSuser = $user; |
| 75 | 78 | $globalDBSpass = $pass; |
| 76 | - if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306; |
|
| 77 | - else $globalDBSport = $globalDBport; |
|
| 79 | + if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') { |
|
| 80 | + $globalDBSport = 3306; |
|
| 81 | + } else { |
|
| 82 | + $globalDBSport = $globalDBport; |
|
| 83 | + } |
|
| 78 | 84 | } |
| 79 | 85 | } else { |
| 80 | 86 | $globalDBSdriver = $globalDB[$DBname]['driver']; |
@@ -82,11 +88,16 @@ discard block |
||
| 82 | 88 | $globalDBSname = $globalDB[$DBname]['name']; |
| 83 | 89 | $globalDBSuser = $globalDB[$DBname]['user']; |
| 84 | 90 | $globalDBSpass = $globalDB[$DBname]['pass']; |
| 85 | - if (isset($globalDB[$DBname]['port'])) $globalDBSport = $globalDB[$DBname]['port']; |
|
| 86 | - else $globalDBSport = 3306; |
|
| 91 | + if (isset($globalDB[$DBname]['port'])) { |
|
| 92 | + $globalDBSport = $globalDB[$DBname]['port']; |
|
| 93 | + } else { |
|
| 94 | + $globalDBSport = 3306; |
|
| 95 | + } |
|
| 87 | 96 | } |
| 88 | 97 | // Set number of try to connect to DB |
| 89 | - if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) $globalDBretry = 5; |
|
| 98 | + if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) { |
|
| 99 | + $globalDBretry = 5; |
|
| 100 | + } |
|
| 90 | 101 | $i = 0; |
| 91 | 102 | while (true) { |
| 92 | 103 | try { |
@@ -95,10 +106,16 @@ discard block |
||
| 95 | 106 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 96 | 107 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 97 | 108 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
| 98 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
| 99 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 100 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 101 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 109 | + if (!isset($globalDBTimeOut)) { |
|
| 110 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
| 111 | + } else { |
|
| 112 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 113 | + } |
|
| 114 | + if (!isset($globalDBPersistent)) { |
|
| 115 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 116 | + } else { |
|
| 117 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 118 | + } |
|
| 102 | 119 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 103 | 120 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
| 104 | 121 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -112,23 +129,35 @@ discard block |
||
| 112 | 129 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 113 | 130 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 114 | 131 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
| 115 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
| 116 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 117 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 118 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 132 | + if (!isset($globalDBTimeOut)) { |
|
| 133 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
| 134 | + } else { |
|
| 135 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 136 | + } |
|
| 137 | + if (!isset($globalDBPersistent)) { |
|
| 138 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 139 | + } else { |
|
| 140 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 141 | + } |
|
| 119 | 142 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 120 | 143 | $this->dbs[$DBname]->exec('SET timezone="UTC"'); |
| 121 | 144 | } |
| 122 | 145 | break; |
| 123 | 146 | } catch(PDOException $e) { |
| 124 | 147 | $i++; |
| 125 | - if (isset($globalDebug) && $globalDebug) echo $e->getMessage()."\n"; |
|
| 148 | + if (isset($globalDebug) && $globalDebug) { |
|
| 149 | + echo $e->getMessage()."\n"; |
|
| 150 | + } |
|
| 126 | 151 | //exit; |
| 127 | - if ($i > $globalDBretry) return false; |
|
| 152 | + if ($i > $globalDBretry) { |
|
| 153 | + return false; |
|
| 154 | + } |
|
| 128 | 155 | //return false; |
| 129 | 156 | } |
| 130 | 157 | } |
| 131 | - if ($DBname === 'default') $this->db = $this->dbs['default']; |
|
| 158 | + if ($DBname === 'default') { |
|
| 159 | + $this->db = $this->dbs['default']; |
|
| 160 | + } |
|
| 132 | 161 | return true; |
| 133 | 162 | } |
| 134 | 163 | |
@@ -140,7 +169,9 @@ discard block |
||
| 140 | 169 | } else { |
| 141 | 170 | $query = "SELECT * FROM pg_catalog.pg_tables WHERE tablename = '".$table."'"; |
| 142 | 171 | } |
| 143 | - if ($this->db == NULL) return false; |
|
| 172 | + if ($this->db == NULL) { |
|
| 173 | + return false; |
|
| 174 | + } |
|
| 144 | 175 | try { |
| 145 | 176 | //$Connection = new Connection(); |
| 146 | 177 | $results = $this->db->query($query); |
@@ -149,21 +180,28 @@ discard block |
||
| 149 | 180 | } |
| 150 | 181 | if($results->rowCount()>0) { |
| 151 | 182 | return true; |
| 183 | + } else { |
|
| 184 | + return false; |
|
| 152 | 185 | } |
| 153 | - else return false; |
|
| 154 | 186 | } |
| 155 | 187 | |
| 156 | 188 | public function connectionExists() |
| 157 | 189 | { |
| 158 | 190 | global $globalDBdriver, $globalDBCheckConnection; |
| 159 | - if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) return true; |
|
| 191 | + if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) { |
|
| 192 | + return true; |
|
| 193 | + } |
|
| 160 | 194 | $query = "SELECT 1 + 1"; |
| 161 | - if ($this->db === null) return false; |
|
| 195 | + if ($this->db === null) { |
|
| 196 | + return false; |
|
| 197 | + } |
|
| 162 | 198 | try { |
| 163 | 199 | $sum = @$this->db->query($query); |
| 164 | 200 | if ($sum instanceof \PDOStatement) { |
| 165 | 201 | $sum = $sum->fetchColumn(0); |
| 166 | - } else $sum = 0; |
|
| 202 | + } else { |
|
| 203 | + $sum = 0; |
|
| 204 | + } |
|
| 167 | 205 | if (intval($sum) !== 2) { |
| 168 | 206 | return false; |
| 169 | 207 | } |
@@ -198,8 +236,9 @@ discard block |
||
| 198 | 236 | $nb = $results->fetchAll(PDO::FETCH_ASSOC); |
| 199 | 237 | if($nb[0]['nb'] > 0) { |
| 200 | 238 | return true; |
| 239 | + } else { |
|
| 240 | + return false; |
|
| 201 | 241 | } |
| 202 | - else return false; |
|
| 203 | 242 | } |
| 204 | 243 | |
| 205 | 244 | /* |
@@ -243,9 +282,12 @@ discard block |
||
| 243 | 282 | } |
| 244 | 283 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 245 | 284 | $sth->closeCursor(); |
| 246 | - if ($result['nb'] > 0) return true; |
|
| 247 | - else return false; |
|
| 248 | -/* } else { |
|
| 285 | + if ($result['nb'] > 0) { |
|
| 286 | + return true; |
|
| 287 | + } else { |
|
| 288 | + return false; |
|
| 289 | + } |
|
| 290 | + /* } else { |
|
| 249 | 291 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
| 250 | 292 | try { |
| 251 | 293 | $results = $this->db->query($query); |
@@ -284,7 +326,9 @@ discard block |
||
| 284 | 326 | $sth->closeCursor(); |
| 285 | 327 | return $result['value']; |
| 286 | 328 | } |
| 287 | - } else return $version; |
|
| 329 | + } else { |
|
| 330 | + return $version; |
|
| 331 | + } |
|
| 288 | 332 | } |
| 289 | 333 | |
| 290 | 334 | /* |
@@ -292,8 +336,11 @@ discard block |
||
| 292 | 336 | * @return Boolean if latest version or not |
| 293 | 337 | */ |
| 294 | 338 | public function latest() { |
| 295 | - if ($this->check_schema_version() == $this->latest_schema) return true; |
|
| 296 | - else return false; |
|
| 339 | + if ($this->check_schema_version() == $this->latest_schema) { |
|
| 340 | + return true; |
|
| 341 | + } else { |
|
| 342 | + return false; |
|
| 343 | + } |
|
| 297 | 344 | } |
| 298 | 345 | |
| 299 | 346 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * Get SQL query part for filter used |
| 17 | 17 | * @param Array $filter the filter |
| 18 | - * @return Array the SQL part |
|
| 18 | + * @return string the SQL part |
|
| 19 | 19 | */ |
| 20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
@@ -8717,6 +8717,7 @@ discard block |
||
| 8717 | 8717 | /** |
| 8718 | 8718 | * Counts all hours |
| 8719 | 8719 | * |
| 8720 | + * @param string $orderby |
|
| 8720 | 8721 | * @return Array the hour list |
| 8721 | 8722 | * |
| 8722 | 8723 | */ |
@@ -8782,6 +8783,7 @@ discard block |
||
| 8782 | 8783 | /** |
| 8783 | 8784 | * Counts all hours |
| 8784 | 8785 | * |
| 8786 | + * @param string $orderby |
|
| 8785 | 8787 | * @return Array the hour list |
| 8786 | 8788 | * |
| 8787 | 8789 | */ |
@@ -9594,7 +9596,7 @@ discard block |
||
| 9594 | 9596 | /** |
| 9595 | 9597 | * Parses the direction degrees to working |
| 9596 | 9598 | * |
| 9597 | - * @param Float $direction the direction in degrees |
|
| 9599 | + * @param integer $direction the direction in degrees |
|
| 9598 | 9600 | * @return Array the direction information |
| 9599 | 9601 | * |
| 9600 | 9602 | */ |
@@ -69,7 +69,9 @@ discard block |
||
| 69 | 69 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 72 | + if (is_array($globalFilter)) { |
|
| 73 | + $filter = array_merge($filter,$globalFilter); |
|
| 74 | + } |
|
| 73 | 75 | $filter_query_join = ''; |
| 74 | 76 | $filter_query_where = ''; |
| 75 | 77 | foreach($filters as $flt) { |
@@ -122,8 +124,11 @@ discard block |
||
| 122 | 124 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 123 | 125 | } |
| 124 | 126 | } |
| 125 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 126 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 127 | + if ($filter_query_where == '' && $where) { |
|
| 128 | + $filter_query_where = ' WHERE'; |
|
| 129 | + } elseif ($filter_query_where != '' && $and) { |
|
| 130 | + $filter_query_where .= ' AND'; |
|
| 131 | + } |
|
| 127 | 132 | $filter_query = $filter_query_join.$filter_query_where; |
| 128 | 133 | return $filter_query; |
| 129 | 134 | } |
@@ -143,10 +148,18 @@ discard block |
||
| 143 | 148 | $Image = new Image($this->db); |
| 144 | 149 | $Schedule = new Schedule($this->db); |
| 145 | 150 | $ACARS = new ACARS($this->db); |
| 146 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 147 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 148 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 149 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 151 | + if (!isset($globalIVAO)) { |
|
| 152 | + $globalIVAO = FALSE; |
|
| 153 | + } |
|
| 154 | + if (!isset($globalVATSIM)) { |
|
| 155 | + $globalVATSIM = FALSE; |
|
| 156 | + } |
|
| 157 | + if (!isset($globalphpVMS)) { |
|
| 158 | + $globalphpVMS = FALSE; |
|
| 159 | + } |
|
| 160 | + if (!isset($globalVAM)) { |
|
| 161 | + $globalVAM = FALSE; |
|
| 162 | + } |
|
| 150 | 163 | date_default_timezone_set('UTC'); |
| 151 | 164 | |
| 152 | 165 | if (!is_string($query)) |
@@ -193,21 +206,35 @@ discard block |
||
| 193 | 206 | } else { |
| 194 | 207 | $temp_array['spotter_id'] = ''; |
| 195 | 208 | } |
| 196 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 197 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
| 209 | + if (isset($row['flightaware_id'])) { |
|
| 210 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 211 | + } |
|
| 212 | + if (isset($row['modes'])) { |
|
| 213 | + $temp_array['modes'] = $row['modes']; |
|
| 214 | + } |
|
| 198 | 215 | $temp_array['ident'] = $row['ident']; |
| 199 | 216 | if (isset($row['registration']) && $row['registration'] != '') { |
| 200 | 217 | $temp_array['registration'] = $row['registration']; |
| 201 | 218 | } elseif (isset($temp_array['modes'])) { |
| 202 | 219 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
| 203 | - } else $temp_array['registration'] = ''; |
|
| 204 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 220 | + } else { |
|
| 221 | + $temp_array['registration'] = ''; |
|
| 222 | + } |
|
| 223 | + if (isset($row['aircraft_icao'])) { |
|
| 224 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 225 | + } |
|
| 205 | 226 | |
| 206 | 227 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
| 207 | 228 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
| 208 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 209 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 210 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 229 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
| 230 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 231 | + } |
|
| 232 | + if (isset($row['latitude'])) { |
|
| 233 | + $temp_array['latitude'] = $row['latitude']; |
|
| 234 | + } |
|
| 235 | + if (isset($row['longitude'])) { |
|
| 236 | + $temp_array['longitude'] = $row['longitude']; |
|
| 237 | + } |
|
| 211 | 238 | /* |
| 212 | 239 | if (Connection->tableExists('countries')) { |
| 213 | 240 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -217,8 +244,12 @@ discard block |
||
| 217 | 244 | } |
| 218 | 245 | } |
| 219 | 246 | */ |
| 220 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
| 221 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 247 | + if (isset($row['waypoints'])) { |
|
| 248 | + $temp_array['waypoints'] = $row['waypoints']; |
|
| 249 | + } |
|
| 250 | + if (isset($row['format_source'])) { |
|
| 251 | + $temp_array['format_source'] = $row['format_source']; |
|
| 252 | + } |
|
| 222 | 253 | if (isset($row['route_stop'])) { |
| 223 | 254 | $temp_array['route_stop'] = $row['route_stop']; |
| 224 | 255 | if ($row['route_stop'] != '') { |
@@ -237,13 +268,19 @@ discard block |
||
| 237 | 268 | } |
| 238 | 269 | } |
| 239 | 270 | } |
| 240 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
| 271 | + if (isset($row['altitude'])) { |
|
| 272 | + $temp_array['altitude'] = $row['altitude']; |
|
| 273 | + } |
|
| 241 | 274 | if (isset($row['heading'])) { |
| 242 | 275 | $temp_array['heading'] = $row['heading']; |
| 243 | 276 | $heading_direction = $this->parseDirection($row['heading']); |
| 244 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 277 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 278 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 279 | + } |
|
| 280 | + } |
|
| 281 | + if (isset($row['ground_speed'])) { |
|
| 282 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 245 | 283 | } |
| 246 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 247 | 284 | $temp_array['image'] = ""; |
| 248 | 285 | $temp_array['image_thumbnail'] = ""; |
| 249 | 286 | $temp_array['image_source'] = ""; |
@@ -251,7 +288,9 @@ discard block |
||
| 251 | 288 | |
| 252 | 289 | if (isset($row['highlight'])) { |
| 253 | 290 | $temp_array['highlight'] = $row['highlight']; |
| 254 | - } else $temp_array['highlight'] = ''; |
|
| 291 | + } else { |
|
| 292 | + $temp_array['highlight'] = ''; |
|
| 293 | + } |
|
| 255 | 294 | |
| 256 | 295 | if (isset($row['date'])) { |
| 257 | 296 | $dateArray = $this->parseDateString($row['date']); |
@@ -299,7 +338,9 @@ discard block |
||
| 299 | 338 | |
| 300 | 339 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 301 | 340 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 302 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 341 | + } else { |
|
| 342 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 343 | + } |
|
| 303 | 344 | } else { |
| 304 | 345 | $temp_array['aircraft_shadow'] = 'default.png'; |
| 305 | 346 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -307,11 +348,17 @@ discard block |
||
| 307 | 348 | } |
| 308 | 349 | } |
| 309 | 350 | $fromsource = NULL; |
| 310 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 311 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 312 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 313 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 314 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 351 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 352 | + $fromsource = $globalAirlinesSource; |
|
| 353 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 354 | + $fromsource = 'vatsim'; |
|
| 355 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 356 | + $fromsource = 'ivao'; |
|
| 357 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 358 | + $fromsource = 'vatsim'; |
|
| 359 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 360 | + $fromsource = 'ivao'; |
|
| 361 | + } |
|
| 315 | 362 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 316 | 363 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 317 | 364 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -334,12 +381,18 @@ discard block |
||
| 334 | 381 | } |
| 335 | 382 | } else { |
| 336 | 383 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 337 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 338 | - else $temp_array['airline_iata'] = 'N/A'; |
|
| 384 | + if (isset($row['airline_iata'])) { |
|
| 385 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 386 | + } else { |
|
| 387 | + $temp_array['airline_iata'] = 'N/A'; |
|
| 388 | + } |
|
| 339 | 389 | $temp_array['airline_name'] = $row['airline_name']; |
| 340 | 390 | $temp_array['airline_country'] = $row['airline_country']; |
| 341 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 342 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
| 391 | + if (isset($row['airline_callsign'])) { |
|
| 392 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 393 | + } else { |
|
| 394 | + $temp_array['airline_callsign'] = 'N/A'; |
|
| 395 | + } |
|
| 343 | 396 | $temp_array['airline_type'] = $row['airline_type']; |
| 344 | 397 | if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') { |
| 345 | 398 | $airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']); |
@@ -366,7 +419,9 @@ discard block |
||
| 366 | 419 | } |
| 367 | 420 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
| 368 | 421 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
| 369 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 422 | + if ($owner_info['owner'] != '') { |
|
| 423 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 424 | + } |
|
| 370 | 425 | $temp_array['aircraft_base'] = $owner_info['base']; |
| 371 | 426 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 372 | 427 | } |
@@ -374,9 +429,14 @@ discard block |
||
| 374 | 429 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
| 375 | 430 | { |
| 376 | 431 | if ($globalIVAO) { |
| 377 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 378 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 379 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 432 | + if (isset($temp_array['airline_icao'])) { |
|
| 433 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 434 | + } else { |
|
| 435 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 436 | + } |
|
| 437 | + } else { |
|
| 438 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 439 | + } |
|
| 380 | 440 | if (count($image_array) > 0) { |
| 381 | 441 | $temp_array['image'] = $image_array[0]['image']; |
| 382 | 442 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -428,7 +488,9 @@ discard block |
||
| 428 | 488 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
| 429 | 489 | if ($row['departure_airport_icao'] != '') { |
| 430 | 490 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
| 431 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 491 | + if (!isset($departure_airport_array[0]['name'])) { |
|
| 492 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 493 | + } |
|
| 432 | 494 | /* |
| 433 | 495 | } elseif ($row['departure_airport_name'] != '') { |
| 434 | 496 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -436,7 +498,9 @@ discard block |
||
| 436 | 498 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 437 | 499 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
| 438 | 500 | */ |
| 439 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 501 | + } else { |
|
| 502 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 503 | + } |
|
| 440 | 504 | if (isset($departure_airport_array[0]['name'])) { |
| 441 | 505 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
| 442 | 506 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -456,8 +520,12 @@ discard block |
||
| 456 | 520 | |
| 457 | 521 | if ($row['arrival_airport_icao'] != '') { |
| 458 | 522 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
| 459 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 460 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 523 | + if (count($arrival_airport_array) == 0) { |
|
| 524 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 525 | + } |
|
| 526 | + } else { |
|
| 527 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 528 | + } |
|
| 461 | 529 | if (isset($arrival_airport_array[0]['name'])) { |
| 462 | 530 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
| 463 | 531 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -473,27 +541,45 @@ discard block |
||
| 473 | 541 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 474 | 542 | } |
| 475 | 543 | */ |
| 476 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 477 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 478 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 479 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 480 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 544 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
| 545 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 546 | + } |
|
| 547 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
| 548 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 549 | + } |
|
| 550 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 551 | + $temp_array['source_name'] = $row['source_name']; |
|
| 552 | + } |
|
| 553 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 554 | + $temp_array['over_country'] = $row['over_country']; |
|
| 555 | + } |
|
| 556 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 557 | + $temp_array['distance'] = $row['distance']; |
|
| 558 | + } |
|
| 481 | 559 | if (isset($row['squawk'])) { |
| 482 | 560 | $temp_array['squawk'] = $row['squawk']; |
| 483 | 561 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 484 | 562 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
| 485 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 563 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 564 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 565 | + } |
|
| 486 | 566 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 487 | 567 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
| 488 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 489 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 568 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 569 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 570 | + } |
|
| 571 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
| 572 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 573 | + } |
|
| 490 | 574 | } |
| 491 | 575 | |
| 492 | 576 | $temp_array['query_number_rows'] = $num_rows; |
| 493 | 577 | |
| 494 | 578 | $spotter_array[] = $temp_array; |
| 495 | 579 | } |
| 496 | - if ($num_rows == 0) return array(); |
|
| 580 | + if ($num_rows == 0) { |
|
| 581 | + return array(); |
|
| 582 | + } |
|
| 497 | 583 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 498 | 584 | return $spotter_array; |
| 499 | 585 | } |
@@ -526,7 +612,9 @@ discard block |
||
| 526 | 612 | foreach ($q_array as $q_item){ |
| 527 | 613 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
| 528 | 614 | $additional_query .= " AND ("; |
| 529 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 615 | + if (is_int($q_item)) { |
|
| 616 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 617 | + } |
|
| 530 | 618 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 531 | 619 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
| 532 | 620 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -547,7 +635,9 @@ discard block |
||
| 547 | 635 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
| 548 | 636 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
| 549 | 637 | $translate = $Translation->ident2icao($q_item); |
| 550 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 638 | + if ($translate != $q_item) { |
|
| 639 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 640 | + } |
|
| 551 | 641 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
| 552 | 642 | $additional_query .= ")"; |
| 553 | 643 | } |
@@ -774,7 +864,9 @@ discard block |
||
| 774 | 864 | date_default_timezone_set($globalTimezone); |
| 775 | 865 | $datetime = new DateTime(); |
| 776 | 866 | $offset = $datetime->format('P'); |
| 777 | - } else $offset = '+00:00'; |
|
| 867 | + } else { |
|
| 868 | + $offset = '+00:00'; |
|
| 869 | + } |
|
| 778 | 870 | |
| 779 | 871 | if ($date_array[1] != "") |
| 780 | 872 | { |
@@ -806,8 +898,12 @@ discard block |
||
| 806 | 898 | { |
| 807 | 899 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 808 | 900 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 809 | - } else $limit_query = ""; |
|
| 810 | - } else $limit_query = ""; |
|
| 901 | + } else { |
|
| 902 | + $limit_query = ""; |
|
| 903 | + } |
|
| 904 | + } else { |
|
| 905 | + $limit_query = ""; |
|
| 906 | + } |
|
| 811 | 907 | |
| 812 | 908 | |
| 813 | 909 | if ($sort != "") |
@@ -875,8 +971,12 @@ discard block |
||
| 875 | 971 | { |
| 876 | 972 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 877 | 973 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 878 | - } else $limit_query = ""; |
|
| 879 | - } else $limit_query = ""; |
|
| 974 | + } else { |
|
| 975 | + $limit_query = ""; |
|
| 976 | + } |
|
| 977 | + } else { |
|
| 978 | + $limit_query = ""; |
|
| 979 | + } |
|
| 880 | 980 | |
| 881 | 981 | if ($sort != "") |
| 882 | 982 | { |
@@ -1200,7 +1300,9 @@ discard block |
||
| 1200 | 1300 | global $global_query; |
| 1201 | 1301 | |
| 1202 | 1302 | date_default_timezone_set('UTC'); |
| 1203 | - if ($id == '') return array(); |
|
| 1303 | + if ($id == '') { |
|
| 1304 | + return array(); |
|
| 1305 | + } |
|
| 1204 | 1306 | $additional_query = "spotter_output.spotter_id = :id"; |
| 1205 | 1307 | $query_values = array(':id' => $id); |
| 1206 | 1308 | |
@@ -1832,7 +1934,9 @@ discard block |
||
| 1832 | 1934 | { |
| 1833 | 1935 | $highlight = $row['highlight']; |
| 1834 | 1936 | } |
| 1835 | - if (isset($highlight)) return $highlight; |
|
| 1937 | + if (isset($highlight)) { |
|
| 1938 | + return $highlight; |
|
| 1939 | + } |
|
| 1836 | 1940 | } |
| 1837 | 1941 | |
| 1838 | 1942 | |
@@ -1860,7 +1964,9 @@ discard block |
||
| 1860 | 1964 | $sth->closeCursor(); |
| 1861 | 1965 | if (count($row) > 0) { |
| 1862 | 1966 | return $row['usage']; |
| 1863 | - } else return ''; |
|
| 1967 | + } else { |
|
| 1968 | + return ''; |
|
| 1969 | + } |
|
| 1864 | 1970 | } |
| 1865 | 1971 | |
| 1866 | 1972 | /** |
@@ -1885,7 +1991,9 @@ discard block |
||
| 1885 | 1991 | $sth->closeCursor(); |
| 1886 | 1992 | if (count($row) > 0) { |
| 1887 | 1993 | return $row['icao']; |
| 1888 | - } else return ''; |
|
| 1994 | + } else { |
|
| 1995 | + return ''; |
|
| 1996 | + } |
|
| 1889 | 1997 | } |
| 1890 | 1998 | |
| 1891 | 1999 | /** |
@@ -1913,7 +2021,9 @@ discard block |
||
| 1913 | 2021 | $airport_longitude = $row['longitude']; |
| 1914 | 2022 | $Common = new Common(); |
| 1915 | 2023 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
| 1916 | - } else return ''; |
|
| 2024 | + } else { |
|
| 2025 | + return ''; |
|
| 2026 | + } |
|
| 1917 | 2027 | } |
| 1918 | 2028 | |
| 1919 | 2029 | /** |
@@ -2025,7 +2135,9 @@ discard block |
||
| 2025 | 2135 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2026 | 2136 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2027 | 2137 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2028 | - } else return array(); |
|
| 2138 | + } else { |
|
| 2139 | + return array(); |
|
| 2140 | + } |
|
| 2029 | 2141 | if ($globalDBdriver == 'mysql') { |
| 2030 | 2142 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
| 2031 | 2143 | } else { |
@@ -2060,7 +2172,9 @@ discard block |
||
| 2060 | 2172 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2061 | 2173 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2062 | 2174 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2063 | - } else return array(); |
|
| 2175 | + } else { |
|
| 2176 | + return array(); |
|
| 2177 | + } |
|
| 2064 | 2178 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2065 | 2179 | $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
| 2066 | 2180 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2095,7 +2209,9 @@ discard block |
||
| 2095 | 2209 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2096 | 2210 | { |
| 2097 | 2211 | global $globalUseRealAirlines; |
| 2098 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2212 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2213 | + $fromsource = NULL; |
|
| 2214 | + } |
|
| 2099 | 2215 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
| 2100 | 2216 | if ($airline_icao == 'NA') { |
| 2101 | 2217 | $airline_array = array(); |
@@ -2145,7 +2261,9 @@ discard block |
||
| 2145 | 2261 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2146 | 2262 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2147 | 2263 | $sth->closeCursor(); |
| 2148 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfo($airline_icao); |
|
| 2264 | + if ($row['nb'] == 0) { |
|
| 2265 | + $result = $this->getAllAirlineInfo($airline_icao); |
|
| 2266 | + } |
|
| 2149 | 2267 | } |
| 2150 | 2268 | return $result; |
| 2151 | 2269 | } |
@@ -2161,7 +2279,9 @@ discard block |
||
| 2161 | 2279 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
| 2162 | 2280 | { |
| 2163 | 2281 | global $globalUseRealAirlines; |
| 2164 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2282 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2283 | + $fromsource = NULL; |
|
| 2284 | + } |
|
| 2165 | 2285 | $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
| 2166 | 2286 | $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
| 2167 | 2287 | $sth = $this->db->prepare($query); |
@@ -2177,7 +2297,9 @@ discard block |
||
| 2177 | 2297 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2178 | 2298 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2179 | 2299 | $sth->closeCursor(); |
| 2180 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2300 | + if ($row['nb'] == 0) { |
|
| 2301 | + $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2302 | + } |
|
| 2181 | 2303 | } |
| 2182 | 2304 | return $result; |
| 2183 | 2305 | } |
@@ -2240,15 +2362,20 @@ discard block |
||
| 2240 | 2362 | 'A320-211' => 'A320', |
| 2241 | 2363 | '747-8i' => 'B748', |
| 2242 | 2364 | 'A380' => 'A388'); |
| 2243 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
| 2365 | + if (isset($all_aircraft[$aircraft_type])) { |
|
| 2366 | + return $all_aircraft[$aircraft_type]; |
|
| 2367 | + } |
|
| 2244 | 2368 | |
| 2245 | 2369 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
| 2246 | 2370 | $aircraft_type = strtoupper($aircraft_type); |
| 2247 | 2371 | $sth = $this->db->prepare($query); |
| 2248 | 2372 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
| 2249 | 2373 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2250 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
| 2251 | - else return ''; |
|
| 2374 | + if (isset($result[0]['icao'])) { |
|
| 2375 | + return $result[0]['icao']; |
|
| 2376 | + } else { |
|
| 2377 | + return ''; |
|
| 2378 | + } |
|
| 2252 | 2379 | } |
| 2253 | 2380 | |
| 2254 | 2381 | /** |
@@ -2271,9 +2398,13 @@ discard block |
||
| 2271 | 2398 | $sth->closeCursor(); |
| 2272 | 2399 | if (isset($row['icaotypecode'])) { |
| 2273 | 2400 | $icao = $row['icaotypecode']; |
| 2274 | - if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2401 | + if (isset($this->aircraft_correct_icaotype[$icao])) { |
|
| 2402 | + $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2403 | + } |
|
| 2275 | 2404 | return $icao; |
| 2276 | - } else return ''; |
|
| 2405 | + } else { |
|
| 2406 | + return ''; |
|
| 2407 | + } |
|
| 2277 | 2408 | } |
| 2278 | 2409 | |
| 2279 | 2410 | /** |
@@ -2296,7 +2427,9 @@ discard block |
||
| 2296 | 2427 | $sth->closeCursor(); |
| 2297 | 2428 | if (isset($row['icaotypecode'])) { |
| 2298 | 2429 | return $row['icaotypecode']; |
| 2299 | - } else return ''; |
|
| 2430 | + } else { |
|
| 2431 | + return ''; |
|
| 2432 | + } |
|
| 2300 | 2433 | } |
| 2301 | 2434 | |
| 2302 | 2435 | /** |
@@ -2318,7 +2451,9 @@ discard block |
||
| 2318 | 2451 | $sth->closeCursor(); |
| 2319 | 2452 | if (isset($row['operator_correct'])) { |
| 2320 | 2453 | return $row['operator_correct']; |
| 2321 | - } else return $operator; |
|
| 2454 | + } else { |
|
| 2455 | + return $operator; |
|
| 2456 | + } |
|
| 2322 | 2457 | } |
| 2323 | 2458 | |
| 2324 | 2459 | /** |
@@ -2331,7 +2466,9 @@ discard block |
||
| 2331 | 2466 | public function getRouteInfo($callsign) |
| 2332 | 2467 | { |
| 2333 | 2468 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2334 | - if ($callsign == '') return array(); |
|
| 2469 | + if ($callsign == '') { |
|
| 2470 | + return array(); |
|
| 2471 | + } |
|
| 2335 | 2472 | $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"; |
| 2336 | 2473 | |
| 2337 | 2474 | $sth = $this->db->prepare($query); |
@@ -2341,7 +2478,9 @@ discard block |
||
| 2341 | 2478 | $sth->closeCursor(); |
| 2342 | 2479 | if (count($row) > 0) { |
| 2343 | 2480 | return $row; |
| 2344 | - } else return array(); |
|
| 2481 | + } else { |
|
| 2482 | + return array(); |
|
| 2483 | + } |
|
| 2345 | 2484 | } |
| 2346 | 2485 | |
| 2347 | 2486 | /** |
@@ -2394,7 +2533,9 @@ discard block |
||
| 2394 | 2533 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 2395 | 2534 | $sth->closeCursor(); |
| 2396 | 2535 | return $result; |
| 2397 | - } else return array(); |
|
| 2536 | + } else { |
|
| 2537 | + return array(); |
|
| 2538 | + } |
|
| 2398 | 2539 | } |
| 2399 | 2540 | |
| 2400 | 2541 | |
@@ -2553,8 +2694,11 @@ discard block |
||
| 2553 | 2694 | $query .= " ORDER BY spotter_output.source_name ASC"; |
| 2554 | 2695 | |
| 2555 | 2696 | $sth = $this->db->prepare($query); |
| 2556 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 2557 | - else $sth->execute(); |
|
| 2697 | + if (!empty($query_values)) { |
|
| 2698 | + $sth->execute($query_values); |
|
| 2699 | + } else { |
|
| 2700 | + $sth->execute(); |
|
| 2701 | + } |
|
| 2558 | 2702 | |
| 2559 | 2703 | $source_array = array(); |
| 2560 | 2704 | $temp_array = array(); |
@@ -2587,9 +2731,13 @@ discard block |
||
| 2587 | 2731 | WHERE spotter_output.airline_icao <> '' |
| 2588 | 2732 | ORDER BY spotter_output.airline_name ASC"; |
| 2589 | 2733 | */ |
| 2590 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2591 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2592 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2734 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2735 | + $forsource = $globalAirlinesSource; |
|
| 2736 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2737 | + $forsource = 'vatsim'; |
|
| 2738 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2739 | + $forsource = 'ivao'; |
|
| 2740 | + } |
|
| 2593 | 2741 | if ($forsource === NULL) { |
| 2594 | 2742 | $query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC"; |
| 2595 | 2743 | $query_data = array(); |
@@ -2632,9 +2780,13 @@ discard block |
||
| 2632 | 2780 | { |
| 2633 | 2781 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
| 2634 | 2782 | $filter_query = $this->getFilter($filters,true,true); |
| 2635 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2636 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2637 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2783 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2784 | + $forsource = $globalAirlinesSource; |
|
| 2785 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2786 | + $forsource = 'vatsim'; |
|
| 2787 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2788 | + $forsource = 'ivao'; |
|
| 2789 | + } |
|
| 2638 | 2790 | if ($forsource === NULL) { |
| 2639 | 2791 | $query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC"; |
| 2640 | 2792 | $query_data = array(); |
@@ -2909,7 +3061,9 @@ discard block |
||
| 2909 | 3061 | date_default_timezone_set($globalTimezone); |
| 2910 | 3062 | $datetime = new DateTime(); |
| 2911 | 3063 | $offset = $datetime->format('P'); |
| 2912 | - } else $offset = '+00:00'; |
|
| 3064 | + } else { |
|
| 3065 | + $offset = '+00:00'; |
|
| 3066 | + } |
|
| 2913 | 3067 | if ($airport_icao == '') { |
| 2914 | 3068 | if ($globalDBdriver == 'mysql') { |
| 2915 | 3069 | $query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -2941,7 +3095,9 @@ discard block |
||
| 2941 | 3095 | date_default_timezone_set($globalTimezone); |
| 2942 | 3096 | $datetime = new DateTime(); |
| 2943 | 3097 | $offset = $datetime->format('P'); |
| 2944 | - } else $offset = '+00:00'; |
|
| 3098 | + } else { |
|
| 3099 | + $offset = '+00:00'; |
|
| 3100 | + } |
|
| 2945 | 3101 | if ($airport_icao == '') { |
| 2946 | 3102 | if ($globalDBdriver == 'mysql') { |
| 2947 | 3103 | $query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -2974,7 +3130,9 @@ discard block |
||
| 2974 | 3130 | date_default_timezone_set($globalTimezone); |
| 2975 | 3131 | $datetime = new DateTime(); |
| 2976 | 3132 | $offset = $datetime->format('P'); |
| 2977 | - } else $offset = '+00:00'; |
|
| 3133 | + } else { |
|
| 3134 | + $offset = '+00:00'; |
|
| 3135 | + } |
|
| 2978 | 3136 | if ($airport_icao == '') { |
| 2979 | 3137 | if ($globalDBdriver == 'mysql') { |
| 2980 | 3138 | $query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3013,7 +3171,9 @@ discard block |
||
| 3013 | 3171 | date_default_timezone_set($globalTimezone); |
| 3014 | 3172 | $datetime = new DateTime(); |
| 3015 | 3173 | $offset = $datetime->format('P'); |
| 3016 | - } else $offset = '+00:00'; |
|
| 3174 | + } else { |
|
| 3175 | + $offset = '+00:00'; |
|
| 3176 | + } |
|
| 3017 | 3177 | if ($airport_icao == '') { |
| 3018 | 3178 | if ($globalDBdriver == 'mysql') { |
| 3019 | 3179 | $query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3058,7 +3218,9 @@ discard block |
||
| 3058 | 3218 | date_default_timezone_set($globalTimezone); |
| 3059 | 3219 | $datetime = new DateTime(); |
| 3060 | 3220 | $offset = $datetime->format('P'); |
| 3061 | - } else $offset = '+00:00'; |
|
| 3221 | + } else { |
|
| 3222 | + $offset = '+00:00'; |
|
| 3223 | + } |
|
| 3062 | 3224 | if ($airport_icao == '') { |
| 3063 | 3225 | if ($globalDBdriver == 'mysql') { |
| 3064 | 3226 | $query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3093,7 +3255,9 @@ discard block |
||
| 3093 | 3255 | date_default_timezone_set($globalTimezone); |
| 3094 | 3256 | $datetime = new DateTime(); |
| 3095 | 3257 | $offset = $datetime->format('P'); |
| 3096 | - } else $offset = '+00:00'; |
|
| 3258 | + } else { |
|
| 3259 | + $offset = '+00:00'; |
|
| 3260 | + } |
|
| 3097 | 3261 | if ($airport_icao == '') { |
| 3098 | 3262 | if ($globalDBdriver == 'mysql') { |
| 3099 | 3263 | $query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3135,7 +3299,9 @@ discard block |
||
| 3135 | 3299 | date_default_timezone_set($globalTimezone); |
| 3136 | 3300 | $datetime = new DateTime(); |
| 3137 | 3301 | $offset = $datetime->format('P'); |
| 3138 | - } else $offset = '+00:00'; |
|
| 3302 | + } else { |
|
| 3303 | + $offset = '+00:00'; |
|
| 3304 | + } |
|
| 3139 | 3305 | if ($airport_icao == '') { |
| 3140 | 3306 | if ($globalDBdriver == 'mysql') { |
| 3141 | 3307 | $query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3169,7 +3335,9 @@ discard block |
||
| 3169 | 3335 | date_default_timezone_set($globalTimezone); |
| 3170 | 3336 | $datetime = new DateTime(); |
| 3171 | 3337 | $offset = $datetime->format('P'); |
| 3172 | - } else $offset = '+00:00'; |
|
| 3338 | + } else { |
|
| 3339 | + $offset = '+00:00'; |
|
| 3340 | + } |
|
| 3173 | 3341 | if ($airport_icao == '') { |
| 3174 | 3342 | if ($globalDBdriver == 'mysql') { |
| 3175 | 3343 | $query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3217,7 +3385,9 @@ discard block |
||
| 3217 | 3385 | date_default_timezone_set($globalTimezone); |
| 3218 | 3386 | $datetime = new DateTime(); |
| 3219 | 3387 | $offset = $datetime->format('P'); |
| 3220 | - } else $offset = '+00:00'; |
|
| 3388 | + } else { |
|
| 3389 | + $offset = '+00:00'; |
|
| 3390 | + } |
|
| 3221 | 3391 | |
| 3222 | 3392 | if ($globalDBdriver == 'mysql') { |
| 3223 | 3393 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3337,7 +3507,9 @@ discard block |
||
| 3337 | 3507 | */ |
| 3338 | 3508 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3339 | 3509 | { |
| 3340 | - if ($groundspeed == '') $groundspeed = NULL; |
|
| 3510 | + if ($groundspeed == '') { |
|
| 3511 | + $groundspeed = NULL; |
|
| 3512 | + } |
|
| 3341 | 3513 | $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'; |
| 3342 | 3514 | $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); |
| 3343 | 3515 | |
@@ -3387,10 +3559,18 @@ discard block |
||
| 3387 | 3559 | $Image = new Image($this->db); |
| 3388 | 3560 | $Common = new Common(); |
| 3389 | 3561 | |
| 3390 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 3391 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 3392 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 3393 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 3562 | + if (!isset($globalIVAO)) { |
|
| 3563 | + $globalIVAO = FALSE; |
|
| 3564 | + } |
|
| 3565 | + if (!isset($globalVATSIM)) { |
|
| 3566 | + $globalVATSIM = FALSE; |
|
| 3567 | + } |
|
| 3568 | + if (!isset($globalphpVMS)) { |
|
| 3569 | + $globalphpVMS = FALSE; |
|
| 3570 | + } |
|
| 3571 | + if (!isset($globalVAM)) { |
|
| 3572 | + $globalVAM = FALSE; |
|
| 3573 | + } |
|
| 3394 | 3574 | date_default_timezone_set('UTC'); |
| 3395 | 3575 | |
| 3396 | 3576 | //getting the registration |
@@ -3403,23 +3583,33 @@ discard block |
||
| 3403 | 3583 | if ($ModeS != '') { |
| 3404 | 3584 | $timeelapsed = microtime(true); |
| 3405 | 3585 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
| 3406 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3586 | + if ($globalDebugTimeElapsed) { |
|
| 3587 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3588 | + } |
|
| 3407 | 3589 | } else { |
| 3408 | 3590 | $myhex = explode('-',$flightaware_id); |
| 3409 | 3591 | if (count($myhex) > 0) { |
| 3410 | 3592 | $timeelapsed = microtime(true); |
| 3411 | 3593 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
| 3412 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3594 | + if ($globalDebugTimeElapsed) { |
|
| 3595 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3596 | + } |
|
| 3413 | 3597 | } |
| 3414 | 3598 | } |
| 3415 | 3599 | } |
| 3416 | 3600 | } |
| 3417 | 3601 | $fromsource = NULL; |
| 3418 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 3419 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 3420 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
| 3421 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 3422 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 3602 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 3603 | + $fromsource = $globalAirlinesSource; |
|
| 3604 | + } elseif ($format_source == 'vatsimtxt') { |
|
| 3605 | + $fromsource = 'vatsim'; |
|
| 3606 | + } elseif ($format_source == 'whazzup') { |
|
| 3607 | + $fromsource = 'ivao'; |
|
| 3608 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 3609 | + $fromsource = 'vatsim'; |
|
| 3610 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 3611 | + $fromsource = 'ivao'; |
|
| 3612 | + } |
|
| 3423 | 3613 | //getting the airline information |
| 3424 | 3614 | if ($ident != "") |
| 3425 | 3615 | { |
@@ -3443,15 +3633,21 @@ discard block |
||
| 3443 | 3633 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
| 3444 | 3634 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3445 | 3635 | } |
| 3446 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3636 | + if ($globalDebugTimeElapsed) { |
|
| 3637 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3638 | + } |
|
| 3447 | 3639 | |
| 3448 | 3640 | } else { |
| 3449 | 3641 | $timeelapsed = microtime(true); |
| 3450 | 3642 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3451 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3643 | + if ($globalDebugTimeElapsed) { |
|
| 3644 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3645 | + } |
|
| 3452 | 3646 | } |
| 3453 | 3647 | } |
| 3454 | - } else $airline_array = array(); |
|
| 3648 | + } else { |
|
| 3649 | + $airline_array = array(); |
|
| 3650 | + } |
|
| 3455 | 3651 | |
| 3456 | 3652 | //getting the aircraft information |
| 3457 | 3653 | $aircraft_array = array(); |
@@ -3465,27 +3661,37 @@ discard block |
||
| 3465 | 3661 | { |
| 3466 | 3662 | $timeelapsed = microtime(true); |
| 3467 | 3663 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3468 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3664 | + if ($globalDebugTimeElapsed) { |
|
| 3665 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3666 | + } |
|
| 3469 | 3667 | } else { |
| 3470 | 3668 | $timeelapsed = microtime(true); |
| 3471 | 3669 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3472 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3670 | + if ($globalDebugTimeElapsed) { |
|
| 3671 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3672 | + } |
|
| 3473 | 3673 | } |
| 3474 | 3674 | } |
| 3475 | 3675 | } else { |
| 3476 | 3676 | if ($ModeS != '') { |
| 3477 | 3677 | $timeelapsed = microtime(true); |
| 3478 | 3678 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
| 3479 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3679 | + if ($globalDebugTimeElapsed) { |
|
| 3680 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3681 | + } |
|
| 3480 | 3682 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3481 | 3683 | { |
| 3482 | 3684 | $timeelapsed = microtime(true); |
| 3483 | 3685 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3484 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3686 | + if ($globalDebugTimeElapsed) { |
|
| 3687 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3688 | + } |
|
| 3485 | 3689 | } else { |
| 3486 | 3690 | $timeelapsed = microtime(true); |
| 3487 | 3691 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3488 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3692 | + if ($globalDebugTimeElapsed) { |
|
| 3693 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3694 | + } |
|
| 3489 | 3695 | } |
| 3490 | 3696 | } |
| 3491 | 3697 | } |
@@ -3501,7 +3707,9 @@ discard block |
||
| 3501 | 3707 | } else { |
| 3502 | 3708 | $timeelapsed = microtime(true); |
| 3503 | 3709 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3504 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3710 | + if ($globalDebugTimeElapsed) { |
|
| 3711 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3712 | + } |
|
| 3505 | 3713 | } |
| 3506 | 3714 | } |
| 3507 | 3715 | |
@@ -3516,7 +3724,9 @@ discard block |
||
| 3516 | 3724 | } else { |
| 3517 | 3725 | $timeelapsed = microtime(true); |
| 3518 | 3726 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3519 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3727 | + if ($globalDebugTimeElapsed) { |
|
| 3728 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3729 | + } |
|
| 3520 | 3730 | } |
| 3521 | 3731 | } |
| 3522 | 3732 | |
@@ -3550,7 +3760,9 @@ discard block |
||
| 3550 | 3760 | { |
| 3551 | 3761 | return false; |
| 3552 | 3762 | } |
| 3553 | - } else $altitude = 0; |
|
| 3763 | + } else { |
|
| 3764 | + $altitude = 0; |
|
| 3765 | + } |
|
| 3554 | 3766 | |
| 3555 | 3767 | if ($heading != "") |
| 3556 | 3768 | { |
@@ -3579,7 +3791,9 @@ discard block |
||
| 3579 | 3791 | { |
| 3580 | 3792 | $timeelapsed = microtime(true); |
| 3581 | 3793 | $image_array = $Image->getSpotterImage($registration); |
| 3582 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3794 | + if ($globalDebugTimeElapsed) { |
|
| 3795 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3796 | + } |
|
| 3583 | 3797 | if (!isset($image_array[0]['registration'])) |
| 3584 | 3798 | { |
| 3585 | 3799 | //echo "Add image !!!! \n"; |
@@ -3587,14 +3801,21 @@ discard block |
||
| 3587 | 3801 | } |
| 3588 | 3802 | $timeelapsed = microtime(true); |
| 3589 | 3803 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3590 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3591 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 3804 | + if ($globalDebugTimeElapsed) { |
|
| 3805 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3806 | + } |
|
| 3807 | + if ($owner_info['owner'] != '') { |
|
| 3808 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 3809 | + } |
|
| 3592 | 3810 | } |
| 3593 | 3811 | |
| 3594 | 3812 | if ($globalIVAO && $aircraft_icao != '') |
| 3595 | 3813 | { |
| 3596 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3597 | - else $airline_icao = ''; |
|
| 3814 | + if (isset($airline_array[0]['icao'])) { |
|
| 3815 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3816 | + } else { |
|
| 3817 | + $airline_icao = ''; |
|
| 3818 | + } |
|
| 3598 | 3819 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3599 | 3820 | if (!isset($image_array[0]['registration'])) |
| 3600 | 3821 | { |
@@ -3639,16 +3860,28 @@ discard block |
||
| 3639 | 3860 | { |
| 3640 | 3861 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
| 3641 | 3862 | } |
| 3642 | - if ($registration == '') $registration = 'NA'; |
|
| 3863 | + if ($registration == '') { |
|
| 3864 | + $registration = 'NA'; |
|
| 3865 | + } |
|
| 3643 | 3866 | if ($latitude == '' && $longitude == '') { |
| 3644 | 3867 | $latitude = 0; |
| 3645 | 3868 | $longitude = 0; |
| 3646 | 3869 | } |
| 3647 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3648 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3649 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3650 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3651 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3870 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
| 3871 | + $squawk = NULL; |
|
| 3872 | + } |
|
| 3873 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
| 3874 | + $verticalrate = NULL; |
|
| 3875 | + } |
|
| 3876 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 3877 | + $heading = 0; |
|
| 3878 | + } |
|
| 3879 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 3880 | + $groundspeed = 0; |
|
| 3881 | + } |
|
| 3882 | + if (!isset($aircraft_owner)) { |
|
| 3883 | + $aircraft_owner = NULL; |
|
| 3884 | + } |
|
| 3652 | 3885 | $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) |
| 3653 | 3886 | 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)"; |
| 3654 | 3887 | |
@@ -3659,9 +3892,13 @@ discard block |
||
| 3659 | 3892 | if ($airline_type == '') { |
| 3660 | 3893 | $timeelapsed = microtime(true); |
| 3661 | 3894 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3662 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3895 | + if ($globalDebugTimeElapsed) { |
|
| 3896 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3897 | + } |
|
| 3898 | + } |
|
| 3899 | + if ($airline_type == null) { |
|
| 3900 | + $airline_type = ''; |
|
| 3663 | 3901 | } |
| 3664 | - if ($airline_type == null) $airline_type = ''; |
|
| 3665 | 3902 | $aircraft_type = $aircraft_array[0]['type']; |
| 3666 | 3903 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
| 3667 | 3904 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -3797,7 +4034,9 @@ discard block |
||
| 3797 | 4034 | } |
| 3798 | 4035 | } |
| 3799 | 4036 | $query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
| 3800 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4037 | + if ($limit) { |
|
| 4038 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4039 | + } |
|
| 3801 | 4040 | |
| 3802 | 4041 | $sth = $this->db->prepare($query); |
| 3803 | 4042 | $sth->execute(); |
@@ -3842,7 +4081,9 @@ discard block |
||
| 3842 | 4081 | } |
| 3843 | 4082 | } |
| 3844 | 4083 | $query .= "GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 3845 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4084 | + if ($limit) { |
|
| 4085 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4086 | + } |
|
| 3846 | 4087 | |
| 3847 | 4088 | |
| 3848 | 4089 | $sth = $this->db->prepare($query); |
@@ -3888,7 +4129,9 @@ discard block |
||
| 3888 | 4129 | } |
| 3889 | 4130 | } |
| 3890 | 4131 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 3891 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4132 | + if ($limit) { |
|
| 4133 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4134 | + } |
|
| 3892 | 4135 | |
| 3893 | 4136 | |
| 3894 | 4137 | $sth = $this->db->prepare($query); |
@@ -3936,7 +4179,9 @@ discard block |
||
| 3936 | 4179 | } |
| 3937 | 4180 | } |
| 3938 | 4181 | $query .= "GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
| 3939 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4182 | + if ($limit) { |
|
| 4183 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4184 | + } |
|
| 3940 | 4185 | |
| 3941 | 4186 | |
| 3942 | 4187 | $sth = $this->db->prepare($query); |
@@ -3981,7 +4226,9 @@ discard block |
||
| 3981 | 4226 | } |
| 3982 | 4227 | } |
| 3983 | 4228 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
| 3984 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4229 | + if ($limit) { |
|
| 4230 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4231 | + } |
|
| 3985 | 4232 | |
| 3986 | 4233 | |
| 3987 | 4234 | $sth = $this->db->prepare($query); |
@@ -4224,7 +4471,9 @@ discard block |
||
| 4224 | 4471 | date_default_timezone_set($globalTimezone); |
| 4225 | 4472 | $datetime = new DateTime($date); |
| 4226 | 4473 | $offset = $datetime->format('P'); |
| 4227 | - } else $offset = '+00:00'; |
|
| 4474 | + } else { |
|
| 4475 | + $offset = '+00:00'; |
|
| 4476 | + } |
|
| 4228 | 4477 | |
| 4229 | 4478 | if ($globalDBdriver == 'mysql') { |
| 4230 | 4479 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4272,7 +4521,9 @@ discard block |
||
| 4272 | 4521 | date_default_timezone_set($globalTimezone); |
| 4273 | 4522 | $datetime = new DateTime($date); |
| 4274 | 4523 | $offset = $datetime->format('P'); |
| 4275 | - } else $offset = '+00:00'; |
|
| 4524 | + } else { |
|
| 4525 | + $offset = '+00:00'; |
|
| 4526 | + } |
|
| 4276 | 4527 | |
| 4277 | 4528 | if ($globalDBdriver == 'mysql') { |
| 4278 | 4529 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4490,7 +4741,9 @@ discard block |
||
| 4490 | 4741 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' |
| 4491 | 4742 | GROUP BY spotter_output.airline_country |
| 4492 | 4743 | ORDER BY airline_country_count DESC"; |
| 4493 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4744 | + if ($limit) { |
|
| 4745 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4746 | + } |
|
| 4494 | 4747 | |
| 4495 | 4748 | $sth = $this->db->prepare($query); |
| 4496 | 4749 | $sth->execute(); |
@@ -4518,7 +4771,9 @@ discard block |
||
| 4518 | 4771 | global $globalDBdriver; |
| 4519 | 4772 | //$filter_query = $this->getFilter($filters,true,true); |
| 4520 | 4773 | $Connection= new Connection($this->db); |
| 4521 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 4774 | + if (!$Connection->tableExists('countries')) { |
|
| 4775 | + return array(); |
|
| 4776 | + } |
|
| 4522 | 4777 | /* |
| 4523 | 4778 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 4524 | 4779 | FROM countries c, spotter_output s |
@@ -4550,7 +4805,9 @@ discard block |
||
| 4550 | 4805 | } |
| 4551 | 4806 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country "; |
| 4552 | 4807 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
| 4553 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4808 | + if ($limit) { |
|
| 4809 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4810 | + } |
|
| 4554 | 4811 | |
| 4555 | 4812 | |
| 4556 | 4813 | $sth = $this->db->prepare($query); |
@@ -4600,7 +4857,9 @@ discard block |
||
| 4600 | 4857 | } |
| 4601 | 4858 | |
| 4602 | 4859 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 4603 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4860 | + if ($limit) { |
|
| 4861 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4862 | + } |
|
| 4604 | 4863 | |
| 4605 | 4864 | $sth = $this->db->prepare($query); |
| 4606 | 4865 | $sth->execute(); |
@@ -4646,7 +4905,9 @@ discard block |
||
| 4646 | 4905 | } |
| 4647 | 4906 | |
| 4648 | 4907 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 4649 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4908 | + if ($limit) { |
|
| 4909 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4910 | + } |
|
| 4650 | 4911 | |
| 4651 | 4912 | $sth = $this->db->prepare($query); |
| 4652 | 4913 | $sth->execute(); |
@@ -4693,7 +4954,9 @@ discard block |
||
| 4693 | 4954 | } |
| 4694 | 4955 | |
| 4695 | 4956 | $query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 4696 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4957 | + if ($limit) { |
|
| 4958 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4959 | + } |
|
| 4697 | 4960 | |
| 4698 | 4961 | $sth = $this->db->prepare($query); |
| 4699 | 4962 | $sth->execute(); |
@@ -4746,7 +5009,9 @@ discard block |
||
| 4746 | 5009 | if($row['registration'] != "") |
| 4747 | 5010 | { |
| 4748 | 5011 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4749 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5012 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5013 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5014 | + } |
|
| 4750 | 5015 | } |
| 4751 | 5016 | $temp_array['registration_count'] = $row['registration_count']; |
| 4752 | 5017 | |
@@ -4821,7 +5086,9 @@ discard block |
||
| 4821 | 5086 | if($row['registration'] != "") |
| 4822 | 5087 | { |
| 4823 | 5088 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4824 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5089 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5090 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5091 | + } |
|
| 4825 | 5092 | } |
| 4826 | 5093 | $temp_array['registration_count'] = $row['registration_count']; |
| 4827 | 5094 | |
@@ -4928,7 +5195,9 @@ discard block |
||
| 4928 | 5195 | if($row['registration'] != "") |
| 4929 | 5196 | { |
| 4930 | 5197 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4931 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5198 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5199 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5200 | + } |
|
| 4932 | 5201 | } |
| 4933 | 5202 | $temp_array['registration_count'] = $row['registration_count']; |
| 4934 | 5203 | $aircraft_array[] = $temp_array; |
@@ -5053,7 +5322,9 @@ discard block |
||
| 5053 | 5322 | date_default_timezone_set($globalTimezone); |
| 5054 | 5323 | $datetime = new DateTime($date); |
| 5055 | 5324 | $offset = $datetime->format('P'); |
| 5056 | - } else $offset = '+00:00'; |
|
| 5325 | + } else { |
|
| 5326 | + $offset = '+00:00'; |
|
| 5327 | + } |
|
| 5057 | 5328 | |
| 5058 | 5329 | if ($globalDBdriver == 'mysql') { |
| 5059 | 5330 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -5100,7 +5371,9 @@ discard block |
||
| 5100 | 5371 | date_default_timezone_set($globalTimezone); |
| 5101 | 5372 | $datetime = new DateTime($date); |
| 5102 | 5373 | $offset = $datetime->format('P'); |
| 5103 | - } else $offset = '+00:00'; |
|
| 5374 | + } else { |
|
| 5375 | + $offset = '+00:00'; |
|
| 5376 | + } |
|
| 5104 | 5377 | |
| 5105 | 5378 | if ($globalDBdriver == 'mysql') { |
| 5106 | 5379 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
@@ -5129,7 +5402,9 @@ discard block |
||
| 5129 | 5402 | if($row['registration'] != "") |
| 5130 | 5403 | { |
| 5131 | 5404 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5132 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5405 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5406 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5407 | + } |
|
| 5133 | 5408 | } |
| 5134 | 5409 | $temp_array['registration_count'] = $row['registration_count']; |
| 5135 | 5410 | |
@@ -5154,7 +5429,9 @@ discard block |
||
| 5154 | 5429 | date_default_timezone_set($globalTimezone); |
| 5155 | 5430 | $datetime = new DateTime($date); |
| 5156 | 5431 | $offset = $datetime->format('P'); |
| 5157 | - } else $offset = '+00:00'; |
|
| 5432 | + } else { |
|
| 5433 | + $offset = '+00:00'; |
|
| 5434 | + } |
|
| 5158 | 5435 | |
| 5159 | 5436 | if ($globalDBdriver == 'mysql') { |
| 5160 | 5437 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5252,8 +5529,11 @@ discard block |
||
| 5252 | 5529 | if($row['registration'] != "") |
| 5253 | 5530 | { |
| 5254 | 5531 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5255 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5256 | - else $temp_array['image_thumbnail'] = ''; |
|
| 5532 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5533 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5534 | + } else { |
|
| 5535 | + $temp_array['image_thumbnail'] = ''; |
|
| 5536 | + } |
|
| 5257 | 5537 | } |
| 5258 | 5538 | $temp_array['registration_count'] = $row['registration_count']; |
| 5259 | 5539 | $aircraft_array[] = $temp_array; |
@@ -5360,7 +5640,9 @@ discard block |
||
| 5360 | 5640 | if($row['registration'] != "") |
| 5361 | 5641 | { |
| 5362 | 5642 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5363 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5643 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5644 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5645 | + } |
|
| 5364 | 5646 | } |
| 5365 | 5647 | $temp_array['registration_count'] = $row['registration_count']; |
| 5366 | 5648 | |
@@ -5477,7 +5759,9 @@ discard block |
||
| 5477 | 5759 | if($row['registration'] != "") |
| 5478 | 5760 | { |
| 5479 | 5761 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5480 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5762 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5763 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5764 | + } |
|
| 5481 | 5765 | } |
| 5482 | 5766 | $temp_array['registration_count'] = $row['registration_count']; |
| 5483 | 5767 | |
@@ -5589,7 +5873,9 @@ discard block |
||
| 5589 | 5873 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5590 | 5874 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5591 | 5875 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 5592 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5876 | + if ($limit) { |
|
| 5877 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5878 | + } |
|
| 5593 | 5879 | |
| 5594 | 5880 | $sth = $this->db->prepare($query); |
| 5595 | 5881 | $sth->execute(); |
@@ -5608,7 +5894,9 @@ discard block |
||
| 5608 | 5894 | if($row['registration'] != "") |
| 5609 | 5895 | { |
| 5610 | 5896 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5611 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5897 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5898 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5899 | + } |
|
| 5612 | 5900 | } |
| 5613 | 5901 | |
| 5614 | 5902 | $aircraft_array[] = $temp_array; |
@@ -5649,7 +5937,9 @@ discard block |
||
| 5649 | 5937 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5650 | 5938 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5651 | 5939 | $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"; |
| 5652 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5940 | + if ($limit) { |
|
| 5941 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5942 | + } |
|
| 5653 | 5943 | |
| 5654 | 5944 | $sth = $this->db->prepare($query); |
| 5655 | 5945 | $sth->execute(); |
@@ -5669,7 +5959,9 @@ discard block |
||
| 5669 | 5959 | if($row['registration'] != "") |
| 5670 | 5960 | { |
| 5671 | 5961 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5672 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5962 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5963 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5964 | + } |
|
| 5673 | 5965 | } |
| 5674 | 5966 | |
| 5675 | 5967 | $aircraft_array[] = $temp_array; |
@@ -5710,7 +6002,9 @@ discard block |
||
| 5710 | 6002 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5711 | 6003 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 5712 | 6004 | ORDER BY airport_departure_icao_count DESC"; |
| 5713 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6005 | + if ($limit) { |
|
| 6006 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6007 | + } |
|
| 5714 | 6008 | |
| 5715 | 6009 | $sth = $this->db->prepare($query); |
| 5716 | 6010 | $sth->execute(); |
@@ -5762,7 +6056,9 @@ discard block |
||
| 5762 | 6056 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5763 | 6057 | $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 |
| 5764 | 6058 | ORDER BY airport_departure_icao_count DESC"; |
| 5765 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6059 | + if ($limit) { |
|
| 6060 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6061 | + } |
|
| 5766 | 6062 | |
| 5767 | 6063 | $sth = $this->db->prepare($query); |
| 5768 | 6064 | $sth->execute(); |
@@ -5814,7 +6110,9 @@ discard block |
||
| 5814 | 6110 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5815 | 6111 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 5816 | 6112 | ORDER BY airport_departure_icao_count DESC"; |
| 5817 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6113 | + if ($limit) { |
|
| 6114 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6115 | + } |
|
| 5818 | 6116 | //echo $query; |
| 5819 | 6117 | $sth = $this->db->prepare($query); |
| 5820 | 6118 | $sth->execute(); |
@@ -5866,7 +6164,9 @@ discard block |
||
| 5866 | 6164 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5867 | 6165 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 5868 | 6166 | ORDER BY airport_departure_icao_count DESC"; |
| 5869 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6167 | + if ($limit) { |
|
| 6168 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6169 | + } |
|
| 5870 | 6170 | |
| 5871 | 6171 | $sth = $this->db->prepare($query); |
| 5872 | 6172 | $sth->execute(); |
@@ -6261,7 +6561,9 @@ discard block |
||
| 6261 | 6561 | date_default_timezone_set($globalTimezone); |
| 6262 | 6562 | $datetime = new DateTime($date); |
| 6263 | 6563 | $offset = $datetime->format('P'); |
| 6264 | - } else $offset = '+00:00'; |
|
| 6564 | + } else { |
|
| 6565 | + $offset = '+00:00'; |
|
| 6566 | + } |
|
| 6265 | 6567 | |
| 6266 | 6568 | if ($globalDBdriver == 'mysql') { |
| 6267 | 6569 | $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 |
@@ -6311,7 +6613,9 @@ discard block |
||
| 6311 | 6613 | date_default_timezone_set($globalTimezone); |
| 6312 | 6614 | $datetime = new DateTime($date); |
| 6313 | 6615 | $offset = $datetime->format('P'); |
| 6314 | - } else $offset = '+00:00'; |
|
| 6616 | + } else { |
|
| 6617 | + $offset = '+00:00'; |
|
| 6618 | + } |
|
| 6315 | 6619 | |
| 6316 | 6620 | if ($globalDBdriver == 'mysql') { |
| 6317 | 6621 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -6524,7 +6828,9 @@ discard block |
||
| 6524 | 6828 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6525 | 6829 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6526 | 6830 | ORDER BY airport_arrival_icao_count DESC"; |
| 6527 | - if ($limit) $query .= " LIMIT 10"; |
|
| 6831 | + if ($limit) { |
|
| 6832 | + $query .= " LIMIT 10"; |
|
| 6833 | + } |
|
| 6528 | 6834 | |
| 6529 | 6835 | |
| 6530 | 6836 | $sth = $this->db->prepare($query); |
@@ -6544,7 +6850,9 @@ discard block |
||
| 6544 | 6850 | if ($icaoaskey) { |
| 6545 | 6851 | $icao = $row['arrival_airport_icao']; |
| 6546 | 6852 | $airport_array[$icao] = $temp_array; |
| 6547 | - } else $airport_array[] = $temp_array; |
|
| 6853 | + } else { |
|
| 6854 | + $airport_array[] = $temp_array; |
|
| 6855 | + } |
|
| 6548 | 6856 | } |
| 6549 | 6857 | |
| 6550 | 6858 | return $airport_array; |
@@ -6581,7 +6889,9 @@ discard block |
||
| 6581 | 6889 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6582 | 6890 | $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 |
| 6583 | 6891 | ORDER BY airport_arrival_icao_count DESC"; |
| 6584 | - if ($limit) $query .= " LIMIT 10"; |
|
| 6892 | + if ($limit) { |
|
| 6893 | + $query .= " LIMIT 10"; |
|
| 6894 | + } |
|
| 6585 | 6895 | |
| 6586 | 6896 | |
| 6587 | 6897 | $sth = $this->db->prepare($query); |
@@ -6602,7 +6912,9 @@ discard block |
||
| 6602 | 6912 | if ($icaoaskey) { |
| 6603 | 6913 | $icao = $row['arrival_airport_icao']; |
| 6604 | 6914 | $airport_array[$icao] = $temp_array; |
| 6605 | - } else $airport_array[] = $temp_array; |
|
| 6915 | + } else { |
|
| 6916 | + $airport_array[] = $temp_array; |
|
| 6917 | + } |
|
| 6606 | 6918 | } |
| 6607 | 6919 | |
| 6608 | 6920 | return $airport_array; |
@@ -6639,7 +6951,9 @@ discard block |
||
| 6639 | 6951 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6640 | 6952 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 6641 | 6953 | ORDER BY airport_arrival_icao_count DESC"; |
| 6642 | - if ($limit) $query .= " LIMIT 10"; |
|
| 6954 | + if ($limit) { |
|
| 6955 | + $query .= " LIMIT 10"; |
|
| 6956 | + } |
|
| 6643 | 6957 | |
| 6644 | 6958 | |
| 6645 | 6959 | $sth = $this->db->prepare($query); |
@@ -6659,7 +6973,9 @@ discard block |
||
| 6659 | 6973 | if ($icaoaskey) { |
| 6660 | 6974 | $icao = $row['arrival_airport_icao']; |
| 6661 | 6975 | $airport_array[$icao] = $temp_array; |
| 6662 | - } else $airport_array[] = $temp_array; |
|
| 6976 | + } else { |
|
| 6977 | + $airport_array[] = $temp_array; |
|
| 6978 | + } |
|
| 6663 | 6979 | } |
| 6664 | 6980 | |
| 6665 | 6981 | return $airport_array; |
@@ -6696,7 +7012,9 @@ discard block |
||
| 6696 | 7012 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6697 | 7013 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 6698 | 7014 | ORDER BY airport_arrival_icao_count DESC"; |
| 6699 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7015 | + if ($limit) { |
|
| 7016 | + $query .= " LIMIT 10"; |
|
| 7017 | + } |
|
| 6700 | 7018 | |
| 6701 | 7019 | |
| 6702 | 7020 | $sth = $this->db->prepare($query); |
@@ -6717,7 +7035,9 @@ discard block |
||
| 6717 | 7035 | if ($icaoaskey) { |
| 6718 | 7036 | $icao = $row['arrival_airport_icao']; |
| 6719 | 7037 | $airport_array[$icao] = $temp_array; |
| 6720 | - } else $airport_array[] = $temp_array; |
|
| 7038 | + } else { |
|
| 7039 | + $airport_array[] = $temp_array; |
|
| 7040 | + } |
|
| 6721 | 7041 | } |
| 6722 | 7042 | |
| 6723 | 7043 | return $airport_array; |
@@ -7098,7 +7418,9 @@ discard block |
||
| 7098 | 7418 | date_default_timezone_set($globalTimezone); |
| 7099 | 7419 | $datetime = new DateTime($date); |
| 7100 | 7420 | $offset = $datetime->format('P'); |
| 7101 | - } else $offset = '+00:00'; |
|
| 7421 | + } else { |
|
| 7422 | + $offset = '+00:00'; |
|
| 7423 | + } |
|
| 7102 | 7424 | |
| 7103 | 7425 | if ($globalDBdriver == 'mysql') { |
| 7104 | 7426 | $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 |
@@ -7148,7 +7470,9 @@ discard block |
||
| 7148 | 7470 | date_default_timezone_set($globalTimezone); |
| 7149 | 7471 | $datetime = new DateTime($date); |
| 7150 | 7472 | $offset = $datetime->format('P'); |
| 7151 | - } else $offset = '+00:00'; |
|
| 7473 | + } else { |
|
| 7474 | + $offset = '+00:00'; |
|
| 7475 | + } |
|
| 7152 | 7476 | |
| 7153 | 7477 | if ($globalDBdriver == 'mysql') { |
| 7154 | 7478 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -7371,7 +7695,9 @@ discard block |
||
| 7371 | 7695 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
| 7372 | 7696 | $query .= " GROUP BY spotter_output.arrival_airport_country |
| 7373 | 7697 | ORDER BY airport_arrival_country_count DESC"; |
| 7374 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 7698 | + if ($limit) { |
|
| 7699 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 7700 | + } |
|
| 7375 | 7701 | |
| 7376 | 7702 | |
| 7377 | 7703 | $sth = $this->db->prepare($query); |
@@ -7658,7 +7984,9 @@ discard block |
||
| 7658 | 7984 | date_default_timezone_set($globalTimezone); |
| 7659 | 7985 | $datetime = new DateTime($date); |
| 7660 | 7986 | $offset = $datetime->format('P'); |
| 7661 | - } else $offset = '+00:00'; |
|
| 7987 | + } else { |
|
| 7988 | + $offset = '+00:00'; |
|
| 7989 | + } |
|
| 7662 | 7990 | |
| 7663 | 7991 | if ($globalDBdriver == 'mysql') { |
| 7664 | 7992 | $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
@@ -7834,15 +8162,23 @@ discard block |
||
| 7834 | 8162 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
| 7835 | 8163 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
| 7836 | 8164 | if ($olderthanmonths > 0) { |
| 7837 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 7838 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 8165 | + if ($globalDBdriver == 'mysql') { |
|
| 8166 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 8167 | + } else { |
|
| 8168 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 8169 | + } |
|
| 7839 | 8170 | } |
| 7840 | 8171 | if ($sincedate != '') { |
| 7841 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 7842 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 8172 | + if ($globalDBdriver == 'mysql') { |
|
| 8173 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 8174 | + } else { |
|
| 8175 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 8176 | + } |
|
| 7843 | 8177 | } |
| 7844 | 8178 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 7845 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 8179 | + if ($limit) { |
|
| 8180 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 8181 | + } |
|
| 7846 | 8182 | |
| 7847 | 8183 | $sth = $this->db->prepare($query); |
| 7848 | 8184 | $sth->execute(); |
@@ -7876,15 +8212,23 @@ discard block |
||
| 7876 | 8212 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
| 7877 | 8213 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 7878 | 8214 | if ($olderthanmonths > 0) { |
| 7879 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7880 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 8215 | + if ($globalDBdriver == 'mysql') { |
|
| 8216 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 8217 | + } else { |
|
| 8218 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 8219 | + } |
|
| 7881 | 8220 | } |
| 7882 | 8221 | if ($sincedate != '') { |
| 7883 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 7884 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 8222 | + if ($globalDBdriver == 'mysql') { |
|
| 8223 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 8224 | + } else { |
|
| 8225 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 8226 | + } |
|
| 7885 | 8227 | } |
| 7886 | 8228 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 7887 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 8229 | + if ($limit) { |
|
| 8230 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 8231 | + } |
|
| 7888 | 8232 | |
| 7889 | 8233 | $sth = $this->db->prepare($query); |
| 7890 | 8234 | $sth->execute(); |
@@ -7921,7 +8265,9 @@ discard block |
||
| 7921 | 8265 | date_default_timezone_set($globalTimezone); |
| 7922 | 8266 | $datetime = new DateTime(); |
| 7923 | 8267 | $offset = $datetime->format('P'); |
| 7924 | - } else $offset = '+00:00'; |
|
| 8268 | + } else { |
|
| 8269 | + $offset = '+00:00'; |
|
| 8270 | + } |
|
| 7925 | 8271 | |
| 7926 | 8272 | if ($globalDBdriver == 'mysql') { |
| 7927 | 8273 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -7970,7 +8316,9 @@ discard block |
||
| 7970 | 8316 | date_default_timezone_set($globalTimezone); |
| 7971 | 8317 | $datetime = new DateTime(); |
| 7972 | 8318 | $offset = $datetime->format('P'); |
| 7973 | - } else $offset = '+00:00'; |
|
| 8319 | + } else { |
|
| 8320 | + $offset = '+00:00'; |
|
| 8321 | + } |
|
| 7974 | 8322 | $filter_query = $this->getFilter($filters,true,true); |
| 7975 | 8323 | if ($globalDBdriver == 'mysql') { |
| 7976 | 8324 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8019,7 +8367,9 @@ discard block |
||
| 8019 | 8367 | date_default_timezone_set($globalTimezone); |
| 8020 | 8368 | $datetime = new DateTime(); |
| 8021 | 8369 | $offset = $datetime->format('P'); |
| 8022 | - } else $offset = '+00:00'; |
|
| 8370 | + } else { |
|
| 8371 | + $offset = '+00:00'; |
|
| 8372 | + } |
|
| 8023 | 8373 | $filter_query = $this->getFilter($filters,true,true); |
| 8024 | 8374 | if ($globalDBdriver == 'mysql') { |
| 8025 | 8375 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8065,7 +8415,9 @@ discard block |
||
| 8065 | 8415 | date_default_timezone_set($globalTimezone); |
| 8066 | 8416 | $datetime = new DateTime(); |
| 8067 | 8417 | $offset = $datetime->format('P'); |
| 8068 | - } else $offset = '+00:00'; |
|
| 8418 | + } else { |
|
| 8419 | + $offset = '+00:00'; |
|
| 8420 | + } |
|
| 8069 | 8421 | $filter_query = $this->getFilter($filters,true,true); |
| 8070 | 8422 | if ($globalDBdriver == 'mysql') { |
| 8071 | 8423 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8113,7 +8465,9 @@ discard block |
||
| 8113 | 8465 | date_default_timezone_set($globalTimezone); |
| 8114 | 8466 | $datetime = new DateTime(); |
| 8115 | 8467 | $offset = $datetime->format('P'); |
| 8116 | - } else $offset = '+00:00'; |
|
| 8468 | + } else { |
|
| 8469 | + $offset = '+00:00'; |
|
| 8470 | + } |
|
| 8117 | 8471 | |
| 8118 | 8472 | if ($globalDBdriver == 'mysql') { |
| 8119 | 8473 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -8161,7 +8515,9 @@ discard block |
||
| 8161 | 8515 | date_default_timezone_set($globalTimezone); |
| 8162 | 8516 | $datetime = new DateTime(); |
| 8163 | 8517 | $offset = $datetime->format('P'); |
| 8164 | - } else $offset = '+00:00'; |
|
| 8518 | + } else { |
|
| 8519 | + $offset = '+00:00'; |
|
| 8520 | + } |
|
| 8165 | 8521 | |
| 8166 | 8522 | if ($globalDBdriver == 'mysql') { |
| 8167 | 8523 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -8208,7 +8564,9 @@ discard block |
||
| 8208 | 8564 | date_default_timezone_set($globalTimezone); |
| 8209 | 8565 | $datetime = new DateTime(); |
| 8210 | 8566 | $offset = $datetime->format('P'); |
| 8211 | - } else $offset = '+00:00'; |
|
| 8567 | + } else { |
|
| 8568 | + $offset = '+00:00'; |
|
| 8569 | + } |
|
| 8212 | 8570 | |
| 8213 | 8571 | if ($globalDBdriver == 'mysql') { |
| 8214 | 8572 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -8256,7 +8614,9 @@ discard block |
||
| 8256 | 8614 | date_default_timezone_set($globalTimezone); |
| 8257 | 8615 | $datetime = new DateTime(); |
| 8258 | 8616 | $offset = $datetime->format('P'); |
| 8259 | - } else $offset = '+00:00'; |
|
| 8617 | + } else { |
|
| 8618 | + $offset = '+00:00'; |
|
| 8619 | + } |
|
| 8260 | 8620 | $filter_query = $this->getFilter($filters,true,true); |
| 8261 | 8621 | if ($globalDBdriver == 'mysql') { |
| 8262 | 8622 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -8301,7 +8661,9 @@ discard block |
||
| 8301 | 8661 | date_default_timezone_set($globalTimezone); |
| 8302 | 8662 | $datetime = new DateTime(); |
| 8303 | 8663 | $offset = $datetime->format('P'); |
| 8304 | - } else $offset = '+00:00'; |
|
| 8664 | + } else { |
|
| 8665 | + $offset = '+00:00'; |
|
| 8666 | + } |
|
| 8305 | 8667 | $filter_query = $this->getFilter($filters,true,true); |
| 8306 | 8668 | |
| 8307 | 8669 | if ($globalDBdriver == 'mysql') { |
@@ -8348,7 +8710,9 @@ discard block |
||
| 8348 | 8710 | date_default_timezone_set($globalTimezone); |
| 8349 | 8711 | $datetime = new DateTime(); |
| 8350 | 8712 | $offset = $datetime->format('P'); |
| 8351 | - } else $offset = '+00:00'; |
|
| 8713 | + } else { |
|
| 8714 | + $offset = '+00:00'; |
|
| 8715 | + } |
|
| 8352 | 8716 | |
| 8353 | 8717 | if ($globalDBdriver == 'mysql') { |
| 8354 | 8718 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
@@ -8394,7 +8758,9 @@ discard block |
||
| 8394 | 8758 | date_default_timezone_set($globalTimezone); |
| 8395 | 8759 | $datetime = new DateTime(); |
| 8396 | 8760 | $offset = $datetime->format('P'); |
| 8397 | - } else $offset = '+00:00'; |
|
| 8761 | + } else { |
|
| 8762 | + $offset = '+00:00'; |
|
| 8763 | + } |
|
| 8398 | 8764 | $filter_query = $this->getFilter($filters,true,true); |
| 8399 | 8765 | |
| 8400 | 8766 | if ($globalDBdriver == 'mysql') { |
@@ -8441,7 +8807,9 @@ discard block |
||
| 8441 | 8807 | date_default_timezone_set($globalTimezone); |
| 8442 | 8808 | $datetime = new DateTime(); |
| 8443 | 8809 | $offset = $datetime->format('P'); |
| 8444 | - } else $offset = '+00:00'; |
|
| 8810 | + } else { |
|
| 8811 | + $offset = '+00:00'; |
|
| 8812 | + } |
|
| 8445 | 8813 | |
| 8446 | 8814 | if ($globalDBdriver == 'mysql') { |
| 8447 | 8815 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
@@ -8488,7 +8856,9 @@ discard block |
||
| 8488 | 8856 | date_default_timezone_set($globalTimezone); |
| 8489 | 8857 | $datetime = new DateTime(); |
| 8490 | 8858 | $offset = $datetime->format('P'); |
| 8491 | - } else $offset = '+00:00'; |
|
| 8859 | + } else { |
|
| 8860 | + $offset = '+00:00'; |
|
| 8861 | + } |
|
| 8492 | 8862 | |
| 8493 | 8863 | if ($globalDBdriver == 'mysql') { |
| 8494 | 8864 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
@@ -8533,7 +8903,9 @@ discard block |
||
| 8533 | 8903 | date_default_timezone_set($globalTimezone); |
| 8534 | 8904 | $datetime = new DateTime(); |
| 8535 | 8905 | $offset = $datetime->format('P'); |
| 8536 | - } else $offset = '+00:00'; |
|
| 8906 | + } else { |
|
| 8907 | + $offset = '+00:00'; |
|
| 8908 | + } |
|
| 8537 | 8909 | $filter_query = $this->getFilter($filters,true,true); |
| 8538 | 8910 | |
| 8539 | 8911 | if ($globalDBdriver == 'mysql') { |
@@ -8581,7 +8953,9 @@ discard block |
||
| 8581 | 8953 | date_default_timezone_set($globalTimezone); |
| 8582 | 8954 | $datetime = new DateTime(); |
| 8583 | 8955 | $offset = $datetime->format('P'); |
| 8584 | - } else $offset = '+00:00'; |
|
| 8956 | + } else { |
|
| 8957 | + $offset = '+00:00'; |
|
| 8958 | + } |
|
| 8585 | 8959 | |
| 8586 | 8960 | if ($globalDBdriver == 'mysql') { |
| 8587 | 8961 | $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
@@ -8627,7 +9001,9 @@ discard block |
||
| 8627 | 9001 | date_default_timezone_set($globalTimezone); |
| 8628 | 9002 | $datetime = new DateTime(); |
| 8629 | 9003 | $offset = $datetime->format('P'); |
| 8630 | - } else $offset = '+00:00'; |
|
| 9004 | + } else { |
|
| 9005 | + $offset = '+00:00'; |
|
| 9006 | + } |
|
| 8631 | 9007 | $filter_query = $this->getFilter($filters,true,true); |
| 8632 | 9008 | |
| 8633 | 9009 | if ($globalDBdriver == 'mysql') { |
@@ -8675,7 +9051,9 @@ discard block |
||
| 8675 | 9051 | date_default_timezone_set($globalTimezone); |
| 8676 | 9052 | $datetime = new DateTime(); |
| 8677 | 9053 | $offset = $datetime->format('P'); |
| 8678 | - } else $offset = '+00:00'; |
|
| 9054 | + } else { |
|
| 9055 | + $offset = '+00:00'; |
|
| 9056 | + } |
|
| 8679 | 9057 | |
| 8680 | 9058 | if ($globalDBdriver == 'mysql') { |
| 8681 | 9059 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
@@ -8722,7 +9100,9 @@ discard block |
||
| 8722 | 9100 | date_default_timezone_set($globalTimezone); |
| 8723 | 9101 | $datetime = new DateTime(); |
| 8724 | 9102 | $offset = $datetime->format('P'); |
| 8725 | - } else $offset = '+00:00'; |
|
| 9103 | + } else { |
|
| 9104 | + $offset = '+00:00'; |
|
| 9105 | + } |
|
| 8726 | 9106 | $filter_query = $this->getFilter($filters,true,true); |
| 8727 | 9107 | if ($globalDBdriver == 'mysql') { |
| 8728 | 9108 | $query = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -8771,7 +9151,9 @@ discard block |
||
| 8771 | 9151 | date_default_timezone_set($globalTimezone); |
| 8772 | 9152 | $datetime = new DateTime(); |
| 8773 | 9153 | $offset = $datetime->format('P'); |
| 8774 | - } else $offset = '+00:00'; |
|
| 9154 | + } else { |
|
| 9155 | + $offset = '+00:00'; |
|
| 9156 | + } |
|
| 8775 | 9157 | |
| 8776 | 9158 | $orderby_sql = ''; |
| 8777 | 9159 | if ($orderby == "hour") |
@@ -8837,7 +9219,9 @@ discard block |
||
| 8837 | 9219 | date_default_timezone_set($globalTimezone); |
| 8838 | 9220 | $datetime = new DateTime(); |
| 8839 | 9221 | $offset = $datetime->format('P'); |
| 8840 | - } else $offset = '+00:00'; |
|
| 9222 | + } else { |
|
| 9223 | + $offset = '+00:00'; |
|
| 9224 | + } |
|
| 8841 | 9225 | |
| 8842 | 9226 | $orderby_sql = ''; |
| 8843 | 9227 | if ($orderby == "hour") |
@@ -8904,7 +9288,9 @@ discard block |
||
| 8904 | 9288 | date_default_timezone_set($globalTimezone); |
| 8905 | 9289 | $datetime = new DateTime(); |
| 8906 | 9290 | $offset = $datetime->format('P'); |
| 8907 | - } else $offset = '+00:00'; |
|
| 9291 | + } else { |
|
| 9292 | + $offset = '+00:00'; |
|
| 9293 | + } |
|
| 8908 | 9294 | |
| 8909 | 9295 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
| 8910 | 9296 | |
@@ -8955,7 +9341,9 @@ discard block |
||
| 8955 | 9341 | date_default_timezone_set($globalTimezone); |
| 8956 | 9342 | $datetime = new DateTime(); |
| 8957 | 9343 | $offset = $datetime->format('P'); |
| 8958 | - } else $offset = '+00:00'; |
|
| 9344 | + } else { |
|
| 9345 | + $offset = '+00:00'; |
|
| 9346 | + } |
|
| 8959 | 9347 | |
| 8960 | 9348 | if ($globalDBdriver == 'mysql') { |
| 8961 | 9349 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9002,7 +9390,9 @@ discard block |
||
| 9002 | 9390 | date_default_timezone_set($globalTimezone); |
| 9003 | 9391 | $datetime = new DateTime(); |
| 9004 | 9392 | $offset = $datetime->format('P'); |
| 9005 | - } else $offset = '+00:00'; |
|
| 9393 | + } else { |
|
| 9394 | + $offset = '+00:00'; |
|
| 9395 | + } |
|
| 9006 | 9396 | |
| 9007 | 9397 | if ($globalDBdriver == 'mysql') { |
| 9008 | 9398 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9049,7 +9439,9 @@ discard block |
||
| 9049 | 9439 | date_default_timezone_set($globalTimezone); |
| 9050 | 9440 | $datetime = new DateTime(); |
| 9051 | 9441 | $offset = $datetime->format('P'); |
| 9052 | - } else $offset = '+00:00'; |
|
| 9442 | + } else { |
|
| 9443 | + $offset = '+00:00'; |
|
| 9444 | + } |
|
| 9053 | 9445 | |
| 9054 | 9446 | if ($globalDBdriver == 'mysql') { |
| 9055 | 9447 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9097,7 +9489,9 @@ discard block |
||
| 9097 | 9489 | date_default_timezone_set($globalTimezone); |
| 9098 | 9490 | $datetime = new DateTime(); |
| 9099 | 9491 | $offset = $datetime->format('P'); |
| 9100 | - } else $offset = '+00:00'; |
|
| 9492 | + } else { |
|
| 9493 | + $offset = '+00:00'; |
|
| 9494 | + } |
|
| 9101 | 9495 | |
| 9102 | 9496 | if ($globalDBdriver == 'mysql') { |
| 9103 | 9497 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9145,7 +9539,9 @@ discard block |
||
| 9145 | 9539 | date_default_timezone_set($globalTimezone); |
| 9146 | 9540 | $datetime = new DateTime($date); |
| 9147 | 9541 | $offset = $datetime->format('P'); |
| 9148 | - } else $offset = '+00:00'; |
|
| 9542 | + } else { |
|
| 9543 | + $offset = '+00:00'; |
|
| 9544 | + } |
|
| 9149 | 9545 | |
| 9150 | 9546 | if ($globalDBdriver == 'mysql') { |
| 9151 | 9547 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9193,7 +9589,9 @@ discard block |
||
| 9193 | 9589 | date_default_timezone_set($globalTimezone); |
| 9194 | 9590 | $datetime = new DateTime(); |
| 9195 | 9591 | $offset = $datetime->format('P'); |
| 9196 | - } else $offset = '+00:00'; |
|
| 9592 | + } else { |
|
| 9593 | + $offset = '+00:00'; |
|
| 9594 | + } |
|
| 9197 | 9595 | |
| 9198 | 9596 | if ($globalDBdriver == 'mysql') { |
| 9199 | 9597 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9243,7 +9641,9 @@ discard block |
||
| 9243 | 9641 | date_default_timezone_set($globalTimezone); |
| 9244 | 9642 | $datetime = new DateTime(); |
| 9245 | 9643 | $offset = $datetime->format('P'); |
| 9246 | - } else $offset = '+00:00'; |
|
| 9644 | + } else { |
|
| 9645 | + $offset = '+00:00'; |
|
| 9646 | + } |
|
| 9247 | 9647 | |
| 9248 | 9648 | if ($globalDBdriver == 'mysql') { |
| 9249 | 9649 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9290,7 +9690,9 @@ discard block |
||
| 9290 | 9690 | date_default_timezone_set($globalTimezone); |
| 9291 | 9691 | $datetime = new DateTime(); |
| 9292 | 9692 | $offset = $datetime->format('P'); |
| 9293 | - } else $offset = '+00:00'; |
|
| 9693 | + } else { |
|
| 9694 | + $offset = '+00:00'; |
|
| 9695 | + } |
|
| 9294 | 9696 | |
| 9295 | 9697 | if ($globalDBdriver == 'mysql') { |
| 9296 | 9698 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9458,7 +9860,9 @@ discard block |
||
| 9458 | 9860 | date_default_timezone_set($globalTimezone); |
| 9459 | 9861 | $datetime = new DateTime(); |
| 9460 | 9862 | $offset = $datetime->format('P'); |
| 9461 | - } else $offset = '+00:00'; |
|
| 9863 | + } else { |
|
| 9864 | + $offset = '+00:00'; |
|
| 9865 | + } |
|
| 9462 | 9866 | |
| 9463 | 9867 | if ($globalDBdriver == 'mysql') { |
| 9464 | 9868 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -9644,7 +10048,9 @@ discard block |
||
| 9644 | 10048 | */ |
| 9645 | 10049 | public function parseDirection($direction = 0) |
| 9646 | 10050 | { |
| 9647 | - if ($direction == '') $direction = 0; |
|
| 10051 | + if ($direction == '') { |
|
| 10052 | + $direction = 0; |
|
| 10053 | + } |
|
| 9648 | 10054 | $direction_array = array(); |
| 9649 | 10055 | $temp_array = array(); |
| 9650 | 10056 | |
@@ -9745,7 +10151,9 @@ discard block |
||
| 9745 | 10151 | if (isset($result->AirlineFlightInfoResult)) |
| 9746 | 10152 | { |
| 9747 | 10153 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
| 9748 | - } else return ''; |
|
| 10154 | + } else { |
|
| 10155 | + return ''; |
|
| 10156 | + } |
|
| 9749 | 10157 | |
| 9750 | 10158 | $registration = $this->convertAircraftRegistration($registration); |
| 9751 | 10159 | |
@@ -9774,7 +10182,9 @@ discard block |
||
| 9774 | 10182 | if (count($row) > 0) { |
| 9775 | 10183 | //return $row['Registration']; |
| 9776 | 10184 | return $row['registration']; |
| 9777 | - } else return ''; |
|
| 10185 | + } else { |
|
| 10186 | + return ''; |
|
| 10187 | + } |
|
| 9778 | 10188 | |
| 9779 | 10189 | } |
| 9780 | 10190 | |
@@ -9797,9 +10207,14 @@ discard block |
||
| 9797 | 10207 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 9798 | 10208 | $sth->closeCursor(); |
| 9799 | 10209 | if (count($row) > 0) { |
| 9800 | - if ($row['type_flight'] == null) return ''; |
|
| 9801 | - else return $row['type_flight']; |
|
| 9802 | - } else return ''; |
|
| 10210 | + if ($row['type_flight'] == null) { |
|
| 10211 | + return ''; |
|
| 10212 | + } else { |
|
| 10213 | + return $row['type_flight']; |
|
| 10214 | + } |
|
| 10215 | + } else { |
|
| 10216 | + return ''; |
|
| 10217 | + } |
|
| 9803 | 10218 | |
| 9804 | 10219 | } |
| 9805 | 10220 | |
@@ -9817,7 +10232,9 @@ discard block |
||
| 9817 | 10232 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 9818 | 10233 | |
| 9819 | 10234 | $Connection = new Connection($this->db); |
| 9820 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 10235 | + if (!$Connection->tableExists('countries')) { |
|
| 10236 | + return ''; |
|
| 10237 | + } |
|
| 9821 | 10238 | |
| 9822 | 10239 | try { |
| 9823 | 10240 | /* |
@@ -9837,9 +10254,13 @@ discard block |
||
| 9837 | 10254 | $sth->closeCursor(); |
| 9838 | 10255 | if (count($row) > 0) { |
| 9839 | 10256 | return $row; |
| 9840 | - } else return ''; |
|
| 10257 | + } else { |
|
| 10258 | + return ''; |
|
| 10259 | + } |
|
| 9841 | 10260 | } catch (PDOException $e) { |
| 9842 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 10261 | + if (isset($globalDebug) && $globalDebug) { |
|
| 10262 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 10263 | + } |
|
| 9843 | 10264 | return ''; |
| 9844 | 10265 | } |
| 9845 | 10266 | |
@@ -9857,7 +10278,9 @@ discard block |
||
| 9857 | 10278 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
| 9858 | 10279 | |
| 9859 | 10280 | $Connection = new Connection($this->db); |
| 9860 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 10281 | + if (!$Connection->tableExists('countries')) { |
|
| 10282 | + return ''; |
|
| 10283 | + } |
|
| 9861 | 10284 | |
| 9862 | 10285 | try { |
| 9863 | 10286 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -9869,9 +10292,13 @@ discard block |
||
| 9869 | 10292 | $sth->closeCursor(); |
| 9870 | 10293 | if (count($row) > 0) { |
| 9871 | 10294 | return $row; |
| 9872 | - } else return ''; |
|
| 10295 | + } else { |
|
| 10296 | + return ''; |
|
| 10297 | + } |
|
| 9873 | 10298 | } catch (PDOException $e) { |
| 9874 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 10299 | + if (isset($globalDebug) && $globalDebug) { |
|
| 10300 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 10301 | + } |
|
| 9875 | 10302 | return ''; |
| 9876 | 10303 | } |
| 9877 | 10304 | |
@@ -10121,7 +10548,9 @@ discard block |
||
| 10121 | 10548 | { |
| 10122 | 10549 | global $globalBitlyAccessToken; |
| 10123 | 10550 | |
| 10124 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 10551 | + if ($globalBitlyAccessToken == '') { |
|
| 10552 | + return $url; |
|
| 10553 | + } |
|
| 10125 | 10554 | |
| 10126 | 10555 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 10127 | 10556 | |
@@ -10270,7 +10699,9 @@ discard block |
||
| 10270 | 10699 | |
| 10271 | 10700 | |
| 10272 | 10701 | // routes |
| 10273 | - if ($globalDebug) print "Routes...\n"; |
|
| 10702 | + if ($globalDebug) { |
|
| 10703 | + print "Routes...\n"; |
|
| 10704 | + } |
|
| 10274 | 10705 | if ($globalDBdriver == 'mysql') { |
| 10275 | 10706 | $query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
| 10276 | 10707 | } else { |
@@ -10289,7 +10720,9 @@ discard block |
||
| 10289 | 10720 | } |
| 10290 | 10721 | } |
| 10291 | 10722 | |
| 10292 | - if ($globalDebug) print "Airlines...\n"; |
|
| 10723 | + if ($globalDebug) { |
|
| 10724 | + print "Airlines...\n"; |
|
| 10725 | + } |
|
| 10293 | 10726 | //airlines |
| 10294 | 10727 | if ($globalDBdriver == 'mysql') { |
| 10295 | 10728 | $query = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
@@ -10303,10 +10736,15 @@ discard block |
||
| 10303 | 10736 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 10304 | 10737 | { |
| 10305 | 10738 | $fromsource = NULL; |
| 10306 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 10307 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 10308 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 10309 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 10739 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 10740 | + $fromsource = 'vatsim'; |
|
| 10741 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 10742 | + $fromsource = 'ivao'; |
|
| 10743 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 10744 | + $fromsource = 'vatsim'; |
|
| 10745 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 10746 | + $fromsource = 'ivao'; |
|
| 10747 | + } |
|
| 10310 | 10748 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
| 10311 | 10749 | if (isset($airline_array[0]['name'])) { |
| 10312 | 10750 | $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
@@ -10316,13 +10754,17 @@ discard block |
||
| 10316 | 10754 | } |
| 10317 | 10755 | } |
| 10318 | 10756 | |
| 10319 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
| 10757 | + if ($globalDebug) { |
|
| 10758 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
| 10759 | + } |
|
| 10320 | 10760 | //duplicate modes |
| 10321 | 10761 | $query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL"; |
| 10322 | 10762 | $sth = $this->db->prepare($query); |
| 10323 | 10763 | $sth->execute(); |
| 10324 | 10764 | |
| 10325 | - if ($globalDebug) print "Aircraft...\n"; |
|
| 10765 | + if ($globalDebug) { |
|
| 10766 | + print "Aircraft...\n"; |
|
| 10767 | + } |
|
| 10326 | 10768 | //aircraft |
| 10327 | 10769 | if ($globalDBdriver == 'mysql') { |
| 10328 | 10770 | $query = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -10365,26 +10807,38 @@ discard block |
||
| 10365 | 10807 | if (isset($closestAirports[0])) { |
| 10366 | 10808 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
| 10367 | 10809 | $airport_icao = $closestAirports[0]['icao']; |
| 10368 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 10810 | + if ($globalDebug) { |
|
| 10811 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 10812 | + } |
|
| 10369 | 10813 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
| 10370 | 10814 | foreach ($closestAirports as $airport) { |
| 10371 | 10815 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
| 10372 | 10816 | $airport_icao = $airport['icao']; |
| 10373 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 10817 | + if ($globalDebug) { |
|
| 10818 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 10819 | + } |
|
| 10374 | 10820 | break; |
| 10375 | 10821 | } |
| 10376 | 10822 | } |
| 10377 | 10823 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
| 10378 | 10824 | $airport_icao = $closestAirports[0]['icao']; |
| 10379 | - if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 10825 | + if ($globalDebug) { |
|
| 10826 | + echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 10827 | + } |
|
| 10380 | 10828 | } else { |
| 10381 | - if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 10829 | + if ($globalDebug) { |
|
| 10830 | + echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 10831 | + } |
|
| 10382 | 10832 | } |
| 10383 | 10833 | } else { |
| 10384 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 10834 | + if ($globalDebug) { |
|
| 10835 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 10836 | + } |
|
| 10385 | 10837 | } |
| 10386 | 10838 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 10387 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
| 10839 | + if ($globalDebug) { |
|
| 10840 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
| 10841 | + } |
|
| 10388 | 10842 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
| 10389 | 10843 | $sthu = $this->db->prepare($update_query); |
| 10390 | 10844 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | - * Get SQL query part for filter used |
|
| 59 | - * @param Array $filter the filter |
|
| 60 | - * @return Array the SQL part |
|
| 61 | - */ |
|
| 58 | + * Get SQL query part for filter used |
|
| 59 | + * @param Array $filter the filter |
|
| 60 | + * @return Array the SQL part |
|
| 61 | + */ |
|
| 62 | 62 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 63 | 63 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 64 | 64 | $filters = array(); |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | - * Executes the SQL statements to get the spotter information |
|
| 133 | - * |
|
| 134 | - * @param String $query the SQL query |
|
| 135 | - * @param Array $params parameter of the query |
|
| 136 | - * @param String $limitQuery the limit query |
|
| 137 | - * @return Array the spotter information |
|
| 138 | - * |
|
| 139 | - */ |
|
| 132 | + * Executes the SQL statements to get the spotter information |
|
| 133 | + * |
|
| 134 | + * @param String $query the SQL query |
|
| 135 | + * @param Array $params parameter of the query |
|
| 136 | + * @param String $limitQuery the limit query |
|
| 137 | + * @return Array the spotter information |
|
| 138 | + * |
|
| 139 | + */ |
|
| 140 | 140 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
| 141 | 141 | { |
| 142 | 142 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
@@ -300,11 +300,11 @@ discard block |
||
| 300 | 300 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 301 | 301 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 302 | 302 | } else $temp_array['aircraft_shadow'] = 'default.png'; |
| 303 | - } else { |
|
| 304 | - $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 303 | + } else { |
|
| 304 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 305 | 305 | $temp_array['aircraft_name'] = 'N/A'; |
| 306 | 306 | $temp_array['aircraft_manufacturer'] = 'N/A'; |
| 307 | - } |
|
| 307 | + } |
|
| 308 | 308 | } |
| 309 | 309 | $fromsource = NULL; |
| 310 | 310 | if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
@@ -500,11 +500,11 @@ discard block |
||
| 500 | 500 | |
| 501 | 501 | |
| 502 | 502 | /** |
| 503 | - * Gets all the spotter information |
|
| 504 | - * |
|
| 505 | - * @return Array the spotter information |
|
| 506 | - * |
|
| 507 | - */ |
|
| 503 | + * Gets all the spotter information |
|
| 504 | + * |
|
| 505 | + * @return Array the spotter information |
|
| 506 | + * |
|
| 507 | + */ |
|
| 508 | 508 | 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()) |
| 509 | 509 | { |
| 510 | 510 | global $globalTimezone, $globalDBdriver; |
@@ -851,11 +851,11 @@ discard block |
||
| 851 | 851 | |
| 852 | 852 | |
| 853 | 853 | /** |
| 854 | - * Gets all the spotter information based on the latest data entry |
|
| 855 | - * |
|
| 856 | - * @return Array the spotter information |
|
| 857 | - * |
|
| 858 | - */ |
|
| 854 | + * Gets all the spotter information based on the latest data entry |
|
| 855 | + * |
|
| 856 | + * @return Array the spotter information |
|
| 857 | + * |
|
| 858 | + */ |
|
| 859 | 859 | public function getLatestSpotterData($limit = '', $sort = '', $filter = array()) |
| 860 | 860 | { |
| 861 | 861 | global $global_query; |
@@ -894,12 +894,12 @@ discard block |
||
| 894 | 894 | } |
| 895 | 895 | |
| 896 | 896 | |
| 897 | - /** |
|
| 898 | - * Gets all the spotter information based on a user's latitude and longitude |
|
| 899 | - * |
|
| 900 | - * @return Array the spotter information |
|
| 901 | - * |
|
| 902 | - */ |
|
| 897 | + /** |
|
| 898 | + * Gets all the spotter information based on a user's latitude and longitude |
|
| 899 | + * |
|
| 900 | + * @return Array the spotter information |
|
| 901 | + * |
|
| 902 | + */ |
|
| 903 | 903 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
| 904 | 904 | { |
| 905 | 905 | date_default_timezone_set('UTC'); |
@@ -927,7 +927,7 @@ discard block |
||
| 927 | 927 | return false; |
| 928 | 928 | } |
| 929 | 929 | } |
| 930 | - $additional_query = ''; |
|
| 930 | + $additional_query = ''; |
|
| 931 | 931 | if ($interval != "") |
| 932 | 932 | { |
| 933 | 933 | if (!is_string($interval)) |
@@ -967,12 +967,12 @@ discard block |
||
| 967 | 967 | } |
| 968 | 968 | |
| 969 | 969 | |
| 970 | - /** |
|
| 971 | - * Gets all the spotter information sorted by the newest aircraft type |
|
| 972 | - * |
|
| 973 | - * @return Array the spotter information |
|
| 974 | - * |
|
| 975 | - */ |
|
| 970 | + /** |
|
| 971 | + * Gets all the spotter information sorted by the newest aircraft type |
|
| 972 | + * |
|
| 973 | + * @return Array the spotter information |
|
| 974 | + * |
|
| 975 | + */ |
|
| 976 | 976 | public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
| 977 | 977 | { |
| 978 | 978 | global $global_query; |
@@ -1013,11 +1013,11 @@ discard block |
||
| 1013 | 1013 | |
| 1014 | 1014 | |
| 1015 | 1015 | /** |
| 1016 | - * Gets all the spotter information sorted by the newest aircraft registration |
|
| 1017 | - * |
|
| 1018 | - * @return Array the spotter information |
|
| 1019 | - * |
|
| 1020 | - */ |
|
| 1016 | + * Gets all the spotter information sorted by the newest aircraft registration |
|
| 1017 | + * |
|
| 1018 | + * @return Array the spotter information |
|
| 1019 | + * |
|
| 1020 | + */ |
|
| 1021 | 1021 | public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array()) |
| 1022 | 1022 | { |
| 1023 | 1023 | global $global_query; |
@@ -1057,11 +1057,11 @@ discard block |
||
| 1057 | 1057 | |
| 1058 | 1058 | |
| 1059 | 1059 | /** |
| 1060 | - * Gets all the spotter information sorted by the newest airline |
|
| 1061 | - * |
|
| 1062 | - * @return Array the spotter information |
|
| 1063 | - * |
|
| 1064 | - */ |
|
| 1060 | + * Gets all the spotter information sorted by the newest airline |
|
| 1061 | + * |
|
| 1062 | + * @return Array the spotter information |
|
| 1063 | + * |
|
| 1064 | + */ |
|
| 1065 | 1065 | public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
| 1066 | 1066 | { |
| 1067 | 1067 | global $global_query; |
@@ -1100,12 +1100,12 @@ discard block |
||
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | |
| 1103 | - /** |
|
| 1104 | - * Gets all the spotter information sorted by the newest departure airport |
|
| 1105 | - * |
|
| 1106 | - * @return Array the spotter information |
|
| 1107 | - * |
|
| 1108 | - */ |
|
| 1103 | + /** |
|
| 1104 | + * Gets all the spotter information sorted by the newest departure airport |
|
| 1105 | + * |
|
| 1106 | + * @return Array the spotter information |
|
| 1107 | + * |
|
| 1108 | + */ |
|
| 1109 | 1109 | public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array()) |
| 1110 | 1110 | { |
| 1111 | 1111 | global $global_query; |
@@ -1147,11 +1147,11 @@ discard block |
||
| 1147 | 1147 | |
| 1148 | 1148 | |
| 1149 | 1149 | /** |
| 1150 | - * Gets all the spotter information sorted by the newest arrival airport |
|
| 1151 | - * |
|
| 1152 | - * @return Array the spotter information |
|
| 1153 | - * |
|
| 1154 | - */ |
|
| 1150 | + * Gets all the spotter information sorted by the newest arrival airport |
|
| 1151 | + * |
|
| 1152 | + * @return Array the spotter information |
|
| 1153 | + * |
|
| 1154 | + */ |
|
| 1155 | 1155 | public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array()) |
| 1156 | 1156 | { |
| 1157 | 1157 | global $global_query; |
@@ -1190,11 +1190,11 @@ discard block |
||
| 1190 | 1190 | |
| 1191 | 1191 | |
| 1192 | 1192 | /** |
| 1193 | - * Gets all the spotter information based on the spotter id |
|
| 1194 | - * |
|
| 1195 | - * @return Array the spotter information |
|
| 1196 | - * |
|
| 1197 | - */ |
|
| 1193 | + * Gets all the spotter information based on the spotter id |
|
| 1194 | + * |
|
| 1195 | + * @return Array the spotter information |
|
| 1196 | + * |
|
| 1197 | + */ |
|
| 1198 | 1198 | public function getSpotterDataByID($id = '') |
| 1199 | 1199 | { |
| 1200 | 1200 | global $global_query; |
@@ -1216,11 +1216,11 @@ discard block |
||
| 1216 | 1216 | |
| 1217 | 1217 | |
| 1218 | 1218 | /** |
| 1219 | - * Gets all the spotter information based on the callsign |
|
| 1220 | - * |
|
| 1221 | - * @return Array the spotter information |
|
| 1222 | - * |
|
| 1223 | - */ |
|
| 1219 | + * Gets all the spotter information based on the callsign |
|
| 1220 | + * |
|
| 1221 | + * @return Array the spotter information |
|
| 1222 | + * |
|
| 1223 | + */ |
|
| 1224 | 1224 | public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '') |
| 1225 | 1225 | { |
| 1226 | 1226 | global $global_query; |
@@ -1273,11 +1273,11 @@ discard block |
||
| 1273 | 1273 | |
| 1274 | 1274 | |
| 1275 | 1275 | /** |
| 1276 | - * Gets all the spotter information based on the aircraft type |
|
| 1277 | - * |
|
| 1278 | - * @return Array the spotter information |
|
| 1279 | - * |
|
| 1280 | - */ |
|
| 1276 | + * Gets all the spotter information based on the aircraft type |
|
| 1277 | + * |
|
| 1278 | + * @return Array the spotter information |
|
| 1279 | + * |
|
| 1280 | + */ |
|
| 1281 | 1281 | public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array()) |
| 1282 | 1282 | { |
| 1283 | 1283 | global $global_query; |
@@ -1331,11 +1331,11 @@ discard block |
||
| 1331 | 1331 | |
| 1332 | 1332 | |
| 1333 | 1333 | /** |
| 1334 | - * Gets all the spotter information based on the aircraft registration |
|
| 1335 | - * |
|
| 1336 | - * @return Array the spotter information |
|
| 1337 | - * |
|
| 1338 | - */ |
|
| 1334 | + * Gets all the spotter information based on the aircraft registration |
|
| 1335 | + * |
|
| 1336 | + * @return Array the spotter information |
|
| 1337 | + * |
|
| 1338 | + */ |
|
| 1339 | 1339 | public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array()) |
| 1340 | 1340 | { |
| 1341 | 1341 | global $global_query; |
@@ -1392,11 +1392,11 @@ discard block |
||
| 1392 | 1392 | |
| 1393 | 1393 | |
| 1394 | 1394 | /** |
| 1395 | - * Gets all the spotter information based on the airline |
|
| 1396 | - * |
|
| 1397 | - * @return Array the spotter information |
|
| 1398 | - * |
|
| 1399 | - */ |
|
| 1395 | + * Gets all the spotter information based on the airline |
|
| 1396 | + * |
|
| 1397 | + * @return Array the spotter information |
|
| 1398 | + * |
|
| 1399 | + */ |
|
| 1400 | 1400 | public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
| 1401 | 1401 | { |
| 1402 | 1402 | global $global_query; |
@@ -1449,11 +1449,11 @@ discard block |
||
| 1449 | 1449 | |
| 1450 | 1450 | |
| 1451 | 1451 | /** |
| 1452 | - * Gets all the spotter information based on the airport |
|
| 1453 | - * |
|
| 1454 | - * @return Array the spotter information |
|
| 1455 | - * |
|
| 1456 | - */ |
|
| 1452 | + * Gets all the spotter information based on the airport |
|
| 1453 | + * |
|
| 1454 | + * @return Array the spotter information |
|
| 1455 | + * |
|
| 1456 | + */ |
|
| 1457 | 1457 | public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
| 1458 | 1458 | { |
| 1459 | 1459 | global $global_query; |
@@ -1507,11 +1507,11 @@ discard block |
||
| 1507 | 1507 | |
| 1508 | 1508 | |
| 1509 | 1509 | /** |
| 1510 | - * Gets all the spotter information based on the date |
|
| 1511 | - * |
|
| 1512 | - * @return Array the spotter information |
|
| 1513 | - * |
|
| 1514 | - */ |
|
| 1510 | + * Gets all the spotter information based on the date |
|
| 1511 | + * |
|
| 1512 | + * @return Array the spotter information |
|
| 1513 | + * |
|
| 1514 | + */ |
|
| 1515 | 1515 | public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
| 1516 | 1516 | { |
| 1517 | 1517 | global $global_query, $globalTimezone, $globalDBdriver; |
@@ -1575,11 +1575,11 @@ discard block |
||
| 1575 | 1575 | |
| 1576 | 1576 | |
| 1577 | 1577 | /** |
| 1578 | - * Gets all the spotter information based on the country name |
|
| 1579 | - * |
|
| 1580 | - * @return Array the spotter information |
|
| 1581 | - * |
|
| 1582 | - */ |
|
| 1578 | + * Gets all the spotter information based on the country name |
|
| 1579 | + * |
|
| 1580 | + * @return Array the spotter information |
|
| 1581 | + * |
|
| 1582 | + */ |
|
| 1583 | 1583 | public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
| 1584 | 1584 | { |
| 1585 | 1585 | global $global_query; |
@@ -1633,11 +1633,11 @@ discard block |
||
| 1633 | 1633 | |
| 1634 | 1634 | |
| 1635 | 1635 | /** |
| 1636 | - * Gets all the spotter information based on the manufacturer name |
|
| 1637 | - * |
|
| 1638 | - * @return Array the spotter information |
|
| 1639 | - * |
|
| 1640 | - */ |
|
| 1636 | + * Gets all the spotter information based on the manufacturer name |
|
| 1637 | + * |
|
| 1638 | + * @return Array the spotter information |
|
| 1639 | + * |
|
| 1640 | + */ |
|
| 1641 | 1641 | public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array()) |
| 1642 | 1642 | { |
| 1643 | 1643 | global $global_query; |
@@ -1693,13 +1693,13 @@ discard block |
||
| 1693 | 1693 | |
| 1694 | 1694 | |
| 1695 | 1695 | /** |
| 1696 | - * Gets a list of all aircraft that take a route |
|
| 1697 | - * |
|
| 1698 | - * @param String $departure_airport_icao ICAO code of departure airport |
|
| 1699 | - * @param String $arrival_airport_icao ICAO code of arrival airport |
|
| 1700 | - * @return Array the spotter information |
|
| 1701 | - * |
|
| 1702 | - */ |
|
| 1696 | + * Gets a list of all aircraft that take a route |
|
| 1697 | + * |
|
| 1698 | + * @param String $departure_airport_icao ICAO code of departure airport |
|
| 1699 | + * @param String $arrival_airport_icao ICAO code of arrival airport |
|
| 1700 | + * @return Array the spotter information |
|
| 1701 | + * |
|
| 1702 | + */ |
|
| 1703 | 1703 | public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array()) |
| 1704 | 1704 | { |
| 1705 | 1705 | global $global_query; |
@@ -1768,11 +1768,11 @@ discard block |
||
| 1768 | 1768 | |
| 1769 | 1769 | |
| 1770 | 1770 | /** |
| 1771 | - * Gets all the spotter information based on the special column in the table |
|
| 1772 | - * |
|
| 1773 | - * @return Array the spotter information |
|
| 1774 | - * |
|
| 1775 | - */ |
|
| 1771 | + * Gets all the spotter information based on the special column in the table |
|
| 1772 | + * |
|
| 1773 | + * @return Array the spotter information |
|
| 1774 | + * |
|
| 1775 | + */ |
|
| 1776 | 1776 | public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array()) |
| 1777 | 1777 | { |
| 1778 | 1778 | global $global_query; |
@@ -1811,11 +1811,11 @@ discard block |
||
| 1811 | 1811 | } |
| 1812 | 1812 | |
| 1813 | 1813 | /** |
| 1814 | - * Gets all the highlight based on a aircraft registration |
|
| 1815 | - * |
|
| 1816 | - * @return String the highlight text |
|
| 1817 | - * |
|
| 1818 | - */ |
|
| 1814 | + * Gets all the highlight based on a aircraft registration |
|
| 1815 | + * |
|
| 1816 | + * @return String the highlight text |
|
| 1817 | + * |
|
| 1818 | + */ |
|
| 1819 | 1819 | public function getHighlightByRegistration($registration,$filter = array()) |
| 1820 | 1820 | { |
| 1821 | 1821 | global $global_query; |
@@ -1837,13 +1837,13 @@ discard block |
||
| 1837 | 1837 | |
| 1838 | 1838 | |
| 1839 | 1839 | /** |
| 1840 | - * Gets the squawk usage from squawk code |
|
| 1841 | - * |
|
| 1842 | - * @param String $squawk squawk code |
|
| 1843 | - * @param String $country country |
|
| 1844 | - * @return String usage |
|
| 1845 | - * |
|
| 1846 | - */ |
|
| 1840 | + * Gets the squawk usage from squawk code |
|
| 1841 | + * |
|
| 1842 | + * @param String $squawk squawk code |
|
| 1843 | + * @param String $country country |
|
| 1844 | + * @return String usage |
|
| 1845 | + * |
|
| 1846 | + */ |
|
| 1847 | 1847 | public function getSquawkUsage($squawk = '',$country = 'FR') |
| 1848 | 1848 | { |
| 1849 | 1849 | |
@@ -1864,12 +1864,12 @@ discard block |
||
| 1864 | 1864 | } |
| 1865 | 1865 | |
| 1866 | 1866 | /** |
| 1867 | - * Gets the airport icao from the iata |
|
| 1868 | - * |
|
| 1869 | - * @param String $airport_iata the iata code of the airport |
|
| 1870 | - * @return String airport iata |
|
| 1871 | - * |
|
| 1872 | - */ |
|
| 1867 | + * Gets the airport icao from the iata |
|
| 1868 | + * |
|
| 1869 | + * @param String $airport_iata the iata code of the airport |
|
| 1870 | + * @return String airport iata |
|
| 1871 | + * |
|
| 1872 | + */ |
|
| 1873 | 1873 | public function getAirportIcao($airport_iata = '') |
| 1874 | 1874 | { |
| 1875 | 1875 | |
@@ -1889,14 +1889,14 @@ discard block |
||
| 1889 | 1889 | } |
| 1890 | 1890 | |
| 1891 | 1891 | /** |
| 1892 | - * Gets the airport distance |
|
| 1893 | - * |
|
| 1894 | - * @param String $airport_icao the icao code of the airport |
|
| 1895 | - * @param Float $latitude the latitude |
|
| 1896 | - * @param Float $longitude the longitude |
|
| 1897 | - * @return Float distance to the airport |
|
| 1898 | - * |
|
| 1899 | - */ |
|
| 1892 | + * Gets the airport distance |
|
| 1893 | + * |
|
| 1894 | + * @param String $airport_icao the icao code of the airport |
|
| 1895 | + * @param Float $latitude the latitude |
|
| 1896 | + * @param Float $longitude the longitude |
|
| 1897 | + * @return Float distance to the airport |
|
| 1898 | + * |
|
| 1899 | + */ |
|
| 1900 | 1900 | public function getAirportDistance($airport_icao,$latitude,$longitude) |
| 1901 | 1901 | { |
| 1902 | 1902 | |
@@ -1917,12 +1917,12 @@ discard block |
||
| 1917 | 1917 | } |
| 1918 | 1918 | |
| 1919 | 1919 | /** |
| 1920 | - * Gets the airport info based on the icao |
|
| 1921 | - * |
|
| 1922 | - * @param String $airport the icao code of the airport |
|
| 1923 | - * @return Array airport information |
|
| 1924 | - * |
|
| 1925 | - */ |
|
| 1920 | + * Gets the airport info based on the icao |
|
| 1921 | + * |
|
| 1922 | + * @param String $airport the icao code of the airport |
|
| 1923 | + * @return Array airport information |
|
| 1924 | + * |
|
| 1925 | + */ |
|
| 1926 | 1926 | public function getAllAirportInfo($airport = '') |
| 1927 | 1927 | { |
| 1928 | 1928 | |
@@ -1968,12 +1968,12 @@ discard block |
||
| 1968 | 1968 | } |
| 1969 | 1969 | |
| 1970 | 1970 | /** |
| 1971 | - * Gets the airport info based on the country |
|
| 1972 | - * |
|
| 1973 | - * @param Array $countries Airports countries |
|
| 1974 | - * @return Array airport information |
|
| 1975 | - * |
|
| 1976 | - */ |
|
| 1971 | + * Gets the airport info based on the country |
|
| 1972 | + * |
|
| 1973 | + * @param Array $countries Airports countries |
|
| 1974 | + * @return Array airport information |
|
| 1975 | + * |
|
| 1976 | + */ |
|
| 1977 | 1977 | public function getAllAirportInfobyCountry($countries) |
| 1978 | 1978 | { |
| 1979 | 1979 | $lst_countries = ''; |
@@ -2011,12 +2011,12 @@ discard block |
||
| 2011 | 2011 | } |
| 2012 | 2012 | |
| 2013 | 2013 | /** |
| 2014 | - * Gets airports info based on the coord |
|
| 2015 | - * |
|
| 2016 | - * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
| 2017 | - * @return Array airport information |
|
| 2018 | - * |
|
| 2019 | - */ |
|
| 2014 | + * Gets airports info based on the coord |
|
| 2015 | + * |
|
| 2016 | + * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
| 2017 | + * @return Array airport information |
|
| 2018 | + * |
|
| 2019 | + */ |
|
| 2020 | 2020 | public function getAllAirportInfobyCoord($coord) |
| 2021 | 2021 | { |
| 2022 | 2022 | global $globalDBdriver; |
@@ -2047,12 +2047,12 @@ discard block |
||
| 2047 | 2047 | } |
| 2048 | 2048 | |
| 2049 | 2049 | /** |
| 2050 | - * Gets waypoints info based on the coord |
|
| 2051 | - * |
|
| 2052 | - * @param Array $coord waypoints coord |
|
| 2053 | - * @return Array airport information |
|
| 2054 | - * |
|
| 2055 | - */ |
|
| 2050 | + * Gets waypoints info based on the coord |
|
| 2051 | + * |
|
| 2052 | + * @param Array $coord waypoints coord |
|
| 2053 | + * @return Array airport information |
|
| 2054 | + * |
|
| 2055 | + */ |
|
| 2056 | 2056 | public function getAllWaypointsInfobyCoord($coord) |
| 2057 | 2057 | { |
| 2058 | 2058 | if (is_array($coord)) { |
@@ -2086,12 +2086,12 @@ discard block |
||
| 2086 | 2086 | |
| 2087 | 2087 | |
| 2088 | 2088 | /** |
| 2089 | - * Gets the airline info based on the icao code or iata code |
|
| 2090 | - * |
|
| 2091 | - * @param String $airline_icao the iata code of the airport |
|
| 2092 | - * @return Array airport information |
|
| 2093 | - * |
|
| 2094 | - */ |
|
| 2089 | + * Gets the airline info based on the icao code or iata code |
|
| 2090 | + * |
|
| 2091 | + * @param String $airline_icao the iata code of the airport |
|
| 2092 | + * @return Array airport information |
|
| 2093 | + * |
|
| 2094 | + */ |
|
| 2095 | 2095 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2096 | 2096 | { |
| 2097 | 2097 | global $globalUseRealAirlines; |
@@ -2122,7 +2122,7 @@ discard block |
||
| 2122 | 2122 | } else { |
| 2123 | 2123 | $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
| 2124 | 2124 | } |
| 2125 | - /* |
|
| 2125 | + /* |
|
| 2126 | 2126 | $airline_array = array(); |
| 2127 | 2127 | $temp_array = array(); |
| 2128 | 2128 | |
@@ -2152,12 +2152,12 @@ discard block |
||
| 2152 | 2152 | } |
| 2153 | 2153 | |
| 2154 | 2154 | /** |
| 2155 | - * Gets the airline info based on the airline name |
|
| 2156 | - * |
|
| 2157 | - * @param String $airline_name the name of the airline |
|
| 2158 | - * @return Array airline information |
|
| 2159 | - * |
|
| 2160 | - */ |
|
| 2155 | + * Gets the airline info based on the airline name |
|
| 2156 | + * |
|
| 2157 | + * @param String $airline_name the name of the airline |
|
| 2158 | + * @return Array airline information |
|
| 2159 | + * |
|
| 2160 | + */ |
|
| 2161 | 2161 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
| 2162 | 2162 | { |
| 2163 | 2163 | global $globalUseRealAirlines; |
@@ -2185,12 +2185,12 @@ discard block |
||
| 2185 | 2185 | |
| 2186 | 2186 | |
| 2187 | 2187 | /** |
| 2188 | - * Gets the aircraft info based on the aircraft type |
|
| 2189 | - * |
|
| 2190 | - * @param String $aircraft_type the aircraft type |
|
| 2191 | - * @return Array aircraft information |
|
| 2192 | - * |
|
| 2193 | - */ |
|
| 2188 | + * Gets the aircraft info based on the aircraft type |
|
| 2189 | + * |
|
| 2190 | + * @param String $aircraft_type the aircraft type |
|
| 2191 | + * @return Array aircraft information |
|
| 2192 | + * |
|
| 2193 | + */ |
|
| 2194 | 2194 | public function getAllAircraftInfo($aircraft_type) |
| 2195 | 2195 | { |
| 2196 | 2196 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2222,12 +2222,12 @@ discard block |
||
| 2222 | 2222 | } |
| 2223 | 2223 | |
| 2224 | 2224 | /** |
| 2225 | - * Gets the aircraft icao based on the aircraft name/type |
|
| 2226 | - * |
|
| 2227 | - * @param String $aircraft_type the aircraft type |
|
| 2228 | - * @return String aircraft information |
|
| 2229 | - * |
|
| 2230 | - */ |
|
| 2225 | + * Gets the aircraft icao based on the aircraft name/type |
|
| 2226 | + * |
|
| 2227 | + * @param String $aircraft_type the aircraft type |
|
| 2228 | + * @return String aircraft information |
|
| 2229 | + * |
|
| 2230 | + */ |
|
| 2231 | 2231 | public function getAircraftIcao($aircraft_type) |
| 2232 | 2232 | { |
| 2233 | 2233 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2252,12 +2252,12 @@ discard block |
||
| 2252 | 2252 | } |
| 2253 | 2253 | |
| 2254 | 2254 | /** |
| 2255 | - * Gets the aircraft info based on the aircraft modes |
|
| 2256 | - * |
|
| 2257 | - * @param String $aircraft_modes the aircraft ident (hex) |
|
| 2258 | - * @return String aircraft type |
|
| 2259 | - * |
|
| 2260 | - */ |
|
| 2255 | + * Gets the aircraft info based on the aircraft modes |
|
| 2256 | + * |
|
| 2257 | + * @param String $aircraft_modes the aircraft ident (hex) |
|
| 2258 | + * @return String aircraft type |
|
| 2259 | + * |
|
| 2260 | + */ |
|
| 2261 | 2261 | public function getAllAircraftType($aircraft_modes) |
| 2262 | 2262 | { |
| 2263 | 2263 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -2277,12 +2277,12 @@ discard block |
||
| 2277 | 2277 | } |
| 2278 | 2278 | |
| 2279 | 2279 | /** |
| 2280 | - * Gets the aircraft info based on the aircraft registration |
|
| 2281 | - * |
|
| 2282 | - * @param String $registration the aircraft registration |
|
| 2283 | - * @return String aircraft type |
|
| 2284 | - * |
|
| 2285 | - */ |
|
| 2280 | + * Gets the aircraft info based on the aircraft registration |
|
| 2281 | + * |
|
| 2282 | + * @param String $registration the aircraft registration |
|
| 2283 | + * @return String aircraft type |
|
| 2284 | + * |
|
| 2285 | + */ |
|
| 2286 | 2286 | public function getAllAircraftTypeByRegistration($registration) |
| 2287 | 2287 | { |
| 2288 | 2288 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2300,12 +2300,12 @@ discard block |
||
| 2300 | 2300 | } |
| 2301 | 2301 | |
| 2302 | 2302 | /** |
| 2303 | - * Gets the spotter_id and flightaware_id based on the aircraft registration |
|
| 2304 | - * |
|
| 2305 | - * @param String $registration the aircraft registration |
|
| 2306 | - * @return Array spotter_id and flightaware_id |
|
| 2307 | - * |
|
| 2308 | - */ |
|
| 2303 | + * Gets the spotter_id and flightaware_id based on the aircraft registration |
|
| 2304 | + * |
|
| 2305 | + * @param String $registration the aircraft registration |
|
| 2306 | + * @return Array spotter_id and flightaware_id |
|
| 2307 | + * |
|
| 2308 | + */ |
|
| 2309 | 2309 | public function getAllIDByRegistration($registration) |
| 2310 | 2310 | { |
| 2311 | 2311 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2324,12 +2324,12 @@ discard block |
||
| 2324 | 2324 | } |
| 2325 | 2325 | |
| 2326 | 2326 | /** |
| 2327 | - * Gets correct aircraft operator code |
|
| 2328 | - * |
|
| 2329 | - * @param String $operator the aircraft operator code (callsign) |
|
| 2330 | - * @return String aircraft operator code |
|
| 2331 | - * |
|
| 2332 | - */ |
|
| 2327 | + * Gets correct aircraft operator code |
|
| 2328 | + * |
|
| 2329 | + * @param String $operator the aircraft operator code (callsign) |
|
| 2330 | + * @return String aircraft operator code |
|
| 2331 | + * |
|
| 2332 | + */ |
|
| 2333 | 2333 | public function getOperator($operator) |
| 2334 | 2334 | { |
| 2335 | 2335 | $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
@@ -2346,16 +2346,16 @@ discard block |
||
| 2346 | 2346 | } |
| 2347 | 2347 | |
| 2348 | 2348 | /** |
| 2349 | - * Gets the aircraft route based on the aircraft callsign |
|
| 2350 | - * |
|
| 2351 | - * @param String $callsign the aircraft callsign |
|
| 2352 | - * @return Array aircraft type |
|
| 2353 | - * |
|
| 2354 | - */ |
|
| 2349 | + * Gets the aircraft route based on the aircraft callsign |
|
| 2350 | + * |
|
| 2351 | + * @param String $callsign the aircraft callsign |
|
| 2352 | + * @return Array aircraft type |
|
| 2353 | + * |
|
| 2354 | + */ |
|
| 2355 | 2355 | public function getRouteInfo($callsign) |
| 2356 | 2356 | { |
| 2357 | 2357 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2358 | - if ($callsign == '') return array(); |
|
| 2358 | + if ($callsign == '') return array(); |
|
| 2359 | 2359 | $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"; |
| 2360 | 2360 | |
| 2361 | 2361 | $sth = $this->db->prepare($query); |
@@ -2369,12 +2369,12 @@ discard block |
||
| 2369 | 2369 | } |
| 2370 | 2370 | |
| 2371 | 2371 | /** |
| 2372 | - * Gets the aircraft info based on the aircraft registration |
|
| 2373 | - * |
|
| 2374 | - * @param String $registration the aircraft registration |
|
| 2375 | - * @return Array aircraft information |
|
| 2376 | - * |
|
| 2377 | - */ |
|
| 2372 | + * Gets the aircraft info based on the aircraft registration |
|
| 2373 | + * |
|
| 2374 | + * @param String $registration the aircraft registration |
|
| 2375 | + * @return Array aircraft information |
|
| 2376 | + * |
|
| 2377 | + */ |
|
| 2378 | 2378 | public function getAircraftInfoByRegistration($registration) |
| 2379 | 2379 | { |
| 2380 | 2380 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2401,12 +2401,12 @@ discard block |
||
| 2401 | 2401 | } |
| 2402 | 2402 | |
| 2403 | 2403 | /** |
| 2404 | - * Gets the aircraft owner & base based on the aircraft registration |
|
| 2405 | - * |
|
| 2406 | - * @param String $registration the aircraft registration |
|
| 2407 | - * @return Array aircraft information |
|
| 2408 | - * |
|
| 2409 | - */ |
|
| 2404 | + * Gets the aircraft owner & base based on the aircraft registration |
|
| 2405 | + * |
|
| 2406 | + * @param String $registration the aircraft registration |
|
| 2407 | + * @return Array aircraft information |
|
| 2408 | + * |
|
| 2409 | + */ |
|
| 2410 | 2410 | public function getAircraftOwnerByRegistration($registration) |
| 2411 | 2411 | { |
| 2412 | 2412 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2423,11 +2423,11 @@ discard block |
||
| 2423 | 2423 | |
| 2424 | 2424 | |
| 2425 | 2425 | /** |
| 2426 | - * Gets all flights (but with only little info) |
|
| 2427 | - * |
|
| 2428 | - * @return Array basic flight information |
|
| 2429 | - * |
|
| 2430 | - */ |
|
| 2426 | + * Gets all flights (but with only little info) |
|
| 2427 | + * |
|
| 2428 | + * @return Array basic flight information |
|
| 2429 | + * |
|
| 2430 | + */ |
|
| 2431 | 2431 | public function getAllFlightsforSitemap() |
| 2432 | 2432 | { |
| 2433 | 2433 | //$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 "; |
@@ -2435,7 +2435,7 @@ discard block |
||
| 2435 | 2435 | |
| 2436 | 2436 | $sth = $this->db->prepare($query); |
| 2437 | 2437 | $sth->execute(); |
| 2438 | - /* |
|
| 2438 | + /* |
|
| 2439 | 2439 | $flight_array = array(); |
| 2440 | 2440 | $temp_array = array(); |
| 2441 | 2441 | |
@@ -2457,11 +2457,11 @@ discard block |
||
| 2457 | 2457 | } |
| 2458 | 2458 | |
| 2459 | 2459 | /** |
| 2460 | - * Gets a list of all aircraft manufacturers |
|
| 2461 | - * |
|
| 2462 | - * @return Array list of aircraft types |
|
| 2463 | - * |
|
| 2464 | - */ |
|
| 2460 | + * Gets a list of all aircraft manufacturers |
|
| 2461 | + * |
|
| 2462 | + * @return Array list of aircraft types |
|
| 2463 | + * |
|
| 2464 | + */ |
|
| 2465 | 2465 | public function getAllManufacturers() |
| 2466 | 2466 | { |
| 2467 | 2467 | /* |
@@ -2490,11 +2490,11 @@ discard block |
||
| 2490 | 2490 | |
| 2491 | 2491 | |
| 2492 | 2492 | /** |
| 2493 | - * Gets a list of all aircraft types |
|
| 2494 | - * |
|
| 2495 | - * @return Array list of aircraft types |
|
| 2496 | - * |
|
| 2497 | - */ |
|
| 2493 | + * Gets a list of all aircraft types |
|
| 2494 | + * |
|
| 2495 | + * @return Array list of aircraft types |
|
| 2496 | + * |
|
| 2497 | + */ |
|
| 2498 | 2498 | public function getAllAircraftTypes($filters = array()) |
| 2499 | 2499 | { |
| 2500 | 2500 | /* |
@@ -2529,11 +2529,11 @@ discard block |
||
| 2529 | 2529 | |
| 2530 | 2530 | |
| 2531 | 2531 | /** |
| 2532 | - * Gets a list of all aircraft registrations |
|
| 2533 | - * |
|
| 2534 | - * @return Array list of aircraft registrations |
|
| 2535 | - * |
|
| 2536 | - */ |
|
| 2532 | + * Gets a list of all aircraft registrations |
|
| 2533 | + * |
|
| 2534 | + * @return Array list of aircraft registrations |
|
| 2535 | + * |
|
| 2536 | + */ |
|
| 2537 | 2537 | public function getAllAircraftRegistrations($filters = array()) |
| 2538 | 2538 | { |
| 2539 | 2539 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2558,12 +2558,12 @@ discard block |
||
| 2558 | 2558 | } |
| 2559 | 2559 | |
| 2560 | 2560 | /** |
| 2561 | - * Gets all source name |
|
| 2562 | - * |
|
| 2563 | - * @param String type format of source |
|
| 2564 | - * @return Array list of source name |
|
| 2565 | - * |
|
| 2566 | - */ |
|
| 2561 | + * Gets all source name |
|
| 2562 | + * |
|
| 2563 | + * @param String type format of source |
|
| 2564 | + * @return Array list of source name |
|
| 2565 | + * |
|
| 2566 | + */ |
|
| 2567 | 2567 | public function getAllSourceName($type = '',$filters = array()) |
| 2568 | 2568 | { |
| 2569 | 2569 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2594,11 +2594,11 @@ discard block |
||
| 2594 | 2594 | |
| 2595 | 2595 | |
| 2596 | 2596 | /** |
| 2597 | - * Gets a list of all airline names |
|
| 2598 | - * |
|
| 2599 | - * @return Array list of airline names |
|
| 2600 | - * |
|
| 2601 | - */ |
|
| 2597 | + * Gets a list of all airline names |
|
| 2598 | + * |
|
| 2599 | + * @return Array list of airline names |
|
| 2600 | + * |
|
| 2601 | + */ |
|
| 2602 | 2602 | public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
| 2603 | 2603 | { |
| 2604 | 2604 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
@@ -2647,11 +2647,11 @@ discard block |
||
| 2647 | 2647 | } |
| 2648 | 2648 | |
| 2649 | 2649 | /** |
| 2650 | - * Gets a list of all alliance names |
|
| 2651 | - * |
|
| 2652 | - * @return Array list of alliance names |
|
| 2653 | - * |
|
| 2654 | - */ |
|
| 2650 | + * Gets a list of all alliance names |
|
| 2651 | + * |
|
| 2652 | + * @return Array list of alliance names |
|
| 2653 | + * |
|
| 2654 | + */ |
|
| 2655 | 2655 | public function getAllAllianceNames($forsource = NULL,$filters = array()) |
| 2656 | 2656 | { |
| 2657 | 2657 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
@@ -2676,11 +2676,11 @@ discard block |
||
| 2676 | 2676 | } |
| 2677 | 2677 | |
| 2678 | 2678 | /** |
| 2679 | - * Gets a list of all airline countries |
|
| 2680 | - * |
|
| 2681 | - * @return Array list of airline countries |
|
| 2682 | - * |
|
| 2683 | - */ |
|
| 2679 | + * Gets a list of all airline countries |
|
| 2680 | + * |
|
| 2681 | + * @return Array list of airline countries |
|
| 2682 | + * |
|
| 2683 | + */ |
|
| 2684 | 2684 | public function getAllAirlineCountries($filters = array()) |
| 2685 | 2685 | { |
| 2686 | 2686 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2708,11 +2708,11 @@ discard block |
||
| 2708 | 2708 | |
| 2709 | 2709 | |
| 2710 | 2710 | /** |
| 2711 | - * Gets a list of all departure & arrival names |
|
| 2712 | - * |
|
| 2713 | - * @return Array list of airport names |
|
| 2714 | - * |
|
| 2715 | - */ |
|
| 2711 | + * Gets a list of all departure & arrival names |
|
| 2712 | + * |
|
| 2713 | + * @return Array list of airport names |
|
| 2714 | + * |
|
| 2715 | + */ |
|
| 2716 | 2716 | public function getAllAirportNames($filters = array()) |
| 2717 | 2717 | { |
| 2718 | 2718 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2761,11 +2761,11 @@ discard block |
||
| 2761 | 2761 | |
| 2762 | 2762 | |
| 2763 | 2763 | /** |
| 2764 | - * Gets a list of all departure & arrival airport countries |
|
| 2765 | - * |
|
| 2766 | - * @return Array list of airport countries |
|
| 2767 | - * |
|
| 2768 | - */ |
|
| 2764 | + * Gets a list of all departure & arrival airport countries |
|
| 2765 | + * |
|
| 2766 | + * @return Array list of airport countries |
|
| 2767 | + * |
|
| 2768 | + */ |
|
| 2769 | 2769 | public function getAllAirportCountries($filters = array()) |
| 2770 | 2770 | { |
| 2771 | 2771 | $airport_array = array(); |
@@ -2813,11 +2813,11 @@ discard block |
||
| 2813 | 2813 | |
| 2814 | 2814 | |
| 2815 | 2815 | /** |
| 2816 | - * Gets a list of all countries (airline, departure airport & arrival airport) |
|
| 2817 | - * |
|
| 2818 | - * @return Array list of countries |
|
| 2819 | - * |
|
| 2820 | - */ |
|
| 2816 | + * Gets a list of all countries (airline, departure airport & arrival airport) |
|
| 2817 | + * |
|
| 2818 | + * @return Array list of countries |
|
| 2819 | + * |
|
| 2820 | + */ |
|
| 2821 | 2821 | public function getAllCountries($filters = array()) |
| 2822 | 2822 | { |
| 2823 | 2823 | $Connection= new Connection($this->db); |
@@ -2894,11 +2894,11 @@ discard block |
||
| 2894 | 2894 | |
| 2895 | 2895 | |
| 2896 | 2896 | /** |
| 2897 | - * Gets a list of all idents/callsigns |
|
| 2898 | - * |
|
| 2899 | - * @return Array list of ident/callsign names |
|
| 2900 | - * |
|
| 2901 | - */ |
|
| 2897 | + * Gets a list of all idents/callsigns |
|
| 2898 | + * |
|
| 2899 | + * @return Array list of ident/callsign names |
|
| 2900 | + * |
|
| 2901 | + */ |
|
| 2902 | 2902 | public function getAllIdents($filters = array()) |
| 2903 | 2903 | { |
| 2904 | 2904 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2922,9 +2922,9 @@ discard block |
||
| 2922 | 2922 | } |
| 2923 | 2923 | |
| 2924 | 2924 | /** |
| 2925 | - * Get a list of flights from airport since 7 days |
|
| 2926 | - * @return Array number, icao, name and city of airports |
|
| 2927 | - */ |
|
| 2925 | + * Get a list of flights from airport since 7 days |
|
| 2926 | + * @return Array number, icao, name and city of airports |
|
| 2927 | + */ |
|
| 2928 | 2928 | |
| 2929 | 2929 | public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
| 2930 | 2930 | global $globalTimezone, $globalDBdriver; |
@@ -2955,9 +2955,9 @@ discard block |
||
| 2955 | 2955 | } |
| 2956 | 2956 | |
| 2957 | 2957 | /** |
| 2958 | - * Get a list of flights from airport since 7 days |
|
| 2959 | - * @return Array number, icao, name and city of airports |
|
| 2960 | - */ |
|
| 2958 | + * Get a list of flights from airport since 7 days |
|
| 2959 | + * @return Array number, icao, name and city of airports |
|
| 2960 | + */ |
|
| 2961 | 2961 | |
| 2962 | 2962 | public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') { |
| 2963 | 2963 | global $globalTimezone, $globalDBdriver; |
@@ -2987,9 +2987,9 @@ discard block |
||
| 2987 | 2987 | } |
| 2988 | 2988 | |
| 2989 | 2989 | /** |
| 2990 | - * Get a list of flights from detected airport since 7 days |
|
| 2991 | - * @return Array number, icao, name and city of airports |
|
| 2992 | - */ |
|
| 2990 | + * Get a list of flights from detected airport since 7 days |
|
| 2991 | + * @return Array number, icao, name and city of airports |
|
| 2992 | + */ |
|
| 2993 | 2993 | |
| 2994 | 2994 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
| 2995 | 2995 | global $globalTimezone, $globalDBdriver; |
@@ -3027,9 +3027,9 @@ discard block |
||
| 3027 | 3027 | } |
| 3028 | 3028 | |
| 3029 | 3029 | /** |
| 3030 | - * Get a list of flights from detected airport since 7 days |
|
| 3031 | - * @return Array number, icao, name and city of airports |
|
| 3032 | - */ |
|
| 3030 | + * Get a list of flights from detected airport since 7 days |
|
| 3031 | + * @return Array number, icao, name and city of airports |
|
| 3032 | + */ |
|
| 3033 | 3033 | |
| 3034 | 3034 | public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') { |
| 3035 | 3035 | global $globalTimezone, $globalDBdriver; |
@@ -3071,9 +3071,9 @@ discard block |
||
| 3071 | 3071 | |
| 3072 | 3072 | |
| 3073 | 3073 | /** |
| 3074 | - * Get a list of flights to airport since 7 days |
|
| 3075 | - * @return Array number, icao, name and city of airports |
|
| 3076 | - */ |
|
| 3074 | + * Get a list of flights to airport since 7 days |
|
| 3075 | + * @return Array number, icao, name and city of airports |
|
| 3076 | + */ |
|
| 3077 | 3077 | |
| 3078 | 3078 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
| 3079 | 3079 | global $globalTimezone, $globalDBdriver; |
@@ -3106,9 +3106,9 @@ discard block |
||
| 3106 | 3106 | |
| 3107 | 3107 | |
| 3108 | 3108 | /** |
| 3109 | - * Get a list of flights detected to airport since 7 days |
|
| 3110 | - * @return Array number, icao, name and city of airports |
|
| 3111 | - */ |
|
| 3109 | + * Get a list of flights detected to airport since 7 days |
|
| 3110 | + * @return Array number, icao, name and city of airports |
|
| 3111 | + */ |
|
| 3112 | 3112 | |
| 3113 | 3113 | public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
| 3114 | 3114 | global $globalTimezone, $globalDBdriver; |
@@ -3149,9 +3149,9 @@ discard block |
||
| 3149 | 3149 | |
| 3150 | 3150 | |
| 3151 | 3151 | /** |
| 3152 | - * Get a list of flights to airport since 7 days |
|
| 3153 | - * @return Array number, icao, name and city of airports |
|
| 3154 | - */ |
|
| 3152 | + * Get a list of flights to airport since 7 days |
|
| 3153 | + * @return Array number, icao, name and city of airports |
|
| 3154 | + */ |
|
| 3155 | 3155 | |
| 3156 | 3156 | public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') { |
| 3157 | 3157 | global $globalTimezone, $globalDBdriver; |
@@ -3183,9 +3183,9 @@ discard block |
||
| 3183 | 3183 | |
| 3184 | 3184 | |
| 3185 | 3185 | /** |
| 3186 | - * Get a list of flights detected to airport since 7 days |
|
| 3187 | - * @return Array number, icao, name and city of airports |
|
| 3188 | - */ |
|
| 3186 | + * Get a list of flights detected to airport since 7 days |
|
| 3187 | + * @return Array number, icao, name and city of airports |
|
| 3188 | + */ |
|
| 3189 | 3189 | |
| 3190 | 3190 | public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') { |
| 3191 | 3191 | global $globalTimezone, $globalDBdriver; |
@@ -3229,11 +3229,11 @@ discard block |
||
| 3229 | 3229 | |
| 3230 | 3230 | |
| 3231 | 3231 | /** |
| 3232 | - * Gets a list of all dates |
|
| 3233 | - * |
|
| 3234 | - * @return Array list of date names |
|
| 3235 | - * |
|
| 3236 | - */ |
|
| 3232 | + * Gets a list of all dates |
|
| 3233 | + * |
|
| 3234 | + * @return Array list of date names |
|
| 3235 | + * |
|
| 3236 | + */ |
|
| 3237 | 3237 | public function getAllDates() |
| 3238 | 3238 | { |
| 3239 | 3239 | global $globalTimezone, $globalDBdriver; |
@@ -3274,11 +3274,11 @@ discard block |
||
| 3274 | 3274 | |
| 3275 | 3275 | |
| 3276 | 3276 | /** |
| 3277 | - * Gets all route combinations |
|
| 3278 | - * |
|
| 3279 | - * @return Array the route list |
|
| 3280 | - * |
|
| 3281 | - */ |
|
| 3277 | + * Gets all route combinations |
|
| 3278 | + * |
|
| 3279 | + * @return Array the route list |
|
| 3280 | + * |
|
| 3281 | + */ |
|
| 3282 | 3282 | public function getAllRoutes() |
| 3283 | 3283 | { |
| 3284 | 3284 | $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 |
@@ -3304,13 +3304,13 @@ discard block |
||
| 3304 | 3304 | } |
| 3305 | 3305 | |
| 3306 | 3306 | /** |
| 3307 | - * Update ident spotter data |
|
| 3308 | - * |
|
| 3309 | - * @param String $flightaware_id the ID from flightaware |
|
| 3310 | - * @param String $ident the flight ident |
|
| 3311 | - * @return String success or false |
|
| 3312 | - * |
|
| 3313 | - */ |
|
| 3307 | + * Update ident spotter data |
|
| 3308 | + * |
|
| 3309 | + * @param String $flightaware_id the ID from flightaware |
|
| 3310 | + * @param String $ident the flight ident |
|
| 3311 | + * @return String success or false |
|
| 3312 | + * |
|
| 3313 | + */ |
|
| 3314 | 3314 | public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
| 3315 | 3315 | { |
| 3316 | 3316 | if (!is_numeric(substr($ident, 0, 3))) |
@@ -3331,14 +3331,14 @@ discard block |
||
| 3331 | 3331 | } else { |
| 3332 | 3332 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3333 | 3333 | } |
| 3334 | - $airline_name = $airline_array[0]['name']; |
|
| 3335 | - $airline_icao = $airline_array[0]['icao']; |
|
| 3336 | - $airline_country = $airline_array[0]['country']; |
|
| 3337 | - $airline_type = $airline_array[0]['type']; |
|
| 3334 | + $airline_name = $airline_array[0]['name']; |
|
| 3335 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3336 | + $airline_country = $airline_array[0]['country']; |
|
| 3337 | + $airline_type = $airline_array[0]['type']; |
|
| 3338 | 3338 | |
| 3339 | 3339 | |
| 3340 | 3340 | $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'; |
| 3341 | - $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); |
|
| 3341 | + $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); |
|
| 3342 | 3342 | |
| 3343 | 3343 | try { |
| 3344 | 3344 | $sth = $this->db->prepare($query); |
@@ -3351,19 +3351,19 @@ discard block |
||
| 3351 | 3351 | |
| 3352 | 3352 | } |
| 3353 | 3353 | /** |
| 3354 | - * Update latest spotter data |
|
| 3355 | - * |
|
| 3356 | - * @param String $flightaware_id the ID from flightaware |
|
| 3357 | - * @param String $ident the flight ident |
|
| 3358 | - * @param String $arrival_airport_icao the arrival airport |
|
| 3359 | - * @return String success or false |
|
| 3360 | - * |
|
| 3361 | - */ |
|
| 3354 | + * Update latest spotter data |
|
| 3355 | + * |
|
| 3356 | + * @param String $flightaware_id the ID from flightaware |
|
| 3357 | + * @param String $ident the flight ident |
|
| 3358 | + * @param String $arrival_airport_icao the arrival airport |
|
| 3359 | + * @return String success or false |
|
| 3360 | + * |
|
| 3361 | + */ |
|
| 3362 | 3362 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3363 | 3363 | { |
| 3364 | 3364 | if ($groundspeed == '') $groundspeed = NULL; |
| 3365 | 3365 | $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'; |
| 3366 | - $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); |
|
| 3366 | + $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); |
|
| 3367 | 3367 | |
| 3368 | 3368 | try { |
| 3369 | 3369 | $sth = $this->db->prepare($query); |
@@ -3377,32 +3377,32 @@ discard block |
||
| 3377 | 3377 | } |
| 3378 | 3378 | |
| 3379 | 3379 | /** |
| 3380 | - * Adds a new spotter data |
|
| 3381 | - * |
|
| 3382 | - * @param String $flightaware_id the ID from flightaware |
|
| 3383 | - * @param String $ident the flight ident |
|
| 3384 | - * @param String $aircraft_icao the aircraft type |
|
| 3385 | - * @param String $departure_airport_icao the departure airport |
|
| 3386 | - * @param String $arrival_airport_icao the arrival airport |
|
| 3387 | - * @param String $latitude latitude of flight |
|
| 3388 | - * @param String $longitude latitude of flight |
|
| 3389 | - * @param String $waypoints waypoints of flight |
|
| 3390 | - * @param String $altitude altitude of flight |
|
| 3391 | - * @param String $heading heading of flight |
|
| 3392 | - * @param String $groundspeed speed of flight |
|
| 3393 | - * @param String $date date of flight |
|
| 3394 | - * @param String $departure_airport_time departure time of flight |
|
| 3395 | - * @param String $arrival_airport_time arrival time of flight |
|
| 3396 | - * @param String $squawk squawk code of flight |
|
| 3397 | - * @param String $route_stop route stop of flight |
|
| 3398 | - * @param String $highlight highlight or not |
|
| 3399 | - * @param String $ModeS ModesS code of flight |
|
| 3400 | - * @param String $registration registration code of flight |
|
| 3401 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 3402 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 3403 | - * @param String $verticalrate vertival rate of flight |
|
| 3404 | - * @return String success or false |
|
| 3405 | - */ |
|
| 3380 | + * Adds a new spotter data |
|
| 3381 | + * |
|
| 3382 | + * @param String $flightaware_id the ID from flightaware |
|
| 3383 | + * @param String $ident the flight ident |
|
| 3384 | + * @param String $aircraft_icao the aircraft type |
|
| 3385 | + * @param String $departure_airport_icao the departure airport |
|
| 3386 | + * @param String $arrival_airport_icao the arrival airport |
|
| 3387 | + * @param String $latitude latitude of flight |
|
| 3388 | + * @param String $longitude latitude of flight |
|
| 3389 | + * @param String $waypoints waypoints of flight |
|
| 3390 | + * @param String $altitude altitude of flight |
|
| 3391 | + * @param String $heading heading of flight |
|
| 3392 | + * @param String $groundspeed speed of flight |
|
| 3393 | + * @param String $date date of flight |
|
| 3394 | + * @param String $departure_airport_time departure time of flight |
|
| 3395 | + * @param String $arrival_airport_time arrival time of flight |
|
| 3396 | + * @param String $squawk squawk code of flight |
|
| 3397 | + * @param String $route_stop route stop of flight |
|
| 3398 | + * @param String $highlight highlight or not |
|
| 3399 | + * @param String $ModeS ModesS code of flight |
|
| 3400 | + * @param String $registration registration code of flight |
|
| 3401 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 3402 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 3403 | + * @param String $verticalrate vertival rate of flight |
|
| 3404 | + * @return String success or false |
|
| 3405 | + */ |
|
| 3406 | 3406 | 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 = '') |
| 3407 | 3407 | { |
| 3408 | 3408 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
@@ -3617,8 +3617,8 @@ discard block |
||
| 3617 | 3617 | |
| 3618 | 3618 | if ($globalIVAO && $aircraft_icao != '') |
| 3619 | 3619 | { |
| 3620 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3621 | - else $airline_icao = ''; |
|
| 3620 | + if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3621 | + else $airline_icao = ''; |
|
| 3622 | 3622 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3623 | 3623 | if (!isset($image_array[0]['registration'])) |
| 3624 | 3624 | { |
@@ -3649,53 +3649,53 @@ discard block |
||
| 3649 | 3649 | |
| 3650 | 3650 | if (count($airline_array) == 0) |
| 3651 | 3651 | { |
| 3652 | - $airline_array = $this->getAllAirlineInfo('NA'); |
|
| 3653 | - } |
|
| 3654 | - if (count($aircraft_array) == 0) |
|
| 3655 | - { |
|
| 3656 | - $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
| 3657 | - } |
|
| 3658 | - if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') |
|
| 3659 | - { |
|
| 3660 | - $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3661 | - } |
|
| 3662 | - if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') |
|
| 3663 | - { |
|
| 3664 | - $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3665 | - } |
|
| 3666 | - if ($registration == '') $registration = 'NA'; |
|
| 3667 | - if ($latitude == '' && $longitude == '') { |
|
| 3668 | - $latitude = 0; |
|
| 3669 | - $longitude = 0; |
|
| 3670 | - } |
|
| 3671 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3672 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3673 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3674 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3675 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3676 | - $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) |
|
| 3652 | + $airline_array = $this->getAllAirlineInfo('NA'); |
|
| 3653 | + } |
|
| 3654 | + if (count($aircraft_array) == 0) |
|
| 3655 | + { |
|
| 3656 | + $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
| 3657 | + } |
|
| 3658 | + if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') |
|
| 3659 | + { |
|
| 3660 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3661 | + } |
|
| 3662 | + if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') |
|
| 3663 | + { |
|
| 3664 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3665 | + } |
|
| 3666 | + if ($registration == '') $registration = 'NA'; |
|
| 3667 | + if ($latitude == '' && $longitude == '') { |
|
| 3668 | + $latitude = 0; |
|
| 3669 | + $longitude = 0; |
|
| 3670 | + } |
|
| 3671 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3672 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3673 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3674 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3675 | + if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3676 | + $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) |
|
| 3677 | 3677 | 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)"; |
| 3678 | 3678 | |
| 3679 | - $airline_name = $airline_array[0]['name']; |
|
| 3680 | - $airline_icao = $airline_array[0]['icao']; |
|
| 3681 | - $airline_country = $airline_array[0]['country']; |
|
| 3682 | - $airline_type = $airline_array[0]['type']; |
|
| 3679 | + $airline_name = $airline_array[0]['name']; |
|
| 3680 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3681 | + $airline_country = $airline_array[0]['country']; |
|
| 3682 | + $airline_type = $airline_array[0]['type']; |
|
| 3683 | 3683 | if ($airline_type == '') { |
| 3684 | 3684 | $timeelapsed = microtime(true); |
| 3685 | 3685 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3686 | 3686 | if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 3687 | 3687 | } |
| 3688 | 3688 | if ($airline_type == null) $airline_type = ''; |
| 3689 | - $aircraft_type = $aircraft_array[0]['type']; |
|
| 3690 | - $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
| 3691 | - $departure_airport_name = $departure_airport_array[0]['name']; |
|
| 3692 | - $departure_airport_city = $departure_airport_array[0]['city']; |
|
| 3693 | - $departure_airport_country = $departure_airport_array[0]['country']; |
|
| 3689 | + $aircraft_type = $aircraft_array[0]['type']; |
|
| 3690 | + $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
| 3691 | + $departure_airport_name = $departure_airport_array[0]['name']; |
|
| 3692 | + $departure_airport_city = $departure_airport_array[0]['city']; |
|
| 3693 | + $departure_airport_country = $departure_airport_array[0]['country']; |
|
| 3694 | 3694 | |
| 3695 | - $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
| 3696 | - $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
| 3697 | - $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
| 3698 | - $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); |
|
| 3695 | + $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
| 3696 | + $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
| 3697 | + $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
| 3698 | + $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); |
|
| 3699 | 3699 | |
| 3700 | 3700 | try { |
| 3701 | 3701 | |
@@ -3703,7 +3703,7 @@ discard block |
||
| 3703 | 3703 | $sth->execute($query_values); |
| 3704 | 3704 | $this->db = null; |
| 3705 | 3705 | } catch (PDOException $e) { |
| 3706 | - return "error : ".$e->getMessage(); |
|
| 3706 | + return "error : ".$e->getMessage(); |
|
| 3707 | 3707 | } |
| 3708 | 3708 | |
| 3709 | 3709 | return "success"; |
@@ -3712,11 +3712,11 @@ discard block |
||
| 3712 | 3712 | |
| 3713 | 3713 | |
| 3714 | 3714 | /** |
| 3715 | - * Gets the aircraft ident within the last hour |
|
| 3716 | - * |
|
| 3717 | - * @return String the ident |
|
| 3718 | - * |
|
| 3719 | - */ |
|
| 3715 | + * Gets the aircraft ident within the last hour |
|
| 3716 | + * |
|
| 3717 | + * @return String the ident |
|
| 3718 | + * |
|
| 3719 | + */ |
|
| 3720 | 3720 | public function getIdentFromLastHour($ident) |
| 3721 | 3721 | { |
| 3722 | 3722 | global $globalDBdriver, $globalTimezone; |
@@ -3732,11 +3732,11 @@ discard block |
||
| 3732 | 3732 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 3733 | 3733 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
| 3734 | 3734 | $query_data = array(':ident' => $ident); |
| 3735 | - } |
|
| 3735 | + } |
|
| 3736 | 3736 | |
| 3737 | 3737 | $sth = $this->db->prepare($query); |
| 3738 | 3738 | $sth->execute($query_data); |
| 3739 | - $ident_result=''; |
|
| 3739 | + $ident_result=''; |
|
| 3740 | 3740 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 3741 | 3741 | { |
| 3742 | 3742 | $ident_result = $row['ident']; |
@@ -3747,11 +3747,11 @@ discard block |
||
| 3747 | 3747 | |
| 3748 | 3748 | |
| 3749 | 3749 | /** |
| 3750 | - * Gets the aircraft data from the last 20 seconds |
|
| 3751 | - * |
|
| 3752 | - * @return Array the spotter data |
|
| 3753 | - * |
|
| 3754 | - */ |
|
| 3750 | + * Gets the aircraft data from the last 20 seconds |
|
| 3751 | + * |
|
| 3752 | + * @return Array the spotter data |
|
| 3753 | + * |
|
| 3754 | + */ |
|
| 3755 | 3755 | public function getRealTimeData($q = '') |
| 3756 | 3756 | { |
| 3757 | 3757 | global $globalDBdriver; |
@@ -3795,11 +3795,11 @@ discard block |
||
| 3795 | 3795 | |
| 3796 | 3796 | |
| 3797 | 3797 | /** |
| 3798 | - * Gets all airlines that have flown over |
|
| 3799 | - * |
|
| 3800 | - * @return Array the airline list |
|
| 3801 | - * |
|
| 3802 | - */ |
|
| 3798 | + * Gets all airlines that have flown over |
|
| 3799 | + * |
|
| 3800 | + * @return Array the airline list |
|
| 3801 | + * |
|
| 3802 | + */ |
|
| 3803 | 3803 | public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 3804 | 3804 | { |
| 3805 | 3805 | global $globalDBdriver; |
@@ -3813,7 +3813,7 @@ discard block |
||
| 3813 | 3813 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3814 | 3814 | } |
| 3815 | 3815 | } |
| 3816 | - if ($sincedate != '') { |
|
| 3816 | + if ($sincedate != '') { |
|
| 3817 | 3817 | if ($globalDBdriver == 'mysql') { |
| 3818 | 3818 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 3819 | 3819 | } else { |
@@ -3840,26 +3840,26 @@ discard block |
||
| 3840 | 3840 | } |
| 3841 | 3841 | |
| 3842 | 3842 | /** |
| 3843 | - * Gets all pilots that have flown over |
|
| 3844 | - * |
|
| 3845 | - * @return Array the pilots list |
|
| 3846 | - * |
|
| 3847 | - */ |
|
| 3843 | + * Gets all pilots that have flown over |
|
| 3844 | + * |
|
| 3845 | + * @return Array the pilots list |
|
| 3846 | + * |
|
| 3847 | + */ |
|
| 3848 | 3848 | public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 3849 | 3849 | { |
| 3850 | 3850 | global $globalDBdriver; |
| 3851 | 3851 | $filter_query = $this->getFilter($filters,true,true); |
| 3852 | 3852 | $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
| 3853 | 3853 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' "; |
| 3854 | - if ($olderthanmonths > 0) { |
|
| 3855 | - if ($globalDBdriver == 'mysql') { |
|
| 3854 | + if ($olderthanmonths > 0) { |
|
| 3855 | + if ($globalDBdriver == 'mysql') { |
|
| 3856 | 3856 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 3857 | 3857 | } else { |
| 3858 | 3858 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3859 | 3859 | } |
| 3860 | 3860 | } |
| 3861 | - if ($sincedate != '') { |
|
| 3862 | - if ($globalDBdriver == 'mysql') { |
|
| 3861 | + if ($sincedate != '') { |
|
| 3862 | + if ($globalDBdriver == 'mysql') { |
|
| 3863 | 3863 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 3864 | 3864 | } else { |
| 3865 | 3865 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3887,25 +3887,25 @@ discard block |
||
| 3887 | 3887 | } |
| 3888 | 3888 | |
| 3889 | 3889 | /** |
| 3890 | - * Gets all pilots that have flown over |
|
| 3891 | - * |
|
| 3892 | - * @return Array the pilots list |
|
| 3893 | - * |
|
| 3894 | - */ |
|
| 3890 | + * Gets all pilots that have flown over |
|
| 3891 | + * |
|
| 3892 | + * @return Array the pilots list |
|
| 3893 | + * |
|
| 3894 | + */ |
|
| 3895 | 3895 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
| 3896 | 3896 | { |
| 3897 | 3897 | global $globalDBdriver; |
| 3898 | 3898 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
| 3899 | 3899 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
| 3900 | - if ($olderthanmonths > 0) { |
|
| 3901 | - if ($globalDBdriver == 'mysql') { |
|
| 3900 | + if ($olderthanmonths > 0) { |
|
| 3901 | + if ($globalDBdriver == 'mysql') { |
|
| 3902 | 3902 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 3903 | 3903 | } else { |
| 3904 | 3904 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3905 | 3905 | } |
| 3906 | 3906 | } |
| 3907 | - if ($sincedate != '') { |
|
| 3908 | - if ($globalDBdriver == 'mysql') { |
|
| 3907 | + if ($sincedate != '') { |
|
| 3908 | + if ($globalDBdriver == 'mysql') { |
|
| 3909 | 3909 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 3910 | 3910 | } else { |
| 3911 | 3911 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3934,26 +3934,26 @@ discard block |
||
| 3934 | 3934 | } |
| 3935 | 3935 | |
| 3936 | 3936 | /** |
| 3937 | - * Gets all owner that have flown over |
|
| 3938 | - * |
|
| 3939 | - * @return Array the pilots list |
|
| 3940 | - * |
|
| 3941 | - */ |
|
| 3937 | + * Gets all owner that have flown over |
|
| 3938 | + * |
|
| 3939 | + * @return Array the pilots list |
|
| 3940 | + * |
|
| 3941 | + */ |
|
| 3942 | 3942 | public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 3943 | 3943 | { |
| 3944 | 3944 | global $globalDBdriver; |
| 3945 | 3945 | $filter_query = $this->getFilter($filters,true,true); |
| 3946 | 3946 | $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
| 3947 | 3947 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 3948 | - if ($olderthanmonths > 0) { |
|
| 3949 | - if ($globalDBdriver == 'mysql') { |
|
| 3948 | + if ($olderthanmonths > 0) { |
|
| 3949 | + if ($globalDBdriver == 'mysql') { |
|
| 3950 | 3950 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 3951 | 3951 | } else { |
| 3952 | 3952 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3953 | 3953 | } |
| 3954 | 3954 | } |
| 3955 | - if ($sincedate != '') { |
|
| 3956 | - if ($globalDBdriver == 'mysql') { |
|
| 3955 | + if ($sincedate != '') { |
|
| 3956 | + if ($globalDBdriver == 'mysql') { |
|
| 3957 | 3957 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 3958 | 3958 | } else { |
| 3959 | 3959 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3979,26 +3979,26 @@ discard block |
||
| 3979 | 3979 | } |
| 3980 | 3980 | |
| 3981 | 3981 | /** |
| 3982 | - * Gets all owner that have flown over |
|
| 3983 | - * |
|
| 3984 | - * @return Array the pilots list |
|
| 3985 | - * |
|
| 3986 | - */ |
|
| 3982 | + * Gets all owner that have flown over |
|
| 3983 | + * |
|
| 3984 | + * @return Array the pilots list |
|
| 3985 | + * |
|
| 3986 | + */ |
|
| 3987 | 3987 | public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 3988 | 3988 | { |
| 3989 | 3989 | global $globalDBdriver; |
| 3990 | 3990 | $filter_query = $this->getFilter($filters,true,true); |
| 3991 | 3991 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
| 3992 | 3992 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 3993 | - if ($olderthanmonths > 0) { |
|
| 3994 | - if ($globalDBdriver == 'mysql') { |
|
| 3993 | + if ($olderthanmonths > 0) { |
|
| 3994 | + if ($globalDBdriver == 'mysql') { |
|
| 3995 | 3995 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 3996 | 3996 | } else { |
| 3997 | 3997 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 3998 | 3998 | } |
| 3999 | 3999 | } |
| 4000 | - if ($sincedate != '') { |
|
| 4001 | - if ($globalDBdriver == 'mysql') { |
|
| 4000 | + if ($sincedate != '') { |
|
| 4001 | + if ($globalDBdriver == 'mysql') { |
|
| 4002 | 4002 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 4003 | 4003 | } else { |
| 4004 | 4004 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4025,11 +4025,11 @@ discard block |
||
| 4025 | 4025 | } |
| 4026 | 4026 | |
| 4027 | 4027 | /** |
| 4028 | - * Gets all airlines that have flown over by aircraft |
|
| 4029 | - * |
|
| 4030 | - * @return Array the airline list |
|
| 4031 | - * |
|
| 4032 | - */ |
|
| 4028 | + * Gets all airlines that have flown over by aircraft |
|
| 4029 | + * |
|
| 4030 | + * @return Array the airline list |
|
| 4031 | + * |
|
| 4032 | + */ |
|
| 4033 | 4033 | public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
| 4034 | 4034 | { |
| 4035 | 4035 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -4061,11 +4061,11 @@ discard block |
||
| 4061 | 4061 | |
| 4062 | 4062 | |
| 4063 | 4063 | /** |
| 4064 | - * Gets all airline countries that have flown over by aircraft |
|
| 4065 | - * |
|
| 4066 | - * @return Array the airline country list |
|
| 4067 | - * |
|
| 4068 | - */ |
|
| 4064 | + * Gets all airline countries that have flown over by aircraft |
|
| 4065 | + * |
|
| 4066 | + * @return Array the airline country list |
|
| 4067 | + * |
|
| 4068 | + */ |
|
| 4069 | 4069 | public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
| 4070 | 4070 | { |
| 4071 | 4071 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -4097,11 +4097,11 @@ discard block |
||
| 4097 | 4097 | |
| 4098 | 4098 | |
| 4099 | 4099 | /** |
| 4100 | - * Gets all airlines that have flown over by airport |
|
| 4101 | - * |
|
| 4102 | - * @return Array the airline list |
|
| 4103 | - * |
|
| 4104 | - */ |
|
| 4100 | + * Gets all airlines that have flown over by airport |
|
| 4101 | + * |
|
| 4102 | + * @return Array the airline list |
|
| 4103 | + * |
|
| 4104 | + */ |
|
| 4105 | 4105 | public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
| 4106 | 4106 | { |
| 4107 | 4107 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -4132,11 +4132,11 @@ discard block |
||
| 4132 | 4132 | |
| 4133 | 4133 | |
| 4134 | 4134 | /** |
| 4135 | - * Gets all airline countries that have flown over by airport icao |
|
| 4136 | - * |
|
| 4137 | - * @return Array the airline country list |
|
| 4138 | - * |
|
| 4139 | - */ |
|
| 4135 | + * Gets all airline countries that have flown over by airport icao |
|
| 4136 | + * |
|
| 4137 | + * @return Array the airline country list |
|
| 4138 | + * |
|
| 4139 | + */ |
|
| 4140 | 4140 | public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
| 4141 | 4141 | { |
| 4142 | 4142 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -4166,11 +4166,11 @@ discard block |
||
| 4166 | 4166 | |
| 4167 | 4167 | |
| 4168 | 4168 | /** |
| 4169 | - * Gets all airlines that have flown over by aircraft manufacturer |
|
| 4170 | - * |
|
| 4171 | - * @return Array the airline list |
|
| 4172 | - * |
|
| 4173 | - */ |
|
| 4169 | + * Gets all airlines that have flown over by aircraft manufacturer |
|
| 4170 | + * |
|
| 4171 | + * @return Array the airline list |
|
| 4172 | + * |
|
| 4173 | + */ |
|
| 4174 | 4174 | public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4175 | 4175 | { |
| 4176 | 4176 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4201,11 +4201,11 @@ discard block |
||
| 4201 | 4201 | |
| 4202 | 4202 | |
| 4203 | 4203 | /** |
| 4204 | - * Gets all airline countries that have flown over by aircraft manufacturer |
|
| 4205 | - * |
|
| 4206 | - * @return Array the airline country list |
|
| 4207 | - * |
|
| 4208 | - */ |
|
| 4204 | + * Gets all airline countries that have flown over by aircraft manufacturer |
|
| 4205 | + * |
|
| 4206 | + * @return Array the airline country list |
|
| 4207 | + * |
|
| 4208 | + */ |
|
| 4209 | 4209 | public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4210 | 4210 | { |
| 4211 | 4211 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4234,11 +4234,11 @@ discard block |
||
| 4234 | 4234 | |
| 4235 | 4235 | |
| 4236 | 4236 | /** |
| 4237 | - * Gets all airlines that have flown over by date |
|
| 4238 | - * |
|
| 4239 | - * @return Array the airline list |
|
| 4240 | - * |
|
| 4241 | - */ |
|
| 4237 | + * Gets all airlines that have flown over by date |
|
| 4238 | + * |
|
| 4239 | + * @return Array the airline list |
|
| 4240 | + * |
|
| 4241 | + */ |
|
| 4242 | 4242 | public function countAllAirlinesByDate($date,$filters = array()) |
| 4243 | 4243 | { |
| 4244 | 4244 | global $globalTimezone, $globalDBdriver; |
@@ -4282,11 +4282,11 @@ discard block |
||
| 4282 | 4282 | |
| 4283 | 4283 | |
| 4284 | 4284 | /** |
| 4285 | - * Gets all airline countries that have flown over by date |
|
| 4286 | - * |
|
| 4287 | - * @return Array the airline country list |
|
| 4288 | - * |
|
| 4289 | - */ |
|
| 4285 | + * Gets all airline countries that have flown over by date |
|
| 4286 | + * |
|
| 4287 | + * @return Array the airline country list |
|
| 4288 | + * |
|
| 4289 | + */ |
|
| 4290 | 4290 | public function countAllAirlineCountriesByDate($date,$filters = array()) |
| 4291 | 4291 | { |
| 4292 | 4292 | global $globalTimezone, $globalDBdriver; |
@@ -4329,11 +4329,11 @@ discard block |
||
| 4329 | 4329 | |
| 4330 | 4330 | |
| 4331 | 4331 | /** |
| 4332 | - * Gets all airlines that have flown over by ident/callsign |
|
| 4333 | - * |
|
| 4334 | - * @return Array the airline list |
|
| 4335 | - * |
|
| 4336 | - */ |
|
| 4332 | + * Gets all airlines that have flown over by ident/callsign |
|
| 4333 | + * |
|
| 4334 | + * @return Array the airline list |
|
| 4335 | + * |
|
| 4336 | + */ |
|
| 4337 | 4337 | public function countAllAirlinesByIdent($ident,$filters = array()) |
| 4338 | 4338 | { |
| 4339 | 4339 | $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
@@ -4363,11 +4363,11 @@ discard block |
||
| 4363 | 4363 | } |
| 4364 | 4364 | |
| 4365 | 4365 | /** |
| 4366 | - * Gets all airlines that have flown over by route |
|
| 4367 | - * |
|
| 4368 | - * @return Array the airline list |
|
| 4369 | - * |
|
| 4370 | - */ |
|
| 4366 | + * Gets all airlines that have flown over by route |
|
| 4367 | + * |
|
| 4368 | + * @return Array the airline list |
|
| 4369 | + * |
|
| 4370 | + */ |
|
| 4371 | 4371 | public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 4372 | 4372 | { |
| 4373 | 4373 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4399,11 +4399,11 @@ discard block |
||
| 4399 | 4399 | } |
| 4400 | 4400 | |
| 4401 | 4401 | /** |
| 4402 | - * Gets all airline countries that have flown over by route |
|
| 4403 | - * |
|
| 4404 | - * @return Array the airline country list |
|
| 4405 | - * |
|
| 4406 | - */ |
|
| 4402 | + * Gets all airline countries that have flown over by route |
|
| 4403 | + * |
|
| 4404 | + * @return Array the airline country list |
|
| 4405 | + * |
|
| 4406 | + */ |
|
| 4407 | 4407 | public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
| 4408 | 4408 | { |
| 4409 | 4409 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4435,11 +4435,11 @@ discard block |
||
| 4435 | 4435 | |
| 4436 | 4436 | |
| 4437 | 4437 | /** |
| 4438 | - * Gets all airlines that have flown over by country |
|
| 4439 | - * |
|
| 4440 | - * @return Array the airline list |
|
| 4441 | - * |
|
| 4442 | - */ |
|
| 4438 | + * Gets all airlines that have flown over by country |
|
| 4439 | + * |
|
| 4440 | + * @return Array the airline list |
|
| 4441 | + * |
|
| 4442 | + */ |
|
| 4443 | 4443 | public function countAllAirlinesByCountry($country,$filters = array()) |
| 4444 | 4444 | { |
| 4445 | 4445 | $country = filter_var($country,FILTER_SANITIZE_STRING); |
@@ -4469,11 +4469,11 @@ discard block |
||
| 4469 | 4469 | |
| 4470 | 4470 | |
| 4471 | 4471 | /** |
| 4472 | - * Gets all airline countries that have flown over by country |
|
| 4473 | - * |
|
| 4474 | - * @return Array the airline country list |
|
| 4475 | - * |
|
| 4476 | - */ |
|
| 4472 | + * Gets all airline countries that have flown over by country |
|
| 4473 | + * |
|
| 4474 | + * @return Array the airline country list |
|
| 4475 | + * |
|
| 4476 | + */ |
|
| 4477 | 4477 | public function countAllAirlineCountriesByCountry($country,$filters = array()) |
| 4478 | 4478 | { |
| 4479 | 4479 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4502,11 +4502,11 @@ discard block |
||
| 4502 | 4502 | |
| 4503 | 4503 | |
| 4504 | 4504 | /** |
| 4505 | - * Gets all airlines countries |
|
| 4506 | - * |
|
| 4507 | - * @return Array the airline country list |
|
| 4508 | - * |
|
| 4509 | - */ |
|
| 4505 | + * Gets all airlines countries |
|
| 4506 | + * |
|
| 4507 | + * @return Array the airline country list |
|
| 4508 | + * |
|
| 4509 | + */ |
|
| 4510 | 4510 | public function countAllAirlineCountries($limit = true, $filters = array()) |
| 4511 | 4511 | { |
| 4512 | 4512 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4532,11 +4532,11 @@ discard block |
||
| 4532 | 4532 | } |
| 4533 | 4533 | |
| 4534 | 4534 | /** |
| 4535 | - * Gets all number of flight over countries |
|
| 4536 | - * |
|
| 4537 | - * @return Array the airline country list |
|
| 4538 | - * |
|
| 4539 | - */ |
|
| 4535 | + * Gets all number of flight over countries |
|
| 4536 | + * |
|
| 4537 | + * @return Array the airline country list |
|
| 4538 | + * |
|
| 4539 | + */ |
|
| 4540 | 4540 | public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 4541 | 4541 | { |
| 4542 | 4542 | global $globalDBdriver; |
@@ -4558,15 +4558,15 @@ discard block |
||
| 4558 | 4558 | $SpotterLive = new SpotterLive(); |
| 4559 | 4559 | $filter_query = $SpotterLive->getFilter($filters,true,true); |
| 4560 | 4560 | $filter_query .= ' over_country IS NOT NULL'; |
| 4561 | - if ($olderthanmonths > 0) { |
|
| 4561 | + if ($olderthanmonths > 0) { |
|
| 4562 | 4562 | if ($globalDBdriver == 'mysql') { |
| 4563 | 4563 | $filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 4564 | 4564 | } else { |
| 4565 | 4565 | $filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 4566 | 4566 | } |
| 4567 | 4567 | } |
| 4568 | - if ($sincedate != '') { |
|
| 4569 | - if ($globalDBdriver == 'mysql') { |
|
| 4568 | + if ($sincedate != '') { |
|
| 4569 | + if ($globalDBdriver == 'mysql') { |
|
| 4570 | 4570 | $filter_query .= " AND spotter_live.date > '".$sincedate."' "; |
| 4571 | 4571 | } else { |
| 4572 | 4572 | $filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4596,11 +4596,11 @@ discard block |
||
| 4596 | 4596 | |
| 4597 | 4597 | |
| 4598 | 4598 | /** |
| 4599 | - * Gets all aircraft types that have flown over |
|
| 4600 | - * |
|
| 4601 | - * @return Array the aircraft list |
|
| 4602 | - * |
|
| 4603 | - */ |
|
| 4599 | + * Gets all aircraft types that have flown over |
|
| 4600 | + * |
|
| 4601 | + * @return Array the aircraft list |
|
| 4602 | + * |
|
| 4603 | + */ |
|
| 4604 | 4604 | public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 4605 | 4605 | { |
| 4606 | 4606 | global $globalDBdriver; |
@@ -4643,11 +4643,11 @@ discard block |
||
| 4643 | 4643 | } |
| 4644 | 4644 | |
| 4645 | 4645 | /** |
| 4646 | - * Gets all aircraft types that have flown over by airline |
|
| 4647 | - * |
|
| 4648 | - * @return Array the aircraft list |
|
| 4649 | - * |
|
| 4650 | - */ |
|
| 4646 | + * Gets all aircraft types that have flown over by airline |
|
| 4647 | + * |
|
| 4648 | + * @return Array the aircraft list |
|
| 4649 | + * |
|
| 4650 | + */ |
|
| 4651 | 4651 | public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 4652 | 4652 | { |
| 4653 | 4653 | global $globalDBdriver; |
@@ -4690,11 +4690,11 @@ discard block |
||
| 4690 | 4690 | } |
| 4691 | 4691 | |
| 4692 | 4692 | /** |
| 4693 | - * Gets all aircraft types that have flown over by months |
|
| 4694 | - * |
|
| 4695 | - * @return Array the aircraft list |
|
| 4696 | - * |
|
| 4697 | - */ |
|
| 4693 | + * Gets all aircraft types that have flown over by months |
|
| 4694 | + * |
|
| 4695 | + * @return Array the aircraft list |
|
| 4696 | + * |
|
| 4697 | + */ |
|
| 4698 | 4698 | public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 4699 | 4699 | { |
| 4700 | 4700 | global $globalDBdriver; |
@@ -4738,11 +4738,11 @@ discard block |
||
| 4738 | 4738 | |
| 4739 | 4739 | |
| 4740 | 4740 | /** |
| 4741 | - * Gets all aircraft registration that have flown over by aircaft icao |
|
| 4742 | - * |
|
| 4743 | - * @return Array the aircraft list |
|
| 4744 | - * |
|
| 4745 | - */ |
|
| 4741 | + * Gets all aircraft registration that have flown over by aircaft icao |
|
| 4742 | + * |
|
| 4743 | + * @return Array the aircraft list |
|
| 4744 | + * |
|
| 4745 | + */ |
|
| 4746 | 4746 | public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
| 4747 | 4747 | { |
| 4748 | 4748 | $Image = new Image($this->db); |
@@ -4781,11 +4781,11 @@ discard block |
||
| 4781 | 4781 | |
| 4782 | 4782 | |
| 4783 | 4783 | /** |
| 4784 | - * Gets all aircraft types that have flown over by airline icao |
|
| 4785 | - * |
|
| 4786 | - * @return Array the aircraft list |
|
| 4787 | - * |
|
| 4788 | - */ |
|
| 4784 | + * Gets all aircraft types that have flown over by airline icao |
|
| 4785 | + * |
|
| 4786 | + * @return Array the aircraft list |
|
| 4787 | + * |
|
| 4788 | + */ |
|
| 4789 | 4789 | public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
| 4790 | 4790 | { |
| 4791 | 4791 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4814,11 +4814,11 @@ discard block |
||
| 4814 | 4814 | |
| 4815 | 4815 | |
| 4816 | 4816 | /** |
| 4817 | - * Gets all aircraft registration that have flown over by airline icao |
|
| 4818 | - * |
|
| 4819 | - * @return Array the aircraft list |
|
| 4820 | - * |
|
| 4821 | - */ |
|
| 4817 | + * Gets all aircraft registration that have flown over by airline icao |
|
| 4818 | + * |
|
| 4819 | + * @return Array the aircraft list |
|
| 4820 | + * |
|
| 4821 | + */ |
|
| 4822 | 4822 | public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
| 4823 | 4823 | { |
| 4824 | 4824 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4856,11 +4856,11 @@ discard block |
||
| 4856 | 4856 | |
| 4857 | 4857 | |
| 4858 | 4858 | /** |
| 4859 | - * Gets all aircraft manufacturer that have flown over by airline icao |
|
| 4860 | - * |
|
| 4861 | - * @return Array the aircraft list |
|
| 4862 | - * |
|
| 4863 | - */ |
|
| 4859 | + * Gets all aircraft manufacturer that have flown over by airline icao |
|
| 4860 | + * |
|
| 4861 | + * @return Array the aircraft list |
|
| 4862 | + * |
|
| 4863 | + */ |
|
| 4864 | 4864 | public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
| 4865 | 4865 | { |
| 4866 | 4866 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4888,11 +4888,11 @@ discard block |
||
| 4888 | 4888 | |
| 4889 | 4889 | |
| 4890 | 4890 | /** |
| 4891 | - * Gets all aircraft types that have flown over by airline icao |
|
| 4892 | - * |
|
| 4893 | - * @return Array the aircraft list |
|
| 4894 | - * |
|
| 4895 | - */ |
|
| 4891 | + * Gets all aircraft types that have flown over by airline icao |
|
| 4892 | + * |
|
| 4893 | + * @return Array the aircraft list |
|
| 4894 | + * |
|
| 4895 | + */ |
|
| 4896 | 4896 | public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
| 4897 | 4897 | { |
| 4898 | 4898 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4921,11 +4921,11 @@ discard block |
||
| 4921 | 4921 | |
| 4922 | 4922 | |
| 4923 | 4923 | /** |
| 4924 | - * Gets all aircraft registration that have flown over by airport icao |
|
| 4925 | - * |
|
| 4926 | - * @return Array the aircraft list |
|
| 4927 | - * |
|
| 4928 | - */ |
|
| 4924 | + * Gets all aircraft registration that have flown over by airport icao |
|
| 4925 | + * |
|
| 4926 | + * @return Array the aircraft list |
|
| 4927 | + * |
|
| 4928 | + */ |
|
| 4929 | 4929 | public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
| 4930 | 4930 | { |
| 4931 | 4931 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4962,11 +4962,11 @@ discard block |
||
| 4962 | 4962 | |
| 4963 | 4963 | |
| 4964 | 4964 | /** |
| 4965 | - * Gets all aircraft manufacturer that have flown over by airport icao |
|
| 4966 | - * |
|
| 4967 | - * @return Array the aircraft list |
|
| 4968 | - * |
|
| 4969 | - */ |
|
| 4965 | + * Gets all aircraft manufacturer that have flown over by airport icao |
|
| 4966 | + * |
|
| 4967 | + * @return Array the aircraft list |
|
| 4968 | + * |
|
| 4969 | + */ |
|
| 4970 | 4970 | public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
| 4971 | 4971 | { |
| 4972 | 4972 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4992,11 +4992,11 @@ discard block |
||
| 4992 | 4992 | } |
| 4993 | 4993 | |
| 4994 | 4994 | /** |
| 4995 | - * Gets all aircraft types that have flown over by aircraft manufacturer |
|
| 4996 | - * |
|
| 4997 | - * @return Array the aircraft list |
|
| 4998 | - * |
|
| 4999 | - */ |
|
| 4995 | + * Gets all aircraft types that have flown over by aircraft manufacturer |
|
| 4996 | + * |
|
| 4997 | + * @return Array the aircraft list |
|
| 4998 | + * |
|
| 4999 | + */ |
|
| 5000 | 5000 | public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 5001 | 5001 | { |
| 5002 | 5002 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5023,11 +5023,11 @@ discard block |
||
| 5023 | 5023 | |
| 5024 | 5024 | |
| 5025 | 5025 | /** |
| 5026 | - * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
| 5027 | - * |
|
| 5028 | - * @return Array the aircraft list |
|
| 5029 | - * |
|
| 5030 | - */ |
|
| 5026 | + * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
| 5027 | + * |
|
| 5028 | + * @return Array the aircraft list |
|
| 5029 | + * |
|
| 5030 | + */ |
|
| 5031 | 5031 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
| 5032 | 5032 | { |
| 5033 | 5033 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5063,11 +5063,11 @@ discard block |
||
| 5063 | 5063 | } |
| 5064 | 5064 | |
| 5065 | 5065 | /** |
| 5066 | - * Gets all aircraft types that have flown over by date |
|
| 5067 | - * |
|
| 5068 | - * @return Array the aircraft list |
|
| 5069 | - * |
|
| 5070 | - */ |
|
| 5066 | + * Gets all aircraft types that have flown over by date |
|
| 5067 | + * |
|
| 5068 | + * @return Array the aircraft list |
|
| 5069 | + * |
|
| 5070 | + */ |
|
| 5071 | 5071 | public function countAllAircraftTypesByDate($date,$filters = array()) |
| 5072 | 5072 | { |
| 5073 | 5073 | global $globalTimezone, $globalDBdriver; |
@@ -5109,11 +5109,11 @@ discard block |
||
| 5109 | 5109 | |
| 5110 | 5110 | |
| 5111 | 5111 | /** |
| 5112 | - * Gets all aircraft registration that have flown over by date |
|
| 5113 | - * |
|
| 5114 | - * @return Array the aircraft list |
|
| 5115 | - * |
|
| 5116 | - */ |
|
| 5112 | + * Gets all aircraft registration that have flown over by date |
|
| 5113 | + * |
|
| 5114 | + * @return Array the aircraft list |
|
| 5115 | + * |
|
| 5116 | + */ |
|
| 5117 | 5117 | public function countAllAircraftRegistrationByDate($date,$filters = array()) |
| 5118 | 5118 | { |
| 5119 | 5119 | global $globalTimezone, $globalDBdriver; |
@@ -5164,11 +5164,11 @@ discard block |
||
| 5164 | 5164 | |
| 5165 | 5165 | |
| 5166 | 5166 | /** |
| 5167 | - * Gets all aircraft manufacturer that have flown over by date |
|
| 5168 | - * |
|
| 5169 | - * @return Array the aircraft manufacturer list |
|
| 5170 | - * |
|
| 5171 | - */ |
|
| 5167 | + * Gets all aircraft manufacturer that have flown over by date |
|
| 5168 | + * |
|
| 5169 | + * @return Array the aircraft manufacturer list |
|
| 5170 | + * |
|
| 5171 | + */ |
|
| 5172 | 5172 | public function countAllAircraftManufacturerByDate($date,$filters = array()) |
| 5173 | 5173 | { |
| 5174 | 5174 | global $globalTimezone, $globalDBdriver; |
@@ -5210,11 +5210,11 @@ discard block |
||
| 5210 | 5210 | |
| 5211 | 5211 | |
| 5212 | 5212 | /** |
| 5213 | - * Gets all aircraft types that have flown over by ident/callsign |
|
| 5214 | - * |
|
| 5215 | - * @return Array the aircraft list |
|
| 5216 | - * |
|
| 5217 | - */ |
|
| 5213 | + * Gets all aircraft types that have flown over by ident/callsign |
|
| 5214 | + * |
|
| 5215 | + * @return Array the aircraft list |
|
| 5216 | + * |
|
| 5217 | + */ |
|
| 5218 | 5218 | public function countAllAircraftTypesByIdent($ident,$filters = array()) |
| 5219 | 5219 | { |
| 5220 | 5220 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5243,11 +5243,11 @@ discard block |
||
| 5243 | 5243 | |
| 5244 | 5244 | |
| 5245 | 5245 | /** |
| 5246 | - * Gets all aircraft registration that have flown over by ident/callsign |
|
| 5247 | - * |
|
| 5248 | - * @return Array the aircraft list |
|
| 5249 | - * |
|
| 5250 | - */ |
|
| 5246 | + * Gets all aircraft registration that have flown over by ident/callsign |
|
| 5247 | + * |
|
| 5248 | + * @return Array the aircraft list |
|
| 5249 | + * |
|
| 5250 | + */ |
|
| 5251 | 5251 | public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
| 5252 | 5252 | { |
| 5253 | 5253 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5287,11 +5287,11 @@ discard block |
||
| 5287 | 5287 | |
| 5288 | 5288 | |
| 5289 | 5289 | /** |
| 5290 | - * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
| 5291 | - * |
|
| 5292 | - * @return Array the aircraft manufacturer list |
|
| 5293 | - * |
|
| 5294 | - */ |
|
| 5290 | + * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
| 5291 | + * |
|
| 5292 | + * @return Array the aircraft manufacturer list |
|
| 5293 | + * |
|
| 5294 | + */ |
|
| 5295 | 5295 | public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
| 5296 | 5296 | { |
| 5297 | 5297 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5317,11 +5317,11 @@ discard block |
||
| 5317 | 5317 | |
| 5318 | 5318 | |
| 5319 | 5319 | /** |
| 5320 | - * Gets all aircraft types that have flown over by route |
|
| 5321 | - * |
|
| 5322 | - * @return Array the aircraft list |
|
| 5323 | - * |
|
| 5324 | - */ |
|
| 5320 | + * Gets all aircraft types that have flown over by route |
|
| 5321 | + * |
|
| 5322 | + * @return Array the aircraft list |
|
| 5323 | + * |
|
| 5324 | + */ |
|
| 5325 | 5325 | public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 5326 | 5326 | { |
| 5327 | 5327 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5350,11 +5350,11 @@ discard block |
||
| 5350 | 5350 | } |
| 5351 | 5351 | |
| 5352 | 5352 | /** |
| 5353 | - * Gets all aircraft registration that have flown over by route |
|
| 5354 | - * |
|
| 5355 | - * @return Array the aircraft list |
|
| 5356 | - * |
|
| 5357 | - */ |
|
| 5353 | + * Gets all aircraft registration that have flown over by route |
|
| 5354 | + * |
|
| 5355 | + * @return Array the aircraft list |
|
| 5356 | + * |
|
| 5357 | + */ |
|
| 5358 | 5358 | public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 5359 | 5359 | { |
| 5360 | 5360 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5396,11 +5396,11 @@ discard block |
||
| 5396 | 5396 | |
| 5397 | 5397 | |
| 5398 | 5398 | /** |
| 5399 | - * Gets all aircraft manufacturer that have flown over by route |
|
| 5400 | - * |
|
| 5401 | - * @return Array the aircraft manufacturer list |
|
| 5402 | - * |
|
| 5403 | - */ |
|
| 5399 | + * Gets all aircraft manufacturer that have flown over by route |
|
| 5400 | + * |
|
| 5401 | + * @return Array the aircraft manufacturer list |
|
| 5402 | + * |
|
| 5403 | + */ |
|
| 5404 | 5404 | public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 5405 | 5405 | { |
| 5406 | 5406 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5434,11 +5434,11 @@ discard block |
||
| 5434 | 5434 | |
| 5435 | 5435 | |
| 5436 | 5436 | /** |
| 5437 | - * Gets all aircraft types that have flown over by country |
|
| 5438 | - * |
|
| 5439 | - * @return Array the aircraft list |
|
| 5440 | - * |
|
| 5441 | - */ |
|
| 5437 | + * Gets all aircraft types that have flown over by country |
|
| 5438 | + * |
|
| 5439 | + * @return Array the aircraft list |
|
| 5440 | + * |
|
| 5441 | + */ |
|
| 5442 | 5442 | public function countAllAircraftTypesByCountry($country,$filters = array()) |
| 5443 | 5443 | { |
| 5444 | 5444 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5469,11 +5469,11 @@ discard block |
||
| 5469 | 5469 | |
| 5470 | 5470 | |
| 5471 | 5471 | /** |
| 5472 | - * Gets all aircraft registration that have flown over by country |
|
| 5473 | - * |
|
| 5474 | - * @return Array the aircraft list |
|
| 5475 | - * |
|
| 5476 | - */ |
|
| 5472 | + * Gets all aircraft registration that have flown over by country |
|
| 5473 | + * |
|
| 5474 | + * @return Array the aircraft list |
|
| 5475 | + * |
|
| 5476 | + */ |
|
| 5477 | 5477 | public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
| 5478 | 5478 | { |
| 5479 | 5479 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5513,11 +5513,11 @@ discard block |
||
| 5513 | 5513 | |
| 5514 | 5514 | |
| 5515 | 5515 | /** |
| 5516 | - * Gets all aircraft manufacturer that have flown over by country |
|
| 5517 | - * |
|
| 5518 | - * @return Array the aircraft manufacturer list |
|
| 5519 | - * |
|
| 5520 | - */ |
|
| 5516 | + * Gets all aircraft manufacturer that have flown over by country |
|
| 5517 | + * |
|
| 5518 | + * @return Array the aircraft manufacturer list |
|
| 5519 | + * |
|
| 5520 | + */ |
|
| 5521 | 5521 | public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
| 5522 | 5522 | { |
| 5523 | 5523 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5548,17 +5548,17 @@ discard block |
||
| 5548 | 5548 | |
| 5549 | 5549 | |
| 5550 | 5550 | /** |
| 5551 | - * Gets all aircraft manufacturers that have flown over |
|
| 5552 | - * |
|
| 5553 | - * @return Array the aircraft list |
|
| 5554 | - * |
|
| 5555 | - */ |
|
| 5551 | + * Gets all aircraft manufacturers that have flown over |
|
| 5552 | + * |
|
| 5553 | + * @return Array the aircraft list |
|
| 5554 | + * |
|
| 5555 | + */ |
|
| 5556 | 5556 | public function countAllAircraftManufacturers($filters = array()) |
| 5557 | 5557 | { |
| 5558 | 5558 | $filter_query = $this->getFilter($filters,true,true); |
| 5559 | 5559 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
| 5560 | 5560 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
| 5561 | - $query .= " GROUP BY spotter_output.aircraft_manufacturer |
|
| 5561 | + $query .= " GROUP BY spotter_output.aircraft_manufacturer |
|
| 5562 | 5562 | ORDER BY aircraft_manufacturer_count DESC |
| 5563 | 5563 | LIMIT 10"; |
| 5564 | 5564 | |
@@ -5583,11 +5583,11 @@ discard block |
||
| 5583 | 5583 | |
| 5584 | 5584 | |
| 5585 | 5585 | /** |
| 5586 | - * Gets all aircraft registrations that have flown over |
|
| 5587 | - * |
|
| 5588 | - * @return Array the aircraft list |
|
| 5589 | - * |
|
| 5590 | - */ |
|
| 5586 | + * Gets all aircraft registrations that have flown over |
|
| 5587 | + * |
|
| 5588 | + * @return Array the aircraft list |
|
| 5589 | + * |
|
| 5590 | + */ |
|
| 5591 | 5591 | public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 5592 | 5592 | { |
| 5593 | 5593 | global $globalDBdriver; |
@@ -5595,15 +5595,15 @@ discard block |
||
| 5595 | 5595 | $filter_query = $this->getFilter($filters,true,true); |
| 5596 | 5596 | $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 |
| 5597 | 5597 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
| 5598 | - if ($olderthanmonths > 0) { |
|
| 5599 | - if ($globalDBdriver == 'mysql') { |
|
| 5598 | + if ($olderthanmonths > 0) { |
|
| 5599 | + if ($globalDBdriver == 'mysql') { |
|
| 5600 | 5600 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 5601 | 5601 | } else { |
| 5602 | 5602 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 5603 | 5603 | } |
| 5604 | 5604 | } |
| 5605 | - if ($sincedate != '') { |
|
| 5606 | - if ($globalDBdriver == 'mysql') { |
|
| 5605 | + if ($sincedate != '') { |
|
| 5606 | + if ($globalDBdriver == 'mysql') { |
|
| 5607 | 5607 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 5608 | 5608 | } else { |
| 5609 | 5609 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5612,7 +5612,7 @@ discard block |
||
| 5612 | 5612 | |
| 5613 | 5613 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5614 | 5614 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5615 | - $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 5615 | + $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 5616 | 5616 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5617 | 5617 | |
| 5618 | 5618 | $sth = $this->db->prepare($query); |
@@ -5643,11 +5643,11 @@ discard block |
||
| 5643 | 5643 | |
| 5644 | 5644 | |
| 5645 | 5645 | /** |
| 5646 | - * Gets all aircraft registrations that have flown over |
|
| 5647 | - * |
|
| 5648 | - * @return Array the aircraft list |
|
| 5649 | - * |
|
| 5650 | - */ |
|
| 5646 | + * Gets all aircraft registrations that have flown over |
|
| 5647 | + * |
|
| 5648 | + * @return Array the aircraft list |
|
| 5649 | + * |
|
| 5650 | + */ |
|
| 5651 | 5651 | public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 5652 | 5652 | { |
| 5653 | 5653 | global $globalDBdriver; |
@@ -5655,15 +5655,15 @@ discard block |
||
| 5655 | 5655 | $Image = new Image($this->db); |
| 5656 | 5656 | $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 |
| 5657 | 5657 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
| 5658 | - if ($olderthanmonths > 0) { |
|
| 5659 | - if ($globalDBdriver == 'mysql') { |
|
| 5658 | + if ($olderthanmonths > 0) { |
|
| 5659 | + if ($globalDBdriver == 'mysql') { |
|
| 5660 | 5660 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5661 | 5661 | } else { |
| 5662 | 5662 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 5663 | 5663 | } |
| 5664 | 5664 | } |
| 5665 | - if ($sincedate != '') { |
|
| 5666 | - if ($globalDBdriver == 'mysql') { |
|
| 5665 | + if ($sincedate != '') { |
|
| 5666 | + if ($globalDBdriver == 'mysql') { |
|
| 5667 | 5667 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 5668 | 5668 | } else { |
| 5669 | 5669 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5672,7 +5672,7 @@ discard block |
||
| 5672 | 5672 | |
| 5673 | 5673 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5674 | 5674 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 5675 | - $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"; |
|
| 5675 | + $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"; |
|
| 5676 | 5676 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5677 | 5677 | |
| 5678 | 5678 | $sth = $this->db->prepare($query); |
@@ -5704,35 +5704,35 @@ discard block |
||
| 5704 | 5704 | |
| 5705 | 5705 | |
| 5706 | 5706 | /** |
| 5707 | - * Gets all departure airports of the airplanes that have flown over |
|
| 5708 | - * |
|
| 5709 | - * @return Array the airport list |
|
| 5710 | - * |
|
| 5711 | - */ |
|
| 5707 | + * Gets all departure airports of the airplanes that have flown over |
|
| 5708 | + * |
|
| 5709 | + * @return Array the airport list |
|
| 5710 | + * |
|
| 5711 | + */ |
|
| 5712 | 5712 | public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 5713 | 5713 | { |
| 5714 | 5714 | global $globalDBdriver; |
| 5715 | 5715 | $filter_query = $this->getFilter($filters,true,true); |
| 5716 | 5716 | $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 |
| 5717 | 5717 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
| 5718 | - if ($olderthanmonths > 0) { |
|
| 5719 | - if ($globalDBdriver == 'mysql') { |
|
| 5718 | + if ($olderthanmonths > 0) { |
|
| 5719 | + if ($globalDBdriver == 'mysql') { |
|
| 5720 | 5720 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 5721 | 5721 | } else { |
| 5722 | 5722 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 5723 | 5723 | } |
| 5724 | - } |
|
| 5725 | - if ($sincedate != '') { |
|
| 5726 | - if ($globalDBdriver == 'mysql') { |
|
| 5724 | + } |
|
| 5725 | + if ($sincedate != '') { |
|
| 5726 | + if ($globalDBdriver == 'mysql') { |
|
| 5727 | 5727 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 5728 | 5728 | } else { |
| 5729 | 5729 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 5730 | 5730 | } |
| 5731 | 5731 | } |
| 5732 | 5732 | |
| 5733 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5734 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5735 | - $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5733 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5734 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5735 | + $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5736 | 5736 | ORDER BY airport_departure_icao_count DESC"; |
| 5737 | 5737 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5738 | 5738 | |
@@ -5756,35 +5756,35 @@ discard block |
||
| 5756 | 5756 | } |
| 5757 | 5757 | |
| 5758 | 5758 | /** |
| 5759 | - * Gets all departure airports of the airplanes that have flown over |
|
| 5760 | - * |
|
| 5761 | - * @return Array the airport list |
|
| 5762 | - * |
|
| 5763 | - */ |
|
| 5759 | + * Gets all departure airports of the airplanes that have flown over |
|
| 5760 | + * |
|
| 5761 | + * @return Array the airport list |
|
| 5762 | + * |
|
| 5763 | + */ |
|
| 5764 | 5764 | public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 5765 | 5765 | { |
| 5766 | 5766 | global $globalDBdriver; |
| 5767 | 5767 | $filter_query = $this->getFilter($filters,true,true); |
| 5768 | 5768 | $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 |
| 5769 | 5769 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' "; |
| 5770 | - if ($olderthanmonths > 0) { |
|
| 5771 | - if ($globalDBdriver == 'mysql') { |
|
| 5770 | + if ($olderthanmonths > 0) { |
|
| 5771 | + if ($globalDBdriver == 'mysql') { |
|
| 5772 | 5772 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5773 | 5773 | } else { |
| 5774 | 5774 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 5775 | 5775 | } |
| 5776 | - } |
|
| 5777 | - if ($sincedate != '') { |
|
| 5778 | - if ($globalDBdriver == 'mysql') { |
|
| 5776 | + } |
|
| 5777 | + if ($sincedate != '') { |
|
| 5778 | + if ($globalDBdriver == 'mysql') { |
|
| 5779 | 5779 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 5780 | 5780 | } else { |
| 5781 | 5781 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 5782 | 5782 | } |
| 5783 | 5783 | } |
| 5784 | 5784 | |
| 5785 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5786 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5787 | - $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 |
|
| 5785 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5786 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5787 | + $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 |
|
| 5788 | 5788 | ORDER BY airport_departure_icao_count DESC"; |
| 5789 | 5789 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5790 | 5790 | |
@@ -5809,37 +5809,37 @@ discard block |
||
| 5809 | 5809 | } |
| 5810 | 5810 | |
| 5811 | 5811 | /** |
| 5812 | - * Gets all detected departure airports of the airplanes that have flown over |
|
| 5813 | - * |
|
| 5814 | - * @return Array the airport list |
|
| 5815 | - * |
|
| 5816 | - */ |
|
| 5812 | + * Gets all detected departure airports of the airplanes that have flown over |
|
| 5813 | + * |
|
| 5814 | + * @return Array the airport list |
|
| 5815 | + * |
|
| 5816 | + */ |
|
| 5817 | 5817 | public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 5818 | 5818 | { |
| 5819 | 5819 | global $globalDBdriver; |
| 5820 | 5820 | $filter_query = $this->getFilter($filters,true,true); |
| 5821 | 5821 | $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 |
| 5822 | 5822 | 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"; |
| 5823 | - if ($olderthanmonths > 0) { |
|
| 5824 | - if ($globalDBdriver == 'mysql') { |
|
| 5823 | + if ($olderthanmonths > 0) { |
|
| 5824 | + if ($globalDBdriver == 'mysql') { |
|
| 5825 | 5825 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 5826 | 5826 | } else { |
| 5827 | 5827 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 5828 | 5828 | } |
| 5829 | - } |
|
| 5830 | - if ($sincedate != '') { |
|
| 5831 | - if ($globalDBdriver == 'mysql') { |
|
| 5829 | + } |
|
| 5830 | + if ($sincedate != '') { |
|
| 5831 | + if ($globalDBdriver == 'mysql') { |
|
| 5832 | 5832 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 5833 | 5833 | } else { |
| 5834 | 5834 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 5835 | 5835 | } |
| 5836 | 5836 | } |
| 5837 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5838 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5839 | - $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 5837 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5838 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5839 | + $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 5840 | 5840 | ORDER BY airport_departure_icao_count DESC"; |
| 5841 | 5841 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5842 | - //echo $query; |
|
| 5842 | + //echo $query; |
|
| 5843 | 5843 | $sth = $this->db->prepare($query); |
| 5844 | 5844 | $sth->execute(); |
| 5845 | 5845 | |
@@ -5860,35 +5860,35 @@ discard block |
||
| 5860 | 5860 | } |
| 5861 | 5861 | |
| 5862 | 5862 | /** |
| 5863 | - * Gets all detected departure airports of the airplanes that have flown over |
|
| 5864 | - * |
|
| 5865 | - * @return Array the airport list |
|
| 5866 | - * |
|
| 5867 | - */ |
|
| 5863 | + * Gets all detected departure airports of the airplanes that have flown over |
|
| 5864 | + * |
|
| 5865 | + * @return Array the airport list |
|
| 5866 | + * |
|
| 5867 | + */ |
|
| 5868 | 5868 | public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 5869 | 5869 | { |
| 5870 | 5870 | global $globalDBdriver; |
| 5871 | 5871 | $filter_query = $this->getFilter($filters,true,true); |
| 5872 | 5872 | $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 |
| 5873 | 5873 | 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 "; |
| 5874 | - if ($olderthanmonths > 0) { |
|
| 5875 | - if ($globalDBdriver == 'mysql') { |
|
| 5874 | + if ($olderthanmonths > 0) { |
|
| 5875 | + if ($globalDBdriver == 'mysql') { |
|
| 5876 | 5876 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5877 | 5877 | } else { |
| 5878 | 5878 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 5879 | 5879 | } |
| 5880 | - } |
|
| 5881 | - if ($sincedate != '') { |
|
| 5882 | - if ($globalDBdriver == 'mysql') { |
|
| 5880 | + } |
|
| 5881 | + if ($sincedate != '') { |
|
| 5882 | + if ($globalDBdriver == 'mysql') { |
|
| 5883 | 5883 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 5884 | 5884 | } else { |
| 5885 | 5885 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
| 5886 | 5886 | } |
| 5887 | 5887 | } |
| 5888 | 5888 | |
| 5889 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5890 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5891 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 5889 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 5890 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 5891 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 5892 | 5892 | ORDER BY airport_departure_icao_count DESC"; |
| 5893 | 5893 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 5894 | 5894 | |
@@ -5913,11 +5913,11 @@ discard block |
||
| 5913 | 5913 | } |
| 5914 | 5914 | |
| 5915 | 5915 | /** |
| 5916 | - * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
| 5917 | - * |
|
| 5918 | - * @return Array the airport list |
|
| 5919 | - * |
|
| 5920 | - */ |
|
| 5916 | + * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
| 5917 | + * |
|
| 5918 | + * @return Array the airport list |
|
| 5919 | + * |
|
| 5920 | + */ |
|
| 5921 | 5921 | public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
| 5922 | 5922 | { |
| 5923 | 5923 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5951,11 +5951,11 @@ discard block |
||
| 5951 | 5951 | |
| 5952 | 5952 | |
| 5953 | 5953 | /** |
| 5954 | - * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
| 5955 | - * |
|
| 5956 | - * @return Array the airport list |
|
| 5957 | - * |
|
| 5958 | - */ |
|
| 5954 | + * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
| 5955 | + * |
|
| 5956 | + * @return Array the airport list |
|
| 5957 | + * |
|
| 5958 | + */ |
|
| 5959 | 5959 | public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
| 5960 | 5960 | { |
| 5961 | 5961 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5986,11 +5986,11 @@ discard block |
||
| 5986 | 5986 | |
| 5987 | 5987 | |
| 5988 | 5988 | /** |
| 5989 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
| 5990 | - * |
|
| 5991 | - * @return Array the airport list |
|
| 5992 | - * |
|
| 5993 | - */ |
|
| 5989 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
| 5990 | + * |
|
| 5991 | + * @return Array the airport list |
|
| 5992 | + * |
|
| 5993 | + */ |
|
| 5994 | 5994 | public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
| 5995 | 5995 | { |
| 5996 | 5996 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6023,11 +6023,11 @@ discard block |
||
| 6023 | 6023 | |
| 6024 | 6024 | |
| 6025 | 6025 | /** |
| 6026 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6027 | - * |
|
| 6028 | - * @return Array the airport list |
|
| 6029 | - * |
|
| 6030 | - */ |
|
| 6026 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6027 | + * |
|
| 6028 | + * @return Array the airport list |
|
| 6029 | + * |
|
| 6030 | + */ |
|
| 6031 | 6031 | public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
| 6032 | 6032 | { |
| 6033 | 6033 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6057,11 +6057,11 @@ discard block |
||
| 6057 | 6057 | |
| 6058 | 6058 | |
| 6059 | 6059 | /** |
| 6060 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
| 6061 | - * |
|
| 6062 | - * @return Array the airport list |
|
| 6063 | - * |
|
| 6064 | - */ |
|
| 6060 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
| 6061 | + * |
|
| 6062 | + * @return Array the airport list |
|
| 6063 | + * |
|
| 6064 | + */ |
|
| 6065 | 6065 | public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
| 6066 | 6066 | { |
| 6067 | 6067 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6094,11 +6094,11 @@ discard block |
||
| 6094 | 6094 | |
| 6095 | 6095 | |
| 6096 | 6096 | /** |
| 6097 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 6098 | - * |
|
| 6099 | - * @return Array the airport list |
|
| 6100 | - * |
|
| 6101 | - */ |
|
| 6097 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 6098 | + * |
|
| 6099 | + * @return Array the airport list |
|
| 6100 | + * |
|
| 6101 | + */ |
|
| 6102 | 6102 | public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
| 6103 | 6103 | { |
| 6104 | 6104 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6128,11 +6128,11 @@ discard block |
||
| 6128 | 6128 | |
| 6129 | 6129 | |
| 6130 | 6130 | /** |
| 6131 | - * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
| 6132 | - * |
|
| 6133 | - * @return Array the airport list |
|
| 6134 | - * |
|
| 6135 | - */ |
|
| 6131 | + * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
| 6132 | + * |
|
| 6133 | + * @return Array the airport list |
|
| 6134 | + * |
|
| 6135 | + */ |
|
| 6136 | 6136 | public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
| 6137 | 6137 | { |
| 6138 | 6138 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6165,11 +6165,11 @@ discard block |
||
| 6165 | 6165 | |
| 6166 | 6166 | |
| 6167 | 6167 | /** |
| 6168 | - * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
| 6169 | - * |
|
| 6170 | - * @return Array the airport list |
|
| 6171 | - * |
|
| 6172 | - */ |
|
| 6168 | + * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
| 6169 | + * |
|
| 6170 | + * @return Array the airport list |
|
| 6171 | + * |
|
| 6172 | + */ |
|
| 6173 | 6173 | public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
| 6174 | 6174 | { |
| 6175 | 6175 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6200,11 +6200,11 @@ discard block |
||
| 6200 | 6200 | |
| 6201 | 6201 | |
| 6202 | 6202 | /** |
| 6203 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
| 6204 | - * |
|
| 6205 | - * @return Array the airport list |
|
| 6206 | - * |
|
| 6207 | - */ |
|
| 6203 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
| 6204 | + * |
|
| 6205 | + * @return Array the airport list |
|
| 6206 | + * |
|
| 6207 | + */ |
|
| 6208 | 6208 | public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
| 6209 | 6209 | { |
| 6210 | 6210 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6237,11 +6237,11 @@ discard block |
||
| 6237 | 6237 | |
| 6238 | 6238 | |
| 6239 | 6239 | /** |
| 6240 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
| 6241 | - * |
|
| 6242 | - * @return Array the airport list |
|
| 6243 | - * |
|
| 6244 | - */ |
|
| 6240 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
| 6241 | + * |
|
| 6242 | + * @return Array the airport list |
|
| 6243 | + * |
|
| 6244 | + */ |
|
| 6245 | 6245 | public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 6246 | 6246 | { |
| 6247 | 6247 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6271,11 +6271,11 @@ discard block |
||
| 6271 | 6271 | |
| 6272 | 6272 | |
| 6273 | 6273 | /** |
| 6274 | - * Gets all departure airports of the airplanes that have flown over based on a date |
|
| 6275 | - * |
|
| 6276 | - * @return Array the airport list |
|
| 6277 | - * |
|
| 6278 | - */ |
|
| 6274 | + * Gets all departure airports of the airplanes that have flown over based on a date |
|
| 6275 | + * |
|
| 6276 | + * @return Array the airport list |
|
| 6277 | + * |
|
| 6278 | + */ |
|
| 6279 | 6279 | public function countAllDepartureAirportsByDate($date,$filters = array()) |
| 6280 | 6280 | { |
| 6281 | 6281 | global $globalTimezone, $globalDBdriver; |
@@ -6321,11 +6321,11 @@ discard block |
||
| 6321 | 6321 | |
| 6322 | 6322 | |
| 6323 | 6323 | /** |
| 6324 | - * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
| 6325 | - * |
|
| 6326 | - * @return Array the airport list |
|
| 6327 | - * |
|
| 6328 | - */ |
|
| 6324 | + * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
| 6325 | + * |
|
| 6326 | + * @return Array the airport list |
|
| 6327 | + * |
|
| 6328 | + */ |
|
| 6329 | 6329 | public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
| 6330 | 6330 | { |
| 6331 | 6331 | global $globalTimezone, $globalDBdriver; |
@@ -6368,11 +6368,11 @@ discard block |
||
| 6368 | 6368 | |
| 6369 | 6369 | |
| 6370 | 6370 | /** |
| 6371 | - * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
| 6372 | - * |
|
| 6373 | - * @return Array the airport list |
|
| 6374 | - * |
|
| 6375 | - */ |
|
| 6371 | + * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
| 6372 | + * |
|
| 6373 | + * @return Array the airport list |
|
| 6374 | + * |
|
| 6375 | + */ |
|
| 6376 | 6376 | public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
| 6377 | 6377 | { |
| 6378 | 6378 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6406,11 +6406,11 @@ discard block |
||
| 6406 | 6406 | |
| 6407 | 6407 | |
| 6408 | 6408 | /** |
| 6409 | - * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 6410 | - * |
|
| 6411 | - * @return Array the airport list |
|
| 6412 | - * |
|
| 6413 | - */ |
|
| 6409 | + * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 6410 | + * |
|
| 6411 | + * @return Array the airport list |
|
| 6412 | + * |
|
| 6413 | + */ |
|
| 6414 | 6414 | public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
| 6415 | 6415 | { |
| 6416 | 6416 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6441,11 +6441,11 @@ discard block |
||
| 6441 | 6441 | |
| 6442 | 6442 | |
| 6443 | 6443 | /** |
| 6444 | - * Gets all departure airports of the airplanes that have flown over based on a country |
|
| 6445 | - * |
|
| 6446 | - * @return Array the airport list |
|
| 6447 | - * |
|
| 6448 | - */ |
|
| 6444 | + * Gets all departure airports of the airplanes that have flown over based on a country |
|
| 6445 | + * |
|
| 6446 | + * @return Array the airport list |
|
| 6447 | + * |
|
| 6448 | + */ |
|
| 6449 | 6449 | public function countAllDepartureAirportsByCountry($country,$filters = array()) |
| 6450 | 6450 | { |
| 6451 | 6451 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6479,11 +6479,11 @@ discard block |
||
| 6479 | 6479 | |
| 6480 | 6480 | |
| 6481 | 6481 | /** |
| 6482 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6483 | - * |
|
| 6484 | - * @return Array the airport list |
|
| 6485 | - * |
|
| 6486 | - */ |
|
| 6482 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6483 | + * |
|
| 6484 | + * @return Array the airport list |
|
| 6485 | + * |
|
| 6486 | + */ |
|
| 6487 | 6487 | public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
| 6488 | 6488 | { |
| 6489 | 6489 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6513,40 +6513,40 @@ discard block |
||
| 6513 | 6513 | |
| 6514 | 6514 | |
| 6515 | 6515 | /** |
| 6516 | - * Gets all arrival airports of the airplanes that have flown over |
|
| 6517 | - * |
|
| 6518 | - * @param Boolean $limit Limit result to 10 or not |
|
| 6519 | - * @param Integer $olderthanmonths Only show result older than x months |
|
| 6520 | - * @param String $sincedate Only show result since x date |
|
| 6521 | - * @param Boolean $icaoaskey Show result by ICAO |
|
| 6522 | - * @param Array $filters Filter used here |
|
| 6523 | - * @return Array the airport list |
|
| 6524 | - * |
|
| 6525 | - */ |
|
| 6516 | + * Gets all arrival airports of the airplanes that have flown over |
|
| 6517 | + * |
|
| 6518 | + * @param Boolean $limit Limit result to 10 or not |
|
| 6519 | + * @param Integer $olderthanmonths Only show result older than x months |
|
| 6520 | + * @param String $sincedate Only show result since x date |
|
| 6521 | + * @param Boolean $icaoaskey Show result by ICAO |
|
| 6522 | + * @param Array $filters Filter used here |
|
| 6523 | + * @return Array the airport list |
|
| 6524 | + * |
|
| 6525 | + */ |
|
| 6526 | 6526 | public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
| 6527 | 6527 | { |
| 6528 | 6528 | global $globalDBdriver; |
| 6529 | 6529 | $filter_query = $this->getFilter($filters,true,true); |
| 6530 | 6530 | $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 |
| 6531 | 6531 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
| 6532 | - if ($olderthanmonths > 0) { |
|
| 6533 | - if ($globalDBdriver == 'mysql') { |
|
| 6532 | + if ($olderthanmonths > 0) { |
|
| 6533 | + if ($globalDBdriver == 'mysql') { |
|
| 6534 | 6534 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6535 | 6535 | } else { |
| 6536 | 6536 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6537 | 6537 | } |
| 6538 | 6538 | } |
| 6539 | - if ($sincedate != '') { |
|
| 6540 | - if ($globalDBdriver == 'mysql') { |
|
| 6539 | + if ($sincedate != '') { |
|
| 6540 | + if ($globalDBdriver == 'mysql') { |
|
| 6541 | 6541 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6542 | 6542 | } else { |
| 6543 | 6543 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6544 | 6544 | } |
| 6545 | 6545 | } |
| 6546 | 6546 | |
| 6547 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6548 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6549 | - $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6547 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6548 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6549 | + $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6550 | 6550 | ORDER BY airport_arrival_icao_count DESC"; |
| 6551 | 6551 | if ($limit) $query .= " LIMIT 10"; |
| 6552 | 6552 | |
@@ -6575,35 +6575,35 @@ discard block |
||
| 6575 | 6575 | } |
| 6576 | 6576 | |
| 6577 | 6577 | /** |
| 6578 | - * Gets all arrival airports of the airplanes that have flown over |
|
| 6579 | - * |
|
| 6580 | - * @return Array the airport list |
|
| 6581 | - * |
|
| 6582 | - */ |
|
| 6578 | + * Gets all arrival airports of the airplanes that have flown over |
|
| 6579 | + * |
|
| 6580 | + * @return Array the airport list |
|
| 6581 | + * |
|
| 6582 | + */ |
|
| 6583 | 6583 | public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
| 6584 | 6584 | { |
| 6585 | 6585 | global $globalDBdriver; |
| 6586 | 6586 | $filter_query = $this->getFilter($filters,true,true); |
| 6587 | 6587 | $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 |
| 6588 | 6588 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' "; |
| 6589 | - if ($olderthanmonths > 0) { |
|
| 6590 | - if ($globalDBdriver == 'mysql') { |
|
| 6589 | + if ($olderthanmonths > 0) { |
|
| 6590 | + if ($globalDBdriver == 'mysql') { |
|
| 6591 | 6591 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6592 | 6592 | } else { |
| 6593 | 6593 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6594 | 6594 | } |
| 6595 | 6595 | } |
| 6596 | - if ($sincedate != '') { |
|
| 6597 | - if ($globalDBdriver == 'mysql') { |
|
| 6596 | + if ($sincedate != '') { |
|
| 6597 | + if ($globalDBdriver == 'mysql') { |
|
| 6598 | 6598 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6599 | 6599 | } else { |
| 6600 | 6600 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6601 | 6601 | } |
| 6602 | 6602 | } |
| 6603 | 6603 | |
| 6604 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6605 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6606 | - $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 |
|
| 6604 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6605 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6606 | + $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 |
|
| 6607 | 6607 | ORDER BY airport_arrival_icao_count DESC"; |
| 6608 | 6608 | if ($limit) $query .= " LIMIT 10"; |
| 6609 | 6609 | |
@@ -6634,34 +6634,34 @@ discard block |
||
| 6634 | 6634 | |
| 6635 | 6635 | |
| 6636 | 6636 | /** |
| 6637 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
| 6638 | - * |
|
| 6639 | - * @return Array the airport list |
|
| 6640 | - * |
|
| 6641 | - */ |
|
| 6637 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
| 6638 | + * |
|
| 6639 | + * @return Array the airport list |
|
| 6640 | + * |
|
| 6641 | + */ |
|
| 6642 | 6642 | public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
| 6643 | 6643 | { |
| 6644 | 6644 | global $globalDBdriver; |
| 6645 | 6645 | $filter_query = $this->getFilter($filters,true,true); |
| 6646 | 6646 | $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 |
| 6647 | 6647 | 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"; |
| 6648 | - if ($olderthanmonths > 0) { |
|
| 6649 | - if ($globalDBdriver == 'mysql') { |
|
| 6648 | + if ($olderthanmonths > 0) { |
|
| 6649 | + if ($globalDBdriver == 'mysql') { |
|
| 6650 | 6650 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6651 | 6651 | } else { |
| 6652 | 6652 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6653 | 6653 | } |
| 6654 | 6654 | } |
| 6655 | - if ($sincedate != '') { |
|
| 6656 | - if ($globalDBdriver == 'mysql') { |
|
| 6655 | + if ($sincedate != '') { |
|
| 6656 | + if ($globalDBdriver == 'mysql') { |
|
| 6657 | 6657 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6658 | 6658 | } else { |
| 6659 | 6659 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6660 | 6660 | } |
| 6661 | 6661 | } |
| 6662 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6663 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6664 | - $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 6662 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6663 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6664 | + $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 6665 | 6665 | ORDER BY airport_arrival_icao_count DESC"; |
| 6666 | 6666 | if ($limit) $query .= " LIMIT 10"; |
| 6667 | 6667 | |
@@ -6690,35 +6690,35 @@ discard block |
||
| 6690 | 6690 | } |
| 6691 | 6691 | |
| 6692 | 6692 | /** |
| 6693 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
| 6694 | - * |
|
| 6695 | - * @return Array the airport list |
|
| 6696 | - * |
|
| 6697 | - */ |
|
| 6693 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
| 6694 | + * |
|
| 6695 | + * @return Array the airport list |
|
| 6696 | + * |
|
| 6697 | + */ |
|
| 6698 | 6698 | public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
| 6699 | 6699 | { |
| 6700 | 6700 | global $globalDBdriver; |
| 6701 | 6701 | $filter_query = $this->getFilter($filters,true,true); |
| 6702 | 6702 | $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 |
| 6703 | 6703 | 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 "; |
| 6704 | - if ($olderthanmonths > 0) { |
|
| 6705 | - if ($globalDBdriver == 'mysql') { |
|
| 6704 | + if ($olderthanmonths > 0) { |
|
| 6705 | + if ($globalDBdriver == 'mysql') { |
|
| 6706 | 6706 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6707 | 6707 | } else { |
| 6708 | 6708 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6709 | 6709 | } |
| 6710 | 6710 | } |
| 6711 | - if ($sincedate != '') { |
|
| 6712 | - if ($globalDBdriver == 'mysql') { |
|
| 6711 | + if ($sincedate != '') { |
|
| 6712 | + if ($globalDBdriver == 'mysql') { |
|
| 6713 | 6713 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6714 | 6714 | } else { |
| 6715 | 6715 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6716 | 6716 | } |
| 6717 | 6717 | } |
| 6718 | 6718 | |
| 6719 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6720 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6721 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 6719 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6720 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6721 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 6722 | 6722 | ORDER BY airport_arrival_icao_count DESC"; |
| 6723 | 6723 | if ($limit) $query .= " LIMIT 10"; |
| 6724 | 6724 | |
@@ -6748,11 +6748,11 @@ discard block |
||
| 6748 | 6748 | } |
| 6749 | 6749 | |
| 6750 | 6750 | /** |
| 6751 | - * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
| 6752 | - * |
|
| 6753 | - * @return Array the airport list |
|
| 6754 | - * |
|
| 6755 | - */ |
|
| 6751 | + * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
| 6752 | + * |
|
| 6753 | + * @return Array the airport list |
|
| 6754 | + * |
|
| 6755 | + */ |
|
| 6756 | 6756 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
| 6757 | 6757 | { |
| 6758 | 6758 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6784,11 +6784,11 @@ discard block |
||
| 6784 | 6784 | |
| 6785 | 6785 | |
| 6786 | 6786 | /** |
| 6787 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
| 6788 | - * |
|
| 6789 | - * @return Array the airport list |
|
| 6790 | - * |
|
| 6791 | - */ |
|
| 6787 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
| 6788 | + * |
|
| 6789 | + * @return Array the airport list |
|
| 6790 | + * |
|
| 6791 | + */ |
|
| 6792 | 6792 | public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
| 6793 | 6793 | { |
| 6794 | 6794 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6819,11 +6819,11 @@ discard block |
||
| 6819 | 6819 | |
| 6820 | 6820 | |
| 6821 | 6821 | /** |
| 6822 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
| 6823 | - * |
|
| 6824 | - * @return Array the airport list |
|
| 6825 | - * |
|
| 6826 | - */ |
|
| 6822 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
| 6823 | + * |
|
| 6824 | + * @return Array the airport list |
|
| 6825 | + * |
|
| 6826 | + */ |
|
| 6827 | 6827 | public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
| 6828 | 6828 | { |
| 6829 | 6829 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6857,11 +6857,11 @@ discard block |
||
| 6857 | 6857 | |
| 6858 | 6858 | |
| 6859 | 6859 | /** |
| 6860 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6861 | - * |
|
| 6862 | - * @return Array the airport list |
|
| 6863 | - * |
|
| 6864 | - */ |
|
| 6860 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6861 | + * |
|
| 6862 | + * @return Array the airport list |
|
| 6863 | + * |
|
| 6864 | + */ |
|
| 6865 | 6865 | public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
| 6866 | 6866 | { |
| 6867 | 6867 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6891,11 +6891,11 @@ discard block |
||
| 6891 | 6891 | |
| 6892 | 6892 | |
| 6893 | 6893 | /** |
| 6894 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
| 6895 | - * |
|
| 6896 | - * @return Array the airport list |
|
| 6897 | - * |
|
| 6898 | - */ |
|
| 6894 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
| 6895 | + * |
|
| 6896 | + * @return Array the airport list |
|
| 6897 | + * |
|
| 6898 | + */ |
|
| 6899 | 6899 | public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
| 6900 | 6900 | { |
| 6901 | 6901 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6929,11 +6929,11 @@ discard block |
||
| 6929 | 6929 | |
| 6930 | 6930 | |
| 6931 | 6931 | /** |
| 6932 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 6933 | - * |
|
| 6934 | - * @return Array the airport list |
|
| 6935 | - * |
|
| 6936 | - */ |
|
| 6932 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 6933 | + * |
|
| 6934 | + * @return Array the airport list |
|
| 6935 | + * |
|
| 6936 | + */ |
|
| 6937 | 6937 | public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
| 6938 | 6938 | { |
| 6939 | 6939 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6964,11 +6964,11 @@ discard block |
||
| 6964 | 6964 | |
| 6965 | 6965 | |
| 6966 | 6966 | /** |
| 6967 | - * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
| 6968 | - * |
|
| 6969 | - * @return Array the airport list |
|
| 6970 | - * |
|
| 6971 | - */ |
|
| 6967 | + * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
| 6968 | + * |
|
| 6969 | + * @return Array the airport list |
|
| 6970 | + * |
|
| 6971 | + */ |
|
| 6972 | 6972 | public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
| 6973 | 6973 | { |
| 6974 | 6974 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7001,11 +7001,11 @@ discard block |
||
| 7001 | 7001 | |
| 7002 | 7002 | |
| 7003 | 7003 | /** |
| 7004 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
| 7005 | - * |
|
| 7006 | - * @return Array the airport list |
|
| 7007 | - * |
|
| 7008 | - */ |
|
| 7004 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
| 7005 | + * |
|
| 7006 | + * @return Array the airport list |
|
| 7007 | + * |
|
| 7008 | + */ |
|
| 7009 | 7009 | public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
| 7010 | 7010 | { |
| 7011 | 7011 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7035,11 +7035,11 @@ discard block |
||
| 7035 | 7035 | |
| 7036 | 7036 | |
| 7037 | 7037 | /** |
| 7038 | - * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
| 7039 | - * |
|
| 7040 | - * @return Array the airport list |
|
| 7041 | - * |
|
| 7042 | - */ |
|
| 7038 | + * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
| 7039 | + * |
|
| 7040 | + * @return Array the airport list |
|
| 7041 | + * |
|
| 7042 | + */ |
|
| 7043 | 7043 | public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
| 7044 | 7044 | { |
| 7045 | 7045 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7073,11 +7073,11 @@ discard block |
||
| 7073 | 7073 | |
| 7074 | 7074 | |
| 7075 | 7075 | /** |
| 7076 | - * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
| 7077 | - * |
|
| 7078 | - * @return Array the airport list |
|
| 7079 | - * |
|
| 7080 | - */ |
|
| 7076 | + * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
| 7077 | + * |
|
| 7078 | + * @return Array the airport list |
|
| 7079 | + * |
|
| 7080 | + */ |
|
| 7081 | 7081 | public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 7082 | 7082 | { |
| 7083 | 7083 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7108,11 +7108,11 @@ discard block |
||
| 7108 | 7108 | |
| 7109 | 7109 | |
| 7110 | 7110 | /** |
| 7111 | - * Gets all arrival airports of the airplanes that have flown over based on a date |
|
| 7112 | - * |
|
| 7113 | - * @return Array the airport list |
|
| 7114 | - * |
|
| 7115 | - */ |
|
| 7111 | + * Gets all arrival airports of the airplanes that have flown over based on a date |
|
| 7112 | + * |
|
| 7113 | + * @return Array the airport list |
|
| 7114 | + * |
|
| 7115 | + */ |
|
| 7116 | 7116 | public function countAllArrivalAirportsByDate($date,$filters = array()) |
| 7117 | 7117 | { |
| 7118 | 7118 | global $globalTimezone, $globalDBdriver; |
@@ -7158,11 +7158,11 @@ discard block |
||
| 7158 | 7158 | |
| 7159 | 7159 | |
| 7160 | 7160 | /** |
| 7161 | - * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
| 7162 | - * |
|
| 7163 | - * @return Array the airport list |
|
| 7164 | - * |
|
| 7165 | - */ |
|
| 7161 | + * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
| 7162 | + * |
|
| 7163 | + * @return Array the airport list |
|
| 7164 | + * |
|
| 7165 | + */ |
|
| 7166 | 7166 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
| 7167 | 7167 | { |
| 7168 | 7168 | global $globalTimezone, $globalDBdriver; |
@@ -7205,11 +7205,11 @@ discard block |
||
| 7205 | 7205 | |
| 7206 | 7206 | |
| 7207 | 7207 | /** |
| 7208 | - * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
| 7209 | - * |
|
| 7210 | - * @return Array the airport list |
|
| 7211 | - * |
|
| 7212 | - */ |
|
| 7208 | + * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
| 7209 | + * |
|
| 7210 | + * @return Array the airport list |
|
| 7211 | + * |
|
| 7212 | + */ |
|
| 7213 | 7213 | public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
| 7214 | 7214 | { |
| 7215 | 7215 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7242,11 +7242,11 @@ discard block |
||
| 7242 | 7242 | |
| 7243 | 7243 | |
| 7244 | 7244 | /** |
| 7245 | - * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 7246 | - * |
|
| 7247 | - * @return Array the airport list |
|
| 7248 | - * |
|
| 7249 | - */ |
|
| 7245 | + * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 7246 | + * |
|
| 7247 | + * @return Array the airport list |
|
| 7248 | + * |
|
| 7249 | + */ |
|
| 7250 | 7250 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
| 7251 | 7251 | { |
| 7252 | 7252 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7277,11 +7277,11 @@ discard block |
||
| 7277 | 7277 | |
| 7278 | 7278 | |
| 7279 | 7279 | /** |
| 7280 | - * Gets all arrival airports of the airplanes that have flown over based on a country |
|
| 7281 | - * |
|
| 7282 | - * @return Array the airport list |
|
| 7283 | - * |
|
| 7284 | - */ |
|
| 7280 | + * Gets all arrival airports of the airplanes that have flown over based on a country |
|
| 7281 | + * |
|
| 7282 | + * @return Array the airport list |
|
| 7283 | + * |
|
| 7284 | + */ |
|
| 7285 | 7285 | public function countAllArrivalAirportsByCountry($country,$filters = array()) |
| 7286 | 7286 | { |
| 7287 | 7287 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7314,11 +7314,11 @@ discard block |
||
| 7314 | 7314 | |
| 7315 | 7315 | |
| 7316 | 7316 | /** |
| 7317 | - * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
| 7318 | - * |
|
| 7319 | - * @return Array the airport list |
|
| 7320 | - * |
|
| 7321 | - */ |
|
| 7317 | + * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
| 7318 | + * |
|
| 7319 | + * @return Array the airport list |
|
| 7320 | + * |
|
| 7321 | + */ |
|
| 7322 | 7322 | public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
| 7323 | 7323 | { |
| 7324 | 7324 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7349,11 +7349,11 @@ discard block |
||
| 7349 | 7349 | |
| 7350 | 7350 | |
| 7351 | 7351 | /** |
| 7352 | - * Counts all airport departure countries |
|
| 7353 | - * |
|
| 7354 | - * @return Array the airport departure list |
|
| 7355 | - * |
|
| 7356 | - */ |
|
| 7352 | + * Counts all airport departure countries |
|
| 7353 | + * |
|
| 7354 | + * @return Array the airport departure list |
|
| 7355 | + * |
|
| 7356 | + */ |
|
| 7357 | 7357 | public function countAllDepartureCountries($filters = array()) |
| 7358 | 7358 | { |
| 7359 | 7359 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7383,11 +7383,11 @@ discard block |
||
| 7383 | 7383 | |
| 7384 | 7384 | |
| 7385 | 7385 | /** |
| 7386 | - * Counts all airport arrival countries |
|
| 7387 | - * |
|
| 7388 | - * @return Array the airport arrival list |
|
| 7389 | - * |
|
| 7390 | - */ |
|
| 7386 | + * Counts all airport arrival countries |
|
| 7387 | + * |
|
| 7388 | + * @return Array the airport arrival list |
|
| 7389 | + * |
|
| 7390 | + */ |
|
| 7391 | 7391 | public function countAllArrivalCountries($limit = true,$filters = array()) |
| 7392 | 7392 | { |
| 7393 | 7393 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7420,11 +7420,11 @@ discard block |
||
| 7420 | 7420 | |
| 7421 | 7421 | |
| 7422 | 7422 | /** |
| 7423 | - * Gets all route combinations |
|
| 7424 | - * |
|
| 7425 | - * @return Array the route list |
|
| 7426 | - * |
|
| 7427 | - */ |
|
| 7423 | + * Gets all route combinations |
|
| 7424 | + * |
|
| 7425 | + * @return Array the route list |
|
| 7426 | + * |
|
| 7427 | + */ |
|
| 7428 | 7428 | public function countAllRoutes($filters = array()) |
| 7429 | 7429 | { |
| 7430 | 7430 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7463,11 +7463,11 @@ discard block |
||
| 7463 | 7463 | |
| 7464 | 7464 | |
| 7465 | 7465 | /** |
| 7466 | - * Gets all route combinations based on an aircraft |
|
| 7467 | - * |
|
| 7468 | - * @return Array the route list |
|
| 7469 | - * |
|
| 7470 | - */ |
|
| 7466 | + * Gets all route combinations based on an aircraft |
|
| 7467 | + * |
|
| 7468 | + * @return Array the route list |
|
| 7469 | + * |
|
| 7470 | + */ |
|
| 7471 | 7471 | public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
| 7472 | 7472 | { |
| 7473 | 7473 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7503,11 +7503,11 @@ discard block |
||
| 7503 | 7503 | |
| 7504 | 7504 | |
| 7505 | 7505 | /** |
| 7506 | - * Gets all route combinations based on an aircraft registration |
|
| 7507 | - * |
|
| 7508 | - * @return Array the route list |
|
| 7509 | - * |
|
| 7510 | - */ |
|
| 7506 | + * Gets all route combinations based on an aircraft registration |
|
| 7507 | + * |
|
| 7508 | + * @return Array the route list |
|
| 7509 | + * |
|
| 7510 | + */ |
|
| 7511 | 7511 | public function countAllRoutesByRegistration($registration, $filters = array()) |
| 7512 | 7512 | { |
| 7513 | 7513 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7545,11 +7545,11 @@ discard block |
||
| 7545 | 7545 | |
| 7546 | 7546 | |
| 7547 | 7547 | /** |
| 7548 | - * Gets all route combinations based on an airline |
|
| 7549 | - * |
|
| 7550 | - * @return Array the route list |
|
| 7551 | - * |
|
| 7552 | - */ |
|
| 7548 | + * Gets all route combinations based on an airline |
|
| 7549 | + * |
|
| 7550 | + * @return Array the route list |
|
| 7551 | + * |
|
| 7552 | + */ |
|
| 7553 | 7553 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
| 7554 | 7554 | { |
| 7555 | 7555 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7587,11 +7587,11 @@ discard block |
||
| 7587 | 7587 | |
| 7588 | 7588 | |
| 7589 | 7589 | /** |
| 7590 | - * Gets all route combinations based on an airport |
|
| 7591 | - * |
|
| 7592 | - * @return Array the route list |
|
| 7593 | - * |
|
| 7594 | - */ |
|
| 7590 | + * Gets all route combinations based on an airport |
|
| 7591 | + * |
|
| 7592 | + * @return Array the route list |
|
| 7593 | + * |
|
| 7594 | + */ |
|
| 7595 | 7595 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
| 7596 | 7596 | { |
| 7597 | 7597 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7628,11 +7628,11 @@ discard block |
||
| 7628 | 7628 | |
| 7629 | 7629 | |
| 7630 | 7630 | /** |
| 7631 | - * Gets all route combinations based on an country |
|
| 7632 | - * |
|
| 7633 | - * @return Array the route list |
|
| 7634 | - * |
|
| 7635 | - */ |
|
| 7631 | + * Gets all route combinations based on an country |
|
| 7632 | + * |
|
| 7633 | + * @return Array the route list |
|
| 7634 | + * |
|
| 7635 | + */ |
|
| 7636 | 7636 | public function countAllRoutesByCountry($country, $filters = array()) |
| 7637 | 7637 | { |
| 7638 | 7638 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7668,11 +7668,11 @@ discard block |
||
| 7668 | 7668 | |
| 7669 | 7669 | |
| 7670 | 7670 | /** |
| 7671 | - * Gets all route combinations based on an date |
|
| 7672 | - * |
|
| 7673 | - * @return Array the route list |
|
| 7674 | - * |
|
| 7675 | - */ |
|
| 7671 | + * Gets all route combinations based on an date |
|
| 7672 | + * |
|
| 7673 | + * @return Array the route list |
|
| 7674 | + * |
|
| 7675 | + */ |
|
| 7676 | 7676 | public function countAllRoutesByDate($date, $filters = array()) |
| 7677 | 7677 | { |
| 7678 | 7678 | global $globalTimezone, $globalDBdriver; |
@@ -7722,11 +7722,11 @@ discard block |
||
| 7722 | 7722 | |
| 7723 | 7723 | |
| 7724 | 7724 | /** |
| 7725 | - * Gets all route combinations based on an ident/callsign |
|
| 7726 | - * |
|
| 7727 | - * @return Array the route list |
|
| 7728 | - * |
|
| 7729 | - */ |
|
| 7725 | + * Gets all route combinations based on an ident/callsign |
|
| 7726 | + * |
|
| 7727 | + * @return Array the route list |
|
| 7728 | + * |
|
| 7729 | + */ |
|
| 7730 | 7730 | public function countAllRoutesByIdent($ident, $filters = array()) |
| 7731 | 7731 | { |
| 7732 | 7732 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7763,11 +7763,11 @@ discard block |
||
| 7763 | 7763 | |
| 7764 | 7764 | |
| 7765 | 7765 | /** |
| 7766 | - * Gets all route combinations based on an manufacturer |
|
| 7767 | - * |
|
| 7768 | - * @return Array the route list |
|
| 7769 | - * |
|
| 7770 | - */ |
|
| 7766 | + * Gets all route combinations based on an manufacturer |
|
| 7767 | + * |
|
| 7768 | + * @return Array the route list |
|
| 7769 | + * |
|
| 7770 | + */ |
|
| 7771 | 7771 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
| 7772 | 7772 | { |
| 7773 | 7773 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7805,11 +7805,11 @@ discard block |
||
| 7805 | 7805 | |
| 7806 | 7806 | |
| 7807 | 7807 | /** |
| 7808 | - * Gets all route combinations with waypoints |
|
| 7809 | - * |
|
| 7810 | - * @return Array the route list |
|
| 7811 | - * |
|
| 7812 | - */ |
|
| 7808 | + * Gets all route combinations with waypoints |
|
| 7809 | + * |
|
| 7810 | + * @return Array the route list |
|
| 7811 | + * |
|
| 7812 | + */ |
|
| 7813 | 7813 | public function countAllRoutesWithWaypoints($filters = array()) |
| 7814 | 7814 | { |
| 7815 | 7815 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7846,11 +7846,11 @@ discard block |
||
| 7846 | 7846 | } |
| 7847 | 7847 | |
| 7848 | 7848 | /** |
| 7849 | - * Gets all callsigns that have flown over |
|
| 7850 | - * |
|
| 7851 | - * @return Array the callsign list |
|
| 7852 | - * |
|
| 7853 | - */ |
|
| 7849 | + * Gets all callsigns that have flown over |
|
| 7850 | + * |
|
| 7851 | + * @return Array the callsign list |
|
| 7852 | + * |
|
| 7853 | + */ |
|
| 7854 | 7854 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 7855 | 7855 | { |
| 7856 | 7856 | global $globalDBdriver; |
@@ -7888,11 +7888,11 @@ discard block |
||
| 7888 | 7888 | } |
| 7889 | 7889 | |
| 7890 | 7890 | /** |
| 7891 | - * Gets all callsigns that have flown over |
|
| 7892 | - * |
|
| 7893 | - * @return Array the callsign list |
|
| 7894 | - * |
|
| 7895 | - */ |
|
| 7891 | + * Gets all callsigns that have flown over |
|
| 7892 | + * |
|
| 7893 | + * @return Array the callsign list |
|
| 7894 | + * |
|
| 7895 | + */ |
|
| 7896 | 7896 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
| 7897 | 7897 | { |
| 7898 | 7898 | global $globalDBdriver; |
@@ -7933,11 +7933,11 @@ discard block |
||
| 7933 | 7933 | |
| 7934 | 7934 | |
| 7935 | 7935 | /** |
| 7936 | - * Counts all dates |
|
| 7937 | - * |
|
| 7938 | - * @return Array the date list |
|
| 7939 | - * |
|
| 7940 | - */ |
|
| 7936 | + * Counts all dates |
|
| 7937 | + * |
|
| 7938 | + * @return Array the date list |
|
| 7939 | + * |
|
| 7940 | + */ |
|
| 7941 | 7941 | public function countAllDates($filters = array()) |
| 7942 | 7942 | { |
| 7943 | 7943 | global $globalTimezone, $globalDBdriver; |
@@ -7982,11 +7982,11 @@ discard block |
||
| 7982 | 7982 | } |
| 7983 | 7983 | |
| 7984 | 7984 | /** |
| 7985 | - * Counts all dates |
|
| 7986 | - * |
|
| 7987 | - * @return Array the date list |
|
| 7988 | - * |
|
| 7989 | - */ |
|
| 7985 | + * Counts all dates |
|
| 7986 | + * |
|
| 7987 | + * @return Array the date list |
|
| 7988 | + * |
|
| 7989 | + */ |
|
| 7990 | 7990 | public function countAllDatesByAirlines($filters = array()) |
| 7991 | 7991 | { |
| 7992 | 7992 | global $globalTimezone, $globalDBdriver; |
@@ -8031,11 +8031,11 @@ discard block |
||
| 8031 | 8031 | } |
| 8032 | 8032 | |
| 8033 | 8033 | /** |
| 8034 | - * Counts all dates during the last 7 days |
|
| 8035 | - * |
|
| 8036 | - * @return Array the date list |
|
| 8037 | - * |
|
| 8038 | - */ |
|
| 8034 | + * Counts all dates during the last 7 days |
|
| 8035 | + * |
|
| 8036 | + * @return Array the date list |
|
| 8037 | + * |
|
| 8038 | + */ |
|
| 8039 | 8039 | public function countAllDatesLast7Days($filters = array()) |
| 8040 | 8040 | { |
| 8041 | 8041 | global $globalTimezone, $globalDBdriver; |
@@ -8057,7 +8057,7 @@ discard block |
||
| 8057 | 8057 | $query .= " GROUP BY date_name |
| 8058 | 8058 | ORDER BY date_name ASC"; |
| 8059 | 8059 | $query_data = array(':offset' => $offset); |
| 8060 | - } |
|
| 8060 | + } |
|
| 8061 | 8061 | |
| 8062 | 8062 | $sth = $this->db->prepare($query); |
| 8063 | 8063 | $sth->execute($query_data); |
@@ -8077,11 +8077,11 @@ discard block |
||
| 8077 | 8077 | } |
| 8078 | 8078 | |
| 8079 | 8079 | /** |
| 8080 | - * Counts all dates during the last month |
|
| 8081 | - * |
|
| 8082 | - * @return Array the date list |
|
| 8083 | - * |
|
| 8084 | - */ |
|
| 8080 | + * Counts all dates during the last month |
|
| 8081 | + * |
|
| 8082 | + * @return Array the date list |
|
| 8083 | + * |
|
| 8084 | + */ |
|
| 8085 | 8085 | public function countAllDatesLastMonth($filters = array()) |
| 8086 | 8086 | { |
| 8087 | 8087 | global $globalTimezone, $globalDBdriver; |
@@ -8103,7 +8103,7 @@ discard block |
||
| 8103 | 8103 | $query .= " GROUP BY date_name |
| 8104 | 8104 | ORDER BY date_name ASC"; |
| 8105 | 8105 | $query_data = array(':offset' => $offset); |
| 8106 | - } |
|
| 8106 | + } |
|
| 8107 | 8107 | |
| 8108 | 8108 | $sth = $this->db->prepare($query); |
| 8109 | 8109 | $sth->execute($query_data); |
@@ -8124,11 +8124,11 @@ discard block |
||
| 8124 | 8124 | |
| 8125 | 8125 | |
| 8126 | 8126 | /** |
| 8127 | - * Counts all dates during the last month |
|
| 8128 | - * |
|
| 8129 | - * @return Array the date list |
|
| 8130 | - * |
|
| 8131 | - */ |
|
| 8127 | + * Counts all dates during the last month |
|
| 8128 | + * |
|
| 8129 | + * @return Array the date list |
|
| 8130 | + * |
|
| 8131 | + */ |
|
| 8132 | 8132 | public function countAllDatesLastMonthByAirlines($filters = array()) |
| 8133 | 8133 | { |
| 8134 | 8134 | global $globalTimezone, $globalDBdriver; |
@@ -8151,7 +8151,7 @@ discard block |
||
| 8151 | 8151 | GROUP BY spotter_output.airline_icao, date_name |
| 8152 | 8152 | ORDER BY date_name ASC"; |
| 8153 | 8153 | $query_data = array(':offset' => $offset); |
| 8154 | - } |
|
| 8154 | + } |
|
| 8155 | 8155 | |
| 8156 | 8156 | $sth = $this->db->prepare($query); |
| 8157 | 8157 | $sth->execute($query_data); |
@@ -8173,11 +8173,11 @@ discard block |
||
| 8173 | 8173 | |
| 8174 | 8174 | |
| 8175 | 8175 | /** |
| 8176 | - * Counts all month |
|
| 8177 | - * |
|
| 8178 | - * @return Array the month list |
|
| 8179 | - * |
|
| 8180 | - */ |
|
| 8176 | + * Counts all month |
|
| 8177 | + * |
|
| 8178 | + * @return Array the month list |
|
| 8179 | + * |
|
| 8180 | + */ |
|
| 8181 | 8181 | public function countAllMonths($filters = array()) |
| 8182 | 8182 | { |
| 8183 | 8183 | global $globalTimezone, $globalDBdriver; |
@@ -8219,11 +8219,11 @@ discard block |
||
| 8219 | 8219 | } |
| 8220 | 8220 | |
| 8221 | 8221 | /** |
| 8222 | - * Counts all month |
|
| 8223 | - * |
|
| 8224 | - * @return Array the month list |
|
| 8225 | - * |
|
| 8226 | - */ |
|
| 8222 | + * Counts all month |
|
| 8223 | + * |
|
| 8224 | + * @return Array the month list |
|
| 8225 | + * |
|
| 8226 | + */ |
|
| 8227 | 8227 | public function countAllMonthsByAirlines($filters = array()) |
| 8228 | 8228 | { |
| 8229 | 8229 | global $globalTimezone, $globalDBdriver; |
@@ -8268,11 +8268,11 @@ discard block |
||
| 8268 | 8268 | } |
| 8269 | 8269 | |
| 8270 | 8270 | /** |
| 8271 | - * Counts all military month |
|
| 8272 | - * |
|
| 8273 | - * @return Array the month list |
|
| 8274 | - * |
|
| 8275 | - */ |
|
| 8271 | + * Counts all military month |
|
| 8272 | + * |
|
| 8273 | + * @return Array the month list |
|
| 8274 | + * |
|
| 8275 | + */ |
|
| 8276 | 8276 | public function countAllMilitaryMonths($filters = array()) |
| 8277 | 8277 | { |
| 8278 | 8278 | global $globalTimezone, $globalDBdriver; |
@@ -8313,11 +8313,11 @@ discard block |
||
| 8313 | 8313 | } |
| 8314 | 8314 | |
| 8315 | 8315 | /** |
| 8316 | - * Counts all month owners |
|
| 8317 | - * |
|
| 8318 | - * @return Array the month list |
|
| 8319 | - * |
|
| 8320 | - */ |
|
| 8316 | + * Counts all month owners |
|
| 8317 | + * |
|
| 8318 | + * @return Array the month list |
|
| 8319 | + * |
|
| 8320 | + */ |
|
| 8321 | 8321 | public function countAllMonthsOwners($filters = array()) |
| 8322 | 8322 | { |
| 8323 | 8323 | global $globalTimezone, $globalDBdriver; |
@@ -8359,11 +8359,11 @@ discard block |
||
| 8359 | 8359 | } |
| 8360 | 8360 | |
| 8361 | 8361 | /** |
| 8362 | - * Counts all month owners |
|
| 8363 | - * |
|
| 8364 | - * @return Array the month list |
|
| 8365 | - * |
|
| 8366 | - */ |
|
| 8362 | + * Counts all month owners |
|
| 8363 | + * |
|
| 8364 | + * @return Array the month list |
|
| 8365 | + * |
|
| 8366 | + */ |
|
| 8367 | 8367 | public function countAllMonthsOwnersByAirlines($filters = array()) |
| 8368 | 8368 | { |
| 8369 | 8369 | global $globalTimezone, $globalDBdriver; |
@@ -8406,11 +8406,11 @@ discard block |
||
| 8406 | 8406 | } |
| 8407 | 8407 | |
| 8408 | 8408 | /** |
| 8409 | - * Counts all month pilot |
|
| 8410 | - * |
|
| 8411 | - * @return Array the month list |
|
| 8412 | - * |
|
| 8413 | - */ |
|
| 8409 | + * Counts all month pilot |
|
| 8410 | + * |
|
| 8411 | + * @return Array the month list |
|
| 8412 | + * |
|
| 8413 | + */ |
|
| 8414 | 8414 | public function countAllMonthsPilots($filters = array()) |
| 8415 | 8415 | { |
| 8416 | 8416 | global $globalTimezone, $globalDBdriver; |
@@ -8452,11 +8452,11 @@ discard block |
||
| 8452 | 8452 | } |
| 8453 | 8453 | |
| 8454 | 8454 | /** |
| 8455 | - * Counts all month pilot |
|
| 8456 | - * |
|
| 8457 | - * @return Array the month list |
|
| 8458 | - * |
|
| 8459 | - */ |
|
| 8455 | + * Counts all month pilot |
|
| 8456 | + * |
|
| 8457 | + * @return Array the month list |
|
| 8458 | + * |
|
| 8459 | + */ |
|
| 8460 | 8460 | public function countAllMonthsPilotsByAirlines($filters = array()) |
| 8461 | 8461 | { |
| 8462 | 8462 | global $globalTimezone, $globalDBdriver; |
@@ -8499,11 +8499,11 @@ discard block |
||
| 8499 | 8499 | } |
| 8500 | 8500 | |
| 8501 | 8501 | /** |
| 8502 | - * Counts all month airline |
|
| 8503 | - * |
|
| 8504 | - * @return Array the month list |
|
| 8505 | - * |
|
| 8506 | - */ |
|
| 8502 | + * Counts all month airline |
|
| 8503 | + * |
|
| 8504 | + * @return Array the month list |
|
| 8505 | + * |
|
| 8506 | + */ |
|
| 8507 | 8507 | public function countAllMonthsAirlines($filters = array()) |
| 8508 | 8508 | { |
| 8509 | 8509 | global $globalTimezone, $globalDBdriver; |
@@ -8545,11 +8545,11 @@ discard block |
||
| 8545 | 8545 | } |
| 8546 | 8546 | |
| 8547 | 8547 | /** |
| 8548 | - * Counts all month aircraft |
|
| 8549 | - * |
|
| 8550 | - * @return Array the month list |
|
| 8551 | - * |
|
| 8552 | - */ |
|
| 8548 | + * Counts all month aircraft |
|
| 8549 | + * |
|
| 8550 | + * @return Array the month list |
|
| 8551 | + * |
|
| 8552 | + */ |
|
| 8553 | 8553 | public function countAllMonthsAircrafts($filters = array()) |
| 8554 | 8554 | { |
| 8555 | 8555 | global $globalTimezone, $globalDBdriver; |
@@ -8592,11 +8592,11 @@ discard block |
||
| 8592 | 8592 | |
| 8593 | 8593 | |
| 8594 | 8594 | /** |
| 8595 | - * Counts all month aircraft |
|
| 8596 | - * |
|
| 8597 | - * @return Array the month list |
|
| 8598 | - * |
|
| 8599 | - */ |
|
| 8595 | + * Counts all month aircraft |
|
| 8596 | + * |
|
| 8597 | + * @return Array the month list |
|
| 8598 | + * |
|
| 8599 | + */ |
|
| 8600 | 8600 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
| 8601 | 8601 | { |
| 8602 | 8602 | global $globalTimezone, $globalDBdriver; |
@@ -8639,11 +8639,11 @@ discard block |
||
| 8639 | 8639 | } |
| 8640 | 8640 | |
| 8641 | 8641 | /** |
| 8642 | - * Counts all month real arrival |
|
| 8643 | - * |
|
| 8644 | - * @return Array the month list |
|
| 8645 | - * |
|
| 8646 | - */ |
|
| 8642 | + * Counts all month real arrival |
|
| 8643 | + * |
|
| 8644 | + * @return Array the month list |
|
| 8645 | + * |
|
| 8646 | + */ |
|
| 8647 | 8647 | public function countAllMonthsRealArrivals($filters = array()) |
| 8648 | 8648 | { |
| 8649 | 8649 | global $globalTimezone, $globalDBdriver; |
@@ -8686,11 +8686,11 @@ discard block |
||
| 8686 | 8686 | |
| 8687 | 8687 | |
| 8688 | 8688 | /** |
| 8689 | - * Counts all month real arrival |
|
| 8690 | - * |
|
| 8691 | - * @return Array the month list |
|
| 8692 | - * |
|
| 8693 | - */ |
|
| 8689 | + * Counts all month real arrival |
|
| 8690 | + * |
|
| 8691 | + * @return Array the month list |
|
| 8692 | + * |
|
| 8693 | + */ |
|
| 8694 | 8694 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
| 8695 | 8695 | { |
| 8696 | 8696 | global $globalTimezone, $globalDBdriver; |
@@ -8734,11 +8734,11 @@ discard block |
||
| 8734 | 8734 | |
| 8735 | 8735 | |
| 8736 | 8736 | /** |
| 8737 | - * Counts all dates during the last year |
|
| 8738 | - * |
|
| 8739 | - * @return Array the date list |
|
| 8740 | - * |
|
| 8741 | - */ |
|
| 8737 | + * Counts all dates during the last year |
|
| 8738 | + * |
|
| 8739 | + * @return Array the date list |
|
| 8740 | + * |
|
| 8741 | + */ |
|
| 8742 | 8742 | public function countAllMonthsLastYear($filters) |
| 8743 | 8743 | { |
| 8744 | 8744 | global $globalTimezone, $globalDBdriver; |
@@ -8760,7 +8760,7 @@ discard block |
||
| 8760 | 8760 | $query .= " GROUP BY year_name, month_name |
| 8761 | 8761 | ORDER BY year_name, month_name ASC"; |
| 8762 | 8762 | $query_data = array(':offset' => $offset); |
| 8763 | - } |
|
| 8763 | + } |
|
| 8764 | 8764 | |
| 8765 | 8765 | $sth = $this->db->prepare($query); |
| 8766 | 8766 | $sth->execute($query_data); |
@@ -8783,11 +8783,11 @@ discard block |
||
| 8783 | 8783 | |
| 8784 | 8784 | |
| 8785 | 8785 | /** |
| 8786 | - * Counts all hours |
|
| 8787 | - * |
|
| 8788 | - * @return Array the hour list |
|
| 8789 | - * |
|
| 8790 | - */ |
|
| 8786 | + * Counts all hours |
|
| 8787 | + * |
|
| 8788 | + * @return Array the hour list |
|
| 8789 | + * |
|
| 8790 | + */ |
|
| 8791 | 8791 | public function countAllHours($orderby,$filters = array()) |
| 8792 | 8792 | { |
| 8793 | 8793 | global $globalTimezone, $globalDBdriver; |
@@ -8848,11 +8848,11 @@ discard block |
||
| 8848 | 8848 | } |
| 8849 | 8849 | |
| 8850 | 8850 | /** |
| 8851 | - * Counts all hours |
|
| 8852 | - * |
|
| 8853 | - * @return Array the hour list |
|
| 8854 | - * |
|
| 8855 | - */ |
|
| 8851 | + * Counts all hours |
|
| 8852 | + * |
|
| 8853 | + * @return Array the hour list |
|
| 8854 | + * |
|
| 8855 | + */ |
|
| 8856 | 8856 | public function countAllHoursByAirlines($orderby, $filters = array()) |
| 8857 | 8857 | { |
| 8858 | 8858 | global $globalTimezone, $globalDBdriver; |
@@ -8915,11 +8915,11 @@ discard block |
||
| 8915 | 8915 | |
| 8916 | 8916 | |
| 8917 | 8917 | /** |
| 8918 | - * Counts all hours by airline |
|
| 8919 | - * |
|
| 8920 | - * @return Array the hour list |
|
| 8921 | - * |
|
| 8922 | - */ |
|
| 8918 | + * Counts all hours by airline |
|
| 8919 | + * |
|
| 8920 | + * @return Array the hour list |
|
| 8921 | + * |
|
| 8922 | + */ |
|
| 8923 | 8923 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
| 8924 | 8924 | { |
| 8925 | 8925 | global $globalTimezone, $globalDBdriver; |
@@ -8965,11 +8965,11 @@ discard block |
||
| 8965 | 8965 | |
| 8966 | 8966 | |
| 8967 | 8967 | /** |
| 8968 | - * Counts all hours by aircraft |
|
| 8969 | - * |
|
| 8970 | - * @return Array the hour list |
|
| 8971 | - * |
|
| 8972 | - */ |
|
| 8968 | + * Counts all hours by aircraft |
|
| 8969 | + * |
|
| 8970 | + * @return Array the hour list |
|
| 8971 | + * |
|
| 8972 | + */ |
|
| 8973 | 8973 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
| 8974 | 8974 | { |
| 8975 | 8975 | global $globalTimezone, $globalDBdriver; |
@@ -9012,11 +9012,11 @@ discard block |
||
| 9012 | 9012 | |
| 9013 | 9013 | |
| 9014 | 9014 | /** |
| 9015 | - * Counts all hours by aircraft registration |
|
| 9016 | - * |
|
| 9017 | - * @return Array the hour list |
|
| 9018 | - * |
|
| 9019 | - */ |
|
| 9015 | + * Counts all hours by aircraft registration |
|
| 9016 | + * |
|
| 9017 | + * @return Array the hour list |
|
| 9018 | + * |
|
| 9019 | + */ |
|
| 9020 | 9020 | public function countAllHoursByRegistration($registration, $filters = array()) |
| 9021 | 9021 | { |
| 9022 | 9022 | global $globalTimezone, $globalDBdriver; |
@@ -9059,11 +9059,11 @@ discard block |
||
| 9059 | 9059 | |
| 9060 | 9060 | |
| 9061 | 9061 | /** |
| 9062 | - * Counts all hours by airport |
|
| 9063 | - * |
|
| 9064 | - * @return Array the hour list |
|
| 9065 | - * |
|
| 9066 | - */ |
|
| 9062 | + * Counts all hours by airport |
|
| 9063 | + * |
|
| 9064 | + * @return Array the hour list |
|
| 9065 | + * |
|
| 9066 | + */ |
|
| 9067 | 9067 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
| 9068 | 9068 | { |
| 9069 | 9069 | global $globalTimezone, $globalDBdriver; |
@@ -9107,11 +9107,11 @@ discard block |
||
| 9107 | 9107 | |
| 9108 | 9108 | |
| 9109 | 9109 | /** |
| 9110 | - * Counts all hours by manufacturer |
|
| 9111 | - * |
|
| 9112 | - * @return Array the hour list |
|
| 9113 | - * |
|
| 9114 | - */ |
|
| 9110 | + * Counts all hours by manufacturer |
|
| 9111 | + * |
|
| 9112 | + * @return Array the hour list |
|
| 9113 | + * |
|
| 9114 | + */ |
|
| 9115 | 9115 | public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
| 9116 | 9116 | { |
| 9117 | 9117 | global $globalTimezone, $globalDBdriver; |
@@ -9155,11 +9155,11 @@ discard block |
||
| 9155 | 9155 | |
| 9156 | 9156 | |
| 9157 | 9157 | /** |
| 9158 | - * Counts all hours by date |
|
| 9159 | - * |
|
| 9160 | - * @return Array the hour list |
|
| 9161 | - * |
|
| 9162 | - */ |
|
| 9158 | + * Counts all hours by date |
|
| 9159 | + * |
|
| 9160 | + * @return Array the hour list |
|
| 9161 | + * |
|
| 9162 | + */ |
|
| 9163 | 9163 | public function countAllHoursByDate($date, $filters = array()) |
| 9164 | 9164 | { |
| 9165 | 9165 | global $globalTimezone, $globalDBdriver; |
@@ -9203,11 +9203,11 @@ discard block |
||
| 9203 | 9203 | |
| 9204 | 9204 | |
| 9205 | 9205 | /** |
| 9206 | - * Counts all hours by a ident/callsign |
|
| 9207 | - * |
|
| 9208 | - * @return Array the hour list |
|
| 9209 | - * |
|
| 9210 | - */ |
|
| 9206 | + * Counts all hours by a ident/callsign |
|
| 9207 | + * |
|
| 9208 | + * @return Array the hour list |
|
| 9209 | + * |
|
| 9210 | + */ |
|
| 9211 | 9211 | public function countAllHoursByIdent($ident, $filters = array()) |
| 9212 | 9212 | { |
| 9213 | 9213 | global $globalTimezone, $globalDBdriver; |
@@ -9252,11 +9252,11 @@ discard block |
||
| 9252 | 9252 | |
| 9253 | 9253 | |
| 9254 | 9254 | /** |
| 9255 | - * Counts all hours by route |
|
| 9256 | - * |
|
| 9257 | - * @return Array the hour list |
|
| 9258 | - * |
|
| 9259 | - */ |
|
| 9255 | + * Counts all hours by route |
|
| 9256 | + * |
|
| 9257 | + * @return Array the hour list |
|
| 9258 | + * |
|
| 9259 | + */ |
|
| 9260 | 9260 | public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
| 9261 | 9261 | { |
| 9262 | 9262 | global $globalTimezone, $globalDBdriver; |
@@ -9300,11 +9300,11 @@ discard block |
||
| 9300 | 9300 | |
| 9301 | 9301 | |
| 9302 | 9302 | /** |
| 9303 | - * Counts all hours by country |
|
| 9304 | - * |
|
| 9305 | - * @return Array the hour list |
|
| 9306 | - * |
|
| 9307 | - */ |
|
| 9303 | + * Counts all hours by country |
|
| 9304 | + * |
|
| 9305 | + * @return Array the hour list |
|
| 9306 | + * |
|
| 9307 | + */ |
|
| 9308 | 9308 | public function countAllHoursByCountry($country, $filters = array()) |
| 9309 | 9309 | { |
| 9310 | 9310 | global $globalTimezone, $globalDBdriver; |
@@ -9349,11 +9349,11 @@ discard block |
||
| 9349 | 9349 | |
| 9350 | 9350 | |
| 9351 | 9351 | /** |
| 9352 | - * Counts all aircraft that have flown over |
|
| 9353 | - * |
|
| 9354 | - * @return Integer the number of aircrafts |
|
| 9355 | - * |
|
| 9356 | - */ |
|
| 9352 | + * Counts all aircraft that have flown over |
|
| 9353 | + * |
|
| 9354 | + * @return Integer the number of aircrafts |
|
| 9355 | + * |
|
| 9356 | + */ |
|
| 9357 | 9357 | public function countOverallAircrafts($filters = array()) |
| 9358 | 9358 | { |
| 9359 | 9359 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9365,11 +9365,11 @@ discard block |
||
| 9365 | 9365 | } |
| 9366 | 9366 | |
| 9367 | 9367 | /** |
| 9368 | - * Counts all flight that really arrival |
|
| 9369 | - * |
|
| 9370 | - * @return Integer the number of aircrafts |
|
| 9371 | - * |
|
| 9372 | - */ |
|
| 9368 | + * Counts all flight that really arrival |
|
| 9369 | + * |
|
| 9370 | + * @return Integer the number of aircrafts |
|
| 9371 | + * |
|
| 9372 | + */ |
|
| 9373 | 9373 | public function countOverallArrival($filters = array()) |
| 9374 | 9374 | { |
| 9375 | 9375 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9382,11 +9382,11 @@ discard block |
||
| 9382 | 9382 | } |
| 9383 | 9383 | |
| 9384 | 9384 | /** |
| 9385 | - * Counts all pilots that have flown over |
|
| 9386 | - * |
|
| 9387 | - * @return Integer the number of pilots |
|
| 9388 | - * |
|
| 9389 | - */ |
|
| 9385 | + * Counts all pilots that have flown over |
|
| 9386 | + * |
|
| 9387 | + * @return Integer the number of pilots |
|
| 9388 | + * |
|
| 9389 | + */ |
|
| 9390 | 9390 | public function countOverallPilots($filters = array()) |
| 9391 | 9391 | { |
| 9392 | 9392 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9398,11 +9398,11 @@ discard block |
||
| 9398 | 9398 | } |
| 9399 | 9399 | |
| 9400 | 9400 | /** |
| 9401 | - * Counts all owners that have flown over |
|
| 9402 | - * |
|
| 9403 | - * @return Integer the number of owners |
|
| 9404 | - * |
|
| 9405 | - */ |
|
| 9401 | + * Counts all owners that have flown over |
|
| 9402 | + * |
|
| 9403 | + * @return Integer the number of owners |
|
| 9404 | + * |
|
| 9405 | + */ |
|
| 9406 | 9406 | public function countOverallOwners($filters = array()) |
| 9407 | 9407 | { |
| 9408 | 9408 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9415,11 +9415,11 @@ discard block |
||
| 9415 | 9415 | |
| 9416 | 9416 | |
| 9417 | 9417 | /** |
| 9418 | - * Counts all flights that have flown over |
|
| 9419 | - * |
|
| 9420 | - * @return Integer the number of flights |
|
| 9421 | - * |
|
| 9422 | - */ |
|
| 9418 | + * Counts all flights that have flown over |
|
| 9419 | + * |
|
| 9420 | + * @return Integer the number of flights |
|
| 9421 | + * |
|
| 9422 | + */ |
|
| 9423 | 9423 | public function countOverallFlights($filters = array()) |
| 9424 | 9424 | { |
| 9425 | 9425 | $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
@@ -9432,11 +9432,11 @@ discard block |
||
| 9432 | 9432 | } |
| 9433 | 9433 | |
| 9434 | 9434 | /** |
| 9435 | - * Counts all military flights that have flown over |
|
| 9436 | - * |
|
| 9437 | - * @return Integer the number of flights |
|
| 9438 | - * |
|
| 9439 | - */ |
|
| 9435 | + * Counts all military flights that have flown over |
|
| 9436 | + * |
|
| 9437 | + * @return Integer the number of flights |
|
| 9438 | + * |
|
| 9439 | + */ |
|
| 9440 | 9440 | public function countOverallMilitaryFlights($filters = array()) |
| 9441 | 9441 | { |
| 9442 | 9442 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9451,11 +9451,11 @@ discard block |
||
| 9451 | 9451 | |
| 9452 | 9452 | |
| 9453 | 9453 | /** |
| 9454 | - * Counts all airlines that have flown over |
|
| 9455 | - * |
|
| 9456 | - * @return Integer the number of airlines |
|
| 9457 | - * |
|
| 9458 | - */ |
|
| 9454 | + * Counts all airlines that have flown over |
|
| 9455 | + * |
|
| 9456 | + * @return Integer the number of airlines |
|
| 9457 | + * |
|
| 9458 | + */ |
|
| 9459 | 9459 | public function countOverallAirlines($filters = array()) |
| 9460 | 9460 | { |
| 9461 | 9461 | $query = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count |
@@ -9469,11 +9469,11 @@ discard block |
||
| 9469 | 9469 | |
| 9470 | 9470 | |
| 9471 | 9471 | /** |
| 9472 | - * Counts all hours of today |
|
| 9473 | - * |
|
| 9474 | - * @return Array the hour list |
|
| 9475 | - * |
|
| 9476 | - */ |
|
| 9472 | + * Counts all hours of today |
|
| 9473 | + * |
|
| 9474 | + * @return Array the hour list |
|
| 9475 | + * |
|
| 9476 | + */ |
|
| 9477 | 9477 | public function countAllHoursFromToday($filters = array()) |
| 9478 | 9478 | { |
| 9479 | 9479 | global $globalTimezone, $globalDBdriver; |
@@ -9513,11 +9513,11 @@ discard block |
||
| 9513 | 9513 | } |
| 9514 | 9514 | |
| 9515 | 9515 | /** |
| 9516 | - * Gets all the spotter information based on calculated upcoming flights |
|
| 9517 | - * |
|
| 9518 | - * @return Array the spotter information |
|
| 9519 | - * |
|
| 9520 | - */ |
|
| 9516 | + * Gets all the spotter information based on calculated upcoming flights |
|
| 9517 | + * |
|
| 9518 | + * @return Array the spotter information |
|
| 9519 | + * |
|
| 9520 | + */ |
|
| 9521 | 9521 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
| 9522 | 9522 | { |
| 9523 | 9523 | global $global_query, $globalDBdriver, $globalTimezone; |
@@ -9592,12 +9592,12 @@ discard block |
||
| 9592 | 9592 | } |
| 9593 | 9593 | |
| 9594 | 9594 | |
| 9595 | - /** |
|
| 9596 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 9597 | - * |
|
| 9598 | - * @return Integer the Barrie Spotter ID |
|
| 9595 | + /** |
|
| 9596 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 9597 | + * |
|
| 9598 | + * @return Integer the Barrie Spotter ID |
|
| 9599 | 9599 | q * |
| 9600 | - */ |
|
| 9600 | + */ |
|
| 9601 | 9601 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
| 9602 | 9602 | { |
| 9603 | 9603 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -9618,13 +9618,13 @@ discard block |
||
| 9618 | 9618 | |
| 9619 | 9619 | |
| 9620 | 9620 | /** |
| 9621 | - * Parses a date string |
|
| 9622 | - * |
|
| 9623 | - * @param String $dateString the date string |
|
| 9624 | - * @param String $timezone the timezone of a user |
|
| 9625 | - * @return Array the time information |
|
| 9626 | - * |
|
| 9627 | - */ |
|
| 9621 | + * Parses a date string |
|
| 9622 | + * |
|
| 9623 | + * @param String $dateString the date string |
|
| 9624 | + * @param String $timezone the timezone of a user |
|
| 9625 | + * @return Array the time information |
|
| 9626 | + * |
|
| 9627 | + */ |
|
| 9628 | 9628 | public function parseDateString($dateString, $timezone = '') |
| 9629 | 9629 | { |
| 9630 | 9630 | $time_array = array(); |
@@ -9660,12 +9660,12 @@ discard block |
||
| 9660 | 9660 | |
| 9661 | 9661 | |
| 9662 | 9662 | /** |
| 9663 | - * Parses the direction degrees to working |
|
| 9664 | - * |
|
| 9665 | - * @param Float $direction the direction in degrees |
|
| 9666 | - * @return Array the direction information |
|
| 9667 | - * |
|
| 9668 | - */ |
|
| 9663 | + * Parses the direction degrees to working |
|
| 9664 | + * |
|
| 9665 | + * @param Float $direction the direction in degrees |
|
| 9666 | + * @return Array the direction information |
|
| 9667 | + * |
|
| 9668 | + */ |
|
| 9669 | 9669 | public function parseDirection($direction = 0) |
| 9670 | 9670 | { |
| 9671 | 9671 | if ($direction == '') $direction = 0; |
@@ -9744,12 +9744,12 @@ discard block |
||
| 9744 | 9744 | |
| 9745 | 9745 | |
| 9746 | 9746 | /** |
| 9747 | - * Gets the aircraft registration |
|
| 9748 | - * |
|
| 9749 | - * @param String $flightaware_id the flight aware id |
|
| 9750 | - * @return String the aircraft registration |
|
| 9751 | - * |
|
| 9752 | - */ |
|
| 9747 | + * Gets the aircraft registration |
|
| 9748 | + * |
|
| 9749 | + * @param String $flightaware_id the flight aware id |
|
| 9750 | + * @return String the aircraft registration |
|
| 9751 | + * |
|
| 9752 | + */ |
|
| 9753 | 9753 | |
| 9754 | 9754 | public function getAircraftRegistration($flightaware_id) |
| 9755 | 9755 | { |
@@ -9778,12 +9778,12 @@ discard block |
||
| 9778 | 9778 | |
| 9779 | 9779 | |
| 9780 | 9780 | /** |
| 9781 | - * Gets the aircraft registration from ModeS |
|
| 9782 | - * |
|
| 9783 | - * @param String $aircraft_modes the flight ModeS in hex |
|
| 9784 | - * @return String the aircraft registration |
|
| 9785 | - * |
|
| 9786 | - */ |
|
| 9781 | + * Gets the aircraft registration from ModeS |
|
| 9782 | + * |
|
| 9783 | + * @param String $aircraft_modes the flight ModeS in hex |
|
| 9784 | + * @return String the aircraft registration |
|
| 9785 | + * |
|
| 9786 | + */ |
|
| 9787 | 9787 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
| 9788 | 9788 | { |
| 9789 | 9789 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -9796,19 +9796,19 @@ discard block |
||
| 9796 | 9796 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 9797 | 9797 | $sth->closeCursor(); |
| 9798 | 9798 | if (count($row) > 0) { |
| 9799 | - //return $row['Registration']; |
|
| 9800 | - return $row['registration']; |
|
| 9799 | + //return $row['Registration']; |
|
| 9800 | + return $row['registration']; |
|
| 9801 | 9801 | } else return ''; |
| 9802 | 9802 | |
| 9803 | 9803 | } |
| 9804 | 9804 | |
| 9805 | 9805 | /** |
| 9806 | - * Gets the aircraft type from ModeS |
|
| 9807 | - * |
|
| 9808 | - * @param String $aircraft_modes the flight ModeS in hex |
|
| 9809 | - * @return String the aircraft type |
|
| 9810 | - * |
|
| 9811 | - */ |
|
| 9806 | + * Gets the aircraft type from ModeS |
|
| 9807 | + * |
|
| 9808 | + * @param String $aircraft_modes the flight ModeS in hex |
|
| 9809 | + * @return String the aircraft type |
|
| 9810 | + * |
|
| 9811 | + */ |
|
| 9812 | 9812 | public function getAircraftTypeBymodeS($aircraft_modes) |
| 9813 | 9813 | { |
| 9814 | 9814 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -9821,19 +9821,19 @@ discard block |
||
| 9821 | 9821 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 9822 | 9822 | $sth->closeCursor(); |
| 9823 | 9823 | if (count($row) > 0) { |
| 9824 | - if ($row['type_flight'] == null) return ''; |
|
| 9825 | - else return $row['type_flight']; |
|
| 9824 | + if ($row['type_flight'] == null) return ''; |
|
| 9825 | + else return $row['type_flight']; |
|
| 9826 | 9826 | } else return ''; |
| 9827 | 9827 | |
| 9828 | 9828 | } |
| 9829 | 9829 | |
| 9830 | 9830 | /** |
| 9831 | - * Gets Country from latitude/longitude |
|
| 9832 | - * |
|
| 9833 | - * @param Float $latitude latitute of the flight |
|
| 9834 | - * @param Float $longitude longitute of the flight |
|
| 9835 | - * @return String the countrie |
|
| 9836 | - */ |
|
| 9831 | + * Gets Country from latitude/longitude |
|
| 9832 | + * |
|
| 9833 | + * @param Float $latitude latitute of the flight |
|
| 9834 | + * @param Float $longitude longitute of the flight |
|
| 9835 | + * @return String the countrie |
|
| 9836 | + */ |
|
| 9837 | 9837 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 9838 | 9838 | { |
| 9839 | 9839 | global $globalDBdriver, $globalDebug; |
@@ -9870,11 +9870,11 @@ discard block |
||
| 9870 | 9870 | } |
| 9871 | 9871 | |
| 9872 | 9872 | /** |
| 9873 | - * Gets Country from iso2 |
|
| 9874 | - * |
|
| 9875 | - * @param String $iso2 ISO2 country code |
|
| 9876 | - * @return String the countrie |
|
| 9877 | - */ |
|
| 9873 | + * Gets Country from iso2 |
|
| 9874 | + * |
|
| 9875 | + * @param String $iso2 ISO2 country code |
|
| 9876 | + * @return String the countrie |
|
| 9877 | + */ |
|
| 9878 | 9878 | public function getCountryFromISO2($iso2) |
| 9879 | 9879 | { |
| 9880 | 9880 | global $globalDBdriver, $globalDebug; |
@@ -9902,12 +9902,12 @@ discard block |
||
| 9902 | 9902 | } |
| 9903 | 9903 | |
| 9904 | 9904 | /** |
| 9905 | - * converts the registration code using the country prefix |
|
| 9906 | - * |
|
| 9907 | - * @param String $registration the aircraft registration |
|
| 9908 | - * @return String the aircraft registration |
|
| 9909 | - * |
|
| 9910 | - */ |
|
| 9905 | + * converts the registration code using the country prefix |
|
| 9906 | + * |
|
| 9907 | + * @param String $registration the aircraft registration |
|
| 9908 | + * @return String the aircraft registration |
|
| 9909 | + * |
|
| 9910 | + */ |
|
| 9911 | 9911 | public function convertAircraftRegistration($registration) |
| 9912 | 9912 | { |
| 9913 | 9913 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -9959,12 +9959,12 @@ discard block |
||
| 9959 | 9959 | } |
| 9960 | 9960 | |
| 9961 | 9961 | /** |
| 9962 | - * Country from the registration code |
|
| 9963 | - * |
|
| 9964 | - * @param String $registration the aircraft registration |
|
| 9965 | - * @return String the country |
|
| 9966 | - * |
|
| 9967 | - */ |
|
| 9962 | + * Country from the registration code |
|
| 9963 | + * |
|
| 9964 | + * @param String $registration the aircraft registration |
|
| 9965 | + * @return String the country |
|
| 9966 | + * |
|
| 9967 | + */ |
|
| 9968 | 9968 | public function countryFromAircraftRegistration($registration) |
| 9969 | 9969 | { |
| 9970 | 9970 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -9983,8 +9983,8 @@ discard block |
||
| 9983 | 9983 | $country = $row['country']; |
| 9984 | 9984 | } |
| 9985 | 9985 | } else { |
| 9986 | - $registration_1 = substr($registration, 0, 1); |
|
| 9987 | - $registration_2 = substr($registration, 0, 2); |
|
| 9986 | + $registration_1 = substr($registration, 0, 1); |
|
| 9987 | + $registration_2 = substr($registration, 0, 2); |
|
| 9988 | 9988 | |
| 9989 | 9989 | $country = ''; |
| 9990 | 9990 | //first get the prefix based on two characters |
@@ -10020,12 +10020,12 @@ discard block |
||
| 10020 | 10020 | } |
| 10021 | 10021 | |
| 10022 | 10022 | /** |
| 10023 | - * Registration prefix from the registration code |
|
| 10024 | - * |
|
| 10025 | - * @param String $registration the aircraft registration |
|
| 10026 | - * @return String the registration prefix |
|
| 10027 | - * |
|
| 10028 | - */ |
|
| 10023 | + * Registration prefix from the registration code |
|
| 10024 | + * |
|
| 10025 | + * @param String $registration the aircraft registration |
|
| 10026 | + * @return String the registration prefix |
|
| 10027 | + * |
|
| 10028 | + */ |
|
| 10029 | 10029 | public function registrationPrefixFromAircraftRegistration($registration) |
| 10030 | 10030 | { |
| 10031 | 10031 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -10044,8 +10044,8 @@ discard block |
||
| 10044 | 10044 | //$country = $row['country']; |
| 10045 | 10045 | } |
| 10046 | 10046 | } else { |
| 10047 | - $registration_1 = substr($registration, 0, 1); |
|
| 10048 | - $registration_2 = substr($registration, 0, 2); |
|
| 10047 | + $registration_1 = substr($registration, 0, 1); |
|
| 10048 | + $registration_2 = substr($registration, 0, 2); |
|
| 10049 | 10049 | |
| 10050 | 10050 | //first get the prefix based on two characters |
| 10051 | 10051 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
@@ -10081,12 +10081,12 @@ discard block |
||
| 10081 | 10081 | |
| 10082 | 10082 | |
| 10083 | 10083 | /** |
| 10084 | - * Country from the registration code |
|
| 10085 | - * |
|
| 10086 | - * @param String $registration the aircraft registration |
|
| 10087 | - * @return String the country |
|
| 10088 | - * |
|
| 10089 | - */ |
|
| 10084 | + * Country from the registration code |
|
| 10085 | + * |
|
| 10086 | + * @param String $registration the aircraft registration |
|
| 10087 | + * @return String the country |
|
| 10088 | + * |
|
| 10089 | + */ |
|
| 10090 | 10090 | public function countryFromAircraftRegistrationCode($registration) |
| 10091 | 10091 | { |
| 10092 | 10092 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -10103,11 +10103,11 @@ discard block |
||
| 10103 | 10103 | } |
| 10104 | 10104 | |
| 10105 | 10105 | /** |
| 10106 | - * Set a new highlight value for a flight |
|
| 10107 | - * |
|
| 10108 | - * @param String $flightaware_id flightaware_id from spotter_output table |
|
| 10109 | - * @param String $highlight New highlight value |
|
| 10110 | - */ |
|
| 10106 | + * Set a new highlight value for a flight |
|
| 10107 | + * |
|
| 10108 | + * @param String $flightaware_id flightaware_id from spotter_output table |
|
| 10109 | + * @param String $highlight New highlight value |
|
| 10110 | + */ |
|
| 10111 | 10111 | public function setHighlightFlight($flightaware_id,$highlight) { |
| 10112 | 10112 | |
| 10113 | 10113 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
@@ -10116,12 +10116,12 @@ discard block |
||
| 10116 | 10116 | } |
| 10117 | 10117 | |
| 10118 | 10118 | /** |
| 10119 | - * Set a new highlight value for a flight by Registration |
|
| 10120 | - * |
|
| 10121 | - * @param String $registration Registration of the aircraft |
|
| 10122 | - * @param String $date Date of spotted aircraft |
|
| 10123 | - * @param String $highlight New highlight value |
|
| 10124 | - */ |
|
| 10119 | + * Set a new highlight value for a flight by Registration |
|
| 10120 | + * |
|
| 10121 | + * @param String $registration Registration of the aircraft |
|
| 10122 | + * @param String $date Date of spotted aircraft |
|
| 10123 | + * @param String $highlight New highlight value |
|
| 10124 | + */ |
|
| 10125 | 10125 | public function setHighlightFlightByRegistration($registration,$highlight, $date = '') { |
| 10126 | 10126 | if ($date == '') { |
| 10127 | 10127 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)"; |
@@ -10135,12 +10135,12 @@ discard block |
||
| 10135 | 10135 | } |
| 10136 | 10136 | |
| 10137 | 10137 | /** |
| 10138 | - * Gets the short url from bit.ly |
|
| 10139 | - * |
|
| 10140 | - * @param String $url the full url |
|
| 10141 | - * @return String the bit.ly url |
|
| 10142 | - * |
|
| 10143 | - */ |
|
| 10138 | + * Gets the short url from bit.ly |
|
| 10139 | + * |
|
| 10140 | + * @param String $url the full url |
|
| 10141 | + * @return String the bit.ly url |
|
| 10142 | + * |
|
| 10143 | + */ |
|
| 10144 | 10144 | public function getBitlyURL($url) |
| 10145 | 10145 | { |
| 10146 | 10146 | global $globalBitlyAccessToken; |
@@ -10429,11 +10429,11 @@ discard block |
||
| 10429 | 10429 | $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 |
| 10430 | 10430 | 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)) |
| 10431 | 10431 | 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;"; |
| 10432 | - } else { |
|
| 10432 | + } else { |
|
| 10433 | 10433 | $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 |
| 10434 | 10434 | 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)) |
| 10435 | 10435 | 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;"; |
| 10436 | - } |
|
| 10436 | + } |
|
| 10437 | 10437 | $sth = $this->db->prepare($query); |
| 10438 | 10438 | $sth->execute(); |
| 10439 | 10439 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
| 5 | 5 | $global_query = "SELECT spotter_output.* FROM spotter_output"; |
| 6 | 6 | |
| 7 | -class Spotter{ |
|
| 7 | +class Spotter { |
|
| 8 | 8 | public $aircraft_correct_icaotype = array('CL64' => 'CL60', |
| 9 | 9 | 'F9LX' => 'F900', |
| 10 | 10 | 'K35T' => 'K35R', |
@@ -59,45 +59,45 @@ discard block |
||
| 59 | 59 | * @param Array $filter the filter |
| 60 | 60 | * @return Array the SQL part |
| 61 | 61 | */ |
| 62 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 62 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 63 | 63 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 64 | 64 | $filters = array(); |
| 65 | 65 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 66 | 66 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 67 | 67 | $filters = $globalStatsFilters[$globalFilterName]; |
| 68 | 68 | } else { |
| 69 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 69 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 72 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 73 | 73 | $filter_query_join = ''; |
| 74 | 74 | $filter_query_where = ''; |
| 75 | - foreach($filters as $flt) { |
|
| 75 | + foreach ($filters as $flt) { |
|
| 76 | 76 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
| 77 | 77 | if ($flt['airlines'][0] != '') { |
| 78 | 78 | if (isset($flt['source'])) { |
| 79 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 79 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 80 | 80 | } else { |
| 81 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 81 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
| 86 | 86 | if (isset($flt['source'])) { |
| 87 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 87 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 88 | 88 | } else { |
| 89 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 89 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) { |
| 93 | 93 | if (isset($flt['source'])) { |
| 94 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 94 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 99 | 99 | if ($filter['airlines'][0] != '') { |
| 100 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 100 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
@@ -107,19 +107,19 @@ discard block |
||
| 107 | 107 | $filter_query_join .= " INNER JOIN (SELECT icao FROM airlines WHERE alliance = '".$filter['alliance']."') sal ON sal.icao = spotter_output.airline_icao "; |
| 108 | 108 | } |
| 109 | 109 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
| 110 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 110 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 111 | 111 | } |
| 112 | 112 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 113 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 113 | + $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 114 | 114 | } |
| 115 | 115 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 116 | 116 | $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
| 117 | 117 | } |
| 118 | 118 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 119 | 119 | if ($filter_query_where == '') { |
| 120 | - $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 120 | + $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 121 | 121 | } else { |
| 122 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 122 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @return Array the spotter information |
| 138 | 138 | * |
| 139 | 139 | */ |
| 140 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
| 140 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
| 141 | 141 | { |
| 142 | 142 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
| 143 | 143 | $Image = new Image($this->db); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $sth = $this->db->prepare($query.$limitQuery); |
| 168 | 168 | $sth->execute($params); |
| 169 | 169 | } catch (PDOException $e) { |
| 170 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
| 170 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
| 171 | 171 | exit(); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $spotter_array = array(); |
| 178 | 178 | |
| 179 | 179 | |
| 180 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 180 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 181 | 181 | { |
| 182 | 182 | $num_rows++; |
| 183 | 183 | $temp_array = array(); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | if (isset($row['route_stop'])) { |
| 223 | 223 | $temp_array['route_stop'] = $row['route_stop']; |
| 224 | 224 | if ($row['route_stop'] != '') { |
| 225 | - $allroute = explode(' ',$row['route_stop']); |
|
| 225 | + $allroute = explode(' ', $row['route_stop']); |
|
| 226 | 226 | |
| 227 | 227 | foreach ($allroute as $route) { |
| 228 | 228 | $route_airport_array = $this->getAllAirportInfo($route); |
@@ -277,11 +277,11 @@ discard block |
||
| 277 | 277 | { |
| 278 | 278 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
| 279 | 279 | } else { |
| 280 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
| 280 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
| 281 | 281 | } |
| 282 | 282 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
| 283 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
| 284 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
| 283 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
| 284 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
| 285 | 285 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
| 286 | 286 | } |
| 287 | 287 | |
@@ -315,9 +315,9 @@ discard block |
||
| 315 | 315 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 316 | 316 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 317 | 317 | if (is_numeric(substr($row['ident'], 2, 1))) { |
| 318 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource); |
|
| 318 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource); |
|
| 319 | 319 | } elseif (is_numeric(substr($row['ident'], 3, 1))) { |
| 320 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
| 320 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
| 321 | 321 | } else { |
| 322 | 322 | $airline_array = $this->getAllAirlineInfo('NA'); |
| 323 | 323 | } |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') { |
| 357 | - $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3)); |
|
| 357 | + $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3)); |
|
| 358 | 358 | //$acars_array = ACARS->getLiveAcarsData('BA40YL'); |
| 359 | 359 | if (count($acars_array) > 0) { |
| 360 | 360 | $temp_array['acars'] = $acars_array; |
@@ -371,11 +371,11 @@ discard block |
||
| 371 | 371 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
| 374 | + if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
| 375 | 375 | { |
| 376 | 376 | if ($globalIVAO) { |
| 377 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 378 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 377 | + if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']); |
|
| 378 | + else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']); |
|
| 379 | 379 | } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
| 380 | 380 | if (count($image_array) > 0) { |
| 381 | 381 | $temp_array['image'] = $image_array[0]['image']; |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 402 | + if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 403 | 403 | if ($schedules === true) { |
| 404 | 404 | $schedule_array = $Schedule->getSchedule($temp_array['ident']); |
| 405 | 405 | //print_r($schedule_array); |
@@ -481,12 +481,12 @@ discard block |
||
| 481 | 481 | if (isset($row['squawk'])) { |
| 482 | 482 | $temp_array['squawk'] = $row['squawk']; |
| 483 | 483 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 484 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
|
| 485 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 484 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']); |
|
| 485 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 486 | 486 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 487 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
|
| 488 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 489 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 487 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']); |
|
| 488 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 489 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | $temp_array['query_number_rows'] = $num_rows; |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | * @return Array the spotter information |
| 506 | 506 | * |
| 507 | 507 | */ |
| 508 | - 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()) |
|
| 508 | + 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()) |
|
| 509 | 509 | { |
| 510 | 510 | global $globalTimezone, $globalDBdriver; |
| 511 | 511 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | |
| 516 | 516 | $query_values = array(); |
| 517 | 517 | $additional_query = ''; |
| 518 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 518 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 519 | 519 | if ($q != "") |
| 520 | 520 | { |
| 521 | 521 | if (!is_string($q)) |
@@ -523,8 +523,8 @@ discard block |
||
| 523 | 523 | return false; |
| 524 | 524 | } else { |
| 525 | 525 | $q_array = explode(" ", $q); |
| 526 | - foreach ($q_array as $q_item){ |
|
| 527 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 526 | + foreach ($q_array as $q_item) { |
|
| 527 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 528 | 528 | $additional_query .= " AND ("; |
| 529 | 529 | if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
| 530 | 530 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -556,37 +556,37 @@ discard block |
||
| 556 | 556 | |
| 557 | 557 | if ($registration != "") |
| 558 | 558 | { |
| 559 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 559 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 560 | 560 | if (!is_string($registration)) |
| 561 | 561 | { |
| 562 | 562 | return false; |
| 563 | 563 | } else { |
| 564 | 564 | $additional_query .= " AND spotter_output.registration = :registration"; |
| 565 | - $query_values = array_merge($query_values,array(':registration' => $registration)); |
|
| 565 | + $query_values = array_merge($query_values, array(':registration' => $registration)); |
|
| 566 | 566 | } |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | if ($aircraft_icao != "") |
| 570 | 570 | { |
| 571 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 571 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 572 | 572 | if (!is_string($aircraft_icao)) |
| 573 | 573 | { |
| 574 | 574 | return false; |
| 575 | 575 | } else { |
| 576 | 576 | $additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao"; |
| 577 | - $query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao)); |
|
| 577 | + $query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao)); |
|
| 578 | 578 | } |
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | if ($aircraft_manufacturer != "") |
| 582 | 582 | { |
| 583 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 583 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 584 | 584 | if (!is_string($aircraft_manufacturer)) |
| 585 | 585 | { |
| 586 | 586 | return false; |
| 587 | 587 | } else { |
| 588 | 588 | $additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer"; |
| 589 | - $query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
| 589 | + $query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
| 590 | 590 | } |
| 591 | 591 | } |
| 592 | 592 | |
@@ -602,25 +602,25 @@ discard block |
||
| 602 | 602 | |
| 603 | 603 | if ($airline_icao != "") |
| 604 | 604 | { |
| 605 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 605 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 606 | 606 | if (!is_string($airline_icao)) |
| 607 | 607 | { |
| 608 | 608 | return false; |
| 609 | 609 | } else { |
| 610 | 610 | $additional_query .= " AND spotter_output.airline_icao = :airline_icao"; |
| 611 | - $query_values = array_merge($query_values,array(':airline_icao' => $airline_icao)); |
|
| 611 | + $query_values = array_merge($query_values, array(':airline_icao' => $airline_icao)); |
|
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | if ($airline_country != "") |
| 616 | 616 | { |
| 617 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
| 617 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
| 618 | 618 | if (!is_string($airline_country)) |
| 619 | 619 | { |
| 620 | 620 | return false; |
| 621 | 621 | } else { |
| 622 | 622 | $additional_query .= " AND spotter_output.airline_country = :airline_country"; |
| 623 | - $query_values = array_merge($query_values,array(':airline_country' => $airline_country)); |
|
| 623 | + $query_values = array_merge($query_values, array(':airline_country' => $airline_country)); |
|
| 624 | 624 | } |
| 625 | 625 | } |
| 626 | 626 | |
@@ -647,31 +647,31 @@ discard block |
||
| 647 | 647 | |
| 648 | 648 | if ($airport != "") |
| 649 | 649 | { |
| 650 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 650 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 651 | 651 | if (!is_string($airport)) |
| 652 | 652 | { |
| 653 | 653 | return false; |
| 654 | 654 | } else { |
| 655 | 655 | $additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)"; |
| 656 | - $query_values = array_merge($query_values,array(':airport' => $airport)); |
|
| 656 | + $query_values = array_merge($query_values, array(':airport' => $airport)); |
|
| 657 | 657 | } |
| 658 | 658 | } |
| 659 | 659 | |
| 660 | 660 | if ($airport_country != "") |
| 661 | 661 | { |
| 662 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
| 662 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
| 663 | 663 | if (!is_string($airport_country)) |
| 664 | 664 | { |
| 665 | 665 | return false; |
| 666 | 666 | } else { |
| 667 | 667 | $additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)"; |
| 668 | - $query_values = array_merge($query_values,array(':airport_country' => $airport_country)); |
|
| 668 | + $query_values = array_merge($query_values, array(':airport_country' => $airport_country)); |
|
| 669 | 669 | } |
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | if ($callsign != "") |
| 673 | 673 | { |
| 674 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 674 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 675 | 675 | if (!is_string($callsign)) |
| 676 | 676 | { |
| 677 | 677 | return false; |
@@ -679,79 +679,79 @@ discard block |
||
| 679 | 679 | $translate = $Translation->ident2icao($callsign); |
| 680 | 680 | if ($translate != $callsign) { |
| 681 | 681 | $additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)"; |
| 682 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
| 682 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
| 683 | 683 | } else { |
| 684 | 684 | $additional_query .= " AND spotter_output.ident = :callsign"; |
| 685 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
| 685 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
| 686 | 686 | } |
| 687 | 687 | } |
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | if ($owner != "") |
| 691 | 691 | { |
| 692 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 692 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 693 | 693 | if (!is_string($owner)) |
| 694 | 694 | { |
| 695 | 695 | return false; |
| 696 | 696 | } else { |
| 697 | 697 | $additional_query .= " AND spotter_output.owner_name = :owner"; |
| 698 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
| 698 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
| 699 | 699 | } |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | if ($pilot_name != "") |
| 703 | 703 | { |
| 704 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 704 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 705 | 705 | if (!is_string($pilot_name)) |
| 706 | 706 | { |
| 707 | 707 | return false; |
| 708 | 708 | } else { |
| 709 | 709 | $additional_query .= " AND spotter_output.pilot_name = :pilot_name"; |
| 710 | - $query_values = array_merge($query_values,array(':pilot_name' => $pilot_name)); |
|
| 710 | + $query_values = array_merge($query_values, array(':pilot_name' => $pilot_name)); |
|
| 711 | 711 | } |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | if ($pilot_id != "") |
| 715 | 715 | { |
| 716 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
| 716 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
| 717 | 717 | if (!is_string($pilot_id)) |
| 718 | 718 | { |
| 719 | 719 | return false; |
| 720 | 720 | } else { |
| 721 | 721 | $additional_query .= " AND spotter_output.pilot_id = :pilot_id"; |
| 722 | - $query_values = array_merge($query_values,array(':pilot_id' => $pilot_id)); |
|
| 722 | + $query_values = array_merge($query_values, array(':pilot_id' => $pilot_id)); |
|
| 723 | 723 | } |
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | if ($departure_airport_route != "") |
| 727 | 727 | { |
| 728 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
| 728 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
| 729 | 729 | if (!is_string($departure_airport_route)) |
| 730 | 730 | { |
| 731 | 731 | return false; |
| 732 | 732 | } else { |
| 733 | 733 | $additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route"; |
| 734 | - $query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route)); |
|
| 734 | + $query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route)); |
|
| 735 | 735 | } |
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 | if ($arrival_airport_route != "") |
| 739 | 739 | { |
| 740 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
| 740 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
| 741 | 741 | if (!is_string($arrival_airport_route)) |
| 742 | 742 | { |
| 743 | 743 | return false; |
| 744 | 744 | } else { |
| 745 | 745 | $additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route"; |
| 746 | - $query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route)); |
|
| 746 | + $query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route)); |
|
| 747 | 747 | } |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | if ($altitude != "") |
| 751 | 751 | { |
| 752 | 752 | $altitude_array = explode(",", $altitude); |
| 753 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 754 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 753 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 754 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 755 | 755 | |
| 756 | 756 | if ($altitude_array[1] != "") |
| 757 | 757 | { |
@@ -767,8 +767,8 @@ discard block |
||
| 767 | 767 | if ($date_posted != "") |
| 768 | 768 | { |
| 769 | 769 | $date_array = explode(",", $date_posted); |
| 770 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
| 771 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
| 770 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
| 771 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
| 772 | 772 | |
| 773 | 773 | if ($globalTimezone != '') { |
| 774 | 774 | date_default_timezone_set($globalTimezone); |
@@ -799,8 +799,8 @@ discard block |
||
| 799 | 799 | { |
| 800 | 800 | $limit_array = explode(",", $limit); |
| 801 | 801 | |
| 802 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 803 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 802 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 803 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 804 | 804 | |
| 805 | 805 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 806 | 806 | { |
@@ -829,23 +829,23 @@ discard block |
||
| 829 | 829 | |
| 830 | 830 | |
| 831 | 831 | if ($origLat != "" && $origLon != "" && $dist != "") { |
| 832 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
| 832 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
| 833 | 833 | |
| 834 | 834 | if ($globalDBdriver == 'mysql') { |
| 835 | - $query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
| 835 | + $query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
| 836 | 836 | FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 837 | 837 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query; |
| 838 | 838 | } else { |
| 839 | - $query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 839 | + $query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 840 | 840 | FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 841 | 841 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query; |
| 842 | 842 | } |
| 843 | 843 | } else { |
| 844 | - $query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' |
|
| 844 | + $query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' |
|
| 845 | 845 | ".$additional_query." |
| 846 | 846 | ".$orderby_query; |
| 847 | 847 | } |
| 848 | - $spotter_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
| 848 | + $spotter_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
| 849 | 849 | return $spotter_array; |
| 850 | 850 | } |
| 851 | 851 | |
@@ -868,8 +868,8 @@ discard block |
||
| 868 | 868 | { |
| 869 | 869 | $limit_array = explode(",", $limit); |
| 870 | 870 | |
| 871 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 872 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 871 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 872 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 873 | 873 | |
| 874 | 874 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 875 | 875 | { |
@@ -886,9 +886,9 @@ discard block |
||
| 886 | 886 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
| 889 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
| 890 | 890 | |
| 891 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
| 891 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
| 892 | 892 | |
| 893 | 893 | return $spotter_array; |
| 894 | 894 | } |
@@ -934,34 +934,34 @@ discard block |
||
| 934 | 934 | { |
| 935 | 935 | return false; |
| 936 | 936 | } else { |
| 937 | - if ($interval == "30m"){ |
|
| 937 | + if ($interval == "30m") { |
|
| 938 | 938 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date '; |
| 939 | - } else if ($interval == "1h"){ |
|
| 939 | + } else if ($interval == "1h") { |
|
| 940 | 940 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date '; |
| 941 | - } else if ($interval == "3h"){ |
|
| 941 | + } else if ($interval == "3h") { |
|
| 942 | 942 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date '; |
| 943 | - } else if ($interval == "6h"){ |
|
| 943 | + } else if ($interval == "6h") { |
|
| 944 | 944 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date '; |
| 945 | - } else if ($interval == "12h"){ |
|
| 945 | + } else if ($interval == "12h") { |
|
| 946 | 946 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date '; |
| 947 | - } else if ($interval == "24h"){ |
|
| 947 | + } else if ($interval == "24h") { |
|
| 948 | 948 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date '; |
| 949 | - } else if ($interval == "7d"){ |
|
| 949 | + } else if ($interval == "7d") { |
|
| 950 | 950 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date '; |
| 951 | - } else if ($interval == "30d"){ |
|
| 951 | + } else if ($interval == "30d") { |
|
| 952 | 952 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date '; |
| 953 | 953 | } |
| 954 | 954 | } |
| 955 | 955 | } |
| 956 | 956 | |
| 957 | - $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
| 957 | + $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
| 958 | 958 | WHERE spotter_output.latitude <> '' |
| 959 | 959 | AND spotter_output.longitude <> '' |
| 960 | 960 | ".$additional_query." |
| 961 | 961 | HAVING distance < :radius |
| 962 | 962 | ORDER BY distance"; |
| 963 | 963 | |
| 964 | - $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query); |
|
| 964 | + $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query); |
|
| 965 | 965 | |
| 966 | 966 | return $spotter_array; |
| 967 | 967 | } |
@@ -973,21 +973,21 @@ discard block |
||
| 973 | 973 | * @return Array the spotter information |
| 974 | 974 | * |
| 975 | 975 | */ |
| 976 | - public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
|
| 976 | + public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array()) |
|
| 977 | 977 | { |
| 978 | 978 | global $global_query; |
| 979 | 979 | |
| 980 | 980 | date_default_timezone_set('UTC'); |
| 981 | 981 | |
| 982 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 982 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 983 | 983 | |
| 984 | 984 | $limit_query = ''; |
| 985 | 985 | if ($limit != "") |
| 986 | 986 | { |
| 987 | 987 | $limit_array = explode(",", $limit); |
| 988 | 988 | |
| 989 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 990 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 989 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 990 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 991 | 991 | |
| 992 | 992 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 993 | 993 | { |
@@ -1004,7 +1004,7 @@ discard block |
||
| 1004 | 1004 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | - $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1007 | + $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1008 | 1008 | |
| 1009 | 1009 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1010 | 1010 | |
@@ -1023,15 +1023,15 @@ discard block |
||
| 1023 | 1023 | global $global_query; |
| 1024 | 1024 | |
| 1025 | 1025 | date_default_timezone_set('UTC'); |
| 1026 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1026 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1027 | 1027 | |
| 1028 | 1028 | $limit_query = ''; |
| 1029 | 1029 | if ($limit != "") |
| 1030 | 1030 | { |
| 1031 | 1031 | $limit_array = explode(",", $limit); |
| 1032 | 1032 | |
| 1033 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1034 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1033 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1034 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1035 | 1035 | |
| 1036 | 1036 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1037 | 1037 | { |
@@ -1048,7 +1048,7 @@ discard block |
||
| 1048 | 1048 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | - $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1051 | + $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1052 | 1052 | |
| 1053 | 1053 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1054 | 1054 | |
@@ -1062,20 +1062,20 @@ discard block |
||
| 1062 | 1062 | * @return Array the spotter information |
| 1063 | 1063 | * |
| 1064 | 1064 | */ |
| 1065 | - public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
|
| 1065 | + public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array()) |
|
| 1066 | 1066 | { |
| 1067 | 1067 | global $global_query; |
| 1068 | 1068 | |
| 1069 | 1069 | date_default_timezone_set('UTC'); |
| 1070 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1070 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1071 | 1071 | |
| 1072 | 1072 | $limit_query = ''; |
| 1073 | 1073 | if ($limit != "") |
| 1074 | 1074 | { |
| 1075 | 1075 | $limit_array = explode(",", $limit); |
| 1076 | 1076 | |
| 1077 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1078 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1077 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1078 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1079 | 1079 | |
| 1080 | 1080 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1081 | 1081 | { |
@@ -1092,7 +1092,7 @@ discard block |
||
| 1092 | 1092 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1093 | 1093 | } |
| 1094 | 1094 | |
| 1095 | - $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1095 | + $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1096 | 1096 | |
| 1097 | 1097 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1098 | 1098 | |
@@ -1112,7 +1112,7 @@ discard block |
||
| 1112 | 1112 | |
| 1113 | 1113 | date_default_timezone_set('UTC'); |
| 1114 | 1114 | |
| 1115 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1115 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1116 | 1116 | |
| 1117 | 1117 | $limit_query = ''; |
| 1118 | 1118 | |
@@ -1120,8 +1120,8 @@ discard block |
||
| 1120 | 1120 | { |
| 1121 | 1121 | $limit_array = explode(",", $limit); |
| 1122 | 1122 | |
| 1123 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1124 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1123 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1124 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1125 | 1125 | |
| 1126 | 1126 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1127 | 1127 | { |
@@ -1138,7 +1138,7 @@ discard block |
||
| 1138 | 1138 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | - $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1141 | + $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1142 | 1142 | |
| 1143 | 1143 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1144 | 1144 | |
@@ -1157,14 +1157,14 @@ discard block |
||
| 1157 | 1157 | global $global_query; |
| 1158 | 1158 | |
| 1159 | 1159 | date_default_timezone_set('UTC'); |
| 1160 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1160 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1161 | 1161 | $limit_query = ''; |
| 1162 | 1162 | if ($limit != "") |
| 1163 | 1163 | { |
| 1164 | 1164 | $limit_array = explode(",", $limit); |
| 1165 | 1165 | |
| 1166 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1167 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1166 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1167 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1168 | 1168 | |
| 1169 | 1169 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1170 | 1170 | { |
@@ -1181,7 +1181,7 @@ discard block |
||
| 1181 | 1181 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1182 | 1182 | } |
| 1183 | 1183 | |
| 1184 | - $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1184 | + $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1185 | 1185 | |
| 1186 | 1186 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1187 | 1187 | |
@@ -1205,9 +1205,9 @@ discard block |
||
| 1205 | 1205 | $query_values = array(':id' => $id); |
| 1206 | 1206 | |
| 1207 | 1207 | //$query = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." "; |
| 1208 | - $query = $global_query." WHERE ".$additional_query." "; |
|
| 1208 | + $query = $global_query." WHERE ".$additional_query." "; |
|
| 1209 | 1209 | |
| 1210 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
| 1210 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
| 1211 | 1211 | |
| 1212 | 1212 | return $spotter_array; |
| 1213 | 1213 | } |
@@ -1245,8 +1245,8 @@ discard block |
||
| 1245 | 1245 | { |
| 1246 | 1246 | $limit_array = explode(",", $limit); |
| 1247 | 1247 | |
| 1248 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1249 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1248 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1249 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1250 | 1250 | |
| 1251 | 1251 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1252 | 1252 | { |
@@ -1287,7 +1287,7 @@ discard block |
||
| 1287 | 1287 | $query_values = array(); |
| 1288 | 1288 | $limit_query = ''; |
| 1289 | 1289 | $additional_query = ''; |
| 1290 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1290 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1291 | 1291 | |
| 1292 | 1292 | if ($aircraft_type != "") |
| 1293 | 1293 | { |
@@ -1304,8 +1304,8 @@ discard block |
||
| 1304 | 1304 | { |
| 1305 | 1305 | $limit_array = explode(",", $limit); |
| 1306 | 1306 | |
| 1307 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1308 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1307 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1308 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1309 | 1309 | |
| 1310 | 1310 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1311 | 1311 | { |
@@ -1361,8 +1361,8 @@ discard block |
||
| 1361 | 1361 | { |
| 1362 | 1362 | $limit_array = explode(",", $limit); |
| 1363 | 1363 | |
| 1364 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1365 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1364 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1365 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1366 | 1366 | |
| 1367 | 1367 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1368 | 1368 | { |
@@ -1378,7 +1378,7 @@ discard block |
||
| 1378 | 1378 | } else { |
| 1379 | 1379 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1380 | 1380 | } |
| 1381 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1381 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1382 | 1382 | |
| 1383 | 1383 | //$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query; |
| 1384 | 1384 | $query = $global_query.$filter_query." ".$additional_query." ".$orderby_query; |
@@ -1397,7 +1397,7 @@ discard block |
||
| 1397 | 1397 | * @return Array the spotter information |
| 1398 | 1398 | * |
| 1399 | 1399 | */ |
| 1400 | - public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
|
| 1400 | + public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array()) |
|
| 1401 | 1401 | { |
| 1402 | 1402 | global $global_query; |
| 1403 | 1403 | |
@@ -1406,7 +1406,7 @@ discard block |
||
| 1406 | 1406 | $query_values = array(); |
| 1407 | 1407 | $limit_query = ''; |
| 1408 | 1408 | $additional_query = ''; |
| 1409 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1409 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1410 | 1410 | |
| 1411 | 1411 | if ($airline != "") |
| 1412 | 1412 | { |
@@ -1423,8 +1423,8 @@ discard block |
||
| 1423 | 1423 | { |
| 1424 | 1424 | $limit_array = explode(",", $limit); |
| 1425 | 1425 | |
| 1426 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1427 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1426 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1427 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1428 | 1428 | |
| 1429 | 1429 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1430 | 1430 | { |
@@ -1454,7 +1454,7 @@ discard block |
||
| 1454 | 1454 | * @return Array the spotter information |
| 1455 | 1455 | * |
| 1456 | 1456 | */ |
| 1457 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
| 1457 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
| 1458 | 1458 | { |
| 1459 | 1459 | global $global_query; |
| 1460 | 1460 | |
@@ -1462,7 +1462,7 @@ discard block |
||
| 1462 | 1462 | $query_values = array(); |
| 1463 | 1463 | $limit_query = ''; |
| 1464 | 1464 | $additional_query = ''; |
| 1465 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1465 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1466 | 1466 | |
| 1467 | 1467 | if ($airport != "") |
| 1468 | 1468 | { |
@@ -1479,8 +1479,8 @@ discard block |
||
| 1479 | 1479 | { |
| 1480 | 1480 | $limit_array = explode(",", $limit); |
| 1481 | 1481 | |
| 1482 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1483 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1482 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1483 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1484 | 1484 | |
| 1485 | 1485 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1486 | 1486 | { |
@@ -1512,7 +1512,7 @@ discard block |
||
| 1512 | 1512 | * @return Array the spotter information |
| 1513 | 1513 | * |
| 1514 | 1514 | */ |
| 1515 | - public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
| 1515 | + public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
| 1516 | 1516 | { |
| 1517 | 1517 | global $global_query, $globalTimezone, $globalDBdriver; |
| 1518 | 1518 | |
@@ -1520,7 +1520,7 @@ discard block |
||
| 1520 | 1520 | $limit_query = ''; |
| 1521 | 1521 | $additional_query = ''; |
| 1522 | 1522 | |
| 1523 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1523 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1524 | 1524 | |
| 1525 | 1525 | if ($date != "") |
| 1526 | 1526 | { |
@@ -1549,8 +1549,8 @@ discard block |
||
| 1549 | 1549 | { |
| 1550 | 1550 | $limit_array = explode(",", $limit); |
| 1551 | 1551 | |
| 1552 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1553 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1552 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1553 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1554 | 1554 | |
| 1555 | 1555 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1556 | 1556 | { |
@@ -1580,7 +1580,7 @@ discard block |
||
| 1580 | 1580 | * @return Array the spotter information |
| 1581 | 1581 | * |
| 1582 | 1582 | */ |
| 1583 | - public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
|
| 1583 | + public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array()) |
|
| 1584 | 1584 | { |
| 1585 | 1585 | global $global_query; |
| 1586 | 1586 | |
@@ -1589,7 +1589,7 @@ discard block |
||
| 1589 | 1589 | $query_values = array(); |
| 1590 | 1590 | $limit_query = ''; |
| 1591 | 1591 | $additional_query = ''; |
| 1592 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1592 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1593 | 1593 | if ($country != "") |
| 1594 | 1594 | { |
| 1595 | 1595 | if (!is_string($country)) |
@@ -1606,8 +1606,8 @@ discard block |
||
| 1606 | 1606 | { |
| 1607 | 1607 | $limit_array = explode(",", $limit); |
| 1608 | 1608 | |
| 1609 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1610 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1609 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1610 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1611 | 1611 | |
| 1612 | 1612 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1613 | 1613 | { |
@@ -1647,7 +1647,7 @@ discard block |
||
| 1647 | 1647 | $query_values = array(); |
| 1648 | 1648 | $additional_query = ''; |
| 1649 | 1649 | $limit_query = ''; |
| 1650 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1650 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1651 | 1651 | |
| 1652 | 1652 | if ($aircraft_manufacturer != "") |
| 1653 | 1653 | { |
@@ -1664,8 +1664,8 @@ discard block |
||
| 1664 | 1664 | { |
| 1665 | 1665 | $limit_array = explode(",", $limit); |
| 1666 | 1666 | |
| 1667 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1668 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1667 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1668 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1669 | 1669 | |
| 1670 | 1670 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1671 | 1671 | { |
@@ -1707,14 +1707,14 @@ discard block |
||
| 1707 | 1707 | $query_values = array(); |
| 1708 | 1708 | $additional_query = ''; |
| 1709 | 1709 | $limit_query = ''; |
| 1710 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1710 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1711 | 1711 | if ($departure_airport_icao != "") |
| 1712 | 1712 | { |
| 1713 | 1713 | if (!is_string($departure_airport_icao)) |
| 1714 | 1714 | { |
| 1715 | 1715 | return false; |
| 1716 | 1716 | } else { |
| 1717 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1717 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1718 | 1718 | $additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)"; |
| 1719 | 1719 | //$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao AND spotter_output.real_departure_airport_icao IS NULL) OR spotter_output.real_departure_airport_icao = :departure_airport_icao"; |
| 1720 | 1720 | $query_values = array(':departure_airport_icao' => $departure_airport_icao); |
@@ -1727,10 +1727,10 @@ discard block |
||
| 1727 | 1727 | { |
| 1728 | 1728 | return false; |
| 1729 | 1729 | } else { |
| 1730 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1730 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1731 | 1731 | $additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)"; |
| 1732 | 1732 | //$additional_query .= " AND ((spotter_output.arrival_airport_icao = :arrival_airport_icao AND spotter_output.real_arrival_airport_icao IS NULL) OR spotter_output.real_arrival_airport_icao = :arrival_airport_icao)"; |
| 1733 | - $query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 1733 | + $query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 1734 | 1734 | } |
| 1735 | 1735 | } |
| 1736 | 1736 | |
@@ -1738,8 +1738,8 @@ discard block |
||
| 1738 | 1738 | { |
| 1739 | 1739 | $limit_array = explode(",", $limit); |
| 1740 | 1740 | |
| 1741 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1742 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1741 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1742 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1743 | 1743 | |
| 1744 | 1744 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1745 | 1745 | { |
@@ -1778,15 +1778,15 @@ discard block |
||
| 1778 | 1778 | global $global_query; |
| 1779 | 1779 | |
| 1780 | 1780 | date_default_timezone_set('UTC'); |
| 1781 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1781 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1782 | 1782 | $limit_query = ''; |
| 1783 | 1783 | |
| 1784 | 1784 | if ($limit != "") |
| 1785 | 1785 | { |
| 1786 | 1786 | $limit_array = explode(",", $limit); |
| 1787 | 1787 | |
| 1788 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1789 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1788 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1789 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1790 | 1790 | |
| 1791 | 1791 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1792 | 1792 | { |
@@ -1803,7 +1803,7 @@ discard block |
||
| 1803 | 1803 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1804 | 1804 | } |
| 1805 | 1805 | |
| 1806 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
| 1806 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
| 1807 | 1807 | |
| 1808 | 1808 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1809 | 1809 | |
@@ -1816,19 +1816,19 @@ discard block |
||
| 1816 | 1816 | * @return String the highlight text |
| 1817 | 1817 | * |
| 1818 | 1818 | */ |
| 1819 | - public function getHighlightByRegistration($registration,$filter = array()) |
|
| 1819 | + public function getHighlightByRegistration($registration, $filter = array()) |
|
| 1820 | 1820 | { |
| 1821 | 1821 | global $global_query; |
| 1822 | 1822 | |
| 1823 | 1823 | date_default_timezone_set('UTC'); |
| 1824 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1825 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 1824 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1825 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 1826 | 1826 | |
| 1827 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
| 1827 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
| 1828 | 1828 | $sth = $this->db->prepare($query); |
| 1829 | 1829 | $sth->execute(array(':registration' => $registration)); |
| 1830 | 1830 | |
| 1831 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1831 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1832 | 1832 | { |
| 1833 | 1833 | $highlight = $row['highlight']; |
| 1834 | 1834 | } |
@@ -1844,14 +1844,14 @@ discard block |
||
| 1844 | 1844 | * @return String usage |
| 1845 | 1845 | * |
| 1846 | 1846 | */ |
| 1847 | - public function getSquawkUsage($squawk = '',$country = 'FR') |
|
| 1847 | + public function getSquawkUsage($squawk = '', $country = 'FR') |
|
| 1848 | 1848 | { |
| 1849 | 1849 | |
| 1850 | - $squawk = filter_var($squawk,FILTER_SANITIZE_STRING); |
|
| 1851 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 1850 | + $squawk = filter_var($squawk, FILTER_SANITIZE_STRING); |
|
| 1851 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 1852 | 1852 | |
| 1853 | 1853 | $query = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1"; |
| 1854 | - $query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country); |
|
| 1854 | + $query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country); |
|
| 1855 | 1855 | |
| 1856 | 1856 | $sth = $this->db->prepare($query); |
| 1857 | 1857 | $sth->execute($query_values); |
@@ -1873,9 +1873,9 @@ discard block |
||
| 1873 | 1873 | public function getAirportIcao($airport_iata = '') |
| 1874 | 1874 | { |
| 1875 | 1875 | |
| 1876 | - $airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING); |
|
| 1876 | + $airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING); |
|
| 1877 | 1877 | |
| 1878 | - $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
| 1878 | + $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
| 1879 | 1879 | $query_values = array(':airport' => $airport_iata); |
| 1880 | 1880 | |
| 1881 | 1881 | $sth = $this->db->prepare($query); |
@@ -1897,12 +1897,12 @@ discard block |
||
| 1897 | 1897 | * @return Float distance to the airport |
| 1898 | 1898 | * |
| 1899 | 1899 | */ |
| 1900 | - public function getAirportDistance($airport_icao,$latitude,$longitude) |
|
| 1900 | + public function getAirportDistance($airport_icao, $latitude, $longitude) |
|
| 1901 | 1901 | { |
| 1902 | 1902 | |
| 1903 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 1903 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 1904 | 1904 | |
| 1905 | - $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
| 1905 | + $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
| 1906 | 1906 | $query_values = array(':airport' => $airport_icao); |
| 1907 | 1907 | $sth = $this->db->prepare($query); |
| 1908 | 1908 | $sth->execute($query_values); |
@@ -1912,7 +1912,7 @@ discard block |
||
| 1912 | 1912 | $airport_latitude = $row['latitude']; |
| 1913 | 1913 | $airport_longitude = $row['longitude']; |
| 1914 | 1914 | $Common = new Common(); |
| 1915 | - return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
|
| 1915 | + return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude); |
|
| 1916 | 1916 | } else return ''; |
| 1917 | 1917 | } |
| 1918 | 1918 | |
@@ -1926,11 +1926,11 @@ discard block |
||
| 1926 | 1926 | public function getAllAirportInfo($airport = '') |
| 1927 | 1927 | { |
| 1928 | 1928 | |
| 1929 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 1929 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 1930 | 1930 | |
| 1931 | 1931 | $query_values = array(); |
| 1932 | 1932 | if ($airport == 'NA') { |
| 1933 | - return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => '')); |
|
| 1933 | + return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => '')); |
|
| 1934 | 1934 | } elseif ($airport == '') { |
| 1935 | 1935 | $query = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport"; |
| 1936 | 1936 | } else { |
@@ -1978,14 +1978,14 @@ discard block |
||
| 1978 | 1978 | { |
| 1979 | 1979 | $lst_countries = ''; |
| 1980 | 1980 | foreach ($countries as $country) { |
| 1981 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 1981 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 1982 | 1982 | if ($lst_countries == '') { |
| 1983 | 1983 | $lst_countries = "'".$country."'"; |
| 1984 | 1984 | } else { |
| 1985 | 1985 | $lst_countries .= ",'".$country."'"; |
| 1986 | 1986 | } |
| 1987 | 1987 | } |
| 1988 | - $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
| 1988 | + $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
| 1989 | 1989 | |
| 1990 | 1990 | $sth = $this->db->prepare($query); |
| 1991 | 1991 | $sth->execute(); |
@@ -1993,7 +1993,7 @@ discard block |
||
| 1993 | 1993 | $airport_array = array(); |
| 1994 | 1994 | $temp_array = array(); |
| 1995 | 1995 | |
| 1996 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1996 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1997 | 1997 | { |
| 1998 | 1998 | $temp_array['name'] = $row['name']; |
| 1999 | 1999 | $temp_array['city'] = $row['city']; |
@@ -2021,10 +2021,10 @@ discard block |
||
| 2021 | 2021 | { |
| 2022 | 2022 | global $globalDBdriver; |
| 2023 | 2023 | if (is_array($coord)) { |
| 2024 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2025 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2026 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2027 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2024 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2025 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2026 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2027 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2028 | 2028 | } else return array(); |
| 2029 | 2029 | if ($globalDBdriver == 'mysql') { |
| 2030 | 2030 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
@@ -2036,7 +2036,7 @@ discard block |
||
| 2036 | 2036 | |
| 2037 | 2037 | $airport_array = array(); |
| 2038 | 2038 | |
| 2039 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2039 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2040 | 2040 | { |
| 2041 | 2041 | $temp_array = $row; |
| 2042 | 2042 | |
@@ -2056,13 +2056,13 @@ discard block |
||
| 2056 | 2056 | public function getAllWaypointsInfobyCoord($coord) |
| 2057 | 2057 | { |
| 2058 | 2058 | if (is_array($coord)) { |
| 2059 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2060 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2061 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2062 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2059 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2060 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2061 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2062 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2063 | 2063 | } else return array(); |
| 2064 | 2064 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2065 | - $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 2065 | + $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 2066 | 2066 | //$query = "SELECT waypoints.* FROM waypoints"; |
| 2067 | 2067 | //$query = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end"; |
| 2068 | 2068 | //$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
@@ -2074,7 +2074,7 @@ discard block |
||
| 2074 | 2074 | |
| 2075 | 2075 | $waypoints_array = array(); |
| 2076 | 2076 | |
| 2077 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2077 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2078 | 2078 | { |
| 2079 | 2079 | $temp_array = $row; |
| 2080 | 2080 | |
@@ -2096,10 +2096,10 @@ discard block |
||
| 2096 | 2096 | { |
| 2097 | 2097 | global $globalUseRealAirlines; |
| 2098 | 2098 | if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
| 2099 | - $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
|
| 2099 | + $airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING)); |
|
| 2100 | 2100 | if ($airline_icao == 'NA') { |
| 2101 | 2101 | $airline_array = array(); |
| 2102 | - $airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
| 2102 | + $airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
| 2103 | 2103 | return $airline_array; |
| 2104 | 2104 | } else { |
| 2105 | 2105 | if (strlen($airline_icao) == 2) { |
@@ -2120,7 +2120,7 @@ discard block |
||
| 2120 | 2120 | if ($fromsource === NULL) { |
| 2121 | 2121 | $sth->execute(array(':airline_icao' => $airline_icao)); |
| 2122 | 2122 | } else { |
| 2123 | - $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
|
| 2123 | + $sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource)); |
|
| 2124 | 2124 | } |
| 2125 | 2125 | /* |
| 2126 | 2126 | $airline_array = array(); |
@@ -2162,13 +2162,13 @@ discard block |
||
| 2162 | 2162 | { |
| 2163 | 2163 | global $globalUseRealAirlines; |
| 2164 | 2164 | if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
| 2165 | - $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
|
| 2166 | - $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
|
| 2165 | + $airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING)); |
|
| 2166 | + $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
|
| 2167 | 2167 | $sth = $this->db->prepare($query); |
| 2168 | 2168 | if ($fromsource === NULL) { |
| 2169 | 2169 | $sth->execute(array(':airline_name' => $airline_name)); |
| 2170 | 2170 | } else { |
| 2171 | - $sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource)); |
|
| 2171 | + $sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource)); |
|
| 2172 | 2172 | } |
| 2173 | 2173 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2174 | 2174 | if (empty($result) && $fromsource !== NULL) { |
@@ -2193,12 +2193,12 @@ discard block |
||
| 2193 | 2193 | */ |
| 2194 | 2194 | public function getAllAircraftInfo($aircraft_type) |
| 2195 | 2195 | { |
| 2196 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
| 2196 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
| 2197 | 2197 | |
| 2198 | 2198 | if ($aircraft_type == 'NA') { |
| 2199 | - return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
| 2199 | + return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
| 2200 | 2200 | } |
| 2201 | - $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
| 2201 | + $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
| 2202 | 2202 | |
| 2203 | 2203 | $sth = $this->db->prepare($query); |
| 2204 | 2204 | $sth->execute(array(':aircraft_type' => $aircraft_type)); |
@@ -2230,7 +2230,7 @@ discard block |
||
| 2230 | 2230 | */ |
| 2231 | 2231 | public function getAircraftIcao($aircraft_type) |
| 2232 | 2232 | { |
| 2233 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
| 2233 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
| 2234 | 2234 | $all_aircraft = array('737-300' => 'B733', |
| 2235 | 2235 | '777-200' => 'B772', |
| 2236 | 2236 | '777-200ER' => 'B772', |
@@ -2242,10 +2242,10 @@ discard block |
||
| 2242 | 2242 | 'A380' => 'A388'); |
| 2243 | 2243 | if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
| 2244 | 2244 | |
| 2245 | - $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
| 2245 | + $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
| 2246 | 2246 | $aircraft_type = strtoupper($aircraft_type); |
| 2247 | 2247 | $sth = $this->db->prepare($query); |
| 2248 | - $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
|
| 2248 | + $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,)); |
|
| 2249 | 2249 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2250 | 2250 | if (isset($result[0]['icao'])) return $result[0]['icao']; |
| 2251 | 2251 | else return ''; |
@@ -2260,9 +2260,9 @@ discard block |
||
| 2260 | 2260 | */ |
| 2261 | 2261 | public function getAllAircraftType($aircraft_modes) |
| 2262 | 2262 | { |
| 2263 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 2263 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 2264 | 2264 | |
| 2265 | - $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2265 | + $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2266 | 2266 | |
| 2267 | 2267 | $sth = $this->db->prepare($query); |
| 2268 | 2268 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -2285,9 +2285,9 @@ discard block |
||
| 2285 | 2285 | */ |
| 2286 | 2286 | public function getAllAircraftTypeByRegistration($registration) |
| 2287 | 2287 | { |
| 2288 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2288 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2289 | 2289 | |
| 2290 | - $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2290 | + $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2291 | 2291 | |
| 2292 | 2292 | $sth = $this->db->prepare($query); |
| 2293 | 2293 | $sth->execute(array(':registration' => $registration)); |
@@ -2308,9 +2308,9 @@ discard block |
||
| 2308 | 2308 | */ |
| 2309 | 2309 | public function getAllIDByRegistration($registration) |
| 2310 | 2310 | { |
| 2311 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2311 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2312 | 2312 | |
| 2313 | - $query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2313 | + $query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2314 | 2314 | |
| 2315 | 2315 | $sth = $this->db->prepare($query); |
| 2316 | 2316 | $sth->execute(array(':registration' => $registration)); |
@@ -2318,7 +2318,7 @@ discard block |
||
| 2318 | 2318 | $idarray = array(); |
| 2319 | 2319 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 2320 | 2320 | $date = $row['date']; |
| 2321 | - $idarray[$date] = array('flightaware_id' => $row['flightaware_id'],'spotter_id' => $row['spotter_id']); |
|
| 2321 | + $idarray[$date] = array('flightaware_id' => $row['flightaware_id'], 'spotter_id' => $row['spotter_id']); |
|
| 2322 | 2322 | } |
| 2323 | 2323 | return $idarray; |
| 2324 | 2324 | } |
@@ -2332,8 +2332,8 @@ discard block |
||
| 2332 | 2332 | */ |
| 2333 | 2333 | public function getOperator($operator) |
| 2334 | 2334 | { |
| 2335 | - $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
|
| 2336 | - $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
| 2335 | + $operator = filter_var($operator, FILTER_SANITIZE_STRING); |
|
| 2336 | + $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
| 2337 | 2337 | |
| 2338 | 2338 | $sth = $this->db->prepare($query); |
| 2339 | 2339 | $sth->execute(array(':operator' => $operator)); |
@@ -2354,9 +2354,9 @@ discard block |
||
| 2354 | 2354 | */ |
| 2355 | 2355 | public function getRouteInfo($callsign) |
| 2356 | 2356 | { |
| 2357 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 2357 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 2358 | 2358 | if ($callsign == '') return array(); |
| 2359 | - $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"; |
|
| 2359 | + $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"; |
|
| 2360 | 2360 | |
| 2361 | 2361 | $sth = $this->db->prepare($query); |
| 2362 | 2362 | $sth->execute(array(':callsign' => $callsign)); |
@@ -2377,9 +2377,9 @@ discard block |
||
| 2377 | 2377 | */ |
| 2378 | 2378 | public function getAircraftInfoByRegistration($registration) |
| 2379 | 2379 | { |
| 2380 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2380 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2381 | 2381 | |
| 2382 | - $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2382 | + $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2383 | 2383 | |
| 2384 | 2384 | $sth = $this->db->prepare($query); |
| 2385 | 2385 | $sth->execute(array(':registration' => $registration)); |
@@ -2387,7 +2387,7 @@ discard block |
||
| 2387 | 2387 | $aircraft_array = array(); |
| 2388 | 2388 | $temp_array = array(); |
| 2389 | 2389 | |
| 2390 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2390 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2391 | 2391 | { |
| 2392 | 2392 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 2393 | 2393 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -2409,7 +2409,7 @@ discard block |
||
| 2409 | 2409 | */ |
| 2410 | 2410 | public function getAircraftOwnerByRegistration($registration) |
| 2411 | 2411 | { |
| 2412 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2412 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2413 | 2413 | $Connection = new Connection($this->db); |
| 2414 | 2414 | if ($Connection->tableExists('aircraft_owner')) { |
| 2415 | 2415 | $query = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1"; |
@@ -2431,7 +2431,7 @@ discard block |
||
| 2431 | 2431 | public function getAllFlightsforSitemap() |
| 2432 | 2432 | { |
| 2433 | 2433 | //$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 "; |
| 2434 | - $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
| 2434 | + $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
| 2435 | 2435 | |
| 2436 | 2436 | $sth = $this->db->prepare($query); |
| 2437 | 2437 | $sth->execute(); |
@@ -2478,7 +2478,7 @@ discard block |
||
| 2478 | 2478 | $manufacturer_array = array(); |
| 2479 | 2479 | $temp_array = array(); |
| 2480 | 2480 | |
| 2481 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2481 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2482 | 2482 | { |
| 2483 | 2483 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 2484 | 2484 | |
@@ -2515,7 +2515,7 @@ discard block |
||
| 2515 | 2515 | $aircraft_array = array(); |
| 2516 | 2516 | $temp_array = array(); |
| 2517 | 2517 | |
| 2518 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2518 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2519 | 2519 | { |
| 2520 | 2520 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 2521 | 2521 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
@@ -2536,8 +2536,8 @@ discard block |
||
| 2536 | 2536 | */ |
| 2537 | 2537 | public function getAllAircraftRegistrations($filters = array()) |
| 2538 | 2538 | { |
| 2539 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2540 | - $query = "SELECT DISTINCT spotter_output.registration |
|
| 2539 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2540 | + $query = "SELECT DISTINCT spotter_output.registration |
|
| 2541 | 2541 | FROM spotter_output".$filter_query." spotter_output.registration <> '' |
| 2542 | 2542 | ORDER BY spotter_output.registration ASC"; |
| 2543 | 2543 | |
@@ -2547,7 +2547,7 @@ discard block |
||
| 2547 | 2547 | $aircraft_array = array(); |
| 2548 | 2548 | $temp_array = array(); |
| 2549 | 2549 | |
| 2550 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2550 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2551 | 2551 | { |
| 2552 | 2552 | $temp_array['registration'] = $row['registration']; |
| 2553 | 2553 | |
@@ -2564,11 +2564,11 @@ discard block |
||
| 2564 | 2564 | * @return Array list of source name |
| 2565 | 2565 | * |
| 2566 | 2566 | */ |
| 2567 | - public function getAllSourceName($type = '',$filters = array()) |
|
| 2567 | + public function getAllSourceName($type = '', $filters = array()) |
|
| 2568 | 2568 | { |
| 2569 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2569 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2570 | 2570 | $query_values = array(); |
| 2571 | - $query = "SELECT DISTINCT spotter_output.source_name |
|
| 2571 | + $query = "SELECT DISTINCT spotter_output.source_name |
|
| 2572 | 2572 | FROM spotter_output".$filter_query." spotter_output.source_name <> ''"; |
| 2573 | 2573 | if ($type != '') { |
| 2574 | 2574 | $query_values = array(':type' => $type); |
@@ -2583,7 +2583,7 @@ discard block |
||
| 2583 | 2583 | $source_array = array(); |
| 2584 | 2584 | $temp_array = array(); |
| 2585 | 2585 | |
| 2586 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2586 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2587 | 2587 | { |
| 2588 | 2588 | $temp_array['source_name'] = $row['source_name']; |
| 2589 | 2589 | $source_array[] = $temp_array; |
@@ -2599,11 +2599,11 @@ discard block |
||
| 2599 | 2599 | * @return Array list of airline names |
| 2600 | 2600 | * |
| 2601 | 2601 | */ |
| 2602 | - public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
|
| 2602 | + public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array()) |
|
| 2603 | 2603 | { |
| 2604 | - global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
|
| 2605 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2606 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
| 2604 | + global $globalAirlinesSource, $globalVATSIM, $globalIVAO; |
|
| 2605 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2606 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
| 2607 | 2607 | if ($airline_type == '' || $airline_type == 'all') { |
| 2608 | 2608 | /* |
| 2609 | 2609 | $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
@@ -2622,7 +2622,7 @@ discard block |
||
| 2622 | 2622 | $query_data = array(':forsource' => $forsource); |
| 2623 | 2623 | } |
| 2624 | 2624 | } else { |
| 2625 | - $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
| 2625 | + $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
| 2626 | 2626 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 2627 | 2627 | AND spotter_output.airline_type = :airline_type |
| 2628 | 2628 | ORDER BY spotter_output.airline_icao ASC"; |
@@ -2635,7 +2635,7 @@ discard block |
||
| 2635 | 2635 | $airline_array = array(); |
| 2636 | 2636 | $temp_array = array(); |
| 2637 | 2637 | |
| 2638 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2638 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2639 | 2639 | { |
| 2640 | 2640 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 2641 | 2641 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -2652,10 +2652,10 @@ discard block |
||
| 2652 | 2652 | * @return Array list of alliance names |
| 2653 | 2653 | * |
| 2654 | 2654 | */ |
| 2655 | - public function getAllAllianceNames($forsource = NULL,$filters = array()) |
|
| 2655 | + public function getAllAllianceNames($forsource = NULL, $filters = array()) |
|
| 2656 | 2656 | { |
| 2657 | - global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
|
| 2658 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2657 | + global $globalAirlinesSource, $globalVATSIM, $globalIVAO; |
|
| 2658 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2659 | 2659 | if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
| 2660 | 2660 | elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
| 2661 | 2661 | elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
@@ -2683,8 +2683,8 @@ discard block |
||
| 2683 | 2683 | */ |
| 2684 | 2684 | public function getAllAirlineCountries($filters = array()) |
| 2685 | 2685 | { |
| 2686 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2687 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2686 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2687 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2688 | 2688 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
| 2689 | 2689 | ORDER BY spotter_output.airline_country ASC"; |
| 2690 | 2690 | |
@@ -2695,7 +2695,7 @@ discard block |
||
| 2695 | 2695 | $airline_array = array(); |
| 2696 | 2696 | $temp_array = array(); |
| 2697 | 2697 | |
| 2698 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2698 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2699 | 2699 | { |
| 2700 | 2700 | $temp_array['airline_country'] = $row['airline_country']; |
| 2701 | 2701 | |
@@ -2715,9 +2715,9 @@ discard block |
||
| 2715 | 2715 | */ |
| 2716 | 2716 | public function getAllAirportNames($filters = array()) |
| 2717 | 2717 | { |
| 2718 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2718 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2719 | 2719 | $airport_array = array(); |
| 2720 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
| 2720 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
| 2721 | 2721 | FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' |
| 2722 | 2722 | ORDER BY spotter_output.departure_airport_city ASC"; |
| 2723 | 2723 | |
@@ -2726,7 +2726,7 @@ discard block |
||
| 2726 | 2726 | $sth->execute(); |
| 2727 | 2727 | |
| 2728 | 2728 | $temp_array = array(); |
| 2729 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2729 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2730 | 2730 | { |
| 2731 | 2731 | $temp_array['airport_icao'] = $row['airport_icao']; |
| 2732 | 2732 | $temp_array['airport_name'] = $row['airport_name']; |
@@ -2736,14 +2736,14 @@ discard block |
||
| 2736 | 2736 | $airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array; |
| 2737 | 2737 | } |
| 2738 | 2738 | |
| 2739 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
| 2739 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
| 2740 | 2740 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' |
| 2741 | 2741 | ORDER BY spotter_output.arrival_airport_city ASC"; |
| 2742 | 2742 | |
| 2743 | 2743 | $sth = $this->db->prepare($query); |
| 2744 | 2744 | $sth->execute(); |
| 2745 | 2745 | |
| 2746 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2746 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2747 | 2747 | { |
| 2748 | 2748 | // if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao']) |
| 2749 | 2749 | // { |
@@ -2783,21 +2783,21 @@ discard block |
||
| 2783 | 2783 | |
| 2784 | 2784 | $temp_array = array(); |
| 2785 | 2785 | |
| 2786 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2786 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2787 | 2787 | { |
| 2788 | 2788 | $temp_array['airport_country'] = $row['airport_country']; |
| 2789 | 2789 | |
| 2790 | 2790 | $airport_array[$row['airport_country']] = $temp_array; |
| 2791 | 2791 | } |
| 2792 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2793 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2792 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2793 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2794 | 2794 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
| 2795 | 2795 | ORDER BY spotter_output.arrival_airport_country ASC"; |
| 2796 | 2796 | |
| 2797 | 2797 | $sth = $this->db->prepare($query); |
| 2798 | 2798 | $sth->execute(); |
| 2799 | 2799 | |
| 2800 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2800 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2801 | 2801 | { |
| 2802 | 2802 | if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country']) |
| 2803 | 2803 | { |
@@ -2820,9 +2820,9 @@ discard block |
||
| 2820 | 2820 | */ |
| 2821 | 2821 | public function getAllCountries($filters = array()) |
| 2822 | 2822 | { |
| 2823 | - $Connection= new Connection($this->db); |
|
| 2823 | + $Connection = new Connection($this->db); |
|
| 2824 | 2824 | if ($Connection->tableExists('countries')) { |
| 2825 | - $query = "SELECT countries.name AS airport_country |
|
| 2825 | + $query = "SELECT countries.name AS airport_country |
|
| 2826 | 2826 | FROM countries |
| 2827 | 2827 | ORDER BY countries.name ASC"; |
| 2828 | 2828 | $sth = $this->db->prepare($query); |
@@ -2831,14 +2831,14 @@ discard block |
||
| 2831 | 2831 | $temp_array = array(); |
| 2832 | 2832 | $country_array = array(); |
| 2833 | 2833 | |
| 2834 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2834 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2835 | 2835 | { |
| 2836 | 2836 | $temp_array['country'] = $row['airport_country']; |
| 2837 | 2837 | $country_array[$row['airport_country']] = $temp_array; |
| 2838 | 2838 | } |
| 2839 | 2839 | } else { |
| 2840 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2841 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
| 2840 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2841 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
| 2842 | 2842 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' |
| 2843 | 2843 | ORDER BY spotter_output.departure_airport_country ASC"; |
| 2844 | 2844 | |
@@ -2847,20 +2847,20 @@ discard block |
||
| 2847 | 2847 | |
| 2848 | 2848 | $temp_array = array(); |
| 2849 | 2849 | $country_array = array(); |
| 2850 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2850 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2851 | 2851 | { |
| 2852 | 2852 | $temp_array['country'] = $row['airport_country']; |
| 2853 | 2853 | $country_array[$row['airport_country']] = $temp_array; |
| 2854 | 2854 | } |
| 2855 | 2855 | |
| 2856 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2856 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2857 | 2857 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
| 2858 | 2858 | ORDER BY spotter_output.arrival_airport_country ASC"; |
| 2859 | 2859 | |
| 2860 | 2860 | $sth = $this->db->prepare($query); |
| 2861 | 2861 | $sth->execute(); |
| 2862 | 2862 | |
| 2863 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2863 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2864 | 2864 | { |
| 2865 | 2865 | if ($country_array[$row['airport_country']]['country'] != $row['airport_country']) |
| 2866 | 2866 | { |
@@ -2870,14 +2870,14 @@ discard block |
||
| 2870 | 2870 | } |
| 2871 | 2871 | } |
| 2872 | 2872 | |
| 2873 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2873 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2874 | 2874 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
| 2875 | 2875 | ORDER BY spotter_output.airline_country ASC"; |
| 2876 | 2876 | |
| 2877 | 2877 | $sth = $this->db->prepare($query); |
| 2878 | 2878 | $sth->execute(); |
| 2879 | 2879 | |
| 2880 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2880 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2881 | 2881 | { |
| 2882 | 2882 | if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country']) |
| 2883 | 2883 | { |
@@ -2901,8 +2901,8 @@ discard block |
||
| 2901 | 2901 | */ |
| 2902 | 2902 | public function getAllIdents($filters = array()) |
| 2903 | 2903 | { |
| 2904 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2905 | - $query = "SELECT DISTINCT spotter_output.ident |
|
| 2904 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2905 | + $query = "SELECT DISTINCT spotter_output.ident |
|
| 2906 | 2906 | FROM spotter_output".$filter_query." spotter_output.ident <> '' |
| 2907 | 2907 | ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0"; |
| 2908 | 2908 | |
@@ -2912,7 +2912,7 @@ discard block |
||
| 2912 | 2912 | $ident_array = array(); |
| 2913 | 2913 | $temp_array = array(); |
| 2914 | 2914 | |
| 2915 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2915 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2916 | 2916 | { |
| 2917 | 2917 | $temp_array['ident'] = $row['ident']; |
| 2918 | 2918 | $ident_array[] = $temp_array; |
@@ -2926,9 +2926,9 @@ discard block |
||
| 2926 | 2926 | * @return Array number, icao, name and city of airports |
| 2927 | 2927 | */ |
| 2928 | 2928 | |
| 2929 | - public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
|
| 2929 | + public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) { |
|
| 2930 | 2930 | global $globalTimezone, $globalDBdriver; |
| 2931 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2931 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2932 | 2932 | if ($globalTimezone != '') { |
| 2933 | 2933 | date_default_timezone_set($globalTimezone); |
| 2934 | 2934 | $datetime = new DateTime(); |
@@ -2993,7 +2993,7 @@ discard block |
||
| 2993 | 2993 | |
| 2994 | 2994 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
| 2995 | 2995 | global $globalTimezone, $globalDBdriver; |
| 2996 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2996 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2997 | 2997 | if ($globalTimezone != '') { |
| 2998 | 2998 | date_default_timezone_set($globalTimezone); |
| 2999 | 2999 | $datetime = new DateTime(); |
@@ -3077,7 +3077,7 @@ discard block |
||
| 3077 | 3077 | |
| 3078 | 3078 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
| 3079 | 3079 | global $globalTimezone, $globalDBdriver; |
| 3080 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3080 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3081 | 3081 | if ($globalTimezone != '') { |
| 3082 | 3082 | date_default_timezone_set($globalTimezone); |
| 3083 | 3083 | $datetime = new DateTime(); |
@@ -3110,9 +3110,9 @@ discard block |
||
| 3110 | 3110 | * @return Array number, icao, name and city of airports |
| 3111 | 3111 | */ |
| 3112 | 3112 | |
| 3113 | - public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
|
| 3113 | + public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) { |
|
| 3114 | 3114 | global $globalTimezone, $globalDBdriver; |
| 3115 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3115 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3116 | 3116 | if ($globalTimezone != '') { |
| 3117 | 3117 | date_default_timezone_set($globalTimezone); |
| 3118 | 3118 | $datetime = new DateTime(); |
@@ -3244,12 +3244,12 @@ discard block |
||
| 3244 | 3244 | } else $offset = '+00:00'; |
| 3245 | 3245 | |
| 3246 | 3246 | if ($globalDBdriver == 'mysql') { |
| 3247 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
| 3247 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
| 3248 | 3248 | FROM spotter_output |
| 3249 | 3249 | WHERE spotter_output.date <> '' |
| 3250 | 3250 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
| 3251 | 3251 | } else { |
| 3252 | - $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 3252 | + $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 3253 | 3253 | FROM spotter_output |
| 3254 | 3254 | WHERE spotter_output.date <> '' |
| 3255 | 3255 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
@@ -3261,7 +3261,7 @@ discard block |
||
| 3261 | 3261 | $date_array = array(); |
| 3262 | 3262 | $temp_array = array(); |
| 3263 | 3263 | |
| 3264 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3264 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3265 | 3265 | { |
| 3266 | 3266 | $temp_array['date'] = $row['date']; |
| 3267 | 3267 | |
@@ -3281,7 +3281,7 @@ discard block |
||
| 3281 | 3281 | */ |
| 3282 | 3282 | public function getAllRoutes() |
| 3283 | 3283 | { |
| 3284 | - $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 |
|
| 3284 | + $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 |
|
| 3285 | 3285 | FROM spotter_output |
| 3286 | 3286 | WHERE spotter_output.ident <> '' |
| 3287 | 3287 | GROUP BY route |
@@ -3292,7 +3292,7 @@ discard block |
||
| 3292 | 3292 | |
| 3293 | 3293 | $routes_array = array(); |
| 3294 | 3294 | $temp_array = array(); |
| 3295 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3295 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3296 | 3296 | { |
| 3297 | 3297 | $temp_array['route'] = $row['route']; |
| 3298 | 3298 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -3311,21 +3311,21 @@ discard block |
||
| 3311 | 3311 | * @return String success or false |
| 3312 | 3312 | * |
| 3313 | 3313 | */ |
| 3314 | - public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
|
| 3314 | + public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL) |
|
| 3315 | 3315 | { |
| 3316 | 3316 | if (!is_numeric(substr($ident, 0, 3))) |
| 3317 | 3317 | { |
| 3318 | 3318 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
| 3319 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
| 3319 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
| 3320 | 3320 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
| 3321 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
| 3321 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
| 3322 | 3322 | } else { |
| 3323 | 3323 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3324 | 3324 | } |
| 3325 | 3325 | if (count($airline_array) == 0) { |
| 3326 | 3326 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3327 | 3327 | } |
| 3328 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
| 3328 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
| 3329 | 3329 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3330 | 3330 | } |
| 3331 | 3331 | } else { |
@@ -3338,7 +3338,7 @@ discard block |
||
| 3338 | 3338 | |
| 3339 | 3339 | |
| 3340 | 3340 | $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'; |
| 3341 | - $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); |
|
| 3341 | + $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); |
|
| 3342 | 3342 | |
| 3343 | 3343 | try { |
| 3344 | 3344 | $sth = $this->db->prepare($query); |
@@ -3359,11 +3359,11 @@ discard block |
||
| 3359 | 3359 | * @return String success or false |
| 3360 | 3360 | * |
| 3361 | 3361 | */ |
| 3362 | - public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
|
| 3362 | + public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '') |
|
| 3363 | 3363 | { |
| 3364 | 3364 | if ($groundspeed == '') $groundspeed = NULL; |
| 3365 | 3365 | $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'; |
| 3366 | - $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); |
|
| 3366 | + $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); |
|
| 3367 | 3367 | |
| 3368 | 3368 | try { |
| 3369 | 3369 | $sth = $this->db->prepare($query); |
@@ -3403,7 +3403,7 @@ discard block |
||
| 3403 | 3403 | * @param String $verticalrate vertival rate of flight |
| 3404 | 3404 | * @return String success or false |
| 3405 | 3405 | */ |
| 3406 | - 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 = '') |
|
| 3406 | + 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 = '') |
|
| 3407 | 3407 | { |
| 3408 | 3408 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
| 3409 | 3409 | |
@@ -3427,13 +3427,13 @@ discard block |
||
| 3427 | 3427 | if ($ModeS != '') { |
| 3428 | 3428 | $timeelapsed = microtime(true); |
| 3429 | 3429 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
| 3430 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3430 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3431 | 3431 | } else { |
| 3432 | - $myhex = explode('-',$flightaware_id); |
|
| 3432 | + $myhex = explode('-', $flightaware_id); |
|
| 3433 | 3433 | if (count($myhex) > 0) { |
| 3434 | 3434 | $timeelapsed = microtime(true); |
| 3435 | 3435 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
| 3436 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3436 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3437 | 3437 | } |
| 3438 | 3438 | } |
| 3439 | 3439 | } |
@@ -3455,24 +3455,24 @@ discard block |
||
| 3455 | 3455 | { |
| 3456 | 3456 | $timeelapsed = microtime(true); |
| 3457 | 3457 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
| 3458 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
| 3458 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
| 3459 | 3459 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
| 3460 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
| 3460 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
| 3461 | 3461 | } else { |
| 3462 | 3462 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3463 | 3463 | } |
| 3464 | 3464 | if (count($airline_array) == 0) { |
| 3465 | 3465 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3466 | 3466 | } |
| 3467 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
| 3467 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
| 3468 | 3468 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3469 | 3469 | } |
| 3470 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3470 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3471 | 3471 | |
| 3472 | 3472 | } else { |
| 3473 | 3473 | $timeelapsed = microtime(true); |
| 3474 | 3474 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3475 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3475 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3476 | 3476 | } |
| 3477 | 3477 | } |
| 3478 | 3478 | } else $airline_array = array(); |
@@ -3489,27 +3489,27 @@ discard block |
||
| 3489 | 3489 | { |
| 3490 | 3490 | $timeelapsed = microtime(true); |
| 3491 | 3491 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3492 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3492 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3493 | 3493 | } else { |
| 3494 | 3494 | $timeelapsed = microtime(true); |
| 3495 | 3495 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3496 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3496 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3497 | 3497 | } |
| 3498 | 3498 | } |
| 3499 | 3499 | } else { |
| 3500 | 3500 | if ($ModeS != '') { |
| 3501 | 3501 | $timeelapsed = microtime(true); |
| 3502 | 3502 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
| 3503 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3503 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3504 | 3504 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3505 | 3505 | { |
| 3506 | 3506 | $timeelapsed = microtime(true); |
| 3507 | 3507 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3508 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3508 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3509 | 3509 | } else { |
| 3510 | 3510 | $timeelapsed = microtime(true); |
| 3511 | 3511 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3512 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3512 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3513 | 3513 | } |
| 3514 | 3514 | } |
| 3515 | 3515 | } |
@@ -3525,7 +3525,7 @@ discard block |
||
| 3525 | 3525 | } else { |
| 3526 | 3526 | $timeelapsed = microtime(true); |
| 3527 | 3527 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3528 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3528 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3529 | 3529 | } |
| 3530 | 3530 | } |
| 3531 | 3531 | |
@@ -3540,7 +3540,7 @@ discard block |
||
| 3540 | 3540 | } else { |
| 3541 | 3541 | $timeelapsed = microtime(true); |
| 3542 | 3542 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3543 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3543 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3544 | 3544 | } |
| 3545 | 3545 | } |
| 3546 | 3546 | |
@@ -3603,7 +3603,7 @@ discard block |
||
| 3603 | 3603 | { |
| 3604 | 3604 | $timeelapsed = microtime(true); |
| 3605 | 3605 | $image_array = $Image->getSpotterImage($registration); |
| 3606 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3606 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3607 | 3607 | if (!isset($image_array[0]['registration'])) |
| 3608 | 3608 | { |
| 3609 | 3609 | //echo "Add image !!!! \n"; |
@@ -3611,7 +3611,7 @@ discard block |
||
| 3611 | 3611 | } |
| 3612 | 3612 | $timeelapsed = microtime(true); |
| 3613 | 3613 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3614 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3614 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3615 | 3615 | if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
| 3616 | 3616 | } |
| 3617 | 3617 | |
@@ -3619,33 +3619,33 @@ discard block |
||
| 3619 | 3619 | { |
| 3620 | 3620 | if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
| 3621 | 3621 | else $airline_icao = ''; |
| 3622 | - $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 3622 | + $image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao); |
|
| 3623 | 3623 | if (!isset($image_array[0]['registration'])) |
| 3624 | 3624 | { |
| 3625 | 3625 | //echo "Add image !!!! \n"; |
| 3626 | - $Image->addSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 3626 | + $Image->addSpotterImage('', $aircraft_icao, $airline_icao); |
|
| 3627 | 3627 | } |
| 3628 | 3628 | } |
| 3629 | 3629 | |
| 3630 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 3631 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 3632 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 3633 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 3634 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 3635 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 3636 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3637 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3638 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
| 3639 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3640 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 3641 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3642 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
| 3643 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
| 3644 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
| 3645 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 3646 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 3647 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 3648 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
| 3630 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 3631 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 3632 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 3633 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 3634 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 3635 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 3636 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3637 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3638 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
| 3639 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3640 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 3641 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3642 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
| 3643 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
| 3644 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
| 3645 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 3646 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 3647 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 3648 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
| 3649 | 3649 | |
| 3650 | 3650 | if (count($airline_array) == 0) |
| 3651 | 3651 | { |
@@ -3673,7 +3673,7 @@ discard block |
||
| 3673 | 3673 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
| 3674 | 3674 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
| 3675 | 3675 | if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
| 3676 | - $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) |
|
| 3676 | + $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) |
|
| 3677 | 3677 | 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)"; |
| 3678 | 3678 | |
| 3679 | 3679 | $airline_name = $airline_array[0]['name']; |
@@ -3683,7 +3683,7 @@ discard block |
||
| 3683 | 3683 | if ($airline_type == '') { |
| 3684 | 3684 | $timeelapsed = microtime(true); |
| 3685 | 3685 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3686 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3686 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3687 | 3687 | } |
| 3688 | 3688 | if ($airline_type == null) $airline_type = ''; |
| 3689 | 3689 | $aircraft_type = $aircraft_array[0]['type']; |
@@ -3695,7 +3695,7 @@ discard block |
||
| 3695 | 3695 | $arrival_airport_name = $arrival_airport_array[0]['name']; |
| 3696 | 3696 | $arrival_airport_city = $arrival_airport_array[0]['city']; |
| 3697 | 3697 | $arrival_airport_country = $arrival_airport_array[0]['country']; |
| 3698 | - $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); |
|
| 3698 | + $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); |
|
| 3699 | 3699 | |
| 3700 | 3700 | try { |
| 3701 | 3701 | |
@@ -3721,13 +3721,13 @@ discard block |
||
| 3721 | 3721 | { |
| 3722 | 3722 | global $globalDBdriver, $globalTimezone; |
| 3723 | 3723 | if ($globalDBdriver == 'mysql') { |
| 3724 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3724 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3725 | 3725 | WHERE spotter_output.ident = :ident |
| 3726 | 3726 | AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 3727 | 3727 | AND spotter_output.date < UTC_TIMESTAMP()"; |
| 3728 | 3728 | $query_data = array(':ident' => $ident); |
| 3729 | 3729 | } else { |
| 3730 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3730 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3731 | 3731 | WHERE spotter_output.ident = :ident |
| 3732 | 3732 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 3733 | 3733 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -3736,8 +3736,8 @@ discard block |
||
| 3736 | 3736 | |
| 3737 | 3737 | $sth = $this->db->prepare($query); |
| 3738 | 3738 | $sth->execute($query_data); |
| 3739 | - $ident_result=''; |
|
| 3740 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3739 | + $ident_result = ''; |
|
| 3740 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3741 | 3741 | { |
| 3742 | 3742 | $ident_result = $row['ident']; |
| 3743 | 3743 | } |
@@ -3763,8 +3763,8 @@ discard block |
||
| 3763 | 3763 | return false; |
| 3764 | 3764 | } else { |
| 3765 | 3765 | $q_array = explode(" ", $q); |
| 3766 | - foreach ($q_array as $q_item){ |
|
| 3767 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 3766 | + foreach ($q_array as $q_item) { |
|
| 3767 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 3768 | 3768 | $additional_query .= " AND ("; |
| 3769 | 3769 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 3770 | 3770 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
@@ -3779,11 +3779,11 @@ discard block |
||
| 3779 | 3779 | } |
| 3780 | 3780 | } |
| 3781 | 3781 | if ($globalDBdriver == 'mysql') { |
| 3782 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3782 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3783 | 3783 | WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 3784 | 3784 | AND spotter_output.date < UTC_TIMESTAMP()"; |
| 3785 | 3785 | } else { |
| 3786 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3786 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3787 | 3787 | WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 3788 | 3788 | AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 3789 | 3789 | } |
@@ -3800,11 +3800,11 @@ discard block |
||
| 3800 | 3800 | * @return Array the airline list |
| 3801 | 3801 | * |
| 3802 | 3802 | */ |
| 3803 | - public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 3803 | + public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 3804 | 3804 | { |
| 3805 | 3805 | global $globalDBdriver; |
| 3806 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3807 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3806 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3807 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3808 | 3808 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' "; |
| 3809 | 3809 | if ($olderthanmonths > 0) { |
| 3810 | 3810 | if ($globalDBdriver == 'mysql') { |
@@ -3828,7 +3828,7 @@ discard block |
||
| 3828 | 3828 | |
| 3829 | 3829 | $airline_array = array(); |
| 3830 | 3830 | $temp_array = array(); |
| 3831 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3831 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3832 | 3832 | { |
| 3833 | 3833 | $temp_array['airline_name'] = $row['airline_name']; |
| 3834 | 3834 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3845,11 +3845,11 @@ discard block |
||
| 3845 | 3845 | * @return Array the pilots list |
| 3846 | 3846 | * |
| 3847 | 3847 | */ |
| 3848 | - public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 3848 | + public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 3849 | 3849 | { |
| 3850 | 3850 | global $globalDBdriver; |
| 3851 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3852 | - $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 3851 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3852 | + $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 3853 | 3853 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' "; |
| 3854 | 3854 | if ($olderthanmonths > 0) { |
| 3855 | 3855 | if ($globalDBdriver == 'mysql') { |
@@ -3875,7 +3875,7 @@ discard block |
||
| 3875 | 3875 | $airline_array = array(); |
| 3876 | 3876 | $temp_array = array(); |
| 3877 | 3877 | |
| 3878 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3878 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3879 | 3879 | { |
| 3880 | 3880 | $temp_array['pilot_name'] = $row['pilot_name']; |
| 3881 | 3881 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -3895,7 +3895,7 @@ discard block |
||
| 3895 | 3895 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
| 3896 | 3896 | { |
| 3897 | 3897 | global $globalDBdriver; |
| 3898 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 3898 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 3899 | 3899 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
| 3900 | 3900 | if ($olderthanmonths > 0) { |
| 3901 | 3901 | if ($globalDBdriver == 'mysql') { |
@@ -3921,7 +3921,7 @@ discard block |
||
| 3921 | 3921 | $airline_array = array(); |
| 3922 | 3922 | $temp_array = array(); |
| 3923 | 3923 | |
| 3924 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3924 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3925 | 3925 | { |
| 3926 | 3926 | $temp_array['pilot_name'] = $row['pilot_name']; |
| 3927 | 3927 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -3939,11 +3939,11 @@ discard block |
||
| 3939 | 3939 | * @return Array the pilots list |
| 3940 | 3940 | * |
| 3941 | 3941 | */ |
| 3942 | - public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 3942 | + public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 3943 | 3943 | { |
| 3944 | 3944 | global $globalDBdriver; |
| 3945 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3946 | - $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3945 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3946 | + $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3947 | 3947 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 3948 | 3948 | if ($olderthanmonths > 0) { |
| 3949 | 3949 | if ($globalDBdriver == 'mysql') { |
@@ -3969,7 +3969,7 @@ discard block |
||
| 3969 | 3969 | $airline_array = array(); |
| 3970 | 3970 | $temp_array = array(); |
| 3971 | 3971 | |
| 3972 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3972 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3973 | 3973 | { |
| 3974 | 3974 | $temp_array['owner_name'] = $row['owner_name']; |
| 3975 | 3975 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -3984,11 +3984,11 @@ discard block |
||
| 3984 | 3984 | * @return Array the pilots list |
| 3985 | 3985 | * |
| 3986 | 3986 | */ |
| 3987 | - public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 3987 | + public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 3988 | 3988 | { |
| 3989 | 3989 | global $globalDBdriver; |
| 3990 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3991 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3990 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3991 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3992 | 3992 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 3993 | 3993 | if ($olderthanmonths > 0) { |
| 3994 | 3994 | if ($globalDBdriver == 'mysql') { |
@@ -4014,7 +4014,7 @@ discard block |
||
| 4014 | 4014 | $airline_array = array(); |
| 4015 | 4015 | $temp_array = array(); |
| 4016 | 4016 | |
| 4017 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4017 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4018 | 4018 | { |
| 4019 | 4019 | $temp_array['owner_name'] = $row['owner_name']; |
| 4020 | 4020 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -4030,11 +4030,11 @@ discard block |
||
| 4030 | 4030 | * @return Array the airline list |
| 4031 | 4031 | * |
| 4032 | 4032 | */ |
| 4033 | - public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
|
| 4033 | + public function countAllAirlinesByAircraft($aircraft_icao, $filters = array()) |
|
| 4034 | 4034 | { |
| 4035 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 4036 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4037 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4035 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 4036 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4037 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4038 | 4038 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 4039 | 4039 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 4040 | 4040 | ORDER BY airline_count DESC"; |
@@ -4046,7 +4046,7 @@ discard block |
||
| 4046 | 4046 | $airline_array = array(); |
| 4047 | 4047 | $temp_array = array(); |
| 4048 | 4048 | |
| 4049 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4049 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4050 | 4050 | { |
| 4051 | 4051 | $temp_array['airline_name'] = $row['airline_name']; |
| 4052 | 4052 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4066,11 +4066,11 @@ discard block |
||
| 4066 | 4066 | * @return Array the airline country list |
| 4067 | 4067 | * |
| 4068 | 4068 | */ |
| 4069 | - public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 4069 | + public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 4070 | 4070 | { |
| 4071 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 4072 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4073 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4071 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 4072 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4073 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4074 | 4074 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 4075 | 4075 | GROUP BY spotter_output.airline_country |
| 4076 | 4076 | ORDER BY airline_country_count DESC |
@@ -4083,7 +4083,7 @@ discard block |
||
| 4083 | 4083 | $airline_country_array = array(); |
| 4084 | 4084 | $temp_array = array(); |
| 4085 | 4085 | |
| 4086 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4086 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4087 | 4087 | { |
| 4088 | 4088 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4089 | 4089 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4102,11 +4102,11 @@ discard block |
||
| 4102 | 4102 | * @return Array the airline list |
| 4103 | 4103 | * |
| 4104 | 4104 | */ |
| 4105 | - public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
|
| 4105 | + public function countAllAirlinesByAirport($airport_icao, $filters = array()) |
|
| 4106 | 4106 | { |
| 4107 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4108 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4109 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4107 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4108 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4109 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4110 | 4110 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
| 4111 | 4111 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 4112 | 4112 | ORDER BY airline_count DESC"; |
@@ -4118,7 +4118,7 @@ discard block |
||
| 4118 | 4118 | $airline_array = array(); |
| 4119 | 4119 | $temp_array = array(); |
| 4120 | 4120 | |
| 4121 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4121 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4122 | 4122 | { |
| 4123 | 4123 | $temp_array['airline_name'] = $row['airline_name']; |
| 4124 | 4124 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4137,11 +4137,11 @@ discard block |
||
| 4137 | 4137 | * @return Array the airline country list |
| 4138 | 4138 | * |
| 4139 | 4139 | */ |
| 4140 | - public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
|
| 4140 | + public function countAllAirlineCountriesByAirport($airport_icao, $filters = array()) |
|
| 4141 | 4141 | { |
| 4142 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4143 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4144 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4142 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4143 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4144 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4145 | 4145 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
| 4146 | 4146 | GROUP BY spotter_output.airline_country |
| 4147 | 4147 | ORDER BY airline_country_count DESC |
@@ -4154,7 +4154,7 @@ discard block |
||
| 4154 | 4154 | $airline_country_array = array(); |
| 4155 | 4155 | $temp_array = array(); |
| 4156 | 4156 | |
| 4157 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4157 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4158 | 4158 | { |
| 4159 | 4159 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4160 | 4160 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4171,11 +4171,11 @@ discard block |
||
| 4171 | 4171 | * @return Array the airline list |
| 4172 | 4172 | * |
| 4173 | 4173 | */ |
| 4174 | - public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 4174 | + public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 4175 | 4175 | { |
| 4176 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4177 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4178 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4176 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4177 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4178 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4179 | 4179 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4180 | 4180 | GROUP BY spotter_output.airline_name |
| 4181 | 4181 | ORDER BY airline_count DESC"; |
@@ -4186,7 +4186,7 @@ discard block |
||
| 4186 | 4186 | $airline_array = array(); |
| 4187 | 4187 | $temp_array = array(); |
| 4188 | 4188 | |
| 4189 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4189 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4190 | 4190 | { |
| 4191 | 4191 | $temp_array['airline_name'] = $row['airline_name']; |
| 4192 | 4192 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4206,11 +4206,11 @@ discard block |
||
| 4206 | 4206 | * @return Array the airline country list |
| 4207 | 4207 | * |
| 4208 | 4208 | */ |
| 4209 | - public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 4209 | + public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 4210 | 4210 | { |
| 4211 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4212 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4213 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4211 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4212 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4213 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4214 | 4214 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4215 | 4215 | GROUP BY spotter_output.airline_country |
| 4216 | 4216 | ORDER BY airline_country_count DESC |
@@ -4223,7 +4223,7 @@ discard block |
||
| 4223 | 4223 | $airline_country_array = array(); |
| 4224 | 4224 | $temp_array = array(); |
| 4225 | 4225 | |
| 4226 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4226 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4227 | 4227 | { |
| 4228 | 4228 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4229 | 4229 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4239,11 +4239,11 @@ discard block |
||
| 4239 | 4239 | * @return Array the airline list |
| 4240 | 4240 | * |
| 4241 | 4241 | */ |
| 4242 | - public function countAllAirlinesByDate($date,$filters = array()) |
|
| 4242 | + public function countAllAirlinesByDate($date, $filters = array()) |
|
| 4243 | 4243 | { |
| 4244 | 4244 | global $globalTimezone, $globalDBdriver; |
| 4245 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4246 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4245 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4246 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4247 | 4247 | if ($globalTimezone != '') { |
| 4248 | 4248 | date_default_timezone_set($globalTimezone); |
| 4249 | 4249 | $datetime = new DateTime($date); |
@@ -4251,12 +4251,12 @@ discard block |
||
| 4251 | 4251 | } else $offset = '+00:00'; |
| 4252 | 4252 | |
| 4253 | 4253 | if ($globalDBdriver == 'mysql') { |
| 4254 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4254 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4255 | 4255 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4256 | 4256 | GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country |
| 4257 | 4257 | ORDER BY airline_count DESC"; |
| 4258 | 4258 | } else { |
| 4259 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4259 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4260 | 4260 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4261 | 4261 | GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country |
| 4262 | 4262 | ORDER BY airline_count DESC"; |
@@ -4267,7 +4267,7 @@ discard block |
||
| 4267 | 4267 | |
| 4268 | 4268 | $airline_array = array(); |
| 4269 | 4269 | $temp_array = array(); |
| 4270 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4270 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4271 | 4271 | { |
| 4272 | 4272 | $temp_array['airline_name'] = $row['airline_name']; |
| 4273 | 4273 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4287,11 +4287,11 @@ discard block |
||
| 4287 | 4287 | * @return Array the airline country list |
| 4288 | 4288 | * |
| 4289 | 4289 | */ |
| 4290 | - public function countAllAirlineCountriesByDate($date,$filters = array()) |
|
| 4290 | + public function countAllAirlineCountriesByDate($date, $filters = array()) |
|
| 4291 | 4291 | { |
| 4292 | 4292 | global $globalTimezone, $globalDBdriver; |
| 4293 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4294 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4293 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4294 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4295 | 4295 | if ($globalTimezone != '') { |
| 4296 | 4296 | date_default_timezone_set($globalTimezone); |
| 4297 | 4297 | $datetime = new DateTime($date); |
@@ -4299,13 +4299,13 @@ discard block |
||
| 4299 | 4299 | } else $offset = '+00:00'; |
| 4300 | 4300 | |
| 4301 | 4301 | if ($globalDBdriver == 'mysql') { |
| 4302 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4302 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4303 | 4303 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4304 | 4304 | GROUP BY spotter_output.airline_country |
| 4305 | 4305 | ORDER BY airline_country_count DESC |
| 4306 | 4306 | LIMIT 10 OFFSET 0"; |
| 4307 | 4307 | } else { |
| 4308 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4308 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4309 | 4309 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4310 | 4310 | GROUP BY spotter_output.airline_country |
| 4311 | 4311 | ORDER BY airline_country_count DESC |
@@ -4317,7 +4317,7 @@ discard block |
||
| 4317 | 4317 | |
| 4318 | 4318 | $airline_country_array = array(); |
| 4319 | 4319 | $temp_array = array(); |
| 4320 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4320 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4321 | 4321 | { |
| 4322 | 4322 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4323 | 4323 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4334,11 +4334,11 @@ discard block |
||
| 4334 | 4334 | * @return Array the airline list |
| 4335 | 4335 | * |
| 4336 | 4336 | */ |
| 4337 | - public function countAllAirlinesByIdent($ident,$filters = array()) |
|
| 4337 | + public function countAllAirlinesByIdent($ident, $filters = array()) |
|
| 4338 | 4338 | { |
| 4339 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 4340 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4341 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4339 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 4340 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4341 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4342 | 4342 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 4343 | 4343 | GROUP BY spotter_output.airline_name |
| 4344 | 4344 | ORDER BY airline_count DESC"; |
@@ -4350,7 +4350,7 @@ discard block |
||
| 4350 | 4350 | $airline_array = array(); |
| 4351 | 4351 | $temp_array = array(); |
| 4352 | 4352 | |
| 4353 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4353 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4354 | 4354 | { |
| 4355 | 4355 | $temp_array['airline_name'] = $row['airline_name']; |
| 4356 | 4356 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4368,25 +4368,25 @@ discard block |
||
| 4368 | 4368 | * @return Array the airline list |
| 4369 | 4369 | * |
| 4370 | 4370 | */ |
| 4371 | - public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 4371 | + public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 4372 | 4372 | { |
| 4373 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4374 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4375 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4373 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4374 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4375 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4376 | 4376 | |
| 4377 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4377 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4378 | 4378 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 4379 | 4379 | GROUP BY spotter_output.airline_name |
| 4380 | 4380 | ORDER BY airline_count DESC"; |
| 4381 | 4381 | |
| 4382 | 4382 | |
| 4383 | 4383 | $sth = $this->db->prepare($query); |
| 4384 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4384 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4385 | 4385 | |
| 4386 | 4386 | $airline_array = array(); |
| 4387 | 4387 | $temp_array = array(); |
| 4388 | 4388 | |
| 4389 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4389 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4390 | 4390 | { |
| 4391 | 4391 | $temp_array['airline_name'] = $row['airline_name']; |
| 4392 | 4392 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4404,13 +4404,13 @@ discard block |
||
| 4404 | 4404 | * @return Array the airline country list |
| 4405 | 4405 | * |
| 4406 | 4406 | */ |
| 4407 | - public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
|
| 4407 | + public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 4408 | 4408 | { |
| 4409 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4410 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4411 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4409 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4410 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4411 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4412 | 4412 | |
| 4413 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4413 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4414 | 4414 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 4415 | 4415 | GROUP BY spotter_output.airline_country |
| 4416 | 4416 | ORDER BY airline_country_count DESC |
@@ -4418,11 +4418,11 @@ discard block |
||
| 4418 | 4418 | |
| 4419 | 4419 | |
| 4420 | 4420 | $sth = $this->db->prepare($query); |
| 4421 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4421 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4422 | 4422 | |
| 4423 | 4423 | $airline_country_array = array(); |
| 4424 | 4424 | $temp_array = array(); |
| 4425 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4425 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4426 | 4426 | { |
| 4427 | 4427 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4428 | 4428 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4440,11 +4440,11 @@ discard block |
||
| 4440 | 4440 | * @return Array the airline list |
| 4441 | 4441 | * |
| 4442 | 4442 | */ |
| 4443 | - public function countAllAirlinesByCountry($country,$filters = array()) |
|
| 4443 | + public function countAllAirlinesByCountry($country, $filters = array()) |
|
| 4444 | 4444 | { |
| 4445 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 4446 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4447 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4445 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 4446 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4447 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4448 | 4448 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 4449 | 4449 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 4450 | 4450 | ORDER BY airline_count DESC"; |
@@ -4455,7 +4455,7 @@ discard block |
||
| 4455 | 4455 | |
| 4456 | 4456 | $airline_array = array(); |
| 4457 | 4457 | $temp_array = array(); |
| 4458 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4458 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4459 | 4459 | { |
| 4460 | 4460 | $temp_array['airline_name'] = $row['airline_name']; |
| 4461 | 4461 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4474,11 +4474,11 @@ discard block |
||
| 4474 | 4474 | * @return Array the airline country list |
| 4475 | 4475 | * |
| 4476 | 4476 | */ |
| 4477 | - public function countAllAirlineCountriesByCountry($country,$filters = array()) |
|
| 4477 | + public function countAllAirlineCountriesByCountry($country, $filters = array()) |
|
| 4478 | 4478 | { |
| 4479 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4480 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 4481 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4479 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4480 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 4481 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4482 | 4482 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 4483 | 4483 | GROUP BY spotter_output.airline_country |
| 4484 | 4484 | ORDER BY airline_country_count DESC |
@@ -4490,7 +4490,7 @@ discard block |
||
| 4490 | 4490 | |
| 4491 | 4491 | $airline_country_array = array(); |
| 4492 | 4492 | $temp_array = array(); |
| 4493 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4493 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4494 | 4494 | { |
| 4495 | 4495 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4496 | 4496 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4509,8 +4509,8 @@ discard block |
||
| 4509 | 4509 | */ |
| 4510 | 4510 | public function countAllAirlineCountries($limit = true, $filters = array()) |
| 4511 | 4511 | { |
| 4512 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4513 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4512 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4513 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4514 | 4514 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' |
| 4515 | 4515 | GROUP BY spotter_output.airline_country |
| 4516 | 4516 | ORDER BY airline_country_count DESC"; |
@@ -4521,7 +4521,7 @@ discard block |
||
| 4521 | 4521 | |
| 4522 | 4522 | $airline_array = array(); |
| 4523 | 4523 | $temp_array = array(); |
| 4524 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4524 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4525 | 4525 | { |
| 4526 | 4526 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4527 | 4527 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4537,11 +4537,11 @@ discard block |
||
| 4537 | 4537 | * @return Array the airline country list |
| 4538 | 4538 | * |
| 4539 | 4539 | */ |
| 4540 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 4540 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4541 | 4541 | { |
| 4542 | 4542 | global $globalDBdriver; |
| 4543 | 4543 | //$filter_query = $this->getFilter($filters,true,true); |
| 4544 | - $Connection= new Connection($this->db); |
|
| 4544 | + $Connection = new Connection($this->db); |
|
| 4545 | 4545 | if (!$Connection->tableExists('countries')) return array(); |
| 4546 | 4546 | /* |
| 4547 | 4547 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -4556,7 +4556,7 @@ discard block |
||
| 4556 | 4556 | */ |
| 4557 | 4557 | require_once('class.SpotterLive.php'); |
| 4558 | 4558 | $SpotterLive = new SpotterLive(); |
| 4559 | - $filter_query = $SpotterLive->getFilter($filters,true,true); |
|
| 4559 | + $filter_query = $SpotterLive->getFilter($filters, true, true); |
|
| 4560 | 4560 | $filter_query .= ' over_country IS NOT NULL'; |
| 4561 | 4561 | if ($olderthanmonths > 0) { |
| 4562 | 4562 | if ($globalDBdriver == 'mysql') { |
@@ -4583,7 +4583,7 @@ discard block |
||
| 4583 | 4583 | $flight_array = array(); |
| 4584 | 4584 | $temp_array = array(); |
| 4585 | 4585 | |
| 4586 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4586 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4587 | 4587 | { |
| 4588 | 4588 | $temp_array['flight_count'] = $row['nb']; |
| 4589 | 4589 | $temp_array['flight_country'] = $row['name']; |
@@ -4601,12 +4601,12 @@ discard block |
||
| 4601 | 4601 | * @return Array the aircraft list |
| 4602 | 4602 | * |
| 4603 | 4603 | */ |
| 4604 | - public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 4604 | + public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4605 | 4605 | { |
| 4606 | 4606 | global $globalDBdriver; |
| 4607 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4607 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4608 | 4608 | |
| 4609 | - $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4609 | + $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4610 | 4610 | FROM spotter_output ".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> ''"; |
| 4611 | 4611 | if ($olderthanmonths > 0) { |
| 4612 | 4612 | if ($globalDBdriver == 'mysql') { |
@@ -4631,7 +4631,7 @@ discard block |
||
| 4631 | 4631 | |
| 4632 | 4632 | $aircraft_array = array(); |
| 4633 | 4633 | $temp_array = array(); |
| 4634 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4634 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4635 | 4635 | { |
| 4636 | 4636 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4637 | 4637 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4648,11 +4648,11 @@ discard block |
||
| 4648 | 4648 | * @return Array the aircraft list |
| 4649 | 4649 | * |
| 4650 | 4650 | */ |
| 4651 | - public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 4651 | + public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4652 | 4652 | { |
| 4653 | 4653 | global $globalDBdriver; |
| 4654 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4655 | - $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4654 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4655 | + $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4656 | 4656 | FROM spotter_output".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' "; |
| 4657 | 4657 | if ($olderthanmonths > 0) { |
| 4658 | 4658 | if ($globalDBdriver == 'mysql') { |
@@ -4677,7 +4677,7 @@ discard block |
||
| 4677 | 4677 | |
| 4678 | 4678 | $aircraft_array = array(); |
| 4679 | 4679 | $temp_array = array(); |
| 4680 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4680 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4681 | 4681 | { |
| 4682 | 4682 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 4683 | 4683 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -4695,11 +4695,11 @@ discard block |
||
| 4695 | 4695 | * @return Array the aircraft list |
| 4696 | 4696 | * |
| 4697 | 4697 | */ |
| 4698 | - public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 4698 | + public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4699 | 4699 | { |
| 4700 | 4700 | global $globalDBdriver; |
| 4701 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4702 | - $query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4701 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4702 | + $query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4703 | 4703 | FROM spotter_output".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' "; |
| 4704 | 4704 | if ($olderthanmonths > 0) { |
| 4705 | 4705 | if ($globalDBdriver == 'mysql') { |
@@ -4724,7 +4724,7 @@ discard block |
||
| 4724 | 4724 | |
| 4725 | 4725 | $aircraft_array = array(); |
| 4726 | 4726 | $temp_array = array(); |
| 4727 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4727 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4728 | 4728 | { |
| 4729 | 4729 | //$temp_array['airline_icao'] = $row['airline_icao']; |
| 4730 | 4730 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -4743,13 +4743,13 @@ discard block |
||
| 4743 | 4743 | * @return Array the aircraft list |
| 4744 | 4744 | * |
| 4745 | 4745 | */ |
| 4746 | - public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
|
| 4746 | + public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array()) |
|
| 4747 | 4747 | { |
| 4748 | 4748 | $Image = new Image($this->db); |
| 4749 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4750 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 4749 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4750 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 4751 | 4751 | |
| 4752 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4752 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4753 | 4753 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 4754 | 4754 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
| 4755 | 4755 | ORDER BY registration_count DESC"; |
@@ -4760,14 +4760,14 @@ discard block |
||
| 4760 | 4760 | $aircraft_array = array(); |
| 4761 | 4761 | $temp_array = array(); |
| 4762 | 4762 | |
| 4763 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4763 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4764 | 4764 | { |
| 4765 | 4765 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4766 | 4766 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4767 | 4767 | $temp_array['registration'] = $row['registration']; |
| 4768 | 4768 | $temp_array['airline_name'] = $row['airline_name']; |
| 4769 | 4769 | $temp_array['image_thumbnail'] = ""; |
| 4770 | - if($row['registration'] != "") |
|
| 4770 | + if ($row['registration'] != "") |
|
| 4771 | 4771 | { |
| 4772 | 4772 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4773 | 4773 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4786,11 +4786,11 @@ discard block |
||
| 4786 | 4786 | * @return Array the aircraft list |
| 4787 | 4787 | * |
| 4788 | 4788 | */ |
| 4789 | - public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
|
| 4789 | + public function countAllAircraftTypesByAirline($airline_icao, $filters = array()) |
|
| 4790 | 4790 | { |
| 4791 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4792 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 4793 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4791 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4792 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 4793 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4794 | 4794 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao |
| 4795 | 4795 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 4796 | 4796 | ORDER BY aircraft_icao_count DESC"; |
@@ -4801,7 +4801,7 @@ discard block |
||
| 4801 | 4801 | $aircraft_array = array(); |
| 4802 | 4802 | $temp_array = array(); |
| 4803 | 4803 | |
| 4804 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4804 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4805 | 4805 | { |
| 4806 | 4806 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4807 | 4807 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4819,13 +4819,13 @@ discard block |
||
| 4819 | 4819 | * @return Array the aircraft list |
| 4820 | 4820 | * |
| 4821 | 4821 | */ |
| 4822 | - public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
|
| 4822 | + public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array()) |
|
| 4823 | 4823 | { |
| 4824 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4824 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4825 | 4825 | $Image = new Image($this->db); |
| 4826 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 4826 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 4827 | 4827 | |
| 4828 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4828 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4829 | 4829 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao |
| 4830 | 4830 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 4831 | 4831 | ORDER BY registration_count DESC"; |
@@ -4835,14 +4835,14 @@ discard block |
||
| 4835 | 4835 | |
| 4836 | 4836 | $aircraft_array = array(); |
| 4837 | 4837 | $temp_array = array(); |
| 4838 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4838 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4839 | 4839 | { |
| 4840 | 4840 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4841 | 4841 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4842 | 4842 | $temp_array['registration'] = $row['registration']; |
| 4843 | 4843 | $temp_array['airline_name'] = $row['airline_name']; |
| 4844 | 4844 | $temp_array['image_thumbnail'] = ""; |
| 4845 | - if($row['registration'] != "") |
|
| 4845 | + if ($row['registration'] != "") |
|
| 4846 | 4846 | { |
| 4847 | 4847 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4848 | 4848 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4861,11 +4861,11 @@ discard block |
||
| 4861 | 4861 | * @return Array the aircraft list |
| 4862 | 4862 | * |
| 4863 | 4863 | */ |
| 4864 | - public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
|
| 4864 | + public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array()) |
|
| 4865 | 4865 | { |
| 4866 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4867 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 4868 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4866 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4867 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 4868 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4869 | 4869 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao |
| 4870 | 4870 | GROUP BY spotter_output.aircraft_manufacturer |
| 4871 | 4871 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4876,7 +4876,7 @@ discard block |
||
| 4876 | 4876 | $aircraft_array = array(); |
| 4877 | 4877 | $temp_array = array(); |
| 4878 | 4878 | |
| 4879 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4879 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4880 | 4880 | { |
| 4881 | 4881 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 4882 | 4882 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4893,12 +4893,12 @@ discard block |
||
| 4893 | 4893 | * @return Array the aircraft list |
| 4894 | 4894 | * |
| 4895 | 4895 | */ |
| 4896 | - public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
|
| 4896 | + public function countAllAircraftTypesByAirport($airport_icao, $filters = array()) |
|
| 4897 | 4897 | { |
| 4898 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4899 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4898 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4899 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4900 | 4900 | |
| 4901 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4901 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4902 | 4902 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 4903 | 4903 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 4904 | 4904 | ORDER BY aircraft_icao_count DESC"; |
@@ -4908,7 +4908,7 @@ discard block |
||
| 4908 | 4908 | |
| 4909 | 4909 | $aircraft_array = array(); |
| 4910 | 4910 | $temp_array = array(); |
| 4911 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4911 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4912 | 4912 | { |
| 4913 | 4913 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4914 | 4914 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4926,13 +4926,13 @@ discard block |
||
| 4926 | 4926 | * @return Array the aircraft list |
| 4927 | 4927 | * |
| 4928 | 4928 | */ |
| 4929 | - public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
|
| 4929 | + public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array()) |
|
| 4930 | 4930 | { |
| 4931 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4931 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4932 | 4932 | $Image = new Image($this->db); |
| 4933 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4933 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4934 | 4934 | |
| 4935 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4935 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4936 | 4936 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 4937 | 4937 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 4938 | 4938 | ORDER BY registration_count DESC"; |
@@ -4942,14 +4942,14 @@ discard block |
||
| 4942 | 4942 | |
| 4943 | 4943 | $aircraft_array = array(); |
| 4944 | 4944 | $temp_array = array(); |
| 4945 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4945 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4946 | 4946 | { |
| 4947 | 4947 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4948 | 4948 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4949 | 4949 | $temp_array['registration'] = $row['registration']; |
| 4950 | 4950 | $temp_array['airline_name'] = $row['airline_name']; |
| 4951 | 4951 | $temp_array['image_thumbnail'] = ""; |
| 4952 | - if($row['registration'] != "") |
|
| 4952 | + if ($row['registration'] != "") |
|
| 4953 | 4953 | { |
| 4954 | 4954 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4955 | 4955 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4967,11 +4967,11 @@ discard block |
||
| 4967 | 4967 | * @return Array the aircraft list |
| 4968 | 4968 | * |
| 4969 | 4969 | */ |
| 4970 | - public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
|
| 4970 | + public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array()) |
|
| 4971 | 4971 | { |
| 4972 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4973 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4974 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4972 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4973 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4974 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4975 | 4975 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 4976 | 4976 | GROUP BY spotter_output.aircraft_manufacturer |
| 4977 | 4977 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4982,7 +4982,7 @@ discard block |
||
| 4982 | 4982 | |
| 4983 | 4983 | $aircraft_array = array(); |
| 4984 | 4984 | $temp_array = array(); |
| 4985 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4985 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4986 | 4986 | { |
| 4987 | 4987 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 4988 | 4988 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4997,12 +4997,12 @@ discard block |
||
| 4997 | 4997 | * @return Array the aircraft list |
| 4998 | 4998 | * |
| 4999 | 4999 | */ |
| 5000 | - public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 5000 | + public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 5001 | 5001 | { |
| 5002 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5003 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 5002 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5003 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 5004 | 5004 | |
| 5005 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5005 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5006 | 5006 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 5007 | 5007 | GROUP BY spotter_output.aircraft_name |
| 5008 | 5008 | ORDER BY aircraft_icao_count DESC"; |
@@ -5011,7 +5011,7 @@ discard block |
||
| 5011 | 5011 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
| 5012 | 5012 | $aircraft_array = array(); |
| 5013 | 5013 | $temp_array = array(); |
| 5014 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5014 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5015 | 5015 | { |
| 5016 | 5016 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5017 | 5017 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5030,11 +5030,11 @@ discard block |
||
| 5030 | 5030 | */ |
| 5031 | 5031 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
| 5032 | 5032 | { |
| 5033 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5033 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5034 | 5034 | $Image = new Image($this->db); |
| 5035 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 5035 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 5036 | 5036 | |
| 5037 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5037 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5038 | 5038 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 5039 | 5039 | GROUP BY spotter_output.registration |
| 5040 | 5040 | ORDER BY registration_count DESC"; |
@@ -5044,14 +5044,14 @@ discard block |
||
| 5044 | 5044 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
| 5045 | 5045 | $aircraft_array = array(); |
| 5046 | 5046 | $temp_array = array(); |
| 5047 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5047 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5048 | 5048 | { |
| 5049 | 5049 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5050 | 5050 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5051 | 5051 | $temp_array['registration'] = $row['registration']; |
| 5052 | 5052 | $temp_array['airline_name'] = $row['airline_name']; |
| 5053 | 5053 | $temp_array['image_thumbnail'] = ""; |
| 5054 | - if($row['registration'] != "") |
|
| 5054 | + if ($row['registration'] != "") |
|
| 5055 | 5055 | { |
| 5056 | 5056 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5057 | 5057 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5068,11 +5068,11 @@ discard block |
||
| 5068 | 5068 | * @return Array the aircraft list |
| 5069 | 5069 | * |
| 5070 | 5070 | */ |
| 5071 | - public function countAllAircraftTypesByDate($date,$filters = array()) |
|
| 5071 | + public function countAllAircraftTypesByDate($date, $filters = array()) |
|
| 5072 | 5072 | { |
| 5073 | 5073 | global $globalTimezone, $globalDBdriver; |
| 5074 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5075 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 5074 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5075 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 5076 | 5076 | if ($globalTimezone != '') { |
| 5077 | 5077 | date_default_timezone_set($globalTimezone); |
| 5078 | 5078 | $datetime = new DateTime($date); |
@@ -5080,12 +5080,12 @@ discard block |
||
| 5080 | 5080 | } else $offset = '+00:00'; |
| 5081 | 5081 | |
| 5082 | 5082 | if ($globalDBdriver == 'mysql') { |
| 5083 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5083 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5084 | 5084 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 5085 | 5085 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5086 | 5086 | ORDER BY aircraft_icao_count DESC"; |
| 5087 | 5087 | } else { |
| 5088 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5088 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5089 | 5089 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 5090 | 5090 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5091 | 5091 | ORDER BY aircraft_icao_count DESC"; |
@@ -5096,7 +5096,7 @@ discard block |
||
| 5096 | 5096 | |
| 5097 | 5097 | $aircraft_array = array(); |
| 5098 | 5098 | $temp_array = array(); |
| 5099 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5099 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5100 | 5100 | { |
| 5101 | 5101 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5102 | 5102 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5114,12 +5114,12 @@ discard block |
||
| 5114 | 5114 | * @return Array the aircraft list |
| 5115 | 5115 | * |
| 5116 | 5116 | */ |
| 5117 | - public function countAllAircraftRegistrationByDate($date,$filters = array()) |
|
| 5117 | + public function countAllAircraftRegistrationByDate($date, $filters = array()) |
|
| 5118 | 5118 | { |
| 5119 | 5119 | global $globalTimezone, $globalDBdriver; |
| 5120 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5120 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5121 | 5121 | $Image = new Image($this->db); |
| 5122 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 5122 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 5123 | 5123 | if ($globalTimezone != '') { |
| 5124 | 5124 | date_default_timezone_set($globalTimezone); |
| 5125 | 5125 | $datetime = new DateTime($date); |
@@ -5127,12 +5127,12 @@ discard block |
||
| 5127 | 5127 | } else $offset = '+00:00'; |
| 5128 | 5128 | |
| 5129 | 5129 | if ($globalDBdriver == 'mysql') { |
| 5130 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5130 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5131 | 5131 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 5132 | 5132 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5133 | 5133 | ORDER BY registration_count DESC"; |
| 5134 | 5134 | } else { |
| 5135 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5135 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5136 | 5136 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 5137 | 5137 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5138 | 5138 | ORDER BY registration_count DESC"; |
@@ -5143,14 +5143,14 @@ discard block |
||
| 5143 | 5143 | |
| 5144 | 5144 | $aircraft_array = array(); |
| 5145 | 5145 | $temp_array = array(); |
| 5146 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5146 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5147 | 5147 | { |
| 5148 | 5148 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5149 | 5149 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5150 | 5150 | $temp_array['registration'] = $row['registration']; |
| 5151 | 5151 | $temp_array['airline_name'] = $row['airline_name']; |
| 5152 | 5152 | $temp_array['image_thumbnail'] = ""; |
| 5153 | - if($row['registration'] != "") |
|
| 5153 | + if ($row['registration'] != "") |
|
| 5154 | 5154 | { |
| 5155 | 5155 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5156 | 5156 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5169,11 +5169,11 @@ discard block |
||
| 5169 | 5169 | * @return Array the aircraft manufacturer list |
| 5170 | 5170 | * |
| 5171 | 5171 | */ |
| 5172 | - public function countAllAircraftManufacturerByDate($date,$filters = array()) |
|
| 5172 | + public function countAllAircraftManufacturerByDate($date, $filters = array()) |
|
| 5173 | 5173 | { |
| 5174 | 5174 | global $globalTimezone, $globalDBdriver; |
| 5175 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5176 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 5175 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5176 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 5177 | 5177 | if ($globalTimezone != '') { |
| 5178 | 5178 | date_default_timezone_set($globalTimezone); |
| 5179 | 5179 | $datetime = new DateTime($date); |
@@ -5181,12 +5181,12 @@ discard block |
||
| 5181 | 5181 | } else $offset = '+00:00'; |
| 5182 | 5182 | |
| 5183 | 5183 | if ($globalDBdriver == 'mysql') { |
| 5184 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5184 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5185 | 5185 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 5186 | 5186 | GROUP BY spotter_output.aircraft_manufacturer |
| 5187 | 5187 | ORDER BY aircraft_manufacturer_count DESC"; |
| 5188 | 5188 | } else { |
| 5189 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5189 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5190 | 5190 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 5191 | 5191 | GROUP BY spotter_output.aircraft_manufacturer |
| 5192 | 5192 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5198,7 +5198,7 @@ discard block |
||
| 5198 | 5198 | $aircraft_array = array(); |
| 5199 | 5199 | $temp_array = array(); |
| 5200 | 5200 | |
| 5201 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5201 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5202 | 5202 | { |
| 5203 | 5203 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5204 | 5204 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5215,11 +5215,11 @@ discard block |
||
| 5215 | 5215 | * @return Array the aircraft list |
| 5216 | 5216 | * |
| 5217 | 5217 | */ |
| 5218 | - public function countAllAircraftTypesByIdent($ident,$filters = array()) |
|
| 5218 | + public function countAllAircraftTypesByIdent($ident, $filters = array()) |
|
| 5219 | 5219 | { |
| 5220 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5221 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5222 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5220 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5221 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5222 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5223 | 5223 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 5224 | 5224 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5225 | 5225 | ORDER BY aircraft_icao_count DESC"; |
@@ -5230,7 +5230,7 @@ discard block |
||
| 5230 | 5230 | $aircraft_array = array(); |
| 5231 | 5231 | $temp_array = array(); |
| 5232 | 5232 | |
| 5233 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5233 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5234 | 5234 | { |
| 5235 | 5235 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5236 | 5236 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5248,13 +5248,13 @@ discard block |
||
| 5248 | 5248 | * @return Array the aircraft list |
| 5249 | 5249 | * |
| 5250 | 5250 | */ |
| 5251 | - public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
|
| 5251 | + public function countAllAircraftRegistrationByIdent($ident, $filters = array()) |
|
| 5252 | 5252 | { |
| 5253 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5253 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5254 | 5254 | $Image = new Image($this->db); |
| 5255 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5255 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5256 | 5256 | |
| 5257 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5257 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5258 | 5258 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident |
| 5259 | 5259 | GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5260 | 5260 | ORDER BY registration_count DESC"; |
@@ -5266,14 +5266,14 @@ discard block |
||
| 5266 | 5266 | $aircraft_array = array(); |
| 5267 | 5267 | $temp_array = array(); |
| 5268 | 5268 | |
| 5269 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5269 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5270 | 5270 | { |
| 5271 | 5271 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5272 | 5272 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5273 | 5273 | $temp_array['registration'] = $row['registration']; |
| 5274 | 5274 | $temp_array['airline_name'] = $row['airline_name']; |
| 5275 | 5275 | $temp_array['image_thumbnail'] = ""; |
| 5276 | - if($row['registration'] != "") |
|
| 5276 | + if ($row['registration'] != "") |
|
| 5277 | 5277 | { |
| 5278 | 5278 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5279 | 5279 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5292,11 +5292,11 @@ discard block |
||
| 5292 | 5292 | * @return Array the aircraft manufacturer list |
| 5293 | 5293 | * |
| 5294 | 5294 | */ |
| 5295 | - public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
|
| 5295 | + public function countAllAircraftManufacturerByIdent($ident, $filters = array()) |
|
| 5296 | 5296 | { |
| 5297 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5298 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5299 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5297 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5298 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 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.ident = :ident |
| 5301 | 5301 | GROUP BY spotter_output.aircraft_manufacturer |
| 5302 | 5302 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5306,7 +5306,7 @@ discard block |
||
| 5306 | 5306 | $sth->execute(array(':ident' => $ident)); |
| 5307 | 5307 | $aircraft_array = array(); |
| 5308 | 5308 | $temp_array = array(); |
| 5309 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5309 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5310 | 5310 | { |
| 5311 | 5311 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5312 | 5312 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5322,24 +5322,24 @@ discard block |
||
| 5322 | 5322 | * @return Array the aircraft list |
| 5323 | 5323 | * |
| 5324 | 5324 | */ |
| 5325 | - public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5325 | + public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5326 | 5326 | { |
| 5327 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5328 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5329 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5327 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5328 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5329 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5330 | 5330 | |
| 5331 | 5331 | |
| 5332 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5332 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5333 | 5333 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5334 | 5334 | GROUP BY spotter_output.aircraft_name |
| 5335 | 5335 | ORDER BY aircraft_icao_count DESC"; |
| 5336 | 5336 | |
| 5337 | 5337 | |
| 5338 | 5338 | $sth = $this->db->prepare($query); |
| 5339 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5339 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5340 | 5340 | $aircraft_array = array(); |
| 5341 | 5341 | $temp_array = array(); |
| 5342 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5342 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5343 | 5343 | { |
| 5344 | 5344 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5345 | 5345 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5355,33 +5355,33 @@ discard block |
||
| 5355 | 5355 | * @return Array the aircraft list |
| 5356 | 5356 | * |
| 5357 | 5357 | */ |
| 5358 | - public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5358 | + public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5359 | 5359 | { |
| 5360 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5360 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5361 | 5361 | $Image = new Image($this->db); |
| 5362 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5363 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5362 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5363 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5364 | 5364 | |
| 5365 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5365 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5366 | 5366 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5367 | 5367 | GROUP BY spotter_output.registration |
| 5368 | 5368 | ORDER BY registration_count DESC"; |
| 5369 | 5369 | |
| 5370 | 5370 | |
| 5371 | 5371 | $sth = $this->db->prepare($query); |
| 5372 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5372 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5373 | 5373 | |
| 5374 | 5374 | $aircraft_array = array(); |
| 5375 | 5375 | $temp_array = array(); |
| 5376 | 5376 | |
| 5377 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5377 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5378 | 5378 | { |
| 5379 | 5379 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5380 | 5380 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5381 | 5381 | $temp_array['registration'] = $row['registration']; |
| 5382 | 5382 | $temp_array['airline_name'] = $row['airline_name']; |
| 5383 | 5383 | $temp_array['image_thumbnail'] = ""; |
| 5384 | - if($row['registration'] != "") |
|
| 5384 | + if ($row['registration'] != "") |
|
| 5385 | 5385 | { |
| 5386 | 5386 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5387 | 5387 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5401,25 +5401,25 @@ discard block |
||
| 5401 | 5401 | * @return Array the aircraft manufacturer list |
| 5402 | 5402 | * |
| 5403 | 5403 | */ |
| 5404 | - public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5404 | + public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5405 | 5405 | { |
| 5406 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5407 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5408 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5406 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5407 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5408 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5409 | 5409 | |
| 5410 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5410 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5411 | 5411 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5412 | 5412 | GROUP BY spotter_output.aircraft_manufacturer |
| 5413 | 5413 | ORDER BY aircraft_manufacturer_count DESC"; |
| 5414 | 5414 | |
| 5415 | 5415 | |
| 5416 | 5416 | $sth = $this->db->prepare($query); |
| 5417 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5417 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5418 | 5418 | |
| 5419 | 5419 | $aircraft_array = array(); |
| 5420 | 5420 | $temp_array = array(); |
| 5421 | 5421 | |
| 5422 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5422 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5423 | 5423 | { |
| 5424 | 5424 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5425 | 5425 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5439,11 +5439,11 @@ discard block |
||
| 5439 | 5439 | * @return Array the aircraft list |
| 5440 | 5440 | * |
| 5441 | 5441 | */ |
| 5442 | - public function countAllAircraftTypesByCountry($country,$filters = array()) |
|
| 5442 | + public function countAllAircraftTypesByCountry($country, $filters = array()) |
|
| 5443 | 5443 | { |
| 5444 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5445 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 5446 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5444 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5445 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 5446 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5447 | 5447 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 5448 | 5448 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5449 | 5449 | ORDER BY aircraft_icao_count DESC"; |
@@ -5455,7 +5455,7 @@ discard block |
||
| 5455 | 5455 | $aircraft_array = array(); |
| 5456 | 5456 | $temp_array = array(); |
| 5457 | 5457 | |
| 5458 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5458 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5459 | 5459 | { |
| 5460 | 5460 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5461 | 5461 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5474,12 +5474,12 @@ discard block |
||
| 5474 | 5474 | * @return Array the aircraft list |
| 5475 | 5475 | * |
| 5476 | 5476 | */ |
| 5477 | - public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
|
| 5477 | + public function countAllAircraftRegistrationByCountry($country, $filters = array()) |
|
| 5478 | 5478 | { |
| 5479 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5479 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5480 | 5480 | $Image = new Image($this->db); |
| 5481 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 5482 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5481 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 5482 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5483 | 5483 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
| 5484 | 5484 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5485 | 5485 | ORDER BY registration_count DESC"; |
@@ -5491,14 +5491,14 @@ discard block |
||
| 5491 | 5491 | $aircraft_array = array(); |
| 5492 | 5492 | $temp_array = array(); |
| 5493 | 5493 | |
| 5494 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5494 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5495 | 5495 | { |
| 5496 | 5496 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5497 | 5497 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5498 | 5498 | $temp_array['registration'] = $row['registration']; |
| 5499 | 5499 | $temp_array['airline_name'] = $row['airline_name']; |
| 5500 | 5500 | $temp_array['image_thumbnail'] = ""; |
| 5501 | - if($row['registration'] != "") |
|
| 5501 | + if ($row['registration'] != "") |
|
| 5502 | 5502 | { |
| 5503 | 5503 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5504 | 5504 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5518,11 +5518,11 @@ discard block |
||
| 5518 | 5518 | * @return Array the aircraft manufacturer list |
| 5519 | 5519 | * |
| 5520 | 5520 | */ |
| 5521 | - public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
|
| 5521 | + public function countAllAircraftManufacturerByCountry($country, $filters = array()) |
|
| 5522 | 5522 | { |
| 5523 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5524 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 5525 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5523 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5524 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 5525 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5526 | 5526 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
| 5527 | 5527 | GROUP BY spotter_output.aircraft_manufacturer |
| 5528 | 5528 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5534,7 +5534,7 @@ discard block |
||
| 5534 | 5534 | $aircraft_array = array(); |
| 5535 | 5535 | $temp_array = array(); |
| 5536 | 5536 | |
| 5537 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5537 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5538 | 5538 | { |
| 5539 | 5539 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5540 | 5540 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5555,8 +5555,8 @@ discard block |
||
| 5555 | 5555 | */ |
| 5556 | 5556 | public function countAllAircraftManufacturers($filters = array()) |
| 5557 | 5557 | { |
| 5558 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5559 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5558 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5559 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5560 | 5560 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
| 5561 | 5561 | $query .= " GROUP BY spotter_output.aircraft_manufacturer |
| 5562 | 5562 | ORDER BY aircraft_manufacturer_count DESC |
@@ -5569,7 +5569,7 @@ discard block |
||
| 5569 | 5569 | $manufacturer_array = array(); |
| 5570 | 5570 | $temp_array = array(); |
| 5571 | 5571 | |
| 5572 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5572 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5573 | 5573 | { |
| 5574 | 5574 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5575 | 5575 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5588,12 +5588,12 @@ discard block |
||
| 5588 | 5588 | * @return Array the aircraft list |
| 5589 | 5589 | * |
| 5590 | 5590 | */ |
| 5591 | - public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 5591 | + public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5592 | 5592 | { |
| 5593 | 5593 | global $globalDBdriver; |
| 5594 | 5594 | $Image = new Image($this->db); |
| 5595 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5596 | - $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 |
|
| 5595 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5596 | + $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 |
|
| 5597 | 5597 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
| 5598 | 5598 | if ($olderthanmonths > 0) { |
| 5599 | 5599 | if ($globalDBdriver == 'mysql') { |
@@ -5621,7 +5621,7 @@ discard block |
||
| 5621 | 5621 | $aircraft_array = array(); |
| 5622 | 5622 | $temp_array = array(); |
| 5623 | 5623 | |
| 5624 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5624 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5625 | 5625 | { |
| 5626 | 5626 | $temp_array['registration'] = $row['registration']; |
| 5627 | 5627 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -5629,7 +5629,7 @@ discard block |
||
| 5629 | 5629 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5630 | 5630 | $temp_array['airline_name'] = $row['airline_name']; |
| 5631 | 5631 | $temp_array['image_thumbnail'] = ""; |
| 5632 | - if($row['registration'] != "") |
|
| 5632 | + if ($row['registration'] != "") |
|
| 5633 | 5633 | { |
| 5634 | 5634 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5635 | 5635 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5648,12 +5648,12 @@ discard block |
||
| 5648 | 5648 | * @return Array the aircraft list |
| 5649 | 5649 | * |
| 5650 | 5650 | */ |
| 5651 | - public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 5651 | + public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5652 | 5652 | { |
| 5653 | 5653 | global $globalDBdriver; |
| 5654 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5654 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5655 | 5655 | $Image = new Image($this->db); |
| 5656 | - $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 |
|
| 5656 | + $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 |
|
| 5657 | 5657 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
| 5658 | 5658 | if ($olderthanmonths > 0) { |
| 5659 | 5659 | if ($globalDBdriver == 'mysql') { |
@@ -5681,7 +5681,7 @@ discard block |
||
| 5681 | 5681 | $aircraft_array = array(); |
| 5682 | 5682 | $temp_array = array(); |
| 5683 | 5683 | |
| 5684 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5684 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5685 | 5685 | { |
| 5686 | 5686 | $temp_array['registration'] = $row['registration']; |
| 5687 | 5687 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -5690,7 +5690,7 @@ discard block |
||
| 5690 | 5690 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5691 | 5691 | $temp_array['airline_name'] = $row['airline_name']; |
| 5692 | 5692 | $temp_array['image_thumbnail'] = ""; |
| 5693 | - if($row['registration'] != "") |
|
| 5693 | + if ($row['registration'] != "") |
|
| 5694 | 5694 | { |
| 5695 | 5695 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5696 | 5696 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5709,11 +5709,11 @@ discard block |
||
| 5709 | 5709 | * @return Array the airport list |
| 5710 | 5710 | * |
| 5711 | 5711 | */ |
| 5712 | - public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 5712 | + public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5713 | 5713 | { |
| 5714 | 5714 | global $globalDBdriver; |
| 5715 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5716 | - $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 |
|
| 5715 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5716 | + $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 |
|
| 5717 | 5717 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
| 5718 | 5718 | if ($olderthanmonths > 0) { |
| 5719 | 5719 | if ($globalDBdriver == 'mysql') { |
@@ -5742,7 +5742,7 @@ discard block |
||
| 5742 | 5742 | $airport_array = array(); |
| 5743 | 5743 | $temp_array = array(); |
| 5744 | 5744 | |
| 5745 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5745 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5746 | 5746 | { |
| 5747 | 5747 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5748 | 5748 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5761,11 +5761,11 @@ discard block |
||
| 5761 | 5761 | * @return Array the airport list |
| 5762 | 5762 | * |
| 5763 | 5763 | */ |
| 5764 | - public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 5764 | + public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5765 | 5765 | { |
| 5766 | 5766 | global $globalDBdriver; |
| 5767 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5768 | - $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 |
|
| 5767 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5768 | + $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 |
|
| 5769 | 5769 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' "; |
| 5770 | 5770 | if ($olderthanmonths > 0) { |
| 5771 | 5771 | if ($globalDBdriver == 'mysql') { |
@@ -5794,7 +5794,7 @@ discard block |
||
| 5794 | 5794 | $airport_array = array(); |
| 5795 | 5795 | $temp_array = array(); |
| 5796 | 5796 | |
| 5797 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5797 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5798 | 5798 | { |
| 5799 | 5799 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 5800 | 5800 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -5814,11 +5814,11 @@ discard block |
||
| 5814 | 5814 | * @return Array the airport list |
| 5815 | 5815 | * |
| 5816 | 5816 | */ |
| 5817 | - public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 5817 | + public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5818 | 5818 | { |
| 5819 | 5819 | global $globalDBdriver; |
| 5820 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5821 | - $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 |
|
| 5820 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5821 | + $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 |
|
| 5822 | 5822 | 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"; |
| 5823 | 5823 | if ($olderthanmonths > 0) { |
| 5824 | 5824 | if ($globalDBdriver == 'mysql') { |
@@ -5846,7 +5846,7 @@ discard block |
||
| 5846 | 5846 | $airport_array = array(); |
| 5847 | 5847 | $temp_array = array(); |
| 5848 | 5848 | |
| 5849 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5849 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5850 | 5850 | { |
| 5851 | 5851 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5852 | 5852 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5865,11 +5865,11 @@ discard block |
||
| 5865 | 5865 | * @return Array the airport list |
| 5866 | 5866 | * |
| 5867 | 5867 | */ |
| 5868 | - public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 5868 | + public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5869 | 5869 | { |
| 5870 | 5870 | global $globalDBdriver; |
| 5871 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5872 | - $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 |
|
| 5871 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5872 | + $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 |
|
| 5873 | 5873 | 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 "; |
| 5874 | 5874 | if ($olderthanmonths > 0) { |
| 5875 | 5875 | if ($globalDBdriver == 'mysql') { |
@@ -5898,7 +5898,7 @@ discard block |
||
| 5898 | 5898 | $airport_array = array(); |
| 5899 | 5899 | $temp_array = array(); |
| 5900 | 5900 | |
| 5901 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5901 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5902 | 5902 | { |
| 5903 | 5903 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 5904 | 5904 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -5918,11 +5918,11 @@ discard block |
||
| 5918 | 5918 | * @return Array the airport list |
| 5919 | 5919 | * |
| 5920 | 5920 | */ |
| 5921 | - public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
|
| 5921 | + public function countAllDepartureAirportsByAirline($airline_icao, $filters = array()) |
|
| 5922 | 5922 | { |
| 5923 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5924 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 5925 | - $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 |
|
| 5923 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5924 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 5925 | + $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 |
|
| 5926 | 5926 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao AND spotter_output.departure_airport_icao <> '' |
| 5927 | 5927 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 5928 | 5928 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5934,7 +5934,7 @@ discard block |
||
| 5934 | 5934 | $airport_array = array(); |
| 5935 | 5935 | $temp_array = array(); |
| 5936 | 5936 | |
| 5937 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5937 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5938 | 5938 | { |
| 5939 | 5939 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5940 | 5940 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5956,11 +5956,11 @@ discard block |
||
| 5956 | 5956 | * @return Array the airport list |
| 5957 | 5957 | * |
| 5958 | 5958 | */ |
| 5959 | - public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
|
| 5959 | + public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array()) |
|
| 5960 | 5960 | { |
| 5961 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5962 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 5963 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5961 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5962 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 5963 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5964 | 5964 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
| 5965 | 5965 | GROUP BY spotter_output.departure_airport_country |
| 5966 | 5966 | ORDER BY airport_departure_country_count DESC"; |
@@ -5972,7 +5972,7 @@ discard block |
||
| 5972 | 5972 | $airport_array = array(); |
| 5973 | 5973 | $temp_array = array(); |
| 5974 | 5974 | |
| 5975 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5975 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5976 | 5976 | { |
| 5977 | 5977 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 5978 | 5978 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5991,11 +5991,11 @@ discard block |
||
| 5991 | 5991 | * @return Array the airport list |
| 5992 | 5992 | * |
| 5993 | 5993 | */ |
| 5994 | - public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
|
| 5994 | + public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array()) |
|
| 5995 | 5995 | { |
| 5996 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5997 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 5998 | - $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 |
|
| 5996 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5997 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 5998 | + $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 |
|
| 5999 | 5999 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao AND spotter_output.departure_airport_icao <> '' |
| 6000 | 6000 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6001 | 6001 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6007,7 +6007,7 @@ discard block |
||
| 6007 | 6007 | $airport_array = array(); |
| 6008 | 6008 | $temp_array = array(); |
| 6009 | 6009 | |
| 6010 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6010 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6011 | 6011 | { |
| 6012 | 6012 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6013 | 6013 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6028,11 +6028,11 @@ discard block |
||
| 6028 | 6028 | * @return Array the airport list |
| 6029 | 6029 | * |
| 6030 | 6030 | */ |
| 6031 | - public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 6031 | + public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 6032 | 6032 | { |
| 6033 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6034 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 6035 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6033 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6034 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 6035 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6036 | 6036 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 6037 | 6037 | GROUP BY spotter_output.departure_airport_country |
| 6038 | 6038 | ORDER BY airport_departure_country_count DESC"; |
@@ -6044,7 +6044,7 @@ discard block |
||
| 6044 | 6044 | $airport_array = array(); |
| 6045 | 6045 | $temp_array = array(); |
| 6046 | 6046 | |
| 6047 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6047 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6048 | 6048 | { |
| 6049 | 6049 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6050 | 6050 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6062,11 +6062,11 @@ discard block |
||
| 6062 | 6062 | * @return Array the airport list |
| 6063 | 6063 | * |
| 6064 | 6064 | */ |
| 6065 | - public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
|
| 6065 | + public function countAllDepartureAirportsByRegistration($registration, $filters = array()) |
|
| 6066 | 6066 | { |
| 6067 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6068 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 6069 | - $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 |
|
| 6067 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6068 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 6069 | + $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 |
|
| 6070 | 6070 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration AND spotter_output.departure_airport_icao <> '' |
| 6071 | 6071 | GROUP BY spotter_output.departure_airport_icao |
| 6072 | 6072 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6078,7 +6078,7 @@ discard block |
||
| 6078 | 6078 | $airport_array = array(); |
| 6079 | 6079 | $temp_array = array(); |
| 6080 | 6080 | |
| 6081 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6081 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6082 | 6082 | { |
| 6083 | 6083 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6084 | 6084 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6099,11 +6099,11 @@ discard block |
||
| 6099 | 6099 | * @return Array the airport list |
| 6100 | 6100 | * |
| 6101 | 6101 | */ |
| 6102 | - public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
|
| 6102 | + public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array()) |
|
| 6103 | 6103 | { |
| 6104 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6105 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 6106 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6104 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6105 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 6106 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6107 | 6107 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration |
| 6108 | 6108 | GROUP BY spotter_output.departure_airport_country |
| 6109 | 6109 | ORDER BY airport_departure_country_count DESC"; |
@@ -6115,7 +6115,7 @@ discard block |
||
| 6115 | 6115 | $airport_array = array(); |
| 6116 | 6116 | $temp_array = array(); |
| 6117 | 6117 | |
| 6118 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6118 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6119 | 6119 | { |
| 6120 | 6120 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6121 | 6121 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6133,11 +6133,11 @@ discard block |
||
| 6133 | 6133 | * @return Array the airport list |
| 6134 | 6134 | * |
| 6135 | 6135 | */ |
| 6136 | - public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
|
| 6136 | + public function countAllDepartureAirportsByAirport($airport_icao, $filters = array()) |
|
| 6137 | 6137 | { |
| 6138 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6139 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 6140 | - $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 |
|
| 6138 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6139 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 6140 | + $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 |
|
| 6141 | 6141 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao AND spotter_output.departure_airport_icao <> '' |
| 6142 | 6142 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6143 | 6143 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6149,7 +6149,7 @@ discard block |
||
| 6149 | 6149 | $airport_array = array(); |
| 6150 | 6150 | $temp_array = array(); |
| 6151 | 6151 | |
| 6152 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6152 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6153 | 6153 | { |
| 6154 | 6154 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6155 | 6155 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6170,11 +6170,11 @@ discard block |
||
| 6170 | 6170 | * @return Array the airport list |
| 6171 | 6171 | * |
| 6172 | 6172 | */ |
| 6173 | - public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
|
| 6173 | + public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array()) |
|
| 6174 | 6174 | { |
| 6175 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6176 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 6177 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6175 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6176 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 6177 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6178 | 6178 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao |
| 6179 | 6179 | GROUP BY spotter_output.departure_airport_country |
| 6180 | 6180 | ORDER BY airport_departure_country_count DESC"; |
@@ -6186,7 +6186,7 @@ discard block |
||
| 6186 | 6186 | $airport_array = array(); |
| 6187 | 6187 | $temp_array = array(); |
| 6188 | 6188 | |
| 6189 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6189 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6190 | 6190 | { |
| 6191 | 6191 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6192 | 6192 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6205,11 +6205,11 @@ discard block |
||
| 6205 | 6205 | * @return Array the airport list |
| 6206 | 6206 | * |
| 6207 | 6207 | */ |
| 6208 | - public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 6208 | + public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 6209 | 6209 | { |
| 6210 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6211 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 6212 | - $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 |
|
| 6210 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6211 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 6212 | + $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 |
|
| 6213 | 6213 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer AND spotter_output.departure_airport_icao <> '' |
| 6214 | 6214 | GROUP BY spotter_output.departure_airport_icao |
| 6215 | 6215 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6221,7 +6221,7 @@ discard block |
||
| 6221 | 6221 | $airport_array = array(); |
| 6222 | 6222 | $temp_array = array(); |
| 6223 | 6223 | |
| 6224 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6224 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6225 | 6225 | { |
| 6226 | 6226 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6227 | 6227 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6242,11 +6242,11 @@ discard block |
||
| 6242 | 6242 | * @return Array the airport list |
| 6243 | 6243 | * |
| 6244 | 6244 | */ |
| 6245 | - public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 6245 | + public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 6246 | 6246 | { |
| 6247 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6248 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 6249 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6247 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6248 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 6249 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6250 | 6250 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 6251 | 6251 | GROUP BY spotter_output.departure_airport_country |
| 6252 | 6252 | ORDER BY airport_departure_country_count DESC"; |
@@ -6258,7 +6258,7 @@ discard block |
||
| 6258 | 6258 | $airport_array = array(); |
| 6259 | 6259 | $temp_array = array(); |
| 6260 | 6260 | |
| 6261 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6261 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6262 | 6262 | { |
| 6263 | 6263 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6264 | 6264 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6276,11 +6276,11 @@ discard block |
||
| 6276 | 6276 | * @return Array the airport list |
| 6277 | 6277 | * |
| 6278 | 6278 | */ |
| 6279 | - public function countAllDepartureAirportsByDate($date,$filters = array()) |
|
| 6279 | + public function countAllDepartureAirportsByDate($date, $filters = array()) |
|
| 6280 | 6280 | { |
| 6281 | 6281 | global $globalTimezone, $globalDBdriver; |
| 6282 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6283 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 6282 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6283 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 6284 | 6284 | if ($globalTimezone != '') { |
| 6285 | 6285 | date_default_timezone_set($globalTimezone); |
| 6286 | 6286 | $datetime = new DateTime($date); |
@@ -6288,12 +6288,12 @@ discard block |
||
| 6288 | 6288 | } else $offset = '+00:00'; |
| 6289 | 6289 | |
| 6290 | 6290 | if ($globalDBdriver == 'mysql') { |
| 6291 | - $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 |
|
| 6291 | + $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 |
|
| 6292 | 6292 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 6293 | 6293 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6294 | 6294 | ORDER BY airport_departure_icao_count DESC"; |
| 6295 | 6295 | } else { |
| 6296 | - $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 |
|
| 6296 | + $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 |
|
| 6297 | 6297 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 6298 | 6298 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6299 | 6299 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6305,7 +6305,7 @@ discard block |
||
| 6305 | 6305 | $airport_array = array(); |
| 6306 | 6306 | $temp_array = array(); |
| 6307 | 6307 | |
| 6308 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6308 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6309 | 6309 | { |
| 6310 | 6310 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6311 | 6311 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6326,11 +6326,11 @@ discard block |
||
| 6326 | 6326 | * @return Array the airport list |
| 6327 | 6327 | * |
| 6328 | 6328 | */ |
| 6329 | - public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
|
| 6329 | + public function countAllDepartureAirportCountriesByDate($date, $filters = array()) |
|
| 6330 | 6330 | { |
| 6331 | 6331 | global $globalTimezone, $globalDBdriver; |
| 6332 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6333 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 6332 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6333 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 6334 | 6334 | if ($globalTimezone != '') { |
| 6335 | 6335 | date_default_timezone_set($globalTimezone); |
| 6336 | 6336 | $datetime = new DateTime($date); |
@@ -6338,12 +6338,12 @@ discard block |
||
| 6338 | 6338 | } else $offset = '+00:00'; |
| 6339 | 6339 | |
| 6340 | 6340 | if ($globalDBdriver == 'mysql') { |
| 6341 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6341 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6342 | 6342 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 6343 | 6343 | GROUP BY spotter_output.departure_airport_country |
| 6344 | 6344 | ORDER BY airport_departure_country_count DESC"; |
| 6345 | 6345 | } else { |
| 6346 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6346 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6347 | 6347 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 6348 | 6348 | GROUP BY spotter_output.departure_airport_country |
| 6349 | 6349 | ORDER BY airport_departure_country_count DESC"; |
@@ -6355,7 +6355,7 @@ discard block |
||
| 6355 | 6355 | $airport_array = array(); |
| 6356 | 6356 | $temp_array = array(); |
| 6357 | 6357 | |
| 6358 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6358 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6359 | 6359 | { |
| 6360 | 6360 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6361 | 6361 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6373,11 +6373,11 @@ discard block |
||
| 6373 | 6373 | * @return Array the airport list |
| 6374 | 6374 | * |
| 6375 | 6375 | */ |
| 6376 | - public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
|
| 6376 | + public function countAllDepartureAirportsByIdent($ident, $filters = array()) |
|
| 6377 | 6377 | { |
| 6378 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6379 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 6380 | - $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 |
|
| 6378 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6379 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 6380 | + $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 |
|
| 6381 | 6381 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.ident = :ident |
| 6382 | 6382 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6383 | 6383 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6389,7 +6389,7 @@ discard block |
||
| 6389 | 6389 | $airport_array = array(); |
| 6390 | 6390 | $temp_array = array(); |
| 6391 | 6391 | |
| 6392 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6392 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6393 | 6393 | { |
| 6394 | 6394 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6395 | 6395 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6411,11 +6411,11 @@ discard block |
||
| 6411 | 6411 | * @return Array the airport list |
| 6412 | 6412 | * |
| 6413 | 6413 | */ |
| 6414 | - public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
|
| 6414 | + public function countAllDepartureAirportCountriesByIdent($ident, $filters = array()) |
|
| 6415 | 6415 | { |
| 6416 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6417 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 6418 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6416 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6417 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 6418 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6419 | 6419 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident |
| 6420 | 6420 | GROUP BY spotter_output.departure_airport_country |
| 6421 | 6421 | ORDER BY airport_departure_country_count DESC"; |
@@ -6427,7 +6427,7 @@ discard block |
||
| 6427 | 6427 | $airport_array = array(); |
| 6428 | 6428 | $temp_array = array(); |
| 6429 | 6429 | |
| 6430 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6430 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6431 | 6431 | { |
| 6432 | 6432 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6433 | 6433 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6446,12 +6446,12 @@ discard block |
||
| 6446 | 6446 | * @return Array the airport list |
| 6447 | 6447 | * |
| 6448 | 6448 | */ |
| 6449 | - public function countAllDepartureAirportsByCountry($country,$filters = array()) |
|
| 6449 | + public function countAllDepartureAirportsByCountry($country, $filters = array()) |
|
| 6450 | 6450 | { |
| 6451 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6452 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 6451 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6452 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 6453 | 6453 | |
| 6454 | - $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 |
|
| 6454 | + $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 |
|
| 6455 | 6455 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 6456 | 6456 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6457 | 6457 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6463,7 +6463,7 @@ discard block |
||
| 6463 | 6463 | $airport_array = array(); |
| 6464 | 6464 | $temp_array = array(); |
| 6465 | 6465 | |
| 6466 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6466 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6467 | 6467 | { |
| 6468 | 6468 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6469 | 6469 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6484,11 +6484,11 @@ discard block |
||
| 6484 | 6484 | * @return Array the airport list |
| 6485 | 6485 | * |
| 6486 | 6486 | */ |
| 6487 | - public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
|
| 6487 | + public function countAllDepartureAirportCountriesByCountry($country, $filters = array()) |
|
| 6488 | 6488 | { |
| 6489 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6490 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 6491 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6489 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6490 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 6491 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6492 | 6492 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 6493 | 6493 | GROUP BY spotter_output.departure_airport_country |
| 6494 | 6494 | ORDER BY airport_departure_country_count DESC"; |
@@ -6500,7 +6500,7 @@ discard block |
||
| 6500 | 6500 | $airport_array = array(); |
| 6501 | 6501 | $temp_array = array(); |
| 6502 | 6502 | |
| 6503 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6503 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6504 | 6504 | { |
| 6505 | 6505 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6506 | 6506 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6523,11 +6523,11 @@ discard block |
||
| 6523 | 6523 | * @return Array the airport list |
| 6524 | 6524 | * |
| 6525 | 6525 | */ |
| 6526 | - public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
| 6526 | + public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6527 | 6527 | { |
| 6528 | 6528 | global $globalDBdriver; |
| 6529 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6530 | - $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 |
|
| 6529 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6530 | + $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 |
|
| 6531 | 6531 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
| 6532 | 6532 | if ($olderthanmonths > 0) { |
| 6533 | 6533 | if ($globalDBdriver == 'mysql') { |
@@ -6557,7 +6557,7 @@ discard block |
||
| 6557 | 6557 | $airport_array = array(); |
| 6558 | 6558 | $temp_array = array(); |
| 6559 | 6559 | |
| 6560 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6560 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6561 | 6561 | { |
| 6562 | 6562 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6563 | 6563 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6580,11 +6580,11 @@ discard block |
||
| 6580 | 6580 | * @return Array the airport list |
| 6581 | 6581 | * |
| 6582 | 6582 | */ |
| 6583 | - public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
| 6583 | + public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6584 | 6584 | { |
| 6585 | 6585 | global $globalDBdriver; |
| 6586 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6587 | - $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 |
|
| 6586 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6587 | + $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 |
|
| 6588 | 6588 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' "; |
| 6589 | 6589 | if ($olderthanmonths > 0) { |
| 6590 | 6590 | if ($globalDBdriver == 'mysql') { |
@@ -6614,7 +6614,7 @@ discard block |
||
| 6614 | 6614 | $airport_array = array(); |
| 6615 | 6615 | $temp_array = array(); |
| 6616 | 6616 | |
| 6617 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6617 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6618 | 6618 | { |
| 6619 | 6619 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 6620 | 6620 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
@@ -6639,11 +6639,11 @@ discard block |
||
| 6639 | 6639 | * @return Array the airport list |
| 6640 | 6640 | * |
| 6641 | 6641 | */ |
| 6642 | - public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
| 6642 | + public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6643 | 6643 | { |
| 6644 | 6644 | global $globalDBdriver; |
| 6645 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6646 | - $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 |
|
| 6645 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6646 | + $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 |
|
| 6647 | 6647 | 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"; |
| 6648 | 6648 | if ($olderthanmonths > 0) { |
| 6649 | 6649 | if ($globalDBdriver == 'mysql') { |
@@ -6672,7 +6672,7 @@ discard block |
||
| 6672 | 6672 | $airport_array = array(); |
| 6673 | 6673 | $temp_array = array(); |
| 6674 | 6674 | |
| 6675 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6675 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6676 | 6676 | { |
| 6677 | 6677 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6678 | 6678 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6695,11 +6695,11 @@ discard block |
||
| 6695 | 6695 | * @return Array the airport list |
| 6696 | 6696 | * |
| 6697 | 6697 | */ |
| 6698 | - public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
| 6698 | + public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6699 | 6699 | { |
| 6700 | 6700 | global $globalDBdriver; |
| 6701 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6702 | - $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 |
|
| 6701 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6702 | + $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 |
|
| 6703 | 6703 | 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 "; |
| 6704 | 6704 | if ($olderthanmonths > 0) { |
| 6705 | 6705 | if ($globalDBdriver == 'mysql') { |
@@ -6729,7 +6729,7 @@ discard block |
||
| 6729 | 6729 | $airport_array = array(); |
| 6730 | 6730 | $temp_array = array(); |
| 6731 | 6731 | |
| 6732 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6732 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6733 | 6733 | { |
| 6734 | 6734 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6735 | 6735 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6755,9 +6755,9 @@ discard block |
||
| 6755 | 6755 | */ |
| 6756 | 6756 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
| 6757 | 6757 | { |
| 6758 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6759 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 6760 | - $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 |
|
| 6758 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6759 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 6760 | + $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 |
|
| 6761 | 6761 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.airline_icao = :airline_icao |
| 6762 | 6762 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6763 | 6763 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6768,7 +6768,7 @@ discard block |
||
| 6768 | 6768 | $airport_array = array(); |
| 6769 | 6769 | $temp_array = array(); |
| 6770 | 6770 | |
| 6771 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6771 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6772 | 6772 | { |
| 6773 | 6773 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6774 | 6774 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6789,12 +6789,12 @@ discard block |
||
| 6789 | 6789 | * @return Array the airport list |
| 6790 | 6790 | * |
| 6791 | 6791 | */ |
| 6792 | - public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
|
| 6792 | + public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array()) |
|
| 6793 | 6793 | { |
| 6794 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6795 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 6794 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6795 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 6796 | 6796 | |
| 6797 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6797 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6798 | 6798 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
| 6799 | 6799 | GROUP BY spotter_output.arrival_airport_country |
| 6800 | 6800 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6806,7 +6806,7 @@ discard block |
||
| 6806 | 6806 | $airport_array = array(); |
| 6807 | 6807 | $temp_array = array(); |
| 6808 | 6808 | |
| 6809 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6809 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6810 | 6810 | { |
| 6811 | 6811 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6812 | 6812 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6824,11 +6824,11 @@ discard block |
||
| 6824 | 6824 | * @return Array the airport list |
| 6825 | 6825 | * |
| 6826 | 6826 | */ |
| 6827 | - public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
|
| 6827 | + public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array()) |
|
| 6828 | 6828 | { |
| 6829 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6830 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 6831 | - $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 |
|
| 6829 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6830 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 6831 | + $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 |
|
| 6832 | 6832 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 6833 | 6833 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6834 | 6834 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6840,7 +6840,7 @@ discard block |
||
| 6840 | 6840 | $airport_array = array(); |
| 6841 | 6841 | $temp_array = array(); |
| 6842 | 6842 | |
| 6843 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6843 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6844 | 6844 | { |
| 6845 | 6845 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6846 | 6846 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6862,11 +6862,11 @@ discard block |
||
| 6862 | 6862 | * @return Array the airport list |
| 6863 | 6863 | * |
| 6864 | 6864 | */ |
| 6865 | - public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 6865 | + public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 6866 | 6866 | { |
| 6867 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6868 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 6869 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6867 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6868 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 6869 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6870 | 6870 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 6871 | 6871 | GROUP BY spotter_output.arrival_airport_country |
| 6872 | 6872 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6878,7 +6878,7 @@ discard block |
||
| 6878 | 6878 | $airport_array = array(); |
| 6879 | 6879 | $temp_array = array(); |
| 6880 | 6880 | |
| 6881 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6881 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6882 | 6882 | { |
| 6883 | 6883 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6884 | 6884 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6896,12 +6896,12 @@ discard block |
||
| 6896 | 6896 | * @return Array the airport list |
| 6897 | 6897 | * |
| 6898 | 6898 | */ |
| 6899 | - public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
|
| 6899 | + public function countAllArrivalAirportsByRegistration($registration, $filters = array()) |
|
| 6900 | 6900 | { |
| 6901 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6902 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 6901 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6902 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 6903 | 6903 | |
| 6904 | - $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 |
|
| 6904 | + $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 |
|
| 6905 | 6905 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.registration = :registration |
| 6906 | 6906 | GROUP BY spotter_output.arrival_airport_icao |
| 6907 | 6907 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6913,7 +6913,7 @@ discard block |
||
| 6913 | 6913 | $airport_array = array(); |
| 6914 | 6914 | $temp_array = array(); |
| 6915 | 6915 | |
| 6916 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6916 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6917 | 6917 | { |
| 6918 | 6918 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6919 | 6919 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6934,11 +6934,11 @@ discard block |
||
| 6934 | 6934 | * @return Array the airport list |
| 6935 | 6935 | * |
| 6936 | 6936 | */ |
| 6937 | - public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
|
| 6937 | + public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array()) |
|
| 6938 | 6938 | { |
| 6939 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6940 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 6941 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6939 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6940 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 6941 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6942 | 6942 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration |
| 6943 | 6943 | GROUP BY spotter_output.arrival_airport_country |
| 6944 | 6944 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6950,7 +6950,7 @@ discard block |
||
| 6950 | 6950 | $airport_array = array(); |
| 6951 | 6951 | $temp_array = array(); |
| 6952 | 6952 | |
| 6953 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6953 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6954 | 6954 | { |
| 6955 | 6955 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6956 | 6956 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6969,11 +6969,11 @@ discard block |
||
| 6969 | 6969 | * @return Array the airport list |
| 6970 | 6970 | * |
| 6971 | 6971 | */ |
| 6972 | - public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
|
| 6972 | + public function countAllArrivalAirportsByAirport($airport_icao, $filters = array()) |
|
| 6973 | 6973 | { |
| 6974 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6975 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 6976 | - $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 |
|
| 6974 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6975 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 6976 | + $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 |
|
| 6977 | 6977 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.departure_airport_icao = :airport_icao |
| 6978 | 6978 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6979 | 6979 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6985,7 +6985,7 @@ discard block |
||
| 6985 | 6985 | $airport_array = array(); |
| 6986 | 6986 | $temp_array = array(); |
| 6987 | 6987 | |
| 6988 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6988 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6989 | 6989 | { |
| 6990 | 6990 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6991 | 6991 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7006,11 +7006,11 @@ discard block |
||
| 7006 | 7006 | * @return Array the airport list |
| 7007 | 7007 | * |
| 7008 | 7008 | */ |
| 7009 | - public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
|
| 7009 | + public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array()) |
|
| 7010 | 7010 | { |
| 7011 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7012 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 7013 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7011 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7012 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 7013 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7014 | 7014 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao |
| 7015 | 7015 | GROUP BY spotter_output.arrival_airport_country |
| 7016 | 7016 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7022,7 +7022,7 @@ discard block |
||
| 7022 | 7022 | $airport_array = array(); |
| 7023 | 7023 | $temp_array = array(); |
| 7024 | 7024 | |
| 7025 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7025 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7026 | 7026 | { |
| 7027 | 7027 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7028 | 7028 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7040,11 +7040,11 @@ discard block |
||
| 7040 | 7040 | * @return Array the airport list |
| 7041 | 7041 | * |
| 7042 | 7042 | */ |
| 7043 | - public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 7043 | + public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 7044 | 7044 | { |
| 7045 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7046 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 7047 | - $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 |
|
| 7045 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7046 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 7047 | + $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 |
|
| 7048 | 7048 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 7049 | 7049 | GROUP BY spotter_output.arrival_airport_icao |
| 7050 | 7050 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7056,7 +7056,7 @@ discard block |
||
| 7056 | 7056 | $airport_array = array(); |
| 7057 | 7057 | $temp_array = array(); |
| 7058 | 7058 | |
| 7059 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7059 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7060 | 7060 | { |
| 7061 | 7061 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7062 | 7062 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7078,11 +7078,11 @@ discard block |
||
| 7078 | 7078 | * @return Array the airport list |
| 7079 | 7079 | * |
| 7080 | 7080 | */ |
| 7081 | - public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 7081 | + public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 7082 | 7082 | { |
| 7083 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7084 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 7085 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7083 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7084 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 7085 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7086 | 7086 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 7087 | 7087 | GROUP BY spotter_output.arrival_airport_country |
| 7088 | 7088 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7094,7 +7094,7 @@ discard block |
||
| 7094 | 7094 | $airport_array = array(); |
| 7095 | 7095 | $temp_array = array(); |
| 7096 | 7096 | |
| 7097 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7097 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7098 | 7098 | { |
| 7099 | 7099 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7100 | 7100 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7113,11 +7113,11 @@ discard block |
||
| 7113 | 7113 | * @return Array the airport list |
| 7114 | 7114 | * |
| 7115 | 7115 | */ |
| 7116 | - public function countAllArrivalAirportsByDate($date,$filters = array()) |
|
| 7116 | + public function countAllArrivalAirportsByDate($date, $filters = array()) |
|
| 7117 | 7117 | { |
| 7118 | 7118 | global $globalTimezone, $globalDBdriver; |
| 7119 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7120 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 7119 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7120 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 7121 | 7121 | if ($globalTimezone != '') { |
| 7122 | 7122 | date_default_timezone_set($globalTimezone); |
| 7123 | 7123 | $datetime = new DateTime($date); |
@@ -7125,12 +7125,12 @@ discard block |
||
| 7125 | 7125 | } else $offset = '+00:00'; |
| 7126 | 7126 | |
| 7127 | 7127 | if ($globalDBdriver == 'mysql') { |
| 7128 | - $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 |
|
| 7128 | + $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 |
|
| 7129 | 7129 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 7130 | 7130 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7131 | 7131 | ORDER BY airport_arrival_icao_count DESC"; |
| 7132 | 7132 | } else { |
| 7133 | - $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 |
|
| 7133 | + $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 |
|
| 7134 | 7134 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 7135 | 7135 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7136 | 7136 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7142,7 +7142,7 @@ discard block |
||
| 7142 | 7142 | $airport_array = array(); |
| 7143 | 7143 | $temp_array = array(); |
| 7144 | 7144 | |
| 7145 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7145 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7146 | 7146 | { |
| 7147 | 7147 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7148 | 7148 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7166,8 +7166,8 @@ discard block |
||
| 7166 | 7166 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
| 7167 | 7167 | { |
| 7168 | 7168 | global $globalTimezone, $globalDBdriver; |
| 7169 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7170 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 7169 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7170 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 7171 | 7171 | if ($globalTimezone != '') { |
| 7172 | 7172 | date_default_timezone_set($globalTimezone); |
| 7173 | 7173 | $datetime = new DateTime($date); |
@@ -7175,12 +7175,12 @@ discard block |
||
| 7175 | 7175 | } else $offset = '+00:00'; |
| 7176 | 7176 | |
| 7177 | 7177 | if ($globalDBdriver == 'mysql') { |
| 7178 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7178 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7179 | 7179 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 7180 | 7180 | GROUP BY spotter_output.arrival_airport_country |
| 7181 | 7181 | ORDER BY airport_arrival_country_count DESC"; |
| 7182 | 7182 | } else { |
| 7183 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7183 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7184 | 7184 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 7185 | 7185 | GROUP BY spotter_output.arrival_airport_country |
| 7186 | 7186 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7192,7 +7192,7 @@ discard block |
||
| 7192 | 7192 | $airport_array = array(); |
| 7193 | 7193 | $temp_array = array(); |
| 7194 | 7194 | |
| 7195 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7195 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7196 | 7196 | { |
| 7197 | 7197 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7198 | 7198 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7210,11 +7210,11 @@ discard block |
||
| 7210 | 7210 | * @return Array the airport list |
| 7211 | 7211 | * |
| 7212 | 7212 | */ |
| 7213 | - public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
|
| 7213 | + public function countAllArrivalAirportsByIdent($ident, $filters = array()) |
|
| 7214 | 7214 | { |
| 7215 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7216 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7217 | - $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 |
|
| 7215 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7216 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7217 | + $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 |
|
| 7218 | 7218 | FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.ident = :ident |
| 7219 | 7219 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7220 | 7220 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7226,7 +7226,7 @@ discard block |
||
| 7226 | 7226 | $airport_array = array(); |
| 7227 | 7227 | $temp_array = array(); |
| 7228 | 7228 | |
| 7229 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7229 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7230 | 7230 | { |
| 7231 | 7231 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7232 | 7232 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7249,9 +7249,9 @@ discard block |
||
| 7249 | 7249 | */ |
| 7250 | 7250 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
| 7251 | 7251 | { |
| 7252 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7253 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7254 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7252 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7253 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7254 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7255 | 7255 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident |
| 7256 | 7256 | GROUP BY spotter_output.arrival_airport_country |
| 7257 | 7257 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7263,7 +7263,7 @@ discard block |
||
| 7263 | 7263 | $airport_array = array(); |
| 7264 | 7264 | $temp_array = array(); |
| 7265 | 7265 | |
| 7266 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7266 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7267 | 7267 | { |
| 7268 | 7268 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7269 | 7269 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7282,11 +7282,11 @@ discard block |
||
| 7282 | 7282 | * @return Array the airport list |
| 7283 | 7283 | * |
| 7284 | 7284 | */ |
| 7285 | - public function countAllArrivalAirportsByCountry($country,$filters = array()) |
|
| 7285 | + public function countAllArrivalAirportsByCountry($country, $filters = array()) |
|
| 7286 | 7286 | { |
| 7287 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7288 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7289 | - $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 |
|
| 7287 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7288 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7289 | + $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 |
|
| 7290 | 7290 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7291 | 7291 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7292 | 7292 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7298,7 +7298,7 @@ discard block |
||
| 7298 | 7298 | $airport_array = array(); |
| 7299 | 7299 | $temp_array = array(); |
| 7300 | 7300 | |
| 7301 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7301 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7302 | 7302 | { |
| 7303 | 7303 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7304 | 7304 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7319,11 +7319,11 @@ discard block |
||
| 7319 | 7319 | * @return Array the airport list |
| 7320 | 7320 | * |
| 7321 | 7321 | */ |
| 7322 | - public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
|
| 7322 | + public function countAllArrivalAirportCountriesByCountry($country, $filters = array()) |
|
| 7323 | 7323 | { |
| 7324 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7325 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7326 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7324 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7325 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7326 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7327 | 7327 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7328 | 7328 | GROUP BY spotter_output.arrival_airport_country |
| 7329 | 7329 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7335,7 +7335,7 @@ discard block |
||
| 7335 | 7335 | $airport_array = array(); |
| 7336 | 7336 | $temp_array = array(); |
| 7337 | 7337 | |
| 7338 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7338 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7339 | 7339 | { |
| 7340 | 7340 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7341 | 7341 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7356,7 +7356,7 @@ discard block |
||
| 7356 | 7356 | */ |
| 7357 | 7357 | public function countAllDepartureCountries($filters = array()) |
| 7358 | 7358 | { |
| 7359 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7359 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7360 | 7360 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
| 7361 | 7361 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
| 7362 | 7362 | $query .= " GROUP BY spotter_output.departure_airport_country |
@@ -7370,7 +7370,7 @@ discard block |
||
| 7370 | 7370 | $airport_array = array(); |
| 7371 | 7371 | $temp_array = array(); |
| 7372 | 7372 | |
| 7373 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7373 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7374 | 7374 | { |
| 7375 | 7375 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
| 7376 | 7376 | $temp_array['airport_departure_country'] = $row['departure_airport_country']; |
@@ -7388,9 +7388,9 @@ discard block |
||
| 7388 | 7388 | * @return Array the airport arrival list |
| 7389 | 7389 | * |
| 7390 | 7390 | */ |
| 7391 | - public function countAllArrivalCountries($limit = true,$filters = array()) |
|
| 7391 | + public function countAllArrivalCountries($limit = true, $filters = array()) |
|
| 7392 | 7392 | { |
| 7393 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7393 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7394 | 7394 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
| 7395 | 7395 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
| 7396 | 7396 | $query .= " GROUP BY spotter_output.arrival_airport_country |
@@ -7404,7 +7404,7 @@ discard block |
||
| 7404 | 7404 | $airport_array = array(); |
| 7405 | 7405 | $temp_array = array(); |
| 7406 | 7406 | |
| 7407 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7407 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7408 | 7408 | { |
| 7409 | 7409 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
| 7410 | 7410 | $temp_array['airport_arrival_country'] = $row['arrival_airport_country']; |
@@ -7427,8 +7427,8 @@ discard block |
||
| 7427 | 7427 | */ |
| 7428 | 7428 | public function countAllRoutes($filters = array()) |
| 7429 | 7429 | { |
| 7430 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7431 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7430 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7431 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7432 | 7432 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' |
| 7433 | 7433 | GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 7434 | 7434 | ORDER BY route_count DESC |
@@ -7441,7 +7441,7 @@ discard block |
||
| 7441 | 7441 | $routes_array = array(); |
| 7442 | 7442 | $temp_array = array(); |
| 7443 | 7443 | |
| 7444 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7444 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7445 | 7445 | { |
| 7446 | 7446 | $temp_array['route_count'] = $row['route_count']; |
| 7447 | 7447 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7468,11 +7468,11 @@ discard block |
||
| 7468 | 7468 | * @return Array the route list |
| 7469 | 7469 | * |
| 7470 | 7470 | */ |
| 7471 | - public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
|
| 7471 | + public function countAllRoutesByAircraft($aircraft_icao, $filters = array()) |
|
| 7472 | 7472 | { |
| 7473 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7474 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 7475 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7473 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7474 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 7475 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7476 | 7476 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 7477 | 7477 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7478 | 7478 | ORDER BY route_count DESC"; |
@@ -7483,7 +7483,7 @@ discard block |
||
| 7483 | 7483 | $routes_array = array(); |
| 7484 | 7484 | $temp_array = array(); |
| 7485 | 7485 | |
| 7486 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7486 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7487 | 7487 | { |
| 7488 | 7488 | $temp_array['route_count'] = $row['route_count']; |
| 7489 | 7489 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7510,9 +7510,9 @@ discard block |
||
| 7510 | 7510 | */ |
| 7511 | 7511 | public function countAllRoutesByRegistration($registration, $filters = array()) |
| 7512 | 7512 | { |
| 7513 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7513 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7514 | 7514 | $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
| 7515 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7515 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7516 | 7516 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration |
| 7517 | 7517 | GROUP BY route |
| 7518 | 7518 | ORDER BY route_count DESC"; |
@@ -7524,7 +7524,7 @@ discard block |
||
| 7524 | 7524 | $routes_array = array(); |
| 7525 | 7525 | $temp_array = array(); |
| 7526 | 7526 | |
| 7527 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7527 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7528 | 7528 | { |
| 7529 | 7529 | $temp_array['route_count'] = $row['route_count']; |
| 7530 | 7530 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7552,9 +7552,9 @@ discard block |
||
| 7552 | 7552 | */ |
| 7553 | 7553 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
| 7554 | 7554 | { |
| 7555 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7556 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 7557 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7555 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7556 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 7557 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7558 | 7558 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao |
| 7559 | 7559 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7560 | 7560 | ORDER BY route_count DESC"; |
@@ -7566,7 +7566,7 @@ discard block |
||
| 7566 | 7566 | $routes_array = array(); |
| 7567 | 7567 | $temp_array = array(); |
| 7568 | 7568 | |
| 7569 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7569 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7570 | 7570 | { |
| 7571 | 7571 | $temp_array['route_count'] = $row['route_count']; |
| 7572 | 7572 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7594,9 +7594,9 @@ discard block |
||
| 7594 | 7594 | */ |
| 7595 | 7595 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
| 7596 | 7596 | { |
| 7597 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7598 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 7599 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7597 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7598 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 7599 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7600 | 7600 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 7601 | 7601 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7602 | 7602 | ORDER BY route_count DESC"; |
@@ -7607,7 +7607,7 @@ discard block |
||
| 7607 | 7607 | $routes_array = array(); |
| 7608 | 7608 | $temp_array = array(); |
| 7609 | 7609 | |
| 7610 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7610 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7611 | 7611 | { |
| 7612 | 7612 | $temp_array['route_count'] = $row['route_count']; |
| 7613 | 7613 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7635,9 +7635,9 @@ discard block |
||
| 7635 | 7635 | */ |
| 7636 | 7636 | public function countAllRoutesByCountry($country, $filters = array()) |
| 7637 | 7637 | { |
| 7638 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7639 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7640 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7638 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7639 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7640 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7641 | 7641 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7642 | 7642 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7643 | 7643 | ORDER BY route_count DESC"; |
@@ -7648,7 +7648,7 @@ discard block |
||
| 7648 | 7648 | $routes_array = array(); |
| 7649 | 7649 | $temp_array = array(); |
| 7650 | 7650 | |
| 7651 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7651 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7652 | 7652 | { |
| 7653 | 7653 | $temp_array['route_count'] = $row['route_count']; |
| 7654 | 7654 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7676,8 +7676,8 @@ discard block |
||
| 7676 | 7676 | public function countAllRoutesByDate($date, $filters = array()) |
| 7677 | 7677 | { |
| 7678 | 7678 | global $globalTimezone, $globalDBdriver; |
| 7679 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7680 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 7679 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7680 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 7681 | 7681 | if ($globalTimezone != '') { |
| 7682 | 7682 | date_default_timezone_set($globalTimezone); |
| 7683 | 7683 | $datetime = new DateTime($date); |
@@ -7685,12 +7685,12 @@ discard block |
||
| 7685 | 7685 | } else $offset = '+00:00'; |
| 7686 | 7686 | |
| 7687 | 7687 | if ($globalDBdriver == 'mysql') { |
| 7688 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7688 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7689 | 7689 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 7690 | 7690 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7691 | 7691 | ORDER BY route_count DESC"; |
| 7692 | 7692 | } else { |
| 7693 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7693 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7694 | 7694 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 7695 | 7695 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7696 | 7696 | ORDER BY route_count DESC"; |
@@ -7702,7 +7702,7 @@ discard block |
||
| 7702 | 7702 | $routes_array = array(); |
| 7703 | 7703 | $temp_array = array(); |
| 7704 | 7704 | |
| 7705 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7705 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7706 | 7706 | { |
| 7707 | 7707 | $temp_array['route_count'] = $row['route_count']; |
| 7708 | 7708 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7729,9 +7729,9 @@ discard block |
||
| 7729 | 7729 | */ |
| 7730 | 7730 | public function countAllRoutesByIdent($ident, $filters = array()) |
| 7731 | 7731 | { |
| 7732 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7733 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7734 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7732 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7733 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7734 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7735 | 7735 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident |
| 7736 | 7736 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7737 | 7737 | ORDER BY route_count DESC"; |
@@ -7743,7 +7743,7 @@ discard block |
||
| 7743 | 7743 | $routes_array = array(); |
| 7744 | 7744 | $temp_array = array(); |
| 7745 | 7745 | |
| 7746 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7746 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7747 | 7747 | { |
| 7748 | 7748 | $temp_array['route_count'] = $row['route_count']; |
| 7749 | 7749 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7770,9 +7770,9 @@ discard block |
||
| 7770 | 7770 | */ |
| 7771 | 7771 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
| 7772 | 7772 | { |
| 7773 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7774 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 7775 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7773 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7774 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 7775 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7776 | 7776 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 7777 | 7777 | GROUP BY route |
| 7778 | 7778 | ORDER BY route_count DESC"; |
@@ -7784,7 +7784,7 @@ discard block |
||
| 7784 | 7784 | $routes_array = array(); |
| 7785 | 7785 | $temp_array = array(); |
| 7786 | 7786 | |
| 7787 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7787 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7788 | 7788 | { |
| 7789 | 7789 | $temp_array['route_count'] = $row['route_count']; |
| 7790 | 7790 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7812,8 +7812,8 @@ discard block |
||
| 7812 | 7812 | */ |
| 7813 | 7813 | public function countAllRoutesWithWaypoints($filters = array()) |
| 7814 | 7814 | { |
| 7815 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7816 | - $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7815 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7816 | + $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7817 | 7817 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' |
| 7818 | 7818 | GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7819 | 7819 | ORDER BY route_count DESC |
@@ -7826,7 +7826,7 @@ discard block |
||
| 7826 | 7826 | $routes_array = array(); |
| 7827 | 7827 | $temp_array = array(); |
| 7828 | 7828 | |
| 7829 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7829 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7830 | 7830 | { |
| 7831 | 7831 | $temp_array['spotter_id'] = $row['spotter_id']; |
| 7832 | 7832 | $temp_array['route_count'] = $row['route_count']; |
@@ -7851,11 +7851,11 @@ discard block |
||
| 7851 | 7851 | * @return Array the callsign list |
| 7852 | 7852 | * |
| 7853 | 7853 | */ |
| 7854 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 7854 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 7855 | 7855 | { |
| 7856 | 7856 | global $globalDBdriver; |
| 7857 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7858 | - $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
| 7857 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7858 | + $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
| 7859 | 7859 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
| 7860 | 7860 | if ($olderthanmonths > 0) { |
| 7861 | 7861 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -7874,7 +7874,7 @@ discard block |
||
| 7874 | 7874 | $callsign_array = array(); |
| 7875 | 7875 | $temp_array = array(); |
| 7876 | 7876 | |
| 7877 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7877 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7878 | 7878 | { |
| 7879 | 7879 | $temp_array['callsign_icao'] = $row['ident']; |
| 7880 | 7880 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -7896,8 +7896,8 @@ discard block |
||
| 7896 | 7896 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
| 7897 | 7897 | { |
| 7898 | 7898 | global $globalDBdriver; |
| 7899 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7900 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
| 7899 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7900 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
| 7901 | 7901 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 7902 | 7902 | if ($olderthanmonths > 0) { |
| 7903 | 7903 | if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
@@ -7916,7 +7916,7 @@ discard block |
||
| 7916 | 7916 | $callsign_array = array(); |
| 7917 | 7917 | $temp_array = array(); |
| 7918 | 7918 | |
| 7919 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7919 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7920 | 7920 | { |
| 7921 | 7921 | $temp_array['callsign_icao'] = $row['ident']; |
| 7922 | 7922 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -7970,7 +7970,7 @@ discard block |
||
| 7970 | 7970 | $date_array = array(); |
| 7971 | 7971 | $temp_array = array(); |
| 7972 | 7972 | |
| 7973 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7973 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7974 | 7974 | { |
| 7975 | 7975 | $temp_array['date_name'] = $row['date_name']; |
| 7976 | 7976 | $temp_array['date_count'] = $row['date_count']; |
@@ -7995,15 +7995,15 @@ discard block |
||
| 7995 | 7995 | $datetime = new DateTime(); |
| 7996 | 7996 | $offset = $datetime->format('P'); |
| 7997 | 7997 | } else $offset = '+00:00'; |
| 7998 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7998 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7999 | 7999 | if ($globalDBdriver == 'mysql') { |
| 8000 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 8000 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 8001 | 8001 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 8002 | 8002 | GROUP BY spotter_output.airline_icao, date_name |
| 8003 | 8003 | ORDER BY date_count DESC |
| 8004 | 8004 | LIMIT 10 OFFSET 0"; |
| 8005 | 8005 | } else { |
| 8006 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 8006 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 8007 | 8007 | FROM spotter_output |
| 8008 | 8008 | WHERE spotter_output.airline_icao <> '' |
| 8009 | 8009 | GROUP BY spotter_output.airline_icao, date_name |
@@ -8018,7 +8018,7 @@ discard block |
||
| 8018 | 8018 | $date_array = array(); |
| 8019 | 8019 | $temp_array = array(); |
| 8020 | 8020 | |
| 8021 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8021 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8022 | 8022 | { |
| 8023 | 8023 | $temp_array['date_name'] = $row['date_name']; |
| 8024 | 8024 | $temp_array['date_count'] = $row['date_count']; |
@@ -8044,7 +8044,7 @@ discard block |
||
| 8044 | 8044 | $datetime = new DateTime(); |
| 8045 | 8045 | $offset = $datetime->format('P'); |
| 8046 | 8046 | } else $offset = '+00:00'; |
| 8047 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8047 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8048 | 8048 | if ($globalDBdriver == 'mysql') { |
| 8049 | 8049 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 8050 | 8050 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -8065,7 +8065,7 @@ discard block |
||
| 8065 | 8065 | $date_array = array(); |
| 8066 | 8066 | $temp_array = array(); |
| 8067 | 8067 | |
| 8068 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8068 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8069 | 8069 | { |
| 8070 | 8070 | $temp_array['date_name'] = $row['date_name']; |
| 8071 | 8071 | $temp_array['date_count'] = $row['date_count']; |
@@ -8090,7 +8090,7 @@ discard block |
||
| 8090 | 8090 | $datetime = new DateTime(); |
| 8091 | 8091 | $offset = $datetime->format('P'); |
| 8092 | 8092 | } else $offset = '+00:00'; |
| 8093 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8093 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8094 | 8094 | if ($globalDBdriver == 'mysql') { |
| 8095 | 8095 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 8096 | 8096 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -8111,7 +8111,7 @@ discard block |
||
| 8111 | 8111 | $date_array = array(); |
| 8112 | 8112 | $temp_array = array(); |
| 8113 | 8113 | |
| 8114 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8114 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8115 | 8115 | { |
| 8116 | 8116 | $temp_array['date_name'] = $row['date_name']; |
| 8117 | 8117 | $temp_array['date_count'] = $row['date_count']; |
@@ -8132,7 +8132,7 @@ discard block |
||
| 8132 | 8132 | public function countAllDatesLastMonthByAirlines($filters = array()) |
| 8133 | 8133 | { |
| 8134 | 8134 | global $globalTimezone, $globalDBdriver; |
| 8135 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8135 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8136 | 8136 | if ($globalTimezone != '') { |
| 8137 | 8137 | date_default_timezone_set($globalTimezone); |
| 8138 | 8138 | $datetime = new DateTime(); |
@@ -8140,13 +8140,13 @@ discard block |
||
| 8140 | 8140 | } else $offset = '+00:00'; |
| 8141 | 8141 | |
| 8142 | 8142 | if ($globalDBdriver == 'mysql') { |
| 8143 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 8143 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 8144 | 8144 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH) |
| 8145 | 8145 | GROUP BY spotter_output.airline_icao, date_name |
| 8146 | 8146 | ORDER BY spotter_output.date ASC"; |
| 8147 | 8147 | $query_data = array(':offset' => $offset); |
| 8148 | 8148 | } else { |
| 8149 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 8149 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 8150 | 8150 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS' |
| 8151 | 8151 | GROUP BY spotter_output.airline_icao, date_name |
| 8152 | 8152 | ORDER BY date_name ASC"; |
@@ -8159,7 +8159,7 @@ discard block |
||
| 8159 | 8159 | $date_array = array(); |
| 8160 | 8160 | $temp_array = array(); |
| 8161 | 8161 | |
| 8162 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8162 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8163 | 8163 | { |
| 8164 | 8164 | $temp_array['date_name'] = $row['date_name']; |
| 8165 | 8165 | $temp_array['date_count'] = $row['date_count']; |
@@ -8206,7 +8206,7 @@ discard block |
||
| 8206 | 8206 | $date_array = array(); |
| 8207 | 8207 | $temp_array = array(); |
| 8208 | 8208 | |
| 8209 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8209 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8210 | 8210 | { |
| 8211 | 8211 | $temp_array['month_name'] = $row['month_name']; |
| 8212 | 8212 | $temp_array['year_name'] = $row['year_name']; |
@@ -8227,7 +8227,7 @@ discard block |
||
| 8227 | 8227 | public function countAllMonthsByAirlines($filters = array()) |
| 8228 | 8228 | { |
| 8229 | 8229 | global $globalTimezone, $globalDBdriver; |
| 8230 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8230 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8231 | 8231 | if ($globalTimezone != '') { |
| 8232 | 8232 | date_default_timezone_set($globalTimezone); |
| 8233 | 8233 | $datetime = new DateTime(); |
@@ -8235,12 +8235,12 @@ discard block |
||
| 8235 | 8235 | } else $offset = '+00:00'; |
| 8236 | 8236 | |
| 8237 | 8237 | if ($globalDBdriver == 'mysql') { |
| 8238 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 8238 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 8239 | 8239 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 8240 | 8240 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8241 | 8241 | ORDER BY date_count DESC"; |
| 8242 | 8242 | } else { |
| 8243 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8243 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8244 | 8244 | FROM spotter_output |
| 8245 | 8245 | WHERE spotter_output.airline_icao <> '' |
| 8246 | 8246 | GROUP BY spotter_output.airline_icao, year_name, month_name |
@@ -8254,7 +8254,7 @@ discard block |
||
| 8254 | 8254 | $date_array = array(); |
| 8255 | 8255 | $temp_array = array(); |
| 8256 | 8256 | |
| 8257 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8257 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8258 | 8258 | { |
| 8259 | 8259 | $temp_array['month_name'] = $row['month_name']; |
| 8260 | 8260 | $temp_array['year_name'] = $row['year_name']; |
@@ -8281,14 +8281,14 @@ discard block |
||
| 8281 | 8281 | $datetime = new DateTime(); |
| 8282 | 8282 | $offset = $datetime->format('P'); |
| 8283 | 8283 | } else $offset = '+00:00'; |
| 8284 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8284 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8285 | 8285 | if ($globalDBdriver == 'mysql') { |
| 8286 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 8286 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 8287 | 8287 | FROM spotter_output".$filter_query." spotter_output.airline_type = 'military' |
| 8288 | 8288 | GROUP BY year_name, month_name |
| 8289 | 8289 | ORDER BY date_count DESC"; |
| 8290 | 8290 | } else { |
| 8291 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8291 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8292 | 8292 | FROM spotter_output".$filter_query." spotter_output.airline_type = 'military' |
| 8293 | 8293 | GROUP BY year_name, month_name |
| 8294 | 8294 | ORDER BY date_count DESC"; |
@@ -8300,7 +8300,7 @@ discard block |
||
| 8300 | 8300 | $date_array = array(); |
| 8301 | 8301 | $temp_array = array(); |
| 8302 | 8302 | |
| 8303 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8303 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8304 | 8304 | { |
| 8305 | 8305 | $temp_array['month_name'] = $row['month_name']; |
| 8306 | 8306 | $temp_array['year_name'] = $row['year_name']; |
@@ -8326,15 +8326,15 @@ discard block |
||
| 8326 | 8326 | $datetime = new DateTime(); |
| 8327 | 8327 | $offset = $datetime->format('P'); |
| 8328 | 8328 | } else $offset = '+00:00'; |
| 8329 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8329 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8330 | 8330 | |
| 8331 | 8331 | if ($globalDBdriver == 'mysql') { |
| 8332 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 8332 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 8333 | 8333 | FROM spotter_output".$filter_query." owner_name <> '' |
| 8334 | 8334 | GROUP BY year_name, month_name |
| 8335 | 8335 | ORDER BY date_count DESC"; |
| 8336 | 8336 | } else { |
| 8337 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8337 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8338 | 8338 | FROM spotter_output".$filter_query." owner_name <> '' |
| 8339 | 8339 | GROUP BY year_name, month_name |
| 8340 | 8340 | ORDER BY date_count DESC"; |
@@ -8346,7 +8346,7 @@ discard block |
||
| 8346 | 8346 | $date_array = array(); |
| 8347 | 8347 | $temp_array = array(); |
| 8348 | 8348 | |
| 8349 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8349 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8350 | 8350 | { |
| 8351 | 8351 | $temp_array['month_name'] = $row['month_name']; |
| 8352 | 8352 | $temp_array['year_name'] = $row['year_name']; |
@@ -8367,7 +8367,7 @@ discard block |
||
| 8367 | 8367 | public function countAllMonthsOwnersByAirlines($filters = array()) |
| 8368 | 8368 | { |
| 8369 | 8369 | global $globalTimezone, $globalDBdriver; |
| 8370 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8370 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8371 | 8371 | if ($globalTimezone != '') { |
| 8372 | 8372 | date_default_timezone_set($globalTimezone); |
| 8373 | 8373 | $datetime = new DateTime(); |
@@ -8375,12 +8375,12 @@ discard block |
||
| 8375 | 8375 | } else $offset = '+00:00'; |
| 8376 | 8376 | |
| 8377 | 8377 | if ($globalDBdriver == 'mysql') { |
| 8378 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 8378 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 8379 | 8379 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
| 8380 | 8380 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8381 | 8381 | ORDER BY date_count DESC"; |
| 8382 | 8382 | } else { |
| 8383 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8383 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8384 | 8384 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
| 8385 | 8385 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8386 | 8386 | ORDER BY date_count DESC"; |
@@ -8392,7 +8392,7 @@ discard block |
||
| 8392 | 8392 | $date_array = array(); |
| 8393 | 8393 | $temp_array = array(); |
| 8394 | 8394 | |
| 8395 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8395 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8396 | 8396 | { |
| 8397 | 8397 | $temp_array['month_name'] = $row['month_name']; |
| 8398 | 8398 | $temp_array['year_name'] = $row['year_name']; |
@@ -8419,15 +8419,15 @@ discard block |
||
| 8419 | 8419 | $datetime = new DateTime(); |
| 8420 | 8420 | $offset = $datetime->format('P'); |
| 8421 | 8421 | } else $offset = '+00:00'; |
| 8422 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8422 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8423 | 8423 | |
| 8424 | 8424 | if ($globalDBdriver == 'mysql') { |
| 8425 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 8425 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 8426 | 8426 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
| 8427 | 8427 | GROUP BY year_name, month_name |
| 8428 | 8428 | ORDER BY date_count DESC"; |
| 8429 | 8429 | } else { |
| 8430 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8430 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8431 | 8431 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
| 8432 | 8432 | GROUP BY year_name, month_name |
| 8433 | 8433 | ORDER BY date_count DESC"; |
@@ -8439,7 +8439,7 @@ discard block |
||
| 8439 | 8439 | $date_array = array(); |
| 8440 | 8440 | $temp_array = array(); |
| 8441 | 8441 | |
| 8442 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8442 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8443 | 8443 | { |
| 8444 | 8444 | $temp_array['month_name'] = $row['month_name']; |
| 8445 | 8445 | $temp_array['year_name'] = $row['year_name']; |
@@ -8460,7 +8460,7 @@ discard block |
||
| 8460 | 8460 | public function countAllMonthsPilotsByAirlines($filters = array()) |
| 8461 | 8461 | { |
| 8462 | 8462 | global $globalTimezone, $globalDBdriver; |
| 8463 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8463 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8464 | 8464 | if ($globalTimezone != '') { |
| 8465 | 8465 | date_default_timezone_set($globalTimezone); |
| 8466 | 8466 | $datetime = new DateTime(); |
@@ -8468,12 +8468,12 @@ discard block |
||
| 8468 | 8468 | } else $offset = '+00:00'; |
| 8469 | 8469 | |
| 8470 | 8470 | if ($globalDBdriver == 'mysql') { |
| 8471 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 8471 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 8472 | 8472 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
| 8473 | 8473 | GROUP BY spotter_output.airline_icao,year_name, month_name |
| 8474 | 8474 | ORDER BY date_count DESC"; |
| 8475 | 8475 | } else { |
| 8476 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8476 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8477 | 8477 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
| 8478 | 8478 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8479 | 8479 | ORDER BY date_count DESC"; |
@@ -8485,7 +8485,7 @@ discard block |
||
| 8485 | 8485 | $date_array = array(); |
| 8486 | 8486 | $temp_array = array(); |
| 8487 | 8487 | |
| 8488 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8488 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8489 | 8489 | { |
| 8490 | 8490 | $temp_array['month_name'] = $row['month_name']; |
| 8491 | 8491 | $temp_array['year_name'] = $row['year_name']; |
@@ -8507,7 +8507,7 @@ discard block |
||
| 8507 | 8507 | public function countAllMonthsAirlines($filters = array()) |
| 8508 | 8508 | { |
| 8509 | 8509 | global $globalTimezone, $globalDBdriver; |
| 8510 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8510 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8511 | 8511 | if ($globalTimezone != '') { |
| 8512 | 8512 | date_default_timezone_set($globalTimezone); |
| 8513 | 8513 | $datetime = new DateTime(); |
@@ -8515,12 +8515,12 @@ discard block |
||
| 8515 | 8515 | } else $offset = '+00:00'; |
| 8516 | 8516 | |
| 8517 | 8517 | if ($globalDBdriver == 'mysql') { |
| 8518 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
|
| 8518 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
|
| 8519 | 8519 | FROM spotter_output".$filter_query." airline_icao <> '' |
| 8520 | 8520 | GROUP BY year_name, month_name |
| 8521 | 8521 | ORDER BY date_count DESC"; |
| 8522 | 8522 | } else { |
| 8523 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
| 8523 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
| 8524 | 8524 | FROM spotter_output".$filter_query." airline_icao <> '' |
| 8525 | 8525 | GROUP BY year_name, month_name |
| 8526 | 8526 | ORDER BY date_count DESC"; |
@@ -8532,7 +8532,7 @@ discard block |
||
| 8532 | 8532 | $date_array = array(); |
| 8533 | 8533 | $temp_array = array(); |
| 8534 | 8534 | |
| 8535 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8535 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8536 | 8536 | { |
| 8537 | 8537 | $temp_array['month_name'] = $row['month_name']; |
| 8538 | 8538 | $temp_array['year_name'] = $row['year_name']; |
@@ -8558,15 +8558,15 @@ discard block |
||
| 8558 | 8558 | $datetime = new DateTime(); |
| 8559 | 8559 | $offset = $datetime->format('P'); |
| 8560 | 8560 | } else $offset = '+00:00'; |
| 8561 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8561 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8562 | 8562 | |
| 8563 | 8563 | if ($globalDBdriver == 'mysql') { |
| 8564 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8564 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8565 | 8565 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
| 8566 | 8566 | GROUP BY year_name, month_name |
| 8567 | 8567 | ORDER BY date_count DESC"; |
| 8568 | 8568 | } else { |
| 8569 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8569 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8570 | 8570 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
| 8571 | 8571 | GROUP BY year_name, month_name |
| 8572 | 8572 | ORDER BY date_count DESC"; |
@@ -8578,7 +8578,7 @@ discard block |
||
| 8578 | 8578 | $date_array = array(); |
| 8579 | 8579 | $temp_array = array(); |
| 8580 | 8580 | |
| 8581 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8581 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8582 | 8582 | { |
| 8583 | 8583 | $temp_array['month_name'] = $row['month_name']; |
| 8584 | 8584 | $temp_array['year_name'] = $row['year_name']; |
@@ -8600,7 +8600,7 @@ discard block |
||
| 8600 | 8600 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
| 8601 | 8601 | { |
| 8602 | 8602 | global $globalTimezone, $globalDBdriver; |
| 8603 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8603 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8604 | 8604 | if ($globalTimezone != '') { |
| 8605 | 8605 | date_default_timezone_set($globalTimezone); |
| 8606 | 8606 | $datetime = new DateTime(); |
@@ -8608,12 +8608,12 @@ discard block |
||
| 8608 | 8608 | } else $offset = '+00:00'; |
| 8609 | 8609 | |
| 8610 | 8610 | if ($globalDBdriver == 'mysql') { |
| 8611 | - $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8611 | + $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8612 | 8612 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
| 8613 | 8613 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8614 | 8614 | ORDER BY date_count DESC"; |
| 8615 | 8615 | } else { |
| 8616 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8616 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8617 | 8617 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
| 8618 | 8618 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8619 | 8619 | ORDER BY date_count DESC"; |
@@ -8625,7 +8625,7 @@ discard block |
||
| 8625 | 8625 | $date_array = array(); |
| 8626 | 8626 | $temp_array = array(); |
| 8627 | 8627 | |
| 8628 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8628 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8629 | 8629 | { |
| 8630 | 8630 | $temp_array['month_name'] = $row['month_name']; |
| 8631 | 8631 | $temp_array['year_name'] = $row['year_name']; |
@@ -8652,15 +8652,15 @@ discard block |
||
| 8652 | 8652 | $datetime = new DateTime(); |
| 8653 | 8653 | $offset = $datetime->format('P'); |
| 8654 | 8654 | } else $offset = '+00:00'; |
| 8655 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8655 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8656 | 8656 | |
| 8657 | 8657 | if ($globalDBdriver == 'mysql') { |
| 8658 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8658 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8659 | 8659 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
| 8660 | 8660 | GROUP BY year_name, month_name |
| 8661 | 8661 | ORDER BY date_count DESC"; |
| 8662 | 8662 | } else { |
| 8663 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8663 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8664 | 8664 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
| 8665 | 8665 | GROUP BY year_name, month_name |
| 8666 | 8666 | ORDER BY date_count DESC"; |
@@ -8672,7 +8672,7 @@ discard block |
||
| 8672 | 8672 | $date_array = array(); |
| 8673 | 8673 | $temp_array = array(); |
| 8674 | 8674 | |
| 8675 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8675 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8676 | 8676 | { |
| 8677 | 8677 | $temp_array['month_name'] = $row['month_name']; |
| 8678 | 8678 | $temp_array['year_name'] = $row['year_name']; |
@@ -8694,7 +8694,7 @@ discard block |
||
| 8694 | 8694 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
| 8695 | 8695 | { |
| 8696 | 8696 | global $globalTimezone, $globalDBdriver; |
| 8697 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8697 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8698 | 8698 | if ($globalTimezone != '') { |
| 8699 | 8699 | date_default_timezone_set($globalTimezone); |
| 8700 | 8700 | $datetime = new DateTime(); |
@@ -8702,12 +8702,12 @@ discard block |
||
| 8702 | 8702 | } else $offset = '+00:00'; |
| 8703 | 8703 | |
| 8704 | 8704 | if ($globalDBdriver == 'mysql') { |
| 8705 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8705 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8706 | 8706 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
| 8707 | 8707 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8708 | 8708 | ORDER BY date_count DESC"; |
| 8709 | 8709 | } else { |
| 8710 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8710 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8711 | 8711 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
| 8712 | 8712 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8713 | 8713 | ORDER BY date_count DESC"; |
@@ -8719,7 +8719,7 @@ discard block |
||
| 8719 | 8719 | $date_array = array(); |
| 8720 | 8720 | $temp_array = array(); |
| 8721 | 8721 | |
| 8722 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8722 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8723 | 8723 | { |
| 8724 | 8724 | $temp_array['month_name'] = $row['month_name']; |
| 8725 | 8725 | $temp_array['year_name'] = $row['year_name']; |
@@ -8747,7 +8747,7 @@ discard block |
||
| 8747 | 8747 | $datetime = new DateTime(); |
| 8748 | 8748 | $offset = $datetime->format('P'); |
| 8749 | 8749 | } else $offset = '+00:00'; |
| 8750 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8750 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8751 | 8751 | if ($globalDBdriver == 'mysql') { |
| 8752 | 8752 | $query = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
| 8753 | 8753 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -8768,7 +8768,7 @@ discard block |
||
| 8768 | 8768 | $date_array = array(); |
| 8769 | 8769 | $temp_array = array(); |
| 8770 | 8770 | |
| 8771 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8771 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8772 | 8772 | { |
| 8773 | 8773 | $temp_array['year_name'] = $row['year_name']; |
| 8774 | 8774 | $temp_array['month_name'] = $row['month_name']; |
@@ -8788,7 +8788,7 @@ discard block |
||
| 8788 | 8788 | * @return Array the hour list |
| 8789 | 8789 | * |
| 8790 | 8790 | */ |
| 8791 | - public function countAllHours($orderby,$filters = array()) |
|
| 8791 | + public function countAllHours($orderby, $filters = array()) |
|
| 8792 | 8792 | { |
| 8793 | 8793 | global $globalTimezone, $globalDBdriver; |
| 8794 | 8794 | if ($globalTimezone != '') { |
@@ -8836,7 +8836,7 @@ discard block |
||
| 8836 | 8836 | $hour_array = array(); |
| 8837 | 8837 | $temp_array = array(); |
| 8838 | 8838 | |
| 8839 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8839 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8840 | 8840 | { |
| 8841 | 8841 | $temp_array['hour_name'] = $row['hour_name']; |
| 8842 | 8842 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8856,7 +8856,7 @@ discard block |
||
| 8856 | 8856 | public function countAllHoursByAirlines($orderby, $filters = array()) |
| 8857 | 8857 | { |
| 8858 | 8858 | global $globalTimezone, $globalDBdriver; |
| 8859 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8859 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8860 | 8860 | if ($globalTimezone != '') { |
| 8861 | 8861 | date_default_timezone_set($globalTimezone); |
| 8862 | 8862 | $datetime = new DateTime(); |
@@ -8874,7 +8874,7 @@ discard block |
||
| 8874 | 8874 | } |
| 8875 | 8875 | |
| 8876 | 8876 | if ($globalDBdriver == 'mysql') { |
| 8877 | - $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8877 | + $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8878 | 8878 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 8879 | 8879 | GROUP BY spotter_output.airline_icao, hour_name |
| 8880 | 8880 | ".$orderby_sql; |
@@ -8887,7 +8887,7 @@ discard block |
||
| 8887 | 8887 | */ |
| 8888 | 8888 | $query_data = array(':offset' => $offset); |
| 8889 | 8889 | } else { |
| 8890 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8890 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8891 | 8891 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 8892 | 8892 | GROUP BY spotter_output.airline_icao, hour_name |
| 8893 | 8893 | ".$orderby_sql; |
@@ -8900,7 +8900,7 @@ discard block |
||
| 8900 | 8900 | $hour_array = array(); |
| 8901 | 8901 | $temp_array = array(); |
| 8902 | 8902 | |
| 8903 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8903 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8904 | 8904 | { |
| 8905 | 8905 | $temp_array['hour_name'] = $row['hour_name']; |
| 8906 | 8906 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8923,34 +8923,34 @@ discard block |
||
| 8923 | 8923 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
| 8924 | 8924 | { |
| 8925 | 8925 | global $globalTimezone, $globalDBdriver; |
| 8926 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8926 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8927 | 8927 | if ($globalTimezone != '') { |
| 8928 | 8928 | date_default_timezone_set($globalTimezone); |
| 8929 | 8929 | $datetime = new DateTime(); |
| 8930 | 8930 | $offset = $datetime->format('P'); |
| 8931 | 8931 | } else $offset = '+00:00'; |
| 8932 | 8932 | |
| 8933 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 8933 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 8934 | 8934 | |
| 8935 | 8935 | if ($globalDBdriver == 'mysql') { |
| 8936 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8936 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8937 | 8937 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
| 8938 | 8938 | GROUP BY hour_name |
| 8939 | 8939 | ORDER BY hour_name ASC"; |
| 8940 | 8940 | } else { |
| 8941 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8941 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8942 | 8942 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
| 8943 | 8943 | GROUP BY hour_name |
| 8944 | 8944 | ORDER BY hour_name ASC"; |
| 8945 | 8945 | } |
| 8946 | 8946 | |
| 8947 | 8947 | $sth = $this->db->prepare($query); |
| 8948 | - $sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset)); |
|
| 8948 | + $sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset)); |
|
| 8949 | 8949 | |
| 8950 | 8950 | $hour_array = array(); |
| 8951 | 8951 | $temp_array = array(); |
| 8952 | 8952 | |
| 8953 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8953 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8954 | 8954 | { |
| 8955 | 8955 | $temp_array['hour_name'] = $row['hour_name']; |
| 8956 | 8956 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8973,8 +8973,8 @@ discard block |
||
| 8973 | 8973 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
| 8974 | 8974 | { |
| 8975 | 8975 | global $globalTimezone, $globalDBdriver; |
| 8976 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8977 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 8976 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8977 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 8978 | 8978 | if ($globalTimezone != '') { |
| 8979 | 8979 | date_default_timezone_set($globalTimezone); |
| 8980 | 8980 | $datetime = new DateTime(); |
@@ -8982,24 +8982,24 @@ discard block |
||
| 8982 | 8982 | } else $offset = '+00:00'; |
| 8983 | 8983 | |
| 8984 | 8984 | if ($globalDBdriver == 'mysql') { |
| 8985 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8985 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8986 | 8986 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
| 8987 | 8987 | GROUP BY hour_name |
| 8988 | 8988 | ORDER BY hour_name ASC"; |
| 8989 | 8989 | } else { |
| 8990 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8990 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8991 | 8991 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
| 8992 | 8992 | GROUP BY hour_name |
| 8993 | 8993 | ORDER BY hour_name ASC"; |
| 8994 | 8994 | } |
| 8995 | 8995 | |
| 8996 | 8996 | $sth = $this->db->prepare($query); |
| 8997 | - $sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset)); |
|
| 8997 | + $sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset)); |
|
| 8998 | 8998 | |
| 8999 | 8999 | $hour_array = array(); |
| 9000 | 9000 | $temp_array = array(); |
| 9001 | 9001 | |
| 9002 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9002 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9003 | 9003 | { |
| 9004 | 9004 | $temp_array['hour_name'] = $row['hour_name']; |
| 9005 | 9005 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9020,8 +9020,8 @@ discard block |
||
| 9020 | 9020 | public function countAllHoursByRegistration($registration, $filters = array()) |
| 9021 | 9021 | { |
| 9022 | 9022 | global $globalTimezone, $globalDBdriver; |
| 9023 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9024 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 9023 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9024 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 9025 | 9025 | if ($globalTimezone != '') { |
| 9026 | 9026 | date_default_timezone_set($globalTimezone); |
| 9027 | 9027 | $datetime = new DateTime(); |
@@ -9029,24 +9029,24 @@ discard block |
||
| 9029 | 9029 | } else $offset = '+00:00'; |
| 9030 | 9030 | |
| 9031 | 9031 | if ($globalDBdriver == 'mysql') { |
| 9032 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9032 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9033 | 9033 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
| 9034 | 9034 | GROUP BY hour_name |
| 9035 | 9035 | ORDER BY hour_name ASC"; |
| 9036 | 9036 | } else { |
| 9037 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9037 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9038 | 9038 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
| 9039 | 9039 | GROUP BY hour_name |
| 9040 | 9040 | ORDER BY hour_name ASC"; |
| 9041 | 9041 | } |
| 9042 | 9042 | |
| 9043 | 9043 | $sth = $this->db->prepare($query); |
| 9044 | - $sth->execute(array(':registration' => $registration,':offset' => $offset)); |
|
| 9044 | + $sth->execute(array(':registration' => $registration, ':offset' => $offset)); |
|
| 9045 | 9045 | |
| 9046 | 9046 | $hour_array = array(); |
| 9047 | 9047 | $temp_array = array(); |
| 9048 | 9048 | |
| 9049 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9049 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9050 | 9050 | { |
| 9051 | 9051 | $temp_array['hour_name'] = $row['hour_name']; |
| 9052 | 9052 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9067,8 +9067,8 @@ discard block |
||
| 9067 | 9067 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
| 9068 | 9068 | { |
| 9069 | 9069 | global $globalTimezone, $globalDBdriver; |
| 9070 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9071 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 9070 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9071 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 9072 | 9072 | if ($globalTimezone != '') { |
| 9073 | 9073 | date_default_timezone_set($globalTimezone); |
| 9074 | 9074 | $datetime = new DateTime(); |
@@ -9076,24 +9076,24 @@ discard block |
||
| 9076 | 9076 | } else $offset = '+00:00'; |
| 9077 | 9077 | |
| 9078 | 9078 | if ($globalDBdriver == 'mysql') { |
| 9079 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9079 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9080 | 9080 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 9081 | 9081 | GROUP BY hour_name |
| 9082 | 9082 | ORDER BY hour_name ASC"; |
| 9083 | 9083 | } else { |
| 9084 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9084 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9085 | 9085 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 9086 | 9086 | GROUP BY hour_name |
| 9087 | 9087 | ORDER BY hour_name ASC"; |
| 9088 | 9088 | } |
| 9089 | 9089 | |
| 9090 | 9090 | $sth = $this->db->prepare($query); |
| 9091 | - $sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset)); |
|
| 9091 | + $sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset)); |
|
| 9092 | 9092 | |
| 9093 | 9093 | $hour_array = array(); |
| 9094 | 9094 | $temp_array = array(); |
| 9095 | 9095 | |
| 9096 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9096 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9097 | 9097 | { |
| 9098 | 9098 | $temp_array['hour_name'] = $row['hour_name']; |
| 9099 | 9099 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9112,11 +9112,11 @@ discard block |
||
| 9112 | 9112 | * @return Array the hour list |
| 9113 | 9113 | * |
| 9114 | 9114 | */ |
| 9115 | - public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
|
| 9115 | + public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 9116 | 9116 | { |
| 9117 | 9117 | global $globalTimezone, $globalDBdriver; |
| 9118 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9119 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 9118 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9119 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 9120 | 9120 | if ($globalTimezone != '') { |
| 9121 | 9121 | date_default_timezone_set($globalTimezone); |
| 9122 | 9122 | $datetime = new DateTime(); |
@@ -9124,24 +9124,24 @@ discard block |
||
| 9124 | 9124 | } else $offset = '+00:00'; |
| 9125 | 9125 | |
| 9126 | 9126 | if ($globalDBdriver == 'mysql') { |
| 9127 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9127 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9128 | 9128 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 9129 | 9129 | GROUP BY hour_name |
| 9130 | 9130 | ORDER BY hour_name ASC"; |
| 9131 | 9131 | } else { |
| 9132 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9132 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9133 | 9133 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 9134 | 9134 | GROUP BY hour_name |
| 9135 | 9135 | ORDER BY hour_name ASC"; |
| 9136 | 9136 | } |
| 9137 | 9137 | |
| 9138 | 9138 | $sth = $this->db->prepare($query); |
| 9139 | - $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset)); |
|
| 9139 | + $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset)); |
|
| 9140 | 9140 | |
| 9141 | 9141 | $hour_array = array(); |
| 9142 | 9142 | $temp_array = array(); |
| 9143 | 9143 | |
| 9144 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9144 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9145 | 9145 | { |
| 9146 | 9146 | $temp_array['hour_name'] = $row['hour_name']; |
| 9147 | 9147 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9163,8 +9163,8 @@ discard block |
||
| 9163 | 9163 | public function countAllHoursByDate($date, $filters = array()) |
| 9164 | 9164 | { |
| 9165 | 9165 | global $globalTimezone, $globalDBdriver; |
| 9166 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9167 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 9166 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9167 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 9168 | 9168 | if ($globalTimezone != '') { |
| 9169 | 9169 | date_default_timezone_set($globalTimezone); |
| 9170 | 9170 | $datetime = new DateTime($date); |
@@ -9172,12 +9172,12 @@ discard block |
||
| 9172 | 9172 | } else $offset = '+00:00'; |
| 9173 | 9173 | |
| 9174 | 9174 | if ($globalDBdriver == 'mysql') { |
| 9175 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9175 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9176 | 9176 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 9177 | 9177 | GROUP BY hour_name |
| 9178 | 9178 | ORDER BY hour_name ASC"; |
| 9179 | 9179 | } else { |
| 9180 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9180 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9181 | 9181 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
| 9182 | 9182 | GROUP BY hour_name |
| 9183 | 9183 | ORDER BY hour_name ASC"; |
@@ -9189,7 +9189,7 @@ discard block |
||
| 9189 | 9189 | $hour_array = array(); |
| 9190 | 9190 | $temp_array = array(); |
| 9191 | 9191 | |
| 9192 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9192 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9193 | 9193 | { |
| 9194 | 9194 | $temp_array['hour_name'] = $row['hour_name']; |
| 9195 | 9195 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9211,8 +9211,8 @@ discard block |
||
| 9211 | 9211 | public function countAllHoursByIdent($ident, $filters = array()) |
| 9212 | 9212 | { |
| 9213 | 9213 | global $globalTimezone, $globalDBdriver; |
| 9214 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9215 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 9214 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9215 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 9216 | 9216 | if ($globalTimezone != '') { |
| 9217 | 9217 | date_default_timezone_set($globalTimezone); |
| 9218 | 9218 | $datetime = new DateTime(); |
@@ -9220,12 +9220,12 @@ discard block |
||
| 9220 | 9220 | } else $offset = '+00:00'; |
| 9221 | 9221 | |
| 9222 | 9222 | if ($globalDBdriver == 'mysql') { |
| 9223 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9223 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9224 | 9224 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 9225 | 9225 | GROUP BY hour_name |
| 9226 | 9226 | ORDER BY hour_name ASC"; |
| 9227 | 9227 | } else { |
| 9228 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9228 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9229 | 9229 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 9230 | 9230 | GROUP BY hour_name |
| 9231 | 9231 | ORDER BY hour_name ASC"; |
@@ -9233,12 +9233,12 @@ discard block |
||
| 9233 | 9233 | |
| 9234 | 9234 | |
| 9235 | 9235 | $sth = $this->db->prepare($query); |
| 9236 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
| 9236 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
| 9237 | 9237 | |
| 9238 | 9238 | $hour_array = array(); |
| 9239 | 9239 | $temp_array = array(); |
| 9240 | 9240 | |
| 9241 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9241 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9242 | 9242 | { |
| 9243 | 9243 | $temp_array['hour_name'] = $row['hour_name']; |
| 9244 | 9244 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9257,12 +9257,12 @@ discard block |
||
| 9257 | 9257 | * @return Array the hour list |
| 9258 | 9258 | * |
| 9259 | 9259 | */ |
| 9260 | - public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
|
| 9260 | + public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 9261 | 9261 | { |
| 9262 | 9262 | global $globalTimezone, $globalDBdriver; |
| 9263 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9264 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 9265 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 9263 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9264 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 9265 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 9266 | 9266 | if ($globalTimezone != '') { |
| 9267 | 9267 | date_default_timezone_set($globalTimezone); |
| 9268 | 9268 | $datetime = new DateTime(); |
@@ -9270,24 +9270,24 @@ discard block |
||
| 9270 | 9270 | } else $offset = '+00:00'; |
| 9271 | 9271 | |
| 9272 | 9272 | if ($globalDBdriver == 'mysql') { |
| 9273 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9273 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9274 | 9274 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 9275 | 9275 | GROUP BY hour_name |
| 9276 | 9276 | ORDER BY hour_name ASC"; |
| 9277 | 9277 | } else { |
| 9278 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9278 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9279 | 9279 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 9280 | 9280 | GROUP BY hour_name |
| 9281 | 9281 | ORDER BY hour_name ASC"; |
| 9282 | 9282 | } |
| 9283 | 9283 | |
| 9284 | 9284 | $sth = $this->db->prepare($query); |
| 9285 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset)); |
|
| 9285 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset)); |
|
| 9286 | 9286 | |
| 9287 | 9287 | $hour_array = array(); |
| 9288 | 9288 | $temp_array = array(); |
| 9289 | 9289 | |
| 9290 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9290 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9291 | 9291 | { |
| 9292 | 9292 | $temp_array['hour_name'] = $row['hour_name']; |
| 9293 | 9293 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9308,8 +9308,8 @@ discard block |
||
| 9308 | 9308 | public function countAllHoursByCountry($country, $filters = array()) |
| 9309 | 9309 | { |
| 9310 | 9310 | global $globalTimezone, $globalDBdriver; |
| 9311 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9312 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 9311 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9312 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 9313 | 9313 | if ($globalTimezone != '') { |
| 9314 | 9314 | date_default_timezone_set($globalTimezone); |
| 9315 | 9315 | $datetime = new DateTime(); |
@@ -9317,24 +9317,24 @@ discard block |
||
| 9317 | 9317 | } else $offset = '+00:00'; |
| 9318 | 9318 | |
| 9319 | 9319 | if ($globalDBdriver == 'mysql') { |
| 9320 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9320 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9321 | 9321 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 9322 | 9322 | GROUP BY hour_name |
| 9323 | 9323 | ORDER BY hour_name ASC"; |
| 9324 | 9324 | } else { |
| 9325 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9325 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9326 | 9326 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 9327 | 9327 | GROUP BY hour_name |
| 9328 | 9328 | ORDER BY hour_name ASC"; |
| 9329 | 9329 | } |
| 9330 | 9330 | |
| 9331 | 9331 | $sth = $this->db->prepare($query); |
| 9332 | - $sth->execute(array(':country' => $country,':offset' => $offset)); |
|
| 9332 | + $sth->execute(array(':country' => $country, ':offset' => $offset)); |
|
| 9333 | 9333 | |
| 9334 | 9334 | $hour_array = array(); |
| 9335 | 9335 | $temp_array = array(); |
| 9336 | 9336 | |
| 9337 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9337 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9338 | 9338 | { |
| 9339 | 9339 | $temp_array['hour_name'] = $row['hour_name']; |
| 9340 | 9340 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9356,8 +9356,8 @@ discard block |
||
| 9356 | 9356 | */ |
| 9357 | 9357 | public function countOverallAircrafts($filters = array()) |
| 9358 | 9358 | { |
| 9359 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9360 | - $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
| 9359 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9360 | + $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
| 9361 | 9361 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
| 9362 | 9362 | $sth = $this->db->prepare($query); |
| 9363 | 9363 | $sth->execute(); |
@@ -9372,8 +9372,8 @@ discard block |
||
| 9372 | 9372 | */ |
| 9373 | 9373 | public function countOverallArrival($filters = array()) |
| 9374 | 9374 | { |
| 9375 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9376 | - $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
| 9375 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9376 | + $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
| 9377 | 9377 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''"; |
| 9378 | 9378 | |
| 9379 | 9379 | $sth = $this->db->prepare($query); |
@@ -9389,8 +9389,8 @@ discard block |
||
| 9389 | 9389 | */ |
| 9390 | 9390 | public function countOverallPilots($filters = array()) |
| 9391 | 9391 | { |
| 9392 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9393 | - $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
| 9392 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9393 | + $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
| 9394 | 9394 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''"; |
| 9395 | 9395 | $sth = $this->db->prepare($query); |
| 9396 | 9396 | $sth->execute(); |
@@ -9405,8 +9405,8 @@ discard block |
||
| 9405 | 9405 | */ |
| 9406 | 9406 | public function countOverallOwners($filters = array()) |
| 9407 | 9407 | { |
| 9408 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9409 | - $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
| 9408 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9409 | + $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
| 9410 | 9410 | FROM spotter_output".$filter_query." spotter_output.owner_name <> ''"; |
| 9411 | 9411 | $sth = $this->db->prepare($query); |
| 9412 | 9412 | $sth->execute(); |
@@ -9439,8 +9439,8 @@ discard block |
||
| 9439 | 9439 | */ |
| 9440 | 9440 | public function countOverallMilitaryFlights($filters = array()) |
| 9441 | 9441 | { |
| 9442 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9443 | - $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
| 9442 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9443 | + $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
| 9444 | 9444 | FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'"; |
| 9445 | 9445 | |
| 9446 | 9446 | $sth = $this->db->prepare($query); |
@@ -9477,7 +9477,7 @@ discard block |
||
| 9477 | 9477 | public function countAllHoursFromToday($filters = array()) |
| 9478 | 9478 | { |
| 9479 | 9479 | global $globalTimezone, $globalDBdriver; |
| 9480 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9480 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9481 | 9481 | if ($globalTimezone != '') { |
| 9482 | 9482 | date_default_timezone_set($globalTimezone); |
| 9483 | 9483 | $datetime = new DateTime(); |
@@ -9485,12 +9485,12 @@ discard block |
||
| 9485 | 9485 | } else $offset = '+00:00'; |
| 9486 | 9486 | |
| 9487 | 9487 | if ($globalDBdriver == 'mysql') { |
| 9488 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9488 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9489 | 9489 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE() |
| 9490 | 9490 | GROUP BY hour_name |
| 9491 | 9491 | ORDER BY hour_name ASC"; |
| 9492 | 9492 | } else { |
| 9493 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9493 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9494 | 9494 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
| 9495 | 9495 | GROUP BY hour_name |
| 9496 | 9496 | ORDER BY hour_name ASC"; |
@@ -9502,7 +9502,7 @@ discard block |
||
| 9502 | 9502 | $hour_array = array(); |
| 9503 | 9503 | $temp_array = array(); |
| 9504 | 9504 | |
| 9505 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9505 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9506 | 9506 | { |
| 9507 | 9507 | $temp_array['hour_name'] = $row['hour_name']; |
| 9508 | 9508 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9521,14 +9521,14 @@ discard block |
||
| 9521 | 9521 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
| 9522 | 9522 | { |
| 9523 | 9523 | global $global_query, $globalDBdriver, $globalTimezone; |
| 9524 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9524 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9525 | 9525 | date_default_timezone_set('UTC'); |
| 9526 | 9526 | $limit_query = ''; |
| 9527 | 9527 | if ($limit != "") |
| 9528 | 9528 | { |
| 9529 | 9529 | $limit_array = explode(",", $limit); |
| 9530 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 9531 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 9530 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 9531 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 9532 | 9532 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 9533 | 9533 | { |
| 9534 | 9534 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -9581,7 +9581,7 @@ discard block |
||
| 9581 | 9581 | GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH') |
| 9582 | 9582 | HAVING count(spotter_output.ident) > 5$orderby_query"; |
| 9583 | 9583 | //echo $query; |
| 9584 | - $spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone)); |
|
| 9584 | + $spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone)); |
|
| 9585 | 9585 | /* |
| 9586 | 9586 | $sth = $this->db->prepare($query); |
| 9587 | 9587 | $sth->execute(array(':timezone' => $globalTimezone)); |
@@ -9600,9 +9600,9 @@ discard block |
||
| 9600 | 9600 | */ |
| 9601 | 9601 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
| 9602 | 9602 | { |
| 9603 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 9603 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 9604 | 9604 | |
| 9605 | - $query = "SELECT spotter_output.spotter_id |
|
| 9605 | + $query = "SELECT spotter_output.spotter_id |
|
| 9606 | 9606 | FROM spotter_output |
| 9607 | 9607 | WHERE spotter_output.flightaware_id = '".$flightaware_id."'"; |
| 9608 | 9608 | |
@@ -9610,7 +9610,7 @@ discard block |
||
| 9610 | 9610 | $sth = $this->db->prepare($query); |
| 9611 | 9611 | $sth->execute(); |
| 9612 | 9612 | |
| 9613 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9613 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9614 | 9614 | { |
| 9615 | 9615 | return $row['spotter_id']; |
| 9616 | 9616 | } |
@@ -9635,23 +9635,23 @@ discard block |
||
| 9635 | 9635 | } |
| 9636 | 9636 | |
| 9637 | 9637 | $current_date = date("Y-m-d H:i:s"); |
| 9638 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
| 9638 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
| 9639 | 9639 | |
| 9640 | 9640 | $diff = abs(strtotime($current_date) - strtotime($date)); |
| 9641 | 9641 | |
| 9642 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
| 9642 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
| 9643 | 9643 | $years = $time_array['years']; |
| 9644 | 9644 | |
| 9645 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
| 9645 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
| 9646 | 9646 | $months = $time_array['months']; |
| 9647 | 9647 | |
| 9648 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
| 9648 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
| 9649 | 9649 | $days = $time_array['days']; |
| 9650 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
| 9650 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
| 9651 | 9651 | $hours = $time_array['hours']; |
| 9652 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
| 9652 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
| 9653 | 9653 | $minutes = $time_array['minutes']; |
| 9654 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 9654 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 9655 | 9655 | |
| 9656 | 9656 | return $time_array; |
| 9657 | 9657 | } |
@@ -9677,63 +9677,63 @@ discard block |
||
| 9677 | 9677 | $temp_array['direction_degree'] = $direction; |
| 9678 | 9678 | $temp_array['direction_shortname'] = "N"; |
| 9679 | 9679 | $temp_array['direction_fullname'] = "North"; |
| 9680 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
| 9680 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
| 9681 | 9681 | $temp_array['direction_degree'] = $direction; |
| 9682 | 9682 | $temp_array['direction_shortname'] = "NNE"; |
| 9683 | 9683 | $temp_array['direction_fullname'] = "North-Northeast"; |
| 9684 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
| 9684 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
| 9685 | 9685 | $temp_array['direction_degree'] = $direction; |
| 9686 | 9686 | $temp_array['direction_shortname'] = "NE"; |
| 9687 | 9687 | $temp_array['direction_fullname'] = "Northeast"; |
| 9688 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
| 9688 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
| 9689 | 9689 | $temp_array['direction_degree'] = $direction; |
| 9690 | 9690 | $temp_array['direction_shortname'] = "ENE"; |
| 9691 | 9691 | $temp_array['direction_fullname'] = "East-Northeast"; |
| 9692 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
| 9692 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
| 9693 | 9693 | $temp_array['direction_degree'] = $direction; |
| 9694 | 9694 | $temp_array['direction_shortname'] = "E"; |
| 9695 | 9695 | $temp_array['direction_fullname'] = "East"; |
| 9696 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
| 9696 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
| 9697 | 9697 | $temp_array['direction_degree'] = $direction; |
| 9698 | 9698 | $temp_array['direction_shortname'] = "ESE"; |
| 9699 | 9699 | $temp_array['direction_fullname'] = "East-Southeast"; |
| 9700 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
| 9700 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
| 9701 | 9701 | $temp_array['direction_degree'] = $direction; |
| 9702 | 9702 | $temp_array['direction_shortname'] = "SE"; |
| 9703 | 9703 | $temp_array['direction_fullname'] = "Southeast"; |
| 9704 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
| 9704 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
| 9705 | 9705 | $temp_array['direction_degree'] = $direction; |
| 9706 | 9706 | $temp_array['direction_shortname'] = "SSE"; |
| 9707 | 9707 | $temp_array['direction_fullname'] = "South-Southeast"; |
| 9708 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
| 9708 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
| 9709 | 9709 | $temp_array['direction_degree'] = $direction; |
| 9710 | 9710 | $temp_array['direction_shortname'] = "S"; |
| 9711 | 9711 | $temp_array['direction_fullname'] = "South"; |
| 9712 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
| 9712 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
| 9713 | 9713 | $temp_array['direction_degree'] = $direction; |
| 9714 | 9714 | $temp_array['direction_shortname'] = "SSW"; |
| 9715 | 9715 | $temp_array['direction_fullname'] = "South-Southwest"; |
| 9716 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
| 9716 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
| 9717 | 9717 | $temp_array['direction_degree'] = $direction; |
| 9718 | 9718 | $temp_array['direction_shortname'] = "SW"; |
| 9719 | 9719 | $temp_array['direction_fullname'] = "Southwest"; |
| 9720 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
| 9720 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
| 9721 | 9721 | $temp_array['direction_degree'] = $direction; |
| 9722 | 9722 | $temp_array['direction_shortname'] = "WSW"; |
| 9723 | 9723 | $temp_array['direction_fullname'] = "West-Southwest"; |
| 9724 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
| 9724 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
| 9725 | 9725 | $temp_array['direction_degree'] = $direction; |
| 9726 | 9726 | $temp_array['direction_shortname'] = "W"; |
| 9727 | 9727 | $temp_array['direction_fullname'] = "West"; |
| 9728 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
| 9728 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
| 9729 | 9729 | $temp_array['direction_degree'] = $direction; |
| 9730 | 9730 | $temp_array['direction_shortname'] = "WNW"; |
| 9731 | 9731 | $temp_array['direction_fullname'] = "West-Northwest"; |
| 9732 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
| 9732 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
| 9733 | 9733 | $temp_array['direction_degree'] = $direction; |
| 9734 | 9734 | $temp_array['direction_shortname'] = "NW"; |
| 9735 | 9735 | $temp_array['direction_fullname'] = "Northwest"; |
| 9736 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
| 9736 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
| 9737 | 9737 | $temp_array['direction_degree'] = $direction; |
| 9738 | 9738 | $temp_array['direction_shortname'] = "NNW"; |
| 9739 | 9739 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -9786,9 +9786,9 @@ discard block |
||
| 9786 | 9786 | */ |
| 9787 | 9787 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
| 9788 | 9788 | { |
| 9789 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 9789 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 9790 | 9790 | |
| 9791 | - $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 9791 | + $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 9792 | 9792 | |
| 9793 | 9793 | $sth = $this->db->prepare($query); |
| 9794 | 9794 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -9811,9 +9811,9 @@ discard block |
||
| 9811 | 9811 | */ |
| 9812 | 9812 | public function getAircraftTypeBymodeS($aircraft_modes) |
| 9813 | 9813 | { |
| 9814 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 9814 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 9815 | 9815 | |
| 9816 | - $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 9816 | + $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 9817 | 9817 | |
| 9818 | 9818 | $sth = $this->db->prepare($query); |
| 9819 | 9819 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -9834,11 +9834,11 @@ discard block |
||
| 9834 | 9834 | * @param Float $longitude longitute of the flight |
| 9835 | 9835 | * @return String the countrie |
| 9836 | 9836 | */ |
| 9837 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
| 9837 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
| 9838 | 9838 | { |
| 9839 | 9839 | global $globalDBdriver, $globalDebug; |
| 9840 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 9841 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 9840 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 9841 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 9842 | 9842 | |
| 9843 | 9843 | $Connection = new Connection($this->db); |
| 9844 | 9844 | if (!$Connection->tableExists('countries')) return ''; |
@@ -9878,7 +9878,7 @@ discard block |
||
| 9878 | 9878 | public function getCountryFromISO2($iso2) |
| 9879 | 9879 | { |
| 9880 | 9880 | global $globalDBdriver, $globalDebug; |
| 9881 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
| 9881 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
| 9882 | 9882 | |
| 9883 | 9883 | $Connection = new Connection($this->db); |
| 9884 | 9884 | if (!$Connection->tableExists('countries')) return ''; |
@@ -9910,19 +9910,19 @@ discard block |
||
| 9910 | 9910 | */ |
| 9911 | 9911 | public function convertAircraftRegistration($registration) |
| 9912 | 9912 | { |
| 9913 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 9913 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 9914 | 9914 | $registration_prefix = ''; |
| 9915 | 9915 | $registration_1 = substr($registration, 0, 1); |
| 9916 | 9916 | $registration_2 = substr($registration, 0, 2); |
| 9917 | 9917 | |
| 9918 | 9918 | //first get the prefix based on two characters |
| 9919 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
| 9919 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
| 9920 | 9920 | |
| 9921 | 9921 | |
| 9922 | 9922 | $sth = $this->db->prepare($query); |
| 9923 | 9923 | $sth->execute(array(':registration_2' => $registration_2)); |
| 9924 | 9924 | |
| 9925 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9925 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9926 | 9926 | { |
| 9927 | 9927 | $registration_prefix = $row['registration_prefix']; |
| 9928 | 9928 | } |
@@ -9930,11 +9930,11 @@ discard block |
||
| 9930 | 9930 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 9931 | 9931 | if ($registration_prefix == '') |
| 9932 | 9932 | { |
| 9933 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
| 9933 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
| 9934 | 9934 | $sth = $this->db->prepare($query); |
| 9935 | 9935 | $sth->execute(array(':registration_1' => $registration_1)); |
| 9936 | 9936 | |
| 9937 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9937 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9938 | 9938 | { |
| 9939 | 9939 | $registration_prefix = $row['registration_prefix']; |
| 9940 | 9940 | } |
@@ -9948,7 +9948,7 @@ discard block |
||
| 9948 | 9948 | } else { |
| 9949 | 9949 | $registration = preg_replace("/^(.{1})/", "$1-", $registration); |
| 9950 | 9950 | } |
| 9951 | - } else if(strlen($registration_prefix) == 2){ |
|
| 9951 | + } else if (strlen($registration_prefix) == 2) { |
|
| 9952 | 9952 | if (0 === strpos($registration, 'N')) { |
| 9953 | 9953 | $registration = preg_replace("/^(.{2})/", "$1", $registration); |
| 9954 | 9954 | } else { |
@@ -9967,17 +9967,17 @@ discard block |
||
| 9967 | 9967 | */ |
| 9968 | 9968 | public function countryFromAircraftRegistration($registration) |
| 9969 | 9969 | { |
| 9970 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 9970 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 9971 | 9971 | |
| 9972 | 9972 | $registration_prefix = ''; |
| 9973 | - $registration_test = explode('-',$registration); |
|
| 9973 | + $registration_test = explode('-', $registration); |
|
| 9974 | 9974 | $country = ''; |
| 9975 | 9975 | if ($registration_test[0] != $registration) { |
| 9976 | 9976 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
| 9977 | 9977 | |
| 9978 | 9978 | $sth = $this->db->prepare($query); |
| 9979 | 9979 | $sth->execute(array(':registration_1' => $registration_test[0])); |
| 9980 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9980 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9981 | 9981 | { |
| 9982 | 9982 | //$registration_prefix = $row['registration_prefix']; |
| 9983 | 9983 | $country = $row['country']; |
@@ -9988,13 +9988,13 @@ discard block |
||
| 9988 | 9988 | |
| 9989 | 9989 | $country = ''; |
| 9990 | 9990 | //first get the prefix based on two characters |
| 9991 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 9991 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 9992 | 9992 | |
| 9993 | 9993 | |
| 9994 | 9994 | $sth = $this->db->prepare($query); |
| 9995 | 9995 | $sth->execute(array(':registration_2' => $registration_2)); |
| 9996 | 9996 | |
| 9997 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9997 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9998 | 9998 | { |
| 9999 | 9999 | $registration_prefix = $row['registration_prefix']; |
| 10000 | 10000 | $country = $row['country']; |
@@ -10003,12 +10003,12 @@ discard block |
||
| 10003 | 10003 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 10004 | 10004 | if ($registration_prefix == "") |
| 10005 | 10005 | { |
| 10006 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 10006 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 10007 | 10007 | |
| 10008 | 10008 | $sth = $this->db->prepare($query); |
| 10009 | 10009 | $sth->execute(array(':registration_1' => $registration_1)); |
| 10010 | 10010 | |
| 10011 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10011 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10012 | 10012 | { |
| 10013 | 10013 | //$registration_prefix = $row['registration_prefix']; |
| 10014 | 10014 | $country = $row['country']; |
@@ -10028,17 +10028,17 @@ discard block |
||
| 10028 | 10028 | */ |
| 10029 | 10029 | public function registrationPrefixFromAircraftRegistration($registration) |
| 10030 | 10030 | { |
| 10031 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 10031 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 10032 | 10032 | |
| 10033 | 10033 | $registration_prefix = ''; |
| 10034 | - $registration_test = explode('-',$registration); |
|
| 10034 | + $registration_test = explode('-', $registration); |
|
| 10035 | 10035 | //$country = ''; |
| 10036 | 10036 | if ($registration_test[0] != $registration) { |
| 10037 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 10037 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 10038 | 10038 | |
| 10039 | 10039 | $sth = $this->db->prepare($query); |
| 10040 | 10040 | $sth->execute(array(':registration_1' => $registration_test[0])); |
| 10041 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10041 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10042 | 10042 | { |
| 10043 | 10043 | $registration_prefix = $row['registration_prefix']; |
| 10044 | 10044 | //$country = $row['country']; |
@@ -10048,13 +10048,13 @@ discard block |
||
| 10048 | 10048 | $registration_2 = substr($registration, 0, 2); |
| 10049 | 10049 | |
| 10050 | 10050 | //first get the prefix based on two characters |
| 10051 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 10051 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 10052 | 10052 | |
| 10053 | 10053 | |
| 10054 | 10054 | $sth = $this->db->prepare($query); |
| 10055 | 10055 | $sth->execute(array(':registration_2' => $registration_2)); |
| 10056 | 10056 | |
| 10057 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10057 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10058 | 10058 | { |
| 10059 | 10059 | $registration_prefix = $row['registration_prefix']; |
| 10060 | 10060 | //$country = $row['country']; |
@@ -10063,12 +10063,12 @@ discard block |
||
| 10063 | 10063 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 10064 | 10064 | if ($registration_prefix == "") |
| 10065 | 10065 | { |
| 10066 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 10066 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 10067 | 10067 | |
| 10068 | 10068 | $sth = $this->db->prepare($query); |
| 10069 | 10069 | $sth->execute(array(':registration_1' => $registration_1)); |
| 10070 | 10070 | |
| 10071 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10071 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10072 | 10072 | { |
| 10073 | 10073 | $registration_prefix = $row['registration_prefix']; |
| 10074 | 10074 | //$country = $row['country']; |
@@ -10089,13 +10089,13 @@ discard block |
||
| 10089 | 10089 | */ |
| 10090 | 10090 | public function countryFromAircraftRegistrationCode($registration) |
| 10091 | 10091 | { |
| 10092 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 10092 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 10093 | 10093 | |
| 10094 | 10094 | $country = ''; |
| 10095 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1"; |
|
| 10095 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1"; |
|
| 10096 | 10096 | $sth = $this->db->prepare($query); |
| 10097 | 10097 | $sth->execute(array(':registration' => $registration)); |
| 10098 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10098 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10099 | 10099 | { |
| 10100 | 10100 | $country = $row['country']; |
| 10101 | 10101 | } |
@@ -10108,9 +10108,9 @@ discard block |
||
| 10108 | 10108 | * @param String $flightaware_id flightaware_id from spotter_output table |
| 10109 | 10109 | * @param String $highlight New highlight value |
| 10110 | 10110 | */ |
| 10111 | - public function setHighlightFlight($flightaware_id,$highlight) { |
|
| 10111 | + public function setHighlightFlight($flightaware_id, $highlight) { |
|
| 10112 | 10112 | |
| 10113 | - $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
| 10113 | + $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
| 10114 | 10114 | $sth = $this->db->prepare($query); |
| 10115 | 10115 | $sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight)); |
| 10116 | 10116 | } |
@@ -10122,13 +10122,13 @@ discard block |
||
| 10122 | 10122 | * @param String $date Date of spotted aircraft |
| 10123 | 10123 | * @param String $highlight New highlight value |
| 10124 | 10124 | */ |
| 10125 | - public function setHighlightFlightByRegistration($registration,$highlight, $date = '') { |
|
| 10125 | + public function setHighlightFlightByRegistration($registration, $highlight, $date = '') { |
|
| 10126 | 10126 | if ($date == '') { |
| 10127 | 10127 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)"; |
| 10128 | 10128 | $query_values = array(':registration' => $registration, ':highlight' => $highlight); |
| 10129 | 10129 | } else { |
| 10130 | 10130 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date"; |
| 10131 | - $query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date); |
|
| 10131 | + $query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date); |
|
| 10132 | 10132 | } |
| 10133 | 10133 | $sth = $this->db->prepare($query); |
| 10134 | 10134 | $sth->execute($query_values); |
@@ -10158,7 +10158,7 @@ discard block |
||
| 10158 | 10158 | |
| 10159 | 10159 | $bitly_data = json_decode($bitly_data); |
| 10160 | 10160 | $bitly_url = ''; |
| 10161 | - if ($bitly_data->status_txt = "OK"){ |
|
| 10161 | + if ($bitly_data->status_txt = "OK") { |
|
| 10162 | 10162 | $bitly_url = $bitly_data->data->url; |
| 10163 | 10163 | } |
| 10164 | 10164 | |
@@ -10168,7 +10168,7 @@ discard block |
||
| 10168 | 10168 | |
| 10169 | 10169 | public function getOrderBy() |
| 10170 | 10170 | { |
| 10171 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
| 10171 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
| 10172 | 10172 | |
| 10173 | 10173 | return $orderby; |
| 10174 | 10174 | |
@@ -10302,14 +10302,14 @@ discard block |
||
| 10302 | 10302 | } |
| 10303 | 10303 | $sth = $this->db->prepare($query); |
| 10304 | 10304 | $sth->execute(); |
| 10305 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10305 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10306 | 10306 | { |
| 10307 | 10307 | $departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']); |
| 10308 | 10308 | $arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']); |
| 10309 | 10309 | if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) { |
| 10310 | - $update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
| 10310 | + $update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
| 10311 | 10311 | $sthu = $this->db->prepare($update_query); |
| 10312 | - $sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
| 10312 | + $sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
| 10313 | 10313 | } |
| 10314 | 10314 | } |
| 10315 | 10315 | |
@@ -10322,7 +10322,7 @@ discard block |
||
| 10322 | 10322 | } |
| 10323 | 10323 | $sth = $this->db->prepare($query); |
| 10324 | 10324 | $sth->execute(); |
| 10325 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10325 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10326 | 10326 | { |
| 10327 | 10327 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 10328 | 10328 | { |
@@ -10331,11 +10331,11 @@ discard block |
||
| 10331 | 10331 | elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 10332 | 10332 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 10333 | 10333 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 10334 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
| 10334 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
| 10335 | 10335 | if (isset($airline_array[0]['name'])) { |
| 10336 | - $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 10336 | + $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 10337 | 10337 | $sthu = $this->db->prepare($update_query); |
| 10338 | - $sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
| 10338 | + $sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
| 10339 | 10339 | } |
| 10340 | 10340 | } |
| 10341 | 10341 | } |
@@ -10355,18 +10355,18 @@ discard block |
||
| 10355 | 10355 | } |
| 10356 | 10356 | $sth = $this->db->prepare($query); |
| 10357 | 10357 | $sth->execute(); |
| 10358 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10358 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10359 | 10359 | { |
| 10360 | 10360 | if ($row['aircraft_icao'] != '') { |
| 10361 | 10361 | $aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']); |
| 10362 | - if ($row['registration'] != ""){ |
|
| 10362 | + if ($row['registration'] != "") { |
|
| 10363 | 10363 | $image_array = $Image->getSpotterImage($row['registration']); |
| 10364 | 10364 | if (!isset($image_array[0]['registration'])) { |
| 10365 | 10365 | $Image->addSpotterImage($row['registration']); |
| 10366 | 10366 | } |
| 10367 | 10367 | } |
| 10368 | 10368 | if (count($aircraft_name) > 0) { |
| 10369 | - $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 10369 | + $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 10370 | 10370 | $sthu = $this->db->prepare($update_query); |
| 10371 | 10371 | $sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id'])); |
| 10372 | 10372 | } |
@@ -10381,10 +10381,10 @@ discard block |
||
| 10381 | 10381 | $query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output"; |
| 10382 | 10382 | $sth = $this->db->prepare($query); |
| 10383 | 10383 | $sth->execute(); |
| 10384 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10384 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10385 | 10385 | { |
| 10386 | 10386 | if ($row['last_latitude'] != '' && $row['last_longitude'] != '') { |
| 10387 | - $closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist); |
|
| 10387 | + $closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist); |
|
| 10388 | 10388 | $airport_icao = ''; |
| 10389 | 10389 | if (isset($closestAirports[0])) { |
| 10390 | 10390 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
@@ -10398,7 +10398,7 @@ discard block |
||
| 10398 | 10398 | break; |
| 10399 | 10399 | } |
| 10400 | 10400 | } |
| 10401 | - } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
|
| 10401 | + } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) { |
|
| 10402 | 10402 | $airport_icao = $closestAirports[0]['icao']; |
| 10403 | 10403 | if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
| 10404 | 10404 | } else { |
@@ -10409,28 +10409,28 @@ discard block |
||
| 10409 | 10409 | } |
| 10410 | 10410 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 10411 | 10411 | if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
| 10412 | - $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
| 10412 | + $update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
| 10413 | 10413 | $sthu = $this->db->prepare($update_query); |
| 10414 | - $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
|
| 10414 | + $sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id'])); |
|
| 10415 | 10415 | } |
| 10416 | 10416 | } |
| 10417 | 10417 | } |
| 10418 | 10418 | } |
| 10419 | 10419 | |
| 10420 | - public function closestAirports($origLat,$origLon,$dist = 10) { |
|
| 10420 | + public function closestAirports($origLat, $origLon, $dist = 10) { |
|
| 10421 | 10421 | global $globalDBdriver; |
| 10422 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
| 10422 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
| 10423 | 10423 | /* |
| 10424 | 10424 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
| 10425 | 10425 | FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10426 | 10426 | having distance < $dist ORDER BY distance limit 100;"; |
| 10427 | 10427 | */ |
| 10428 | 10428 | if ($globalDBdriver == 'mysql') { |
| 10429 | - $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 |
|
| 10429 | + $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 |
|
| 10430 | 10430 | 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)) |
| 10431 | 10431 | 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;"; |
| 10432 | 10432 | } else { |
| 10433 | - $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 |
|
| 10433 | + $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 |
|
| 10434 | 10434 | 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)) |
| 10435 | 10435 | 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;"; |
| 10436 | 10436 | } |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | /** |
| 15 | 15 | * Get SQL query part for filter used |
| 16 | 16 | * @param Array $filter the filter |
| 17 | - * @return Array the SQL part |
|
| 17 | + * @return string the SQL part |
|
| 18 | 18 | */ |
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * Get SQL query part for filter used |
|
| 16 | - * @param Array $filter the filter |
|
| 17 | - * @return Array the SQL part |
|
| 18 | - */ |
|
| 15 | + * Get SQL query part for filter used |
|
| 16 | + * @param Array $filter the filter |
|
| 17 | + * @return Array the SQL part |
|
| 18 | + */ |
|
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 21 | 21 | $filters = array(); |
@@ -86,11 +86,11 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | - * Gets all the spotter information based on the latest data entry |
|
| 90 | - * |
|
| 91 | - * @return Array the spotter information |
|
| 92 | - * |
|
| 93 | - */ |
|
| 89 | + * Gets all the spotter information based on the latest data entry |
|
| 90 | + * |
|
| 91 | + * @return Array the spotter information |
|
| 92 | + * |
|
| 93 | + */ |
|
| 94 | 94 | public function getLiveSpotterData($limit = '', $sort = '', $filter = array()) |
| 95 | 95 | { |
| 96 | 96 | global $globalDBdriver, $globalLiveInterval; |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | - * Gets Minimal Live Spotter data |
|
| 136 | - * |
|
| 137 | - * @return Array the spotter information |
|
| 138 | - * |
|
| 139 | - */ |
|
| 135 | + * Gets Minimal Live Spotter data |
|
| 136 | + * |
|
| 137 | + * @return Array the spotter information |
|
| 138 | + * |
|
| 139 | + */ |
|
| 140 | 140 | public function getMinLiveSpotterData($filter = array()) |
| 141 | 141 | { |
| 142 | 142 | global $globalDBdriver, $globalLiveInterval; |
@@ -189,11 +189,11 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * Gets Minimal Live Spotter data since xx seconds |
|
| 193 | - * |
|
| 194 | - * @return Array the spotter information |
|
| 195 | - * |
|
| 196 | - */ |
|
| 192 | + * Gets Minimal Live Spotter data since xx seconds |
|
| 193 | + * |
|
| 194 | + * @return Array the spotter information |
|
| 195 | + * |
|
| 196 | + */ |
|
| 197 | 197 | public function getMinLastLiveSpotterData($filter = array()) |
| 198 | 198 | { |
| 199 | 199 | global $globalDBdriver, $globalLiveInterval; |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
| 212 | 212 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 213 | 213 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 214 | - } else { |
|
| 214 | + } else { |
|
| 215 | 215 | /* |
| 216 | 216 | $query = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
| 217 | 217 | FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | // echo $query; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - try { |
|
| 226 | + try { |
|
| 227 | 227 | $sth = $this->db->prepare($query); |
| 228 | 228 | $sth->execute(); |
| 229 | 229 | } catch(PDOException $e) { |
@@ -235,11 +235,11 @@ discard block |
||
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
| 238 | - * Gets number of latest data entry |
|
| 239 | - * |
|
| 240 | - * @return String number of entry |
|
| 241 | - * |
|
| 242 | - */ |
|
| 238 | + * Gets number of latest data entry |
|
| 239 | + * |
|
| 240 | + * @return String number of entry |
|
| 241 | + * |
|
| 242 | + */ |
|
| 243 | 243 | public function getLiveSpotterCount($filter = array()) |
| 244 | 244 | { |
| 245 | 245 | global $globalDBdriver, $globalLiveInterval; |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
| 269 | - * Gets all the spotter information based on the latest data entry and coord |
|
| 270 | - * |
|
| 271 | - * @return Array the spotter information |
|
| 272 | - * |
|
| 273 | - */ |
|
| 269 | + * Gets all the spotter information based on the latest data entry and coord |
|
| 270 | + * |
|
| 271 | + * @return Array the spotter information |
|
| 272 | + * |
|
| 273 | + */ |
|
| 274 | 274 | public function getLiveSpotterDatabyCoord($coord, $filter = array()) |
| 275 | 275 | { |
| 276 | 276 | global $globalDBdriver, $globalLiveInterval; |
@@ -295,11 +295,11 @@ discard block |
||
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
| 298 | - * Gets all the spotter information based on a user's latitude and longitude |
|
| 299 | - * |
|
| 300 | - * @return Array the spotter information |
|
| 301 | - * |
|
| 302 | - */ |
|
| 298 | + * Gets all the spotter information based on a user's latitude and longitude |
|
| 299 | + * |
|
| 300 | + * @return Array the spotter information |
|
| 301 | + * |
|
| 302 | + */ |
|
| 303 | 303 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
| 304 | 304 | { |
| 305 | 305 | $Spotter = new Spotter($this->db); |
@@ -309,145 +309,145 @@ discard block |
||
| 309 | 309 | return false; |
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | - if ($lng != '') |
|
| 313 | - { |
|
| 314 | - if (!is_numeric($lng)) |
|
| 315 | - { |
|
| 316 | - return false; |
|
| 317 | - } |
|
| 318 | - } |
|
| 319 | - |
|
| 320 | - if ($radius != '') |
|
| 321 | - { |
|
| 322 | - if (!is_numeric($radius)) |
|
| 323 | - { |
|
| 324 | - return false; |
|
| 325 | - } |
|
| 326 | - } |
|
| 312 | + if ($lng != '') |
|
| 313 | + { |
|
| 314 | + if (!is_numeric($lng)) |
|
| 315 | + { |
|
| 316 | + return false; |
|
| 317 | + } |
|
| 318 | + } |
|
| 319 | + |
|
| 320 | + if ($radius != '') |
|
| 321 | + { |
|
| 322 | + if (!is_numeric($radius)) |
|
| 323 | + { |
|
| 324 | + return false; |
|
| 325 | + } |
|
| 326 | + } |
|
| 327 | 327 | $additional_query = ''; |
| 328 | - if ($interval != '') |
|
| 329 | - { |
|
| 330 | - if (!is_string($interval)) |
|
| 331 | - { |
|
| 332 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 333 | - return false; |
|
| 334 | - } else { |
|
| 335 | - if ($interval == '1m') |
|
| 336 | - { |
|
| 337 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 338 | - } else if ($interval == '15m'){ |
|
| 339 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
| 340 | - } |
|
| 341 | - } |
|
| 342 | - } else { |
|
| 343 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 344 | - } |
|
| 345 | - |
|
| 346 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 328 | + if ($interval != '') |
|
| 329 | + { |
|
| 330 | + if (!is_string($interval)) |
|
| 331 | + { |
|
| 332 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 333 | + return false; |
|
| 334 | + } else { |
|
| 335 | + if ($interval == '1m') |
|
| 336 | + { |
|
| 337 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 338 | + } else if ($interval == '15m'){ |
|
| 339 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
| 340 | + } |
|
| 341 | + } |
|
| 342 | + } else { |
|
| 343 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 344 | + } |
|
| 345 | + |
|
| 346 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 347 | 347 | WHERE spotter_live.latitude <> '' |
| 348 | 348 | AND spotter_live.longitude <> '' |
| 349 | 349 | ".$additional_query." |
| 350 | 350 | HAVING distance < :radius |
| 351 | 351 | ORDER BY distance"; |
| 352 | 352 | |
| 353 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 353 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 354 | 354 | |
| 355 | - return $spotter_array; |
|
| 356 | - } |
|
| 355 | + return $spotter_array; |
|
| 356 | + } |
|
| 357 | 357 | |
| 358 | 358 | |
| 359 | - /** |
|
| 360 | - * Gets all the spotter information based on a particular callsign |
|
| 361 | - * |
|
| 362 | - * @return Array the spotter information |
|
| 363 | - * |
|
| 364 | - */ |
|
| 359 | + /** |
|
| 360 | + * Gets all the spotter information based on a particular callsign |
|
| 361 | + * |
|
| 362 | + * @return Array the spotter information |
|
| 363 | + * |
|
| 364 | + */ |
|
| 365 | 365 | public function getLastLiveSpotterDataByIdent($ident) |
| 366 | 366 | { |
| 367 | 367 | $Spotter = new Spotter($this->db); |
| 368 | 368 | date_default_timezone_set('UTC'); |
| 369 | 369 | |
| 370 | 370 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 371 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 371 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 372 | 372 | |
| 373 | 373 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
| 374 | 374 | |
| 375 | 375 | return $spotter_array; |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - /** |
|
| 379 | - * Gets all the spotter information based on a particular callsign |
|
| 380 | - * |
|
| 381 | - * @return Array the spotter information |
|
| 382 | - * |
|
| 383 | - */ |
|
| 378 | + /** |
|
| 379 | + * Gets all the spotter information based on a particular callsign |
|
| 380 | + * |
|
| 381 | + * @return Array the spotter information |
|
| 382 | + * |
|
| 383 | + */ |
|
| 384 | 384 | public function getDateLiveSpotterDataByIdent($ident,$date) |
| 385 | 385 | { |
| 386 | 386 | $Spotter = new Spotter($this->db); |
| 387 | 387 | date_default_timezone_set('UTC'); |
| 388 | 388 | |
| 389 | 389 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 390 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 390 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 391 | 391 | |
| 392 | - $date = date('c',$date); |
|
| 392 | + $date = date('c',$date); |
|
| 393 | 393 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
| 394 | 394 | |
| 395 | 395 | return $spotter_array; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - /** |
|
| 399 | - * Gets last spotter information based on a particular callsign |
|
| 400 | - * |
|
| 401 | - * @return Array the spotter information |
|
| 402 | - * |
|
| 403 | - */ |
|
| 398 | + /** |
|
| 399 | + * Gets last spotter information based on a particular callsign |
|
| 400 | + * |
|
| 401 | + * @return Array the spotter information |
|
| 402 | + * |
|
| 403 | + */ |
|
| 404 | 404 | public function getLastLiveSpotterDataById($id) |
| 405 | 405 | { |
| 406 | 406 | $Spotter = new Spotter($this->db); |
| 407 | 407 | date_default_timezone_set('UTC'); |
| 408 | 408 | |
| 409 | 409 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 410 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 410 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 411 | 411 | |
| 412 | 412 | $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
| 413 | 413 | |
| 414 | 414 | return $spotter_array; |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | - /** |
|
| 418 | - * Gets last spotter information based on a particular callsign |
|
| 419 | - * |
|
| 420 | - * @return Array the spotter information |
|
| 421 | - * |
|
| 422 | - */ |
|
| 417 | + /** |
|
| 418 | + * Gets last spotter information based on a particular callsign |
|
| 419 | + * |
|
| 420 | + * @return Array the spotter information |
|
| 421 | + * |
|
| 422 | + */ |
|
| 423 | 423 | public function getDateLiveSpotterDataById($id,$date) |
| 424 | 424 | { |
| 425 | 425 | $Spotter = new Spotter($this->db); |
| 426 | 426 | date_default_timezone_set('UTC'); |
| 427 | 427 | |
| 428 | 428 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 429 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 430 | - $date = date('c',$date); |
|
| 429 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 430 | + $date = date('c',$date); |
|
| 431 | 431 | $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
| 432 | 432 | |
| 433 | 433 | return $spotter_array; |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | - /** |
|
| 437 | - * Gets altitude information based on a particular callsign |
|
| 438 | - * |
|
| 439 | - * @return Array the spotter information |
|
| 440 | - * |
|
| 441 | - */ |
|
| 436 | + /** |
|
| 437 | + * Gets altitude information based on a particular callsign |
|
| 438 | + * |
|
| 439 | + * @return Array the spotter information |
|
| 440 | + * |
|
| 441 | + */ |
|
| 442 | 442 | public function getAltitudeLiveSpotterDataByIdent($ident) |
| 443 | 443 | { |
| 444 | 444 | |
| 445 | 445 | date_default_timezone_set('UTC'); |
| 446 | 446 | |
| 447 | 447 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 448 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 448 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 449 | 449 | |
| 450 | - try { |
|
| 450 | + try { |
|
| 451 | 451 | |
| 452 | 452 | $sth = $this->db->prepare($query); |
| 453 | 453 | $sth->execute(array(':ident' => $ident)); |
@@ -460,12 +460,12 @@ discard block |
||
| 460 | 460 | return $spotter_array; |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | - /** |
|
| 464 | - * Gets all the spotter information based on a particular id |
|
| 465 | - * |
|
| 466 | - * @return Array the spotter information |
|
| 467 | - * |
|
| 468 | - */ |
|
| 463 | + /** |
|
| 464 | + * Gets all the spotter information based on a particular id |
|
| 465 | + * |
|
| 466 | + * @return Array the spotter information |
|
| 467 | + * |
|
| 468 | + */ |
|
| 469 | 469 | public function getAllLiveSpotterDataById($id,$liveinterval = false) |
| 470 | 470 | { |
| 471 | 471 | global $globalDBdriver, $globalLiveInterval; |
@@ -493,18 +493,18 @@ discard block |
||
| 493 | 493 | return $spotter_array; |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | - /** |
|
| 497 | - * Gets all the spotter information based on a particular ident |
|
| 498 | - * |
|
| 499 | - * @return Array the spotter information |
|
| 500 | - * |
|
| 501 | - */ |
|
| 496 | + /** |
|
| 497 | + * Gets all the spotter information based on a particular ident |
|
| 498 | + * |
|
| 499 | + * @return Array the spotter information |
|
| 500 | + * |
|
| 501 | + */ |
|
| 502 | 502 | public function getAllLiveSpotterDataByIdent($ident) |
| 503 | 503 | { |
| 504 | 504 | date_default_timezone_set('UTC'); |
| 505 | 505 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 506 | 506 | $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
| 507 | - try { |
|
| 507 | + try { |
|
| 508 | 508 | |
| 509 | 509 | $sth = $this->db->prepare($query); |
| 510 | 510 | $sth->execute(array(':ident' => $ident)); |
@@ -518,23 +518,23 @@ discard block |
||
| 518 | 518 | |
| 519 | 519 | |
| 520 | 520 | /** |
| 521 | - * Deletes all info in the table |
|
| 522 | - * |
|
| 523 | - * @return String success or false |
|
| 524 | - * |
|
| 525 | - */ |
|
| 521 | + * Deletes all info in the table |
|
| 522 | + * |
|
| 523 | + * @return String success or false |
|
| 524 | + * |
|
| 525 | + */ |
|
| 526 | 526 | public function deleteLiveSpotterData() |
| 527 | 527 | { |
| 528 | 528 | global $globalDBdriver; |
| 529 | 529 | if ($globalDBdriver == 'mysql') { |
| 530 | 530 | //$query = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date"; |
| 531 | 531 | $query = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date'; |
| 532 | - //$query = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)"; |
|
| 532 | + //$query = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)"; |
|
| 533 | 533 | } else { |
| 534 | 534 | $query = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date"; |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | - try { |
|
| 537 | + try { |
|
| 538 | 538 | |
| 539 | 539 | $sth = $this->db->prepare($query); |
| 540 | 540 | $sth->execute(); |
@@ -546,18 +546,18 @@ discard block |
||
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | /** |
| 549 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 550 | - * |
|
| 551 | - * @return String success or false |
|
| 552 | - * |
|
| 553 | - */ |
|
| 549 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 550 | + * |
|
| 551 | + * @return String success or false |
|
| 552 | + * |
|
| 553 | + */ |
|
| 554 | 554 | public function deleteLiveSpotterDataNotUpdated() |
| 555 | 555 | { |
| 556 | 556 | global $globalDBdriver, $globalDebug; |
| 557 | 557 | if ($globalDBdriver == 'mysql') { |
| 558 | 558 | //$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0'; |
| 559 | - $query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
| 560 | - try { |
|
| 559 | + $query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
| 560 | + try { |
|
| 561 | 561 | |
| 562 | 562 | $sth = $this->db->prepare($query); |
| 563 | 563 | $sth->execute(); |
@@ -565,8 +565,8 @@ discard block |
||
| 565 | 565 | return "error"; |
| 566 | 566 | } |
| 567 | 567 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
| 568 | - $i = 0; |
|
| 569 | - $j =0; |
|
| 568 | + $i = 0; |
|
| 569 | + $j =0; |
|
| 570 | 570 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 571 | 571 | foreach($all as $row) |
| 572 | 572 | { |
@@ -574,20 +574,20 @@ discard block |
||
| 574 | 574 | $j++; |
| 575 | 575 | if ($j == 30) { |
| 576 | 576 | if ($globalDebug) echo "."; |
| 577 | - try { |
|
| 577 | + try { |
|
| 578 | 578 | |
| 579 | 579 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 580 | 580 | $sth->execute(); |
| 581 | 581 | } catch(PDOException $e) { |
| 582 | 582 | return "error"; |
| 583 | 583 | } |
| 584 | - $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
| 585 | - $j = 0; |
|
| 584 | + $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
| 585 | + $j = 0; |
|
| 586 | 586 | } |
| 587 | 587 | $query_delete .= "'".$row['flightaware_id']."',"; |
| 588 | 588 | } |
| 589 | 589 | if ($i > 0) { |
| 590 | - try { |
|
| 590 | + try { |
|
| 591 | 591 | |
| 592 | 592 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 593 | 593 | $sth->execute(); |
@@ -598,9 +598,9 @@ discard block |
||
| 598 | 598 | return "success"; |
| 599 | 599 | } elseif ($globalDBdriver == 'pgsql') { |
| 600 | 600 | //$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0"; |
| 601 | - //$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
| 602 | - $query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
| 603 | - try { |
|
| 601 | + //$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
| 602 | + $query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
| 603 | + try { |
|
| 604 | 604 | |
| 605 | 605 | $sth = $this->db->prepare($query); |
| 606 | 606 | $sth->execute(); |
@@ -644,17 +644,17 @@ discard block |
||
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | /** |
| 647 | - * Deletes all info in the table for an ident |
|
| 648 | - * |
|
| 649 | - * @return String success or false |
|
| 650 | - * |
|
| 651 | - */ |
|
| 647 | + * Deletes all info in the table for an ident |
|
| 648 | + * |
|
| 649 | + * @return String success or false |
|
| 650 | + * |
|
| 651 | + */ |
|
| 652 | 652 | public function deleteLiveSpotterDataByIdent($ident) |
| 653 | 653 | { |
| 654 | 654 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 655 | 655 | $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
| 656 | 656 | |
| 657 | - try { |
|
| 657 | + try { |
|
| 658 | 658 | |
| 659 | 659 | $sth = $this->db->prepare($query); |
| 660 | 660 | $sth->execute(array(':ident' => $ident)); |
@@ -666,17 +666,17 @@ discard block |
||
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | /** |
| 669 | - * Deletes all info in the table for an id |
|
| 670 | - * |
|
| 671 | - * @return String success or false |
|
| 672 | - * |
|
| 673 | - */ |
|
| 669 | + * Deletes all info in the table for an id |
|
| 670 | + * |
|
| 671 | + * @return String success or false |
|
| 672 | + * |
|
| 673 | + */ |
|
| 674 | 674 | public function deleteLiveSpotterDataById($id) |
| 675 | 675 | { |
| 676 | 676 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 677 | 677 | $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
| 678 | 678 | |
| 679 | - try { |
|
| 679 | + try { |
|
| 680 | 680 | |
| 681 | 681 | $sth = $this->db->prepare($query); |
| 682 | 682 | $sth->execute(array(':id' => $id)); |
@@ -689,11 +689,11 @@ discard block |
||
| 689 | 689 | |
| 690 | 690 | |
| 691 | 691 | /** |
| 692 | - * Gets the aircraft ident within the last hour |
|
| 693 | - * |
|
| 694 | - * @return String the ident |
|
| 695 | - * |
|
| 696 | - */ |
|
| 692 | + * Gets the aircraft ident within the last hour |
|
| 693 | + * |
|
| 694 | + * @return String the ident |
|
| 695 | + * |
|
| 696 | + */ |
|
| 697 | 697 | public function getIdentFromLastHour($ident) |
| 698 | 698 | { |
| 699 | 699 | global $globalDBdriver, $globalTimezone; |
@@ -719,14 +719,14 @@ discard block |
||
| 719 | 719 | $ident_result = $row['ident']; |
| 720 | 720 | } |
| 721 | 721 | return $ident_result; |
| 722 | - } |
|
| 722 | + } |
|
| 723 | 723 | |
| 724 | 724 | /** |
| 725 | - * Check recent aircraft |
|
| 726 | - * |
|
| 727 | - * @return String the ident |
|
| 728 | - * |
|
| 729 | - */ |
|
| 725 | + * Check recent aircraft |
|
| 726 | + * |
|
| 727 | + * @return String the ident |
|
| 728 | + * |
|
| 729 | + */ |
|
| 730 | 730 | public function checkIdentRecent($ident) |
| 731 | 731 | { |
| 732 | 732 | global $globalDBdriver, $globalTimezone; |
@@ -752,14 +752,14 @@ discard block |
||
| 752 | 752 | $ident_result = $row['flightaware_id']; |
| 753 | 753 | } |
| 754 | 754 | return $ident_result; |
| 755 | - } |
|
| 755 | + } |
|
| 756 | 756 | |
| 757 | 757 | /** |
| 758 | - * Check recent aircraft by id |
|
| 759 | - * |
|
| 760 | - * @return String the ident |
|
| 761 | - * |
|
| 762 | - */ |
|
| 758 | + * Check recent aircraft by id |
|
| 759 | + * |
|
| 760 | + * @return String the ident |
|
| 761 | + * |
|
| 762 | + */ |
|
| 763 | 763 | public function checkIdRecent($id) |
| 764 | 764 | { |
| 765 | 765 | global $globalDBdriver, $globalTimezone; |
@@ -785,14 +785,14 @@ discard block |
||
| 785 | 785 | $ident_result = $row['flightaware_id']; |
| 786 | 786 | } |
| 787 | 787 | return $ident_result; |
| 788 | - } |
|
| 788 | + } |
|
| 789 | 789 | |
| 790 | 790 | /** |
| 791 | - * Check recent aircraft by ModeS |
|
| 792 | - * |
|
| 793 | - * @return String the ModeS |
|
| 794 | - * |
|
| 795 | - */ |
|
| 791 | + * Check recent aircraft by ModeS |
|
| 792 | + * |
|
| 793 | + * @return String the ModeS |
|
| 794 | + * |
|
| 795 | + */ |
|
| 796 | 796 | public function checkModeSRecent($modes) |
| 797 | 797 | { |
| 798 | 798 | global $globalDBdriver, $globalTimezone; |
@@ -819,19 +819,19 @@ discard block |
||
| 819 | 819 | $ident_result = $row['flightaware_id']; |
| 820 | 820 | } |
| 821 | 821 | return $ident_result; |
| 822 | - } |
|
| 822 | + } |
|
| 823 | 823 | |
| 824 | 824 | /** |
| 825 | - * Adds a new spotter data |
|
| 826 | - * |
|
| 827 | - * @param String $flightaware_id the ID from flightaware |
|
| 828 | - * @param String $ident the flight ident |
|
| 829 | - * @param String $aircraft_icao the aircraft type |
|
| 830 | - * @param String $departure_airport_icao the departure airport |
|
| 831 | - * @param String $arrival_airport_icao the arrival airport |
|
| 832 | - * @return String success or false |
|
| 833 | - * |
|
| 834 | - */ |
|
| 825 | + * Adds a new spotter data |
|
| 826 | + * |
|
| 827 | + * @param String $flightaware_id the ID from flightaware |
|
| 828 | + * @param String $ident the flight ident |
|
| 829 | + * @param String $aircraft_icao the aircraft type |
|
| 830 | + * @param String $departure_airport_icao the departure airport |
|
| 831 | + * @param String $arrival_airport_icao the arrival airport |
|
| 832 | + * @return String success or false |
|
| 833 | + * |
|
| 834 | + */ |
|
| 835 | 835 | public function addLiveSpotterData($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 = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
| 836 | 836 | { |
| 837 | 837 | global $globalURL, $globalArchive, $globalDebug; |
@@ -966,10 +966,10 @@ discard block |
||
| 966 | 966 | $arrival_airport_country = ''; |
| 967 | 967 | |
| 968 | 968 | |
| 969 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 970 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 971 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 972 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 969 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 970 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 971 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 972 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 973 | 973 | |
| 974 | 974 | $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
| 975 | 975 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
@@ -979,14 +979,14 @@ discard block |
||
| 979 | 979 | |
| 980 | 980 | $sth = $this->db->prepare($query); |
| 981 | 981 | $sth->execute($query_values); |
| 982 | - } catch(PDOException $e) { |
|
| 983 | - return "error : ".$e->getMessage(); |
|
| 984 | - } |
|
| 982 | + } catch(PDOException $e) { |
|
| 983 | + return "error : ".$e->getMessage(); |
|
| 984 | + } |
|
| 985 | 985 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 986 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
| 987 | - $SpotterArchive = new SpotterArchive($this->db); |
|
| 988 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
| 989 | - if ($globalDebug) echo $result.')'; |
|
| 986 | + if ($globalDebug) echo '(Add to SBS archive : '; |
|
| 987 | + $SpotterArchive = new SpotterArchive($this->db); |
|
| 988 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
| 989 | + if ($globalDebug) echo $result.')'; |
|
| 990 | 990 | } |
| 991 | 991 | return "success"; |
| 992 | 992 | |
@@ -16,45 +16,45 @@ discard block |
||
| 16 | 16 | * @param Array $filter the filter |
| 17 | 17 | * @return Array the SQL part |
| 18 | 18 | */ |
| 19 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 19 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 21 | 21 | $filters = array(); |
| 22 | 22 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 23 | 23 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 24 | 24 | $filters = $globalStatsFilters[$globalFilterName]; |
| 25 | 25 | } else { |
| 26 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 26 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 29 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 30 | 30 | $filter_query_join = ''; |
| 31 | 31 | $filter_query_where = ''; |
| 32 | - foreach($filters as $flt) { |
|
| 32 | + foreach ($filters as $flt) { |
|
| 33 | 33 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
| 34 | 34 | if ($flt['airlines'][0] != '') { |
| 35 | 35 | if (isset($flt['source'])) { |
| 36 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 36 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 37 | 37 | } else { |
| 38 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 38 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
| 43 | 43 | if (isset($flt['source'])) { |
| 44 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 44 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 45 | 45 | } else { |
| 46 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 46 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) { |
| 50 | 50 | if (isset($flt['source'])) { |
| 51 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 51 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 56 | 56 | if ($filter['airlines'][0] != '') { |
| 57 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 57 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
@@ -64,19 +64,19 @@ discard block |
||
| 64 | 64 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
| 65 | 65 | } |
| 66 | 66 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
| 67 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 67 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 68 | 68 | } |
| 69 | 69 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 70 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 70 | + $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 71 | 71 | } |
| 72 | 72 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 73 | 73 | $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
| 74 | 74 | } |
| 75 | 75 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 76 | 76 | if ($filter_query_where == '') { |
| 77 | - $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 77 | + $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 78 | 78 | } else { |
| 79 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 79 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | if ($limit != '') |
| 103 | 103 | { |
| 104 | 104 | $limit_array = explode(',', $limit); |
| 105 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 106 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 105 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 106 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 107 | 107 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 108 | 108 | { |
| 109 | 109 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } else { |
| 127 | 127 | $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query; |
| 128 | 128 | } |
| 129 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
| 129 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
| 130 | 130 | |
| 131 | 131 | return $spotter_array; |
| 132 | 132 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | global $globalDBdriver, $globalLiveInterval; |
| 143 | 143 | date_default_timezone_set('UTC'); |
| 144 | 144 | |
| 145 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 145 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 146 | 146 | |
| 147 | 147 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 148 | 148 | if ($globalDBdriver == 'mysql') { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $query = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
| 154 | 154 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0"; |
| 155 | 155 | */ |
| 156 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 156 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 157 | 157 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0"; |
| 158 | 158 | |
| 159 | 159 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date ORDER BY spotter_live.date GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
| 169 | 169 | */ |
| 170 | 170 | |
| 171 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 171 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 172 | 172 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
| 173 | 173 | |
| 174 | 174 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | try { |
| 180 | 180 | $sth = $this->db->prepare($query); |
| 181 | 181 | $sth->execute(); |
| 182 | - } catch(PDOException $e) { |
|
| 182 | + } catch (PDOException $e) { |
|
| 183 | 183 | echo $e->getMessage(); |
| 184 | 184 | die; |
| 185 | 185 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | global $globalDBdriver, $globalLiveInterval; |
| 200 | 200 | date_default_timezone_set('UTC'); |
| 201 | 201 | |
| 202 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 202 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 203 | 203 | |
| 204 | 204 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 205 | 205 | if ($globalDBdriver == 'mysql') { |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 209 | 209 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 210 | 210 | */ |
| 211 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 211 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 212 | 212 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 213 | 213 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 214 | 214 | } else { |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 218 | 218 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 219 | 219 | */ |
| 220 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 220 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 221 | 221 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 222 | 222 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 223 | 223 | // echo $query; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | try { |
| 227 | 227 | $sth = $this->db->prepare($query); |
| 228 | 228 | $sth->execute(); |
| 229 | - } catch(PDOException $e) { |
|
| 229 | + } catch (PDOException $e) { |
|
| 230 | 230 | echo $e->getMessage(); |
| 231 | 231 | die; |
| 232 | 232 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | public function getLiveSpotterCount($filter = array()) |
| 244 | 244 | { |
| 245 | 245 | global $globalDBdriver, $globalLiveInterval; |
| 246 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 246 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 247 | 247 | |
| 248 | 248 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 249 | 249 | if ($globalDBdriver == 'mysql') { |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | try { |
| 257 | 257 | $sth = $this->db->prepare($query); |
| 258 | 258 | $sth->execute(); |
| 259 | - } catch(PDOException $e) { |
|
| 259 | + } catch (PDOException $e) { |
|
| 260 | 260 | echo $e->getMessage(); |
| 261 | 261 | die; |
| 262 | 262 | } |
@@ -279,10 +279,10 @@ discard block |
||
| 279 | 279 | $filter_query = $this->getFilter($filter); |
| 280 | 280 | |
| 281 | 281 | if (is_array($coord)) { |
| 282 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 283 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 284 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 285 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 282 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 283 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 284 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 285 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 286 | 286 | } else return array(); |
| 287 | 287 | if ($globalDBdriver == 'mysql') { |
| 288 | 288 | //$query = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | if ($interval == '1m') |
| 336 | 336 | { |
| 337 | 337 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 338 | - } else if ($interval == '15m'){ |
|
| 338 | + } else if ($interval == '15m') { |
|
| 339 | 339 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
| 340 | 340 | } |
| 341 | 341 | } |
@@ -343,14 +343,14 @@ discard block |
||
| 343 | 343 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 346 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 347 | 347 | WHERE spotter_live.latitude <> '' |
| 348 | 348 | AND spotter_live.longitude <> '' |
| 349 | 349 | ".$additional_query." |
| 350 | 350 | HAVING distance < :radius |
| 351 | 351 | ORDER BY distance"; |
| 352 | 352 | |
| 353 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 353 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
| 354 | 354 | |
| 355 | 355 | return $spotter_array; |
| 356 | 356 | } |
@@ -368,9 +368,9 @@ discard block |
||
| 368 | 368 | date_default_timezone_set('UTC'); |
| 369 | 369 | |
| 370 | 370 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 371 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 371 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 372 | 372 | |
| 373 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
| 373 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
| 374 | 374 | |
| 375 | 375 | return $spotter_array; |
| 376 | 376 | } |
@@ -381,16 +381,16 @@ discard block |
||
| 381 | 381 | * @return Array the spotter information |
| 382 | 382 | * |
| 383 | 383 | */ |
| 384 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
| 384 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
| 385 | 385 | { |
| 386 | 386 | $Spotter = new Spotter($this->db); |
| 387 | 387 | date_default_timezone_set('UTC'); |
| 388 | 388 | |
| 389 | 389 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 390 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 390 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 391 | 391 | |
| 392 | - $date = date('c',$date); |
|
| 393 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 392 | + $date = date('c', $date); |
|
| 393 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 394 | 394 | |
| 395 | 395 | return $spotter_array; |
| 396 | 396 | } |
@@ -407,9 +407,9 @@ discard block |
||
| 407 | 407 | date_default_timezone_set('UTC'); |
| 408 | 408 | |
| 409 | 409 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 410 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 410 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 411 | 411 | |
| 412 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
| 412 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
| 413 | 413 | |
| 414 | 414 | return $spotter_array; |
| 415 | 415 | } |
@@ -420,15 +420,15 @@ discard block |
||
| 420 | 420 | * @return Array the spotter information |
| 421 | 421 | * |
| 422 | 422 | */ |
| 423 | - public function getDateLiveSpotterDataById($id,$date) |
|
| 423 | + public function getDateLiveSpotterDataById($id, $date) |
|
| 424 | 424 | { |
| 425 | 425 | $Spotter = new Spotter($this->db); |
| 426 | 426 | date_default_timezone_set('UTC'); |
| 427 | 427 | |
| 428 | 428 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 429 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 430 | - $date = date('c',$date); |
|
| 431 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
| 429 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 430 | + $date = date('c', $date); |
|
| 431 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
| 432 | 432 | |
| 433 | 433 | return $spotter_array; |
| 434 | 434 | } |
@@ -445,13 +445,13 @@ discard block |
||
| 445 | 445 | date_default_timezone_set('UTC'); |
| 446 | 446 | |
| 447 | 447 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 448 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 448 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 449 | 449 | |
| 450 | 450 | try { |
| 451 | 451 | |
| 452 | 452 | $sth = $this->db->prepare($query); |
| 453 | 453 | $sth->execute(array(':ident' => $ident)); |
| 454 | - } catch(PDOException $e) { |
|
| 454 | + } catch (PDOException $e) { |
|
| 455 | 455 | echo $e->getMessage(); |
| 456 | 456 | die; |
| 457 | 457 | } |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | * @return Array the spotter information |
| 467 | 467 | * |
| 468 | 468 | */ |
| 469 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
| 469 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
| 470 | 470 | { |
| 471 | 471 | global $globalDBdriver, $globalLiveInterval; |
| 472 | 472 | date_default_timezone_set('UTC'); |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | try { |
| 486 | 486 | $sth = $this->db->prepare($query); |
| 487 | 487 | $sth->execute(array(':id' => $id)); |
| 488 | - } catch(PDOException $e) { |
|
| 488 | + } catch (PDOException $e) { |
|
| 489 | 489 | echo $e->getMessage(); |
| 490 | 490 | die; |
| 491 | 491 | } |
@@ -503,12 +503,12 @@ discard block |
||
| 503 | 503 | { |
| 504 | 504 | date_default_timezone_set('UTC'); |
| 505 | 505 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 506 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 506 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 507 | 507 | try { |
| 508 | 508 | |
| 509 | 509 | $sth = $this->db->prepare($query); |
| 510 | 510 | $sth->execute(array(':ident' => $ident)); |
| 511 | - } catch(PDOException $e) { |
|
| 511 | + } catch (PDOException $e) { |
|
| 512 | 512 | echo $e->getMessage(); |
| 513 | 513 | die; |
| 514 | 514 | } |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | |
| 539 | 539 | $sth = $this->db->prepare($query); |
| 540 | 540 | $sth->execute(); |
| 541 | - } catch(PDOException $e) { |
|
| 541 | + } catch (PDOException $e) { |
|
| 542 | 542 | return "error"; |
| 543 | 543 | } |
| 544 | 544 | |
@@ -561,14 +561,14 @@ discard block |
||
| 561 | 561 | |
| 562 | 562 | $sth = $this->db->prepare($query); |
| 563 | 563 | $sth->execute(); |
| 564 | - } catch(PDOException $e) { |
|
| 564 | + } catch (PDOException $e) { |
|
| 565 | 565 | return "error"; |
| 566 | 566 | } |
| 567 | 567 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
| 568 | 568 | $i = 0; |
| 569 | - $j =0; |
|
| 569 | + $j = 0; |
|
| 570 | 570 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 571 | - foreach($all as $row) |
|
| 571 | + foreach ($all as $row) |
|
| 572 | 572 | { |
| 573 | 573 | $i++; |
| 574 | 574 | $j++; |
@@ -576,9 +576,9 @@ discard block |
||
| 576 | 576 | if ($globalDebug) echo "."; |
| 577 | 577 | try { |
| 578 | 578 | |
| 579 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 579 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 580 | 580 | $sth->execute(); |
| 581 | - } catch(PDOException $e) { |
|
| 581 | + } catch (PDOException $e) { |
|
| 582 | 582 | return "error"; |
| 583 | 583 | } |
| 584 | 584 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -589,9 +589,9 @@ discard block |
||
| 589 | 589 | if ($i > 0) { |
| 590 | 590 | try { |
| 591 | 591 | |
| 592 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 592 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 593 | 593 | $sth->execute(); |
| 594 | - } catch(PDOException $e) { |
|
| 594 | + } catch (PDOException $e) { |
|
| 595 | 595 | return "error"; |
| 596 | 596 | } |
| 597 | 597 | } |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | |
| 605 | 605 | $sth = $this->db->prepare($query); |
| 606 | 606 | $sth->execute(); |
| 607 | - } catch(PDOException $e) { |
|
| 607 | + } catch (PDOException $e) { |
|
| 608 | 608 | return "error"; |
| 609 | 609 | } |
| 610 | 610 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -652,13 +652,13 @@ discard block |
||
| 652 | 652 | public function deleteLiveSpotterDataByIdent($ident) |
| 653 | 653 | { |
| 654 | 654 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 655 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 655 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 656 | 656 | |
| 657 | 657 | try { |
| 658 | 658 | |
| 659 | 659 | $sth = $this->db->prepare($query); |
| 660 | 660 | $sth->execute(array(':ident' => $ident)); |
| 661 | - } catch(PDOException $e) { |
|
| 661 | + } catch (PDOException $e) { |
|
| 662 | 662 | return "error"; |
| 663 | 663 | } |
| 664 | 664 | |
@@ -674,13 +674,13 @@ discard block |
||
| 674 | 674 | public function deleteLiveSpotterDataById($id) |
| 675 | 675 | { |
| 676 | 676 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 677 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 677 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 678 | 678 | |
| 679 | 679 | try { |
| 680 | 680 | |
| 681 | 681 | $sth = $this->db->prepare($query); |
| 682 | 682 | $sth->execute(array(':id' => $id)); |
| 683 | - } catch(PDOException $e) { |
|
| 683 | + } catch (PDOException $e) { |
|
| 684 | 684 | return "error"; |
| 685 | 685 | } |
| 686 | 686 | |
@@ -698,13 +698,13 @@ discard block |
||
| 698 | 698 | { |
| 699 | 699 | global $globalDBdriver, $globalTimezone; |
| 700 | 700 | if ($globalDBdriver == 'mysql') { |
| 701 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 701 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 702 | 702 | WHERE spotter_live.ident = :ident |
| 703 | 703 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 704 | 704 | AND spotter_live.date < UTC_TIMESTAMP()'; |
| 705 | 705 | $query_data = array(':ident' => $ident); |
| 706 | 706 | } else { |
| 707 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 707 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 708 | 708 | WHERE spotter_live.ident = :ident |
| 709 | 709 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 710 | 710 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -713,8 +713,8 @@ discard block |
||
| 713 | 713 | |
| 714 | 714 | $sth = $this->db->prepare($query); |
| 715 | 715 | $sth->execute($query_data); |
| 716 | - $ident_result=''; |
|
| 717 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 716 | + $ident_result = ''; |
|
| 717 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 718 | 718 | { |
| 719 | 719 | $ident_result = $row['ident']; |
| 720 | 720 | } |
@@ -731,13 +731,13 @@ discard block |
||
| 731 | 731 | { |
| 732 | 732 | global $globalDBdriver, $globalTimezone; |
| 733 | 733 | if ($globalDBdriver == 'mysql') { |
| 734 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 734 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 735 | 735 | WHERE spotter_live.ident = :ident |
| 736 | 736 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
| 737 | 737 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 738 | 738 | $query_data = array(':ident' => $ident); |
| 739 | 739 | } else { |
| 740 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 740 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 741 | 741 | WHERE spotter_live.ident = :ident |
| 742 | 742 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
| 743 | 743 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -746,8 +746,8 @@ discard block |
||
| 746 | 746 | |
| 747 | 747 | $sth = $this->db->prepare($query); |
| 748 | 748 | $sth->execute($query_data); |
| 749 | - $ident_result=''; |
|
| 750 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 749 | + $ident_result = ''; |
|
| 750 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 751 | 751 | { |
| 752 | 752 | $ident_result = $row['flightaware_id']; |
| 753 | 753 | } |
@@ -764,13 +764,13 @@ discard block |
||
| 764 | 764 | { |
| 765 | 765 | global $globalDBdriver, $globalTimezone; |
| 766 | 766 | if ($globalDBdriver == 'mysql') { |
| 767 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 767 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 768 | 768 | WHERE spotter_live.flightaware_id = :id |
| 769 | 769 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 770 | 770 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 771 | 771 | $query_data = array(':id' => $id); |
| 772 | 772 | } else { |
| 773 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 773 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 774 | 774 | WHERE spotter_live.flightaware_id = :id |
| 775 | 775 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 776 | 776 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -779,8 +779,8 @@ discard block |
||
| 779 | 779 | |
| 780 | 780 | $sth = $this->db->prepare($query); |
| 781 | 781 | $sth->execute($query_data); |
| 782 | - $ident_result=''; |
|
| 783 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 782 | + $ident_result = ''; |
|
| 783 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 784 | 784 | { |
| 785 | 785 | $ident_result = $row['flightaware_id']; |
| 786 | 786 | } |
@@ -797,13 +797,13 @@ discard block |
||
| 797 | 797 | { |
| 798 | 798 | global $globalDBdriver, $globalTimezone; |
| 799 | 799 | if ($globalDBdriver == 'mysql') { |
| 800 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 800 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 801 | 801 | WHERE spotter_live.ModeS = :modes |
| 802 | 802 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
| 803 | 803 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 804 | 804 | $query_data = array(':modes' => $modes); |
| 805 | 805 | } else { |
| 806 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 806 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 807 | 807 | WHERE spotter_live.ModeS = :modes |
| 808 | 808 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'"; |
| 809 | 809 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -812,8 +812,8 @@ discard block |
||
| 812 | 812 | |
| 813 | 813 | $sth = $this->db->prepare($query); |
| 814 | 814 | $sth->execute($query_data); |
| 815 | - $ident_result=''; |
|
| 816 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 815 | + $ident_result = ''; |
|
| 816 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 817 | 817 | { |
| 818 | 818 | //$ident_result = $row['spotter_live_id']; |
| 819 | 819 | $ident_result = $row['flightaware_id']; |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | * @return String success or false |
| 833 | 833 | * |
| 834 | 834 | */ |
| 835 | - public function addLiveSpotterData($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 = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
| 835 | + public function addLiveSpotterData($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 = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
| 836 | 836 | { |
| 837 | 837 | global $globalURL, $globalArchive, $globalDebug; |
| 838 | 838 | $Common = new Common(); |
@@ -925,26 +925,26 @@ discard block |
||
| 925 | 925 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
| 926 | 926 | |
| 927 | 927 | |
| 928 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 929 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 930 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 931 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 932 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 933 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 934 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 935 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
| 936 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 937 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 938 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 939 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
| 940 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
| 941 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
| 942 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 943 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 944 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 945 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
| 946 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
| 947 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
| 928 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 929 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 930 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 931 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 932 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 933 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 934 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 935 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
| 936 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 937 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 938 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 939 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
| 940 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
| 941 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
| 942 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 943 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 944 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 945 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
| 946 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
| 947 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
| 948 | 948 | |
| 949 | 949 | $airline_name = ''; |
| 950 | 950 | $airline_icao = ''; |
@@ -966,26 +966,26 @@ discard block |
||
| 966 | 966 | $arrival_airport_country = ''; |
| 967 | 967 | |
| 968 | 968 | |
| 969 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 970 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 971 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 972 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 969 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 970 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 971 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 972 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 973 | 973 | |
| 974 | - $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
|
| 974 | + $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
|
| 975 | 975 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
| 976 | 976 | |
| 977 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
| 977 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
| 978 | 978 | try { |
| 979 | 979 | |
| 980 | 980 | $sth = $this->db->prepare($query); |
| 981 | 981 | $sth->execute($query_values); |
| 982 | - } catch(PDOException $e) { |
|
| 982 | + } catch (PDOException $e) { |
|
| 983 | 983 | return "error : ".$e->getMessage(); |
| 984 | 984 | } |
| 985 | 985 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 986 | 986 | if ($globalDebug) echo '(Add to SBS archive : '; |
| 987 | 987 | $SpotterArchive = new SpotterArchive($this->db); |
| 988 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
| 988 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
| 989 | 989 | if ($globalDebug) echo $result.')'; |
| 990 | 990 | } |
| 991 | 991 | return "success"; |
@@ -994,7 +994,7 @@ discard block |
||
| 994 | 994 | |
| 995 | 995 | public function getOrderBy() |
| 996 | 996 | { |
| 997 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
| 997 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
| 998 | 998 | return $orderby; |
| 999 | 999 | } |
| 1000 | 1000 | |
@@ -26,7 +26,9 @@ discard block |
||
| 26 | 26 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 29 | + if (is_array($globalFilter)) { |
|
| 30 | + $filter = array_merge($filter,$globalFilter); |
|
| 31 | + } |
|
| 30 | 32 | $filter_query_join = ''; |
| 31 | 33 | $filter_query_where = ''; |
| 32 | 34 | foreach($filters as $flt) { |
@@ -79,8 +81,11 @@ discard block |
||
| 79 | 81 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 80 | 82 | } |
| 81 | 83 | } |
| 82 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 83 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 84 | + if ($filter_query_where == '' && $where) { |
|
| 85 | + $filter_query_where = ' WHERE'; |
|
| 86 | + } elseif ($filter_query_where != '' && $and) { |
|
| 87 | + $filter_query_where .= ' AND'; |
|
| 88 | + } |
|
| 84 | 89 | $filter_query = $filter_query_join.$filter_query_where; |
| 85 | 90 | return $filter_query; |
| 86 | 91 | } |
@@ -119,7 +124,9 @@ discard block |
||
| 119 | 124 | } |
| 120 | 125 | } |
| 121 | 126 | |
| 122 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 127 | + if (!isset($globalLiveInterval)) { |
|
| 128 | + $globalLiveInterval = '200'; |
|
| 129 | + } |
|
| 123 | 130 | if ($globalDBdriver == 'mysql') { |
| 124 | 131 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
| 125 | 132 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -144,7 +151,9 @@ discard block |
||
| 144 | 151 | |
| 145 | 152 | $filter_query = $this->getFilter($filter,true,true); |
| 146 | 153 | |
| 147 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 154 | + if (!isset($globalLiveInterval)) { |
|
| 155 | + $globalLiveInterval = '200'; |
|
| 156 | + } |
|
| 148 | 157 | if ($globalDBdriver == 'mysql') { |
| 149 | 158 | // $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query"; |
| 150 | 159 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao'; |
@@ -201,7 +210,9 @@ discard block |
||
| 201 | 210 | |
| 202 | 211 | $filter_query = $this->getFilter($filter,true,true); |
| 203 | 212 | |
| 204 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 213 | + if (!isset($globalLiveInterval)) { |
|
| 214 | + $globalLiveInterval = '200'; |
|
| 215 | + } |
|
| 205 | 216 | if ($globalDBdriver == 'mysql') { |
| 206 | 217 | /* |
| 207 | 218 | $query = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
@@ -245,7 +256,9 @@ discard block |
||
| 245 | 256 | global $globalDBdriver, $globalLiveInterval; |
| 246 | 257 | $filter_query = $this->getFilter($filter,true,true); |
| 247 | 258 | |
| 248 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 259 | + if (!isset($globalLiveInterval)) { |
|
| 260 | + $globalLiveInterval = '200'; |
|
| 261 | + } |
|
| 249 | 262 | if ($globalDBdriver == 'mysql') { |
| 250 | 263 | //$query = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query; |
| 251 | 264 | $query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
@@ -275,7 +288,9 @@ discard block |
||
| 275 | 288 | { |
| 276 | 289 | global $globalDBdriver, $globalLiveInterval; |
| 277 | 290 | $Spotter = new Spotter($this->db); |
| 278 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 291 | + if (!isset($globalLiveInterval)) { |
|
| 292 | + $globalLiveInterval = '200'; |
|
| 293 | + } |
|
| 279 | 294 | $filter_query = $this->getFilter($filter); |
| 280 | 295 | |
| 281 | 296 | if (is_array($coord)) { |
@@ -283,7 +298,9 @@ discard block |
||
| 283 | 298 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 284 | 299 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 285 | 300 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 286 | - } else return array(); |
|
| 301 | + } else { |
|
| 302 | + return array(); |
|
| 303 | + } |
|
| 287 | 304 | if ($globalDBdriver == 'mysql') { |
| 288 | 305 | //$query = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
| 289 | 306 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -474,11 +491,15 @@ discard block |
||
| 474 | 491 | //$query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
| 475 | 492 | if ($globalDBdriver == 'mysql') { |
| 476 | 493 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
| 477 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 494 | + if ($liveinterval) { |
|
| 495 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 496 | + } |
|
| 478 | 497 | $query .= ' ORDER BY date'; |
| 479 | 498 | } else { |
| 480 | 499 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
| 481 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 500 | + if ($liveinterval) { |
|
| 501 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 502 | + } |
|
| 482 | 503 | $query .= ' ORDER BY date'; |
| 483 | 504 | } |
| 484 | 505 | |
@@ -573,7 +594,9 @@ discard block |
||
| 573 | 594 | $i++; |
| 574 | 595 | $j++; |
| 575 | 596 | if ($j == 30) { |
| 576 | - if ($globalDebug) echo "."; |
|
| 597 | + if ($globalDebug) { |
|
| 598 | + echo "."; |
|
| 599 | + } |
|
| 577 | 600 | try { |
| 578 | 601 | |
| 579 | 602 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -880,7 +903,9 @@ discard block |
||
| 880 | 903 | { |
| 881 | 904 | return false; |
| 882 | 905 | } |
| 883 | - } else return ''; |
|
| 906 | + } else { |
|
| 907 | + return ''; |
|
| 908 | + } |
|
| 884 | 909 | |
| 885 | 910 | if ($longitude != '') |
| 886 | 911 | { |
@@ -888,7 +913,9 @@ discard block |
||
| 888 | 913 | { |
| 889 | 914 | return false; |
| 890 | 915 | } |
| 891 | - } else return ''; |
|
| 916 | + } else { |
|
| 917 | + return ''; |
|
| 918 | + } |
|
| 892 | 919 | |
| 893 | 920 | if ($waypoints != '') |
| 894 | 921 | { |
@@ -904,7 +931,9 @@ discard block |
||
| 904 | 931 | { |
| 905 | 932 | return false; |
| 906 | 933 | } |
| 907 | - } else $altitude = 0; |
|
| 934 | + } else { |
|
| 935 | + $altitude = 0; |
|
| 936 | + } |
|
| 908 | 937 | |
| 909 | 938 | if ($heading != '') |
| 910 | 939 | { |
@@ -912,7 +941,9 @@ discard block |
||
| 912 | 941 | { |
| 913 | 942 | return false; |
| 914 | 943 | } |
| 915 | - } else $heading = 0; |
|
| 944 | + } else { |
|
| 945 | + $heading = 0; |
|
| 946 | + } |
|
| 916 | 947 | |
| 917 | 948 | if ($groundspeed != '') |
| 918 | 949 | { |
@@ -920,9 +951,13 @@ discard block |
||
| 920 | 951 | { |
| 921 | 952 | return false; |
| 922 | 953 | } |
| 923 | - } else $groundspeed = 0; |
|
| 954 | + } else { |
|
| 955 | + $groundspeed = 0; |
|
| 956 | + } |
|
| 924 | 957 | date_default_timezone_set('UTC'); |
| 925 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
| 958 | + if ($date == '') { |
|
| 959 | + $date = date("Y-m-d H:i:s", time()); |
|
| 960 | + } |
|
| 926 | 961 | |
| 927 | 962 | |
| 928 | 963 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -966,10 +1001,18 @@ discard block |
||
| 966 | 1001 | $arrival_airport_country = ''; |
| 967 | 1002 | |
| 968 | 1003 | |
| 969 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 970 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 971 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 972 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1004 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) { |
|
| 1005 | + $squawk = NULL; |
|
| 1006 | + } |
|
| 1007 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) { |
|
| 1008 | + $verticalrate = NULL; |
|
| 1009 | + } |
|
| 1010 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
| 1011 | + $groundspeed = 0; |
|
| 1012 | + } |
|
| 1013 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
| 1014 | + $heading = 0; |
|
| 1015 | + } |
|
| 973 | 1016 | |
| 974 | 1017 | $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
| 975 | 1018 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
@@ -983,10 +1026,14 @@ discard block |
||
| 983 | 1026 | return "error : ".$e->getMessage(); |
| 984 | 1027 | } |
| 985 | 1028 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 986 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
| 1029 | + if ($globalDebug) { |
|
| 1030 | + echo '(Add to SBS archive : '; |
|
| 1031 | + } |
|
| 987 | 1032 | $SpotterArchive = new SpotterArchive($this->db); |
| 988 | 1033 | $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
| 989 | - if ($globalDebug) echo $result.')'; |
|
| 1034 | + if ($globalDebug) { |
|
| 1035 | + echo $result.')'; |
|
| 1036 | + } |
|
| 990 | 1037 | } |
| 991 | 1038 | return "success"; |
| 992 | 1039 | |