@@ -70,11 +70,11 @@ |
||
70 | 70 | */ |
71 | 71 | $timearray = array(); |
72 | 72 | $begin = time(); |
73 | -for ($i =0; $i <= 288; $i++) { |
|
73 | +for ($i = 0; $i <= 288; $i++) { |
|
74 | 74 | $timearray[] = ($begin + $i*300)*1000; |
75 | 75 | } |
76 | 76 | |
77 | -$output = '{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"Name":"santaclaus","time": ['.implode(',',$timearray).']},"geometry":{"type":"MultiPoint","coordinates":[[-114.4,82.7,0],[-173.300003,64.379997,0],[177.479995,64.75,0],[158.65,53.016667,0],[165.545318,11.626074,0],[171.1300517813333,7.07999665990053,0],[179.380004,-16.469999,0],[178.429992,-18.129999,0],[174.759994,-36.849998,0],[176.839996,-39.639999,0],[174.779998,-41.279998,0],[172.639999,-43.529998,0],[167.838199,-46.986747,0],[168.320999,-17.740391,0],[167.149993,-15.51,0],[159.910003,-9.43,0],[156.850006,-8.1,0],[158.160003,6.92,0],[150.017702,45.873311,0],[154.796487,49.429802,0],[142.7262,46.948978,0],[150.800003,59.569999,0],[135.119995,48.419998,0],[131.899993,43.130001,0],[142.212096,27.070652,0],[141.312779,24.78389,0],[144.79373,13.444305,0],[151.783334,8.45,0],[151.749999,7.416667,0],[152.160003,-4.199999,0],[146.990005,-6.719999,0],[143.211639,-9.085352,0],[146.779998,-19.26,0],[149.179992,-21.139999,0],[153.020004,-27.459999,0],[151.210006,-33.869998,0],[147.291199,-42.85088,0],[138.600006,-34.93,0],[133.869995,-23.7,0],[130.850006,-12.43,0],[143.62,-3.56,0],[134.5552,7.3608,0],[135.169998,34.68,0],[138.690002,35.169998,0],[139.770004,35.669998,0],[140.740005,40.830001,0],[128.600006,35.869998,0],[125.925925,38.950981,0],[129.771118,62.093056,0],[104.239997,52.330001,0],[114.5056,48.060478,0],[106.580001,29.569999,0],[121.470001,31.229999,0],[113.25,23.12,0],[114.177465,22.307184,0],[121.639999,18.36,0],[122.080001,6.92,0],[114.639999,4.809999,0],[119.412399,-5.152193,0],[122.230003,-17.959999,0],[115.839996,-31.959999,0],[105.680687,-10.428593,0],[104.75,-2.99,0],[113.029998,3.17,0],[100.720001,4.86,0],[104.18,10.609999,0],[103.864403,13.36866,0],[99.330001,9.14,0],[105.073303,18.30217,0],[91.132088,29.6507,0],[116.477651,40.332809,0],[93.059997,56.02,0],[86.18,69.410003,0],[88.202881,69.315422,0],[73.400001,55,0],[76.949996,52.299999,0],[78.379997,42.490001,0],[69.779998,37.919998,0],[86.933333,27.983333,0],[84.870002,27.02,0],[88.36,22.569999,0],[90.389999,23.7,0],[97.04,20.78,0],[92.762917,11.66857,0],[50.23720550537109,-46.10261535644531,0],[72.422489,-7.336367,0],[73.510915,4.174199,0],[81.050003,6.989999,0],[72.819999,18.959999,0],[78.042222,27.174167,0],[71.449996,30.2,0],[67.109993,36.703819,0],[54.36,39.509998,0],[63.726529,40.214486,0],[58.853439,48.251126,0],[56.23246,58.00024,0],[49.659999,58.599998,0],[50.150001,53.2,0],[44.11,41.979999,0],[49.893226,40.38344,0],[44.75,40.5,0],[50.95,34.650001,0],[56.27433,27.18717,0],[54.989491,25.005817,0],[59.549999,22.569999,0],[47.58318996007591,-9.722414273737707,0],[57.471008,-20.26026,0],[37.946460723877,-46.6428451538086,0],[53,-67.5,0],[46.99004,-25.03233,0],[46.310001,-15.72,0],[44.41203117370608,-12.22338294982911,0],[39.3822,-6.097406,0],[39.659999,-4.039999,0],[40.033333,7.916667,0],[42.549999,16.899999,0],[43.970001,26.37,0],[41.12,30.455,0],[38.278671,34.547951,0],[37.619998,55.75,0],[30.453329,59.951889,0],[23.12,63.84,0],[26.709999,58.380001,0],[25.42,57.549999,0],[23.319999,55.93,0],[26.1,52.119998,0],[32.259998,48.5,0],[28.829999,47.029998,0],[25.61,45.659999,0],[27.469999,42.509998,0],[23.729999,37.979999,0],[27.149999,38.43,0],[31.132659,29.977088,0],[32.659999,13.17,0],[33.599998,1.71,0],[25.92,-2.95,0],[28.45,-14.439999,0],[30.819999,-20.059999,0],[21.639999,-21.7,0],[25.59,-33.959999,0],[18.129999,-26.579999,0],[13.767777,-10.722417,0],[10.13,-0.15,0],[20.67,5.76,0],[9.71,4.059999,0],[7.44,10.52,0],[18.69,12.189999,0],[7.98,17,0],[14.42,27.069999,0],[3.678539,32.489059,0],[-7.619999,33.599998,0],[13.611066,38.129963,0],[12.482323,41.895466,0],[17.189752,44.763891,0],[16.45,43.509998,0],[14.51,46.060001,0],[21.629999,47.54,0],[16.37,48.220001,0],[10.736111,47.554444,0],[14.43,50.080001,0],[17.129999,48.159999,0],[22.569999,51.240001,0],[13.411895,52.523781,0],[10.039999,56.470001,0],[13.02,55.61,0],[17.329999,62.400001,0],[14.229999,78.059997,0],[10.399999,63.439998,0],[2.350966,48.856558,0],[7.42,43.75,0],[1.57,42.54,0],[-0.991293,37.605651,0],[-7.429999,39.29,0],[-11.4053,16.5889,0],[-3.009999,16.78,0],[-5.36008,5.83885,0],[-12.3,11.319999,0],[-16.239999,12.829999,0],[-16.2507,28.457661,0],[-0.126197,51.500197,0],[-2.968111,56.461428,0],[-7.308429,54.998539,0],[-8.92,52.7,0],[-19.000959,63.427502,0],[-28.364049911499,38.47212219238281,0],[-23.76,15.279999,0],[-36.511219,-54.274151,0],[-58.979999,-51.830001,0],[-64.190002,-31.399999,0],[-54.18,-32.36,0],[-43.2,-22.909999,0],[-37.333333,65.666667,0],[-69.345131,77.48262,0],[-55.65049,48.929001,0],[-63.530471,44.681263,0],[-66.647818,45.957319,0],[-59.630001,13.18,0],[-61.744888,12.06526,0],[-61.171322,10.30501,0],[-67.470001,7.9,0],[-58.159999,6.789999,0],[-60.02,-3.119999,0],[-56.45,-14.409999,0],[-65.260002,-19.059999,0],[-56.636503,-24.158676,0],[-56.509998,-33.409999,0],[-68.523514,-50.021889,0],[-72.505127,-51.732529,0],[-71.639999,-33.04,0],[-72.515821,-13.162849,0],[-76.970001,-6.03,0],[-78.620002,-1.24,0],[-76.739997,8.1,0],[-79.879913,9.368985,0],[-76.949996,18,0],[-72.699996,19.11,0],[-75.220001,20.149999,0],[-73.682953,20.95027,0],[-80.605,28.405556,0],[-84.388056,33.748889,0],[-79.931111,32.776389,0],[-83.920833,35.960556,0],[-84.500278,38.049167,0],[-77.460833,38.303056,0],[-82.515556,40.758333,0],[-83.045833,42.331389,0],[-74.006389,40.714167,0],[-71.802778,42.2625,0],[-72.973056,43.610556,0],[-68.0125,46.860556,0],[-72.581779,46.357398,0],[-78.53632621543271,52.72737572958358,0],[-66.921779,52.940118,0],[-75.652573,62.201069,0],[-64.865257,67.935417,0],[-94.969443,74.716943,0],[-82.793909,76.395731,0],[-97.49276733398439,69.18675994873048,0],[-90.5537452697754,63.36753463745121,0],[-89.270113,48.412197,0],[-79.604159,43.68731,0],[-89.401111,43.073056,0],[-94.633611,42.395278,0],[-89.588889,40.693611,0],[-90.197778,38.627222,0],[-90.704167,35.842222,0],[-91.061667,33.41,0],[-92.445,31.311111,0],[-98.493333,29.423889,0],[-103.349998,20.67,0],[-86.830001,21.17,0],[-89.529998,14.979999,0],[-87.449996,13.42,0],[-83.709999,9.369999,0],[-91.5149765,-0.3781085,0],[-109.425598,-27.1546,0],[-109.9142,22.88093,0],[-110.910003,27.92,0],[-110.925833,32.221667,0],[-104.526667,33.395,0],[-113.061111,37.6775,0],[-104.820833,38.833889,0],[-108.73,42.833056,0],[-113.895,45.175833,0],[-113.993056,46.872222,0],[-114.080796,51.039877,0],[-102.3889594419702,57.15883691318781,0],[-118.0333,66.0833,0],[-140.55,64.45,0],[-122.690386,58.80667,0],[-121.92985,50.686341,0],[-122.330833,47.606389,0],[-122.274167,47.564167,0],[-122.968503,45.309901,0],[-122.874444,42.326667,0],[-122.390556,40.586667,0],[-117.068611,39.493333,0],[-122.418333,37.775,0],[-117.108333,34.207778,0],[-116.544444,33.830278,0],[-117.156389,32.715278,0],[-149.891667,61.218333,0],[-155.566389,62.948889,0],[-165.406389,64.501111,0],[-155.09,19.729722,0],[-156.337974,20.804858,0],[-157.043209,21.141189,0],[-158.009167,21.386667,0],[-159.371111,21.981111,0]]}}]}'; |
|
77 | +$output = '{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"Name":"santaclaus","time": ['.implode(',', $timearray).']},"geometry":{"type":"MultiPoint","coordinates":[[-114.4,82.7,0],[-173.300003,64.379997,0],[177.479995,64.75,0],[158.65,53.016667,0],[165.545318,11.626074,0],[171.1300517813333,7.07999665990053,0],[179.380004,-16.469999,0],[178.429992,-18.129999,0],[174.759994,-36.849998,0],[176.839996,-39.639999,0],[174.779998,-41.279998,0],[172.639999,-43.529998,0],[167.838199,-46.986747,0],[168.320999,-17.740391,0],[167.149993,-15.51,0],[159.910003,-9.43,0],[156.850006,-8.1,0],[158.160003,6.92,0],[150.017702,45.873311,0],[154.796487,49.429802,0],[142.7262,46.948978,0],[150.800003,59.569999,0],[135.119995,48.419998,0],[131.899993,43.130001,0],[142.212096,27.070652,0],[141.312779,24.78389,0],[144.79373,13.444305,0],[151.783334,8.45,0],[151.749999,7.416667,0],[152.160003,-4.199999,0],[146.990005,-6.719999,0],[143.211639,-9.085352,0],[146.779998,-19.26,0],[149.179992,-21.139999,0],[153.020004,-27.459999,0],[151.210006,-33.869998,0],[147.291199,-42.85088,0],[138.600006,-34.93,0],[133.869995,-23.7,0],[130.850006,-12.43,0],[143.62,-3.56,0],[134.5552,7.3608,0],[135.169998,34.68,0],[138.690002,35.169998,0],[139.770004,35.669998,0],[140.740005,40.830001,0],[128.600006,35.869998,0],[125.925925,38.950981,0],[129.771118,62.093056,0],[104.239997,52.330001,0],[114.5056,48.060478,0],[106.580001,29.569999,0],[121.470001,31.229999,0],[113.25,23.12,0],[114.177465,22.307184,0],[121.639999,18.36,0],[122.080001,6.92,0],[114.639999,4.809999,0],[119.412399,-5.152193,0],[122.230003,-17.959999,0],[115.839996,-31.959999,0],[105.680687,-10.428593,0],[104.75,-2.99,0],[113.029998,3.17,0],[100.720001,4.86,0],[104.18,10.609999,0],[103.864403,13.36866,0],[99.330001,9.14,0],[105.073303,18.30217,0],[91.132088,29.6507,0],[116.477651,40.332809,0],[93.059997,56.02,0],[86.18,69.410003,0],[88.202881,69.315422,0],[73.400001,55,0],[76.949996,52.299999,0],[78.379997,42.490001,0],[69.779998,37.919998,0],[86.933333,27.983333,0],[84.870002,27.02,0],[88.36,22.569999,0],[90.389999,23.7,0],[97.04,20.78,0],[92.762917,11.66857,0],[50.23720550537109,-46.10261535644531,0],[72.422489,-7.336367,0],[73.510915,4.174199,0],[81.050003,6.989999,0],[72.819999,18.959999,0],[78.042222,27.174167,0],[71.449996,30.2,0],[67.109993,36.703819,0],[54.36,39.509998,0],[63.726529,40.214486,0],[58.853439,48.251126,0],[56.23246,58.00024,0],[49.659999,58.599998,0],[50.150001,53.2,0],[44.11,41.979999,0],[49.893226,40.38344,0],[44.75,40.5,0],[50.95,34.650001,0],[56.27433,27.18717,0],[54.989491,25.005817,0],[59.549999,22.569999,0],[47.58318996007591,-9.722414273737707,0],[57.471008,-20.26026,0],[37.946460723877,-46.6428451538086,0],[53,-67.5,0],[46.99004,-25.03233,0],[46.310001,-15.72,0],[44.41203117370608,-12.22338294982911,0],[39.3822,-6.097406,0],[39.659999,-4.039999,0],[40.033333,7.916667,0],[42.549999,16.899999,0],[43.970001,26.37,0],[41.12,30.455,0],[38.278671,34.547951,0],[37.619998,55.75,0],[30.453329,59.951889,0],[23.12,63.84,0],[26.709999,58.380001,0],[25.42,57.549999,0],[23.319999,55.93,0],[26.1,52.119998,0],[32.259998,48.5,0],[28.829999,47.029998,0],[25.61,45.659999,0],[27.469999,42.509998,0],[23.729999,37.979999,0],[27.149999,38.43,0],[31.132659,29.977088,0],[32.659999,13.17,0],[33.599998,1.71,0],[25.92,-2.95,0],[28.45,-14.439999,0],[30.819999,-20.059999,0],[21.639999,-21.7,0],[25.59,-33.959999,0],[18.129999,-26.579999,0],[13.767777,-10.722417,0],[10.13,-0.15,0],[20.67,5.76,0],[9.71,4.059999,0],[7.44,10.52,0],[18.69,12.189999,0],[7.98,17,0],[14.42,27.069999,0],[3.678539,32.489059,0],[-7.619999,33.599998,0],[13.611066,38.129963,0],[12.482323,41.895466,0],[17.189752,44.763891,0],[16.45,43.509998,0],[14.51,46.060001,0],[21.629999,47.54,0],[16.37,48.220001,0],[10.736111,47.554444,0],[14.43,50.080001,0],[17.129999,48.159999,0],[22.569999,51.240001,0],[13.411895,52.523781,0],[10.039999,56.470001,0],[13.02,55.61,0],[17.329999,62.400001,0],[14.229999,78.059997,0],[10.399999,63.439998,0],[2.350966,48.856558,0],[7.42,43.75,0],[1.57,42.54,0],[-0.991293,37.605651,0],[-7.429999,39.29,0],[-11.4053,16.5889,0],[-3.009999,16.78,0],[-5.36008,5.83885,0],[-12.3,11.319999,0],[-16.239999,12.829999,0],[-16.2507,28.457661,0],[-0.126197,51.500197,0],[-2.968111,56.461428,0],[-7.308429,54.998539,0],[-8.92,52.7,0],[-19.000959,63.427502,0],[-28.364049911499,38.47212219238281,0],[-23.76,15.279999,0],[-36.511219,-54.274151,0],[-58.979999,-51.830001,0],[-64.190002,-31.399999,0],[-54.18,-32.36,0],[-43.2,-22.909999,0],[-37.333333,65.666667,0],[-69.345131,77.48262,0],[-55.65049,48.929001,0],[-63.530471,44.681263,0],[-66.647818,45.957319,0],[-59.630001,13.18,0],[-61.744888,12.06526,0],[-61.171322,10.30501,0],[-67.470001,7.9,0],[-58.159999,6.789999,0],[-60.02,-3.119999,0],[-56.45,-14.409999,0],[-65.260002,-19.059999,0],[-56.636503,-24.158676,0],[-56.509998,-33.409999,0],[-68.523514,-50.021889,0],[-72.505127,-51.732529,0],[-71.639999,-33.04,0],[-72.515821,-13.162849,0],[-76.970001,-6.03,0],[-78.620002,-1.24,0],[-76.739997,8.1,0],[-79.879913,9.368985,0],[-76.949996,18,0],[-72.699996,19.11,0],[-75.220001,20.149999,0],[-73.682953,20.95027,0],[-80.605,28.405556,0],[-84.388056,33.748889,0],[-79.931111,32.776389,0],[-83.920833,35.960556,0],[-84.500278,38.049167,0],[-77.460833,38.303056,0],[-82.515556,40.758333,0],[-83.045833,42.331389,0],[-74.006389,40.714167,0],[-71.802778,42.2625,0],[-72.973056,43.610556,0],[-68.0125,46.860556,0],[-72.581779,46.357398,0],[-78.53632621543271,52.72737572958358,0],[-66.921779,52.940118,0],[-75.652573,62.201069,0],[-64.865257,67.935417,0],[-94.969443,74.716943,0],[-82.793909,76.395731,0],[-97.49276733398439,69.18675994873048,0],[-90.5537452697754,63.36753463745121,0],[-89.270113,48.412197,0],[-79.604159,43.68731,0],[-89.401111,43.073056,0],[-94.633611,42.395278,0],[-89.588889,40.693611,0],[-90.197778,38.627222,0],[-90.704167,35.842222,0],[-91.061667,33.41,0],[-92.445,31.311111,0],[-98.493333,29.423889,0],[-103.349998,20.67,0],[-86.830001,21.17,0],[-89.529998,14.979999,0],[-87.449996,13.42,0],[-83.709999,9.369999,0],[-91.5149765,-0.3781085,0],[-109.425598,-27.1546,0],[-109.9142,22.88093,0],[-110.910003,27.92,0],[-110.925833,32.221667,0],[-104.526667,33.395,0],[-113.061111,37.6775,0],[-104.820833,38.833889,0],[-108.73,42.833056,0],[-113.895,45.175833,0],[-113.993056,46.872222,0],[-114.080796,51.039877,0],[-102.3889594419702,57.15883691318781,0],[-118.0333,66.0833,0],[-140.55,64.45,0],[-122.690386,58.80667,0],[-121.92985,50.686341,0],[-122.330833,47.606389,0],[-122.274167,47.564167,0],[-122.968503,45.309901,0],[-122.874444,42.326667,0],[-122.390556,40.586667,0],[-117.068611,39.493333,0],[-122.418333,37.775,0],[-117.108333,34.207778,0],[-116.544444,33.830278,0],[-117.156389,32.715278,0],[-149.891667,61.218333,0],[-155.566389,62.948889,0],[-165.406389,64.501111,0],[-155.09,19.729722,0],[-156.337974,20.804858,0],[-157.043209,21.141189,0],[-158.009167,21.386667,0],[-159.371111,21.981111,0]]}}]}'; |
|
78 | 78 | print $output; |
79 | 79 | |
80 | 80 | ?> |
@@ -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['Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['Airlines']))) { |
|
444 | + if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...'; |
|
445 | + if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['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>'; |
@@ -458,8 +458,8 @@ discard block |
||
458 | 458 | <select class="selectpicker" multiple onchange="sources(this);"> |
459 | 459 | <?php |
460 | 460 | $Spotter = new Spotter(); |
461 | - foreach($Spotter->getAllSourceName('aprs') as $source) { |
|
462 | - if (isset($_COOKIE['Sources']) && in_array($source['source_name'],explode(',',$_COOKIE['Sources']))) { |
|
461 | + foreach ($Spotter->getAllSourceName('aprs') as $source) { |
|
462 | + if (isset($_COOKIE['Sources']) && in_array($source['source_name'], explode(',', $_COOKIE['Sources']))) { |
|
463 | 463 | echo '<option value="'.$source['source_name'].'" selected>'.$source['source_name'].'</option>'; |
464 | 464 | } else { |
465 | 465 | echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>'; |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
532 | 532 | else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
533 | 533 | |
534 | - if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
|
534 | + if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) { |
|
535 | 535 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
536 | 536 | } else { |
537 | 537 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | / @param String $source source of data |
25 | 25 | */ |
26 | 26 | |
27 | - public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') { |
|
27 | + public function addSchedule($ident, $departure_airport_icao, $departure_airport_time, $arrival_airport_icao, $arrival_airport_time, $source = 'website') { |
|
28 | 28 | date_default_timezone_set('UTC'); |
29 | - $date = date("Y-m-d H:i:s",time()); |
|
29 | + $date = date("Y-m-d H:i:s", time()); |
|
30 | 30 | //if ($departure_airport_time == '' && $arrival_airport_time == '') exit; |
31 | 31 | //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident"; |
32 | 32 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident"; |
@@ -34,69 +34,69 @@ discard block |
||
34 | 34 | try { |
35 | 35 | $sth = $this->db->prepare($query); |
36 | 36 | $sth->execute($query_values); |
37 | - } catch(PDOException $e) { |
|
37 | + } catch (PDOException $e) { |
|
38 | 38 | return "error : ".$e->getMessage(); |
39 | 39 | } |
40 | 40 | if ($sth->fetchColumn() > 0) { |
41 | 41 | if ($departure_airport_time == '' && $arrival_airport_time == '') { |
42 | 42 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao"; |
43 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao); |
|
43 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao); |
|
44 | 44 | } elseif ($arrival_airport_time == '') { |
45 | 45 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao"; |
46 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao); |
|
46 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao); |
|
47 | 47 | } elseif ($departure_airport_time == '') { |
48 | 48 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time"; |
49 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time); |
|
49 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time); |
|
50 | 50 | } else { |
51 | 51 | //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time"; |
52 | 52 | $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time"; |
53 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time); |
|
53 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time); |
|
54 | 54 | } |
55 | 55 | try { |
56 | 56 | $sth = $this->db->prepare($query); |
57 | 57 | $sth->execute($query_values); |
58 | - } catch(PDOException $e) { |
|
58 | + } catch (PDOException $e) { |
|
59 | 59 | return "error : ".$e->getMessage(); |
60 | 60 | } |
61 | 61 | if ($sth->fetchColumn() == 0) { |
62 | 62 | //$query = 'UPDATE schedule SET departure_airport_icao = :departure_airport_icao, departure_airport_time = :departure_airport_time, arrival_airport_icao = :arrival_airport_icao, arrival_airport_time = :arrival_airport_time, date_modified = :date, source = :source WHERE ident = :ident'; |
63 | 63 | if ($departure_airport_time == '' && $arrival_airport_time == '') { |
64 | 64 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
65 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
65 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
66 | 66 | } elseif ($arrival_airport_time == '') { |
67 | 67 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
68 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
68 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
69 | 69 | } elseif ($departure_airport_time == '') { |
70 | 70 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
71 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
71 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
72 | 72 | } else { |
73 | 73 | $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
74 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
74 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
75 | 75 | } |
76 | 76 | try { |
77 | 77 | $sth = $this->db->prepare($query); |
78 | 78 | $sth->execute($query_values); |
79 | - } catch(PDOException $e) { |
|
79 | + } catch (PDOException $e) { |
|
80 | 80 | return "error : ".$e->getMessage(); |
81 | 81 | } |
82 | 82 | } else { |
83 | 83 | //$query = 'UPDATE schedule SET date_lastseen = :date WHERE ident = :ident'; |
84 | 84 | $query = 'UPDATE routes SET date_lastseen = :date WHERE CallSign = :ident'; |
85 | - $query_values = array(':ident' => $ident,':date' => $date); |
|
85 | + $query_values = array(':ident' => $ident, ':date' => $date); |
|
86 | 86 | try { |
87 | 87 | $sth = $this->db->prepare($query); |
88 | 88 | $sth->execute($query_values); |
89 | - } catch(PDOException $e) { |
|
89 | + } catch (PDOException $e) { |
|
90 | 90 | return "error : ".$e->getMessage(); |
91 | 91 | } |
92 | 92 | } |
93 | 93 | } else { |
94 | 94 | $query = 'INSERT INTO routes (CallSign,FromAirport_ICAO, FromAirport_Time, ToAirport_ICAO, ToAirport_Time,date_added,source) VALUES (:ident,:departure_airport_icao,:departure_airport_time,:arrival_airport_icao,:arrival_airport_time,:date,:source)'; |
95 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
95 | + $query_values = array(':ident' => $ident, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
96 | 96 | try { |
97 | 97 | $sth = $this->db->prepare($query); |
98 | 98 | $sth->execute($query_values); |
99 | - } catch(PDOException $e) { |
|
99 | + } catch (PDOException $e) { |
|
100 | 100 | return "error : ".$e->getMessage(); |
101 | 101 | } |
102 | 102 | } |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | |
106 | 106 | public function getSchedule($ident) { |
107 | 107 | $Translation = new Translation($this->db); |
108 | - $operator = $Translation->checkTranslation($ident,false); |
|
108 | + $operator = $Translation->checkTranslation($ident, false); |
|
109 | 109 | if ($ident != $operator) { |
110 | 110 | $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE CallSign = :operator OR CallSign = :ident LIMIT 1"; |
111 | - $query_values = array(':ident' => $ident,'operator' => $operator); |
|
111 | + $query_values = array(':ident' => $ident, 'operator' => $operator); |
|
112 | 112 | } else { |
113 | 113 | $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE CallSign = :ident LIMIT 1"; |
114 | 114 | $query_values = array(':ident' => $ident); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | try { |
117 | 117 | $sth = $this->db->prepare($query); |
118 | 118 | $sth->execute($query_values); |
119 | - } catch(PDOException $e) { |
|
119 | + } catch (PDOException $e) { |
|
120 | 120 | return "error : ".$e->getMessage(); |
121 | 121 | } |
122 | 122 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | try { |
141 | 141 | $sth = $this->db->prepare($query); |
142 | 142 | $sth->execute($query_values); |
143 | - } catch(PDOException $e) { |
|
143 | + } catch (PDOException $e) { |
|
144 | 144 | return "error : ".$e->getMessage(); |
145 | 145 | } |
146 | 146 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -155,16 +155,16 @@ discard block |
||
155 | 155 | * @param String $carrier IATA code |
156 | 156 | * @return Flight departure and arrival airports and time |
157 | 157 | */ |
158 | - private function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') { |
|
158 | + private function getAirFrance($callsign, $date = 'NOW', $carrier = 'AF') { |
|
159 | 159 | $Common = new Common(); |
160 | 160 | $check_date = new Datetime($date); |
161 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
162 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
161 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
162 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
163 | 163 | $url = "http://www.airfrance.fr/cgi-bin/AF/FR/fr/local/resainfovol/infovols/detailsVolJson.do?codeCompagnie[0]=".$carrier."&numeroVol[0]=".$numvol."&dayFlightDate=".$check_date->format('d')."&yearMonthFlightDate=".$check_date->format('Ym'); |
164 | 164 | $json = $Common->getData($url); |
165 | 165 | |
166 | 166 | $parsed_json = json_decode($json); |
167 | - if (property_exists($parsed_json,'errors') === false) { |
|
167 | + if (property_exists($parsed_json, 'errors') === false) { |
|
168 | 168 | //$originLong = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originLong'}; |
169 | 169 | $originShort = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'originShort'}; |
170 | 170 | //$departureDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'departureDateMedium'}; |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | //$arrivalDateMedium = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalDateMedium'}; |
175 | 175 | $arrivalTime = $parsed_json->{'flightsList'}[0]->{'segmentsList'}[0]->{'arrivalTime'}; |
176 | 176 | |
177 | - preg_match('/\((.*?)\)/',$originShort,$originiata); |
|
177 | + preg_match('/\((.*?)\)/', $originShort, $originiata); |
|
178 | 178 | $DepartureAirportIata = $originiata[1]; |
179 | - preg_match('/\((.*?)\)/',$destinationShort,$destinationiata); |
|
179 | + preg_match('/\((.*?)\)/', $destinationShort, $destinationiata); |
|
180 | 180 | $ArrivalAirportIata = $destinationiata[1]; |
181 | 181 | |
182 | 182 | /* |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $arrivalTime = gmdate('H:i',strtotime($arrivalTime)); |
186 | 186 | */ |
187 | 187 | |
188 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airfrance'); |
|
188 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_airfrance'); |
|
189 | 189 | } else return array(); |
190 | 190 | } |
191 | 191 | |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | $Common = new Common(); |
201 | 201 | date_default_timezone_set($globalTimezone); |
202 | 202 | $check_date = new Datetime($date); |
203 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
204 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
203 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
204 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
205 | 205 | $url = "http://www.easyjet.com/ft/api/flights?date=".$check_date->format('Y-m-d')."&fn=".$callsign; |
206 | 206 | $json = $Common->getData($url); |
207 | 207 | $parsed_json = json_decode($json); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $departureTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fstd'}; |
214 | 214 | $arrivalTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fsta'}; |
215 | 215 | |
216 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_easyjet'); |
|
216 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_easyjet'); |
|
217 | 217 | } else return array(); |
218 | 218 | } |
219 | 219 | |
@@ -224,12 +224,12 @@ discard block |
||
224 | 224 | */ |
225 | 225 | private function getRyanair($callsign) { |
226 | 226 | $Common = new Common(); |
227 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
228 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
227 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
228 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
229 | 229 | $url = "http://www.ryanair.com/fr/api/2/flight-info/0/50/"; |
230 | 230 | $post = '{"flight":"'.$numvol.'","minDepartureTime":"00:00","maxDepartureTime":"23:59"}'; |
231 | - $headers = array('Content-Type: application/json','Content-Length: ' . strlen($post)); |
|
232 | - $json = $Common->getData($url,'post',$post,$headers); |
|
231 | + $headers = array('Content-Type: application/json', 'Content-Length: '.strlen($post)); |
|
232 | + $json = $Common->getData($url, 'post', $post, $headers); |
|
233 | 233 | $parsed_json = json_decode($json); |
234 | 234 | if (isset($parsed_json->{'flightInfo'})) { |
235 | 235 | $flights = $parsed_json->{'flightInfo'}; |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $ArrivalAirportIata = $parsed_json->{'flightInfo'}[0]->{'arrivalAirport'}->{'iata'}; //name |
239 | 239 | $departureTime = $parsed_json->{'flightInfo'}[0]->{'departureTime'}; |
240 | 240 | $arrivalTime = $parsed_json->{'flightInfo'}[0]->{'arrivalTime'}; |
241 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair'); |
|
241 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair'); |
|
242 | 242 | } else return array(); |
243 | 243 | } else return array(); |
244 | 244 | } |
@@ -250,8 +250,8 @@ discard block |
||
250 | 250 | */ |
251 | 251 | private function getSwiss($callsign) { |
252 | 252 | $Common = new Common(); |
253 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
254 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
253 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
254 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
255 | 255 | $url = "http://www.world-of-swiss.com/fr/routenetwork.json"; |
256 | 256 | $json = $Common->getData($url); |
257 | 257 | $parsed_json = json_decode($json); |
@@ -265,12 +265,12 @@ discard block |
||
265 | 265 | if ($flight->{'no'} == "Vol LX ".$numvol) { |
266 | 266 | $DepartureAirportIata = $flight->{'from'}->{'code'}; //city |
267 | 267 | $ArrivalAirportIata = $flight->{'to'}->{'code'}; //city |
268 | - $departureTime = substr($flight->{'from'}->{'hour'},0,5); |
|
269 | - $arrivalTime = substr($flight->{'to'}->{'hour'},0,5); |
|
268 | + $departureTime = substr($flight->{'from'}->{'hour'},0, 5); |
|
269 | + $arrivalTime = substr($flight->{'to'}->{'hour'},0, 5); |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | if (isset($DepartureAirportIata) && isset($ArrivalAirportIata)) { |
273 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_swiss'); |
|
273 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_swiss'); |
|
274 | 274 | } else return array(); |
275 | 275 | } else return array(); |
276 | 276 | } |
@@ -285,21 +285,21 @@ discard block |
||
285 | 285 | global $globalBritishAirwaysKey; |
286 | 286 | $Common = new Common(); |
287 | 287 | $check_date = new Datetime($date); |
288 | - $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
|
289 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
288 | + $numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign)); |
|
289 | + if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array(); |
|
290 | 290 | if ($globalBritishAirwaysKey == '') return array(); |
291 | 291 | $url = "https://api.ba.com/rest-v1/v1/flights;flightNumber=".$numvol.";scheduledDepartureDate=".$check_date->format('Y-m-d').".json"; |
292 | 292 | $headers = array('Client-Key: '.$globalBritishAirwaysKey); |
293 | - $json = $Common->getData($url,'get','',$headers); |
|
293 | + $json = $Common->getData($url, 'get', '', $headers); |
|
294 | 294 | if ($json == '') return array(); |
295 | 295 | $parsed_json = json_decode($json); |
296 | 296 | $flights = $parsed_json->{'FlightsResponse'}; |
297 | 297 | if (count($flights) > 0) { |
298 | 298 | $DepartureAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'DepartureAirport'}; |
299 | 299 | $ArrivalAirportIata = $parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ArrivalAirport'}; |
300 | - $departureTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'})); |
|
301 | - $arrivalTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'})); |
|
302 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_britishairways'); |
|
300 | + $departureTime = date('H:i', strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'})); |
|
301 | + $arrivalTime = date('H:i', strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'})); |
|
302 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_britishairways'); |
|
303 | 303 | } else return array(); |
304 | 304 | } |
305 | 305 | |
@@ -313,27 +313,27 @@ discard block |
||
313 | 313 | global $globalLufthansaKey; |
314 | 314 | $Common = new Common(); |
315 | 315 | $check_date = new Datetime($date); |
316 | - $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
|
317 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
316 | + $numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign)); |
|
317 | + if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array(); |
|
318 | 318 | if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') return array(); |
319 | 319 | $url = "https://api.lufthansa.com/v1/oauth/token"; |
320 | - $post = array('client_id' => $globalLufthansaKey['key'],'client_secret' => $globalLufthansaKey['secret'],'grant_type' => 'client_credentials'); |
|
321 | - $data = $Common->getData($url,'post',$post); |
|
320 | + $post = array('client_id' => $globalLufthansaKey['key'], 'client_secret' => $globalLufthansaKey['secret'], 'grant_type' => 'client_credentials'); |
|
321 | + $data = $Common->getData($url, 'post', $post); |
|
322 | 322 | $parsed_data = json_decode($data); |
323 | 323 | if (!isset($parsed_data->{'access_token'})) return array(); |
324 | 324 | $token = $parsed_data->{'access_token'}; |
325 | 325 | |
326 | 326 | $url = "https://api.lufthansa.com/v1/operations/flightstatus/LH".$numvol."/".$check_date->format('Y-m-d'); |
327 | - $headers = array('Authorization: Bearer '.$token,'Accept: application/json'); |
|
328 | - $json = $Common->getData($url,'get','',$headers); |
|
327 | + $headers = array('Authorization: Bearer '.$token, 'Accept: application/json'); |
|
328 | + $json = $Common->getData($url, 'get', '', $headers); |
|
329 | 329 | if ($json == '') return array(); |
330 | 330 | $parsed_json = json_decode($json); |
331 | 331 | if (isset($parsed_json->{'FlightStatusResource'}) && count($parsed_json->{'FlightStatusResource'}) > 0) { |
332 | 332 | $DepartureAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'AirportCode'}; |
333 | - $departureTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
333 | + $departureTime = date('H:i', strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
334 | 334 | $ArrivalAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'AirportCode'}; |
335 | - $arrivalTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
336 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_lufthansa'); |
|
335 | + $arrivalTime = date('H:i', strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'})); |
|
336 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_lufthansa'); |
|
337 | 337 | } else return array(); |
338 | 338 | } |
339 | 339 | |
@@ -347,23 +347,23 @@ discard block |
||
347 | 347 | global $globalTransaviaKey; |
348 | 348 | $Common = new Common(); |
349 | 349 | $check_date = new Datetime($date); |
350 | - $numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign)); |
|
351 | - if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array(); |
|
350 | + $numvol = sprintf('%04d', preg_replace('/^[A-Z]*/', '', $callsign)); |
|
351 | + if (!filter_var(preg_replace('/^[A-Z]*/', '', $callsign), FILTER_VALIDATE_INT)) return array(); |
|
352 | 352 | if ($globalTransaviaKey == '') return array(); |
353 | 353 | $url = "https://tst.api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol; |
354 | 354 | //$url = "https://api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol; |
355 | 355 | $headers = array('apikey: '.$globalTransaviaKey); |
356 | - $json = $Common->getData($url,'get','',$headers); |
|
356 | + $json = $Common->getData($url, 'get', '', $headers); |
|
357 | 357 | //echo 'result : '.$json; |
358 | 358 | if ($json == '') return array(); |
359 | 359 | $parsed_json = json_decode($json); |
360 | 360 | |
361 | 361 | if (isset($parsed_json->{'data'}[0])) { |
362 | 362 | $DepartureAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'departureAirport'}->{'locationCode'}; |
363 | - $departureTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'})); |
|
363 | + $departureTime = date('H:i', strtotime($parsed_json->{'data'}[0]->{'flight'}->{'departureDateTime'})); |
|
364 | 364 | $ArrivalAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'arrivalAirport'}->{'locationCode'}; |
365 | - $arrivalTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'})); |
|
366 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_transavia'); |
|
365 | + $arrivalTime = date('H:i', strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'})); |
|
366 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_transavia'); |
|
367 | 367 | } else return array(); |
368 | 368 | } |
369 | 369 | |
@@ -374,14 +374,14 @@ discard block |
||
374 | 374 | */ |
375 | 375 | public function getTunisair($callsign) { |
376 | 376 | $Common = new Common(); |
377 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
378 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
377 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
378 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
379 | 379 | $url = "http://www.tunisair.com/site/publish/module/Volj/fr/Flight_List.asp"; |
380 | 380 | $data = $Common->getData($url); |
381 | 381 | $table = $Common->table2array($data); |
382 | 382 | foreach ($table as $flight) { |
383 | - if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d',$numvol)) { |
|
384 | - return array('DepartureAirportIATA' => $flight[2],'DepartureTime' => str_replace('.',':',$flight[5]),'ArrivalAirportIATA' => $flight[3],'ArrivalTime' => str_replace('.',':',$flight[6]),'Source' => 'website_tunisair'); |
|
383 | + if (isset($flight[1]) && $flight[1] == "TU ".sprintf('%04d', $numvol)) { |
|
384 | + return array('DepartureAirportIATA' => $flight[2], 'DepartureTime' => str_replace('.', ':', $flight[5]), 'ArrivalAirportIATA' => $flight[3], 'ArrivalTime' => str_replace('.', ':', $flight[6]), 'Source' => 'website_tunisair'); |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | return array(); |
@@ -392,21 +392,21 @@ discard block |
||
392 | 392 | * @param String $callsign The callsign |
393 | 393 | * @return Flight departure and arrival airports and time |
394 | 394 | */ |
395 | - public function getVueling($callsign,$date = 'NOW') { |
|
395 | + public function getVueling($callsign, $date = 'NOW') { |
|
396 | 396 | $Common = new Common(); |
397 | 397 | $check_date = new Datetime($date); |
398 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
399 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
400 | - $final_date = str_replace('/','%2F',$check_date->format('d/m/Y')); |
|
398 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
399 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
400 | + $final_date = str_replace('/', '%2F', $check_date->format('d/m/Y')); |
|
401 | 401 | $url = "http://www.vueling.com/Base/BaseProxy/RenderMacro/?macroalias=FlightStatusResult&searchBy=bycode&date=".$final_date."&flightNumber=".$numvol."&idioma=en-GB"; |
402 | 402 | $data = $Common->getData($url); |
403 | - $data=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$data)); |
|
403 | + $data = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $data)); |
|
404 | 404 | if ($data != '') { |
405 | - preg_match('/flightOri=[A-Z]{3}/',$data,$result); |
|
406 | - $DepartureAirportIata = str_replace('flightOri=','',$result[0]); |
|
407 | - preg_match('/flightDest=[A-Z]{3}/',$data,$result); |
|
408 | - $ArrivalAirportIata = str_replace('flightDest=','',$result[0]); |
|
409 | - if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling'); |
|
405 | + preg_match('/flightOri=[A-Z]{3}/', $data, $result); |
|
406 | + $DepartureAirportIata = str_replace('flightOri=', '', $result[0]); |
|
407 | + preg_match('/flightDest=[A-Z]{3}/', $data, $result); |
|
408 | + $ArrivalAirportIata = str_replace('flightDest=', '', $result[0]); |
|
409 | + if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'Source' => 'website_vueling'); |
|
410 | 410 | else return array(); |
411 | 411 | } |
412 | 412 | return array(); |
@@ -420,27 +420,27 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function getIberia($callsign, $date = 'NOW') { |
422 | 422 | $Common = new Common(); |
423 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
423 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
424 | 424 | $check_date = new Datetime($date); |
425 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
425 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
426 | 426 | $url = "https://www.iberia.com/web/flightDetail.do"; |
427 | - $post = array('numvuelo' => $numvol,'fecha' => $check_date->format('Ymd'),'airlineID' => 'IB'); |
|
428 | - $data = $Common->getData($url,'post',$post); |
|
427 | + $post = array('numvuelo' => $numvol, 'fecha' => $check_date->format('Ymd'), 'airlineID' => 'IB'); |
|
428 | + $data = $Common->getData($url, 'post', $post); |
|
429 | 429 | if ($data != '') { |
430 | 430 | $table = $Common->table2array($data); |
431 | 431 | //print_r($table); |
432 | 432 | if (count($table) > 0) { |
433 | 433 | $flight = $table; |
434 | - preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch); |
|
435 | - preg_match('/([A-Z]{3})/',$flight[5][0],$ArrivalAirportIataMatch); |
|
434 | + preg_match('/([A-Z]{3})/', $flight[3][0], $DepartureAirportIataMatch); |
|
435 | + preg_match('/([A-Z]{3})/', $flight[5][0], $ArrivalAirportIataMatch); |
|
436 | 436 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
437 | 437 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
438 | - $departureTime = substr(trim(str_replace(' lunes','',str_replace(' ','',$flight[3][2]))),0,5); |
|
439 | - $arrivalTime = trim(str_replace(' lunes','',str_replace(' ','',$flight[5][1]))); |
|
438 | + $departureTime = substr(trim(str_replace(' lunes', '', str_replace(' ', '', $flight[3][2]))), 0, 5); |
|
439 | + $arrivalTime = trim(str_replace(' lunes', '', str_replace(' ', '', $flight[5][1]))); |
|
440 | 440 | if ($arrivalTime == 'Hora estimada de llegada') { |
441 | - $arrivalTime = substr(trim(str_replace(' lunes','',str_replace(' ','',$flight[5][2]))),0,5); |
|
442 | - } else $arrivalTime = substr($arrivalTime,0,5); |
|
443 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_iberia'); |
|
441 | + $arrivalTime = substr(trim(str_replace(' lunes', '', str_replace(' ', '', $flight[5][2]))), 0, 5); |
|
442 | + } else $arrivalTime = substr($arrivalTime, 0, 5); |
|
443 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_iberia'); |
|
444 | 444 | } |
445 | 445 | } |
446 | 446 | return array(); |
@@ -453,11 +453,11 @@ discard block |
||
453 | 453 | * @return Flight departure and arrival airports and time |
454 | 454 | */ |
455 | 455 | |
456 | - private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') { |
|
456 | + private function getStarAlliance($callsign, $date = 'NOW', $carrier = '') { |
|
457 | 457 | $Common = new Common(); |
458 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
458 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
459 | 459 | $check_date = new Datetime($date); |
460 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
460 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
461 | 461 | $url = "http://www.staralliance.com/flifoQueryAction.do?myAirline=&airlineCode=".$carrier."&flightNo=".$numvol."&day=".$check_date->format('d')."&month=".$check_date->format('m')."&year=".$check_date->format('Y')."&departuredate=".$check_date->format('d-M-Y'); |
462 | 462 | $data = $Common->getData($url); |
463 | 463 | if ($data != '') { |
@@ -466,13 +466,13 @@ discard block |
||
466 | 466 | $flight = $table; |
467 | 467 | //print_r($table); |
468 | 468 | if (isset($flight[25]) && isset($flight[29])) { |
469 | - preg_match('/([A-Z]{3})/',$flight[25][1],$DepartureAirportIataMatch); |
|
470 | - preg_match('/([A-Z]{3})/',$flight[25][3],$ArrivalAirportIataMatch); |
|
469 | + preg_match('/([A-Z]{3})/', $flight[25][1], $DepartureAirportIataMatch); |
|
470 | + preg_match('/([A-Z]{3})/', $flight[25][3], $ArrivalAirportIataMatch); |
|
471 | 471 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
472 | 472 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
473 | - $departureTime = substr(trim(str_replace('Scheduled: ','',$flight[29][0])),0,5); |
|
474 | - $arrivalTime = substr(trim(str_replace('Scheduled: ','',$flight[29][1])),0,5); |
|
475 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_staralliance'); |
|
473 | + $departureTime = substr(trim(str_replace('Scheduled: ', '', $flight[29][0])), 0, 5); |
|
474 | + $arrivalTime = substr(trim(str_replace('Scheduled: ', '', $flight[29][1])), 0, 5); |
|
475 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_staralliance'); |
|
476 | 476 | } else return array(); |
477 | 477 | } |
478 | 478 | |
@@ -490,10 +490,10 @@ discard block |
||
490 | 490 | */ |
491 | 491 | private function getAlitalia($callsign, $date = 'NOW') { |
492 | 492 | $Common = new Common(); |
493 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
493 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
494 | 494 | $check_date = new Datetime($date); |
495 | - $url= "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y'); |
|
496 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
495 | + $url = "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y'); |
|
496 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
497 | 497 | $data = $Common->getData($url); |
498 | 498 | if ($data != '') { |
499 | 499 | $table = $Common->text2array($data); |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | $ArrivalAirportIata = ''; |
502 | 502 | $departureTime = $table[4]; |
503 | 503 | $arrivalTime = $table[5]; |
504 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_alitalia'); |
|
504 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_alitalia'); |
|
505 | 505 | } |
506 | 506 | } |
507 | 507 | |
@@ -513,21 +513,21 @@ discard block |
||
513 | 513 | */ |
514 | 514 | private function getBrussels($callsign, $date = 'NOW') { |
515 | 515 | $Common = new Common(); |
516 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
516 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
517 | 517 | $check_date = new Datetime($date); |
518 | - $url= "http://www.brusselsairlines.com/api/flightstatus/getresults?from=NA&to=NA&date=".$check_date->format('d/m/Y')."&hour=NA&lookup=flightnumber&flightnumber=".$numvol."&publicationID=302"; |
|
518 | + $url = "http://www.brusselsairlines.com/api/flightstatus/getresults?from=NA&to=NA&date=".$check_date->format('d/m/Y')."&hour=NA&lookup=flightnumber&flightnumber=".$numvol."&publicationID=302"; |
|
519 | 519 | //http://www.brusselsairlines.com/fr-fr/informations-pratiques/statut-de-votre-vol/resultat.aspx?flightnumber=".$numvol."&date=".$check_date->format('d/m/Y')."&lookup=flightnumber"; |
520 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
520 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
521 | 521 | $data = $Common->getData($url); |
522 | 522 | if ($data != '') { |
523 | 523 | //echo $data; |
524 | - $parsed_json = json_decode($data,true); |
|
524 | + $parsed_json = json_decode($data, true); |
|
525 | 525 | if (isset($parsed_json[0]['FromAirportCode'])) { |
526 | 526 | $DepartureAirportIata = $parsed_json[0]['FromAirportCode']; |
527 | 527 | $ArrivalAirportIata = $parsed_json[0]['ToAirportCode']; |
528 | - $departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate'])); |
|
529 | - $arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate'])); |
|
530 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels'); |
|
528 | + $departureTime = date('H:i', strtotime($parsed_json[0]['ScheduledDepatureDate'])); |
|
529 | + $arrivalTime = date('H:i', strtotime($parsed_json[0]['ScheduledArrivalDate'])); |
|
530 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_brussels'); |
|
531 | 531 | } |
532 | 532 | } |
533 | 533 | } |
@@ -604,21 +604,21 @@ discard block |
||
604 | 604 | */ |
605 | 605 | private function getFlyTap($callsign) { |
606 | 606 | $Common = new Common(); |
607 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
608 | - $url= "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees"; |
|
607 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
608 | + $url = "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees"; |
|
609 | 609 | //$check_date = new Datetime($date); |
610 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
611 | - $post = array('arrivalsdepartures_content' => 'number','arrivalsdepartures_tp' => $numvol,'arrivalsdepartures_trk' => 'ARR','arrivalsdepartures_date_trk' => '1','aptCode' => '','arrivalsdepartures' => 'DEP','arrivalsdepartures_date' => '1','aptCodeFrom' => '','aptCodeTo' => '','arrivalsdepartures2' => 'DEP','arrivalsdepartures_date2' => '1'); |
|
612 | - $data = $Common->getData($url,'post',$post); |
|
610 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
611 | + $post = array('arrivalsdepartures_content' => 'number', 'arrivalsdepartures_tp' => $numvol, 'arrivalsdepartures_trk' => 'ARR', 'arrivalsdepartures_date_trk' => '1', 'aptCode' => '', 'arrivalsdepartures' => 'DEP', 'arrivalsdepartures_date' => '1', 'aptCodeFrom' => '', 'aptCodeTo' => '', 'arrivalsdepartures2' => 'DEP', 'arrivalsdepartures_date2' => '1'); |
|
612 | + $data = $Common->getData($url, 'post', $post); |
|
613 | 613 | if ($data != '') { |
614 | 614 | $table = $Common->table2array($data); |
615 | - $departureTime = trim(substr($table[15][0],0,5)); |
|
616 | - $arrivalTime = trim(substr($table[35][0],0,5)); |
|
617 | - preg_match('/([A-Z]{3})/',$table[11][0],$DepartureAirportIataMatch); |
|
618 | - preg_match('/([A-Z]{3})/',$table[31][0],$ArrivalAirportIataMatch); |
|
615 | + $departureTime = trim(substr($table[15][0], 0, 5)); |
|
616 | + $arrivalTime = trim(substr($table[35][0], 0, 5)); |
|
617 | + preg_match('/([A-Z]{3})/', $table[11][0], $DepartureAirportIataMatch); |
|
618 | + preg_match('/([A-Z]{3})/', $table[31][0], $ArrivalAirportIataMatch); |
|
619 | 619 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
620 | 620 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
621 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flytap'); |
|
621 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flytap'); |
|
622 | 622 | } |
623 | 623 | return array(); |
624 | 624 | } |
@@ -640,10 +640,10 @@ discard block |
||
640 | 640 | } |
641 | 641 | } |
642 | 642 | if ($airline_icao == '') return array(); |
643 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
644 | - $url= "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol; |
|
643 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
644 | + $url = "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol; |
|
645 | 645 | //$check_date = new Datetime($date); |
646 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
646 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
647 | 647 | $data = $Common->getData($url); |
648 | 648 | if ($data != '') { |
649 | 649 | $table = $Common->table2array($data); |
@@ -653,13 +653,13 @@ discard block |
||
653 | 653 | $darr = ''; |
654 | 654 | $ahour = ''; |
655 | 655 | $aarr = ''; |
656 | - $n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr); |
|
656 | + $n = sscanf($sched, '%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])', $dhour, $darr, $ahour, $aarr); |
|
657 | 657 | if ($n == 7) { |
658 | 658 | $departureTime = $dhour; |
659 | 659 | $arrivalTime = $ahour; |
660 | - $DepartureAirportIata = str_replace(array('(',')'),'',$darr); |
|
661 | - $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr); |
|
662 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper'); |
|
660 | + $DepartureAirportIata = str_replace(array('(', ')'), '', $darr); |
|
661 | + $ArrivalAirportIata = str_replace(array('(', ')'), '', $aarr); |
|
662 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flightmapper'); |
|
663 | 663 | } |
664 | 664 | } |
665 | 665 | } |
@@ -683,20 +683,20 @@ discard block |
||
683 | 683 | } |
684 | 684 | } |
685 | 685 | */ |
686 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
687 | - $url= "http://fr.flightaware.com/live/flight/".$callsign; |
|
686 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
687 | + $url = "http://fr.flightaware.com/live/flight/".$callsign; |
|
688 | 688 | //$check_date = new Datetime($date); |
689 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
689 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
690 | 690 | $data = $Common->getData($url); |
691 | 691 | if ($data != '') { |
692 | 692 | $table = $Common->table2array($data); |
693 | 693 | if (isset($table[11][0])) { |
694 | - $departureTime = str_replace('h',':',substr($table[5][0],0,5)); |
|
695 | - $arrivalTime = str_replace('h',':',substr($table[5][1],0,5)); |
|
694 | + $departureTime = str_replace('h', ':', substr($table[5][0], 0, 5)); |
|
695 | + $arrivalTime = str_replace('h', ':', substr($table[5][1], 0, 5)); |
|
696 | 696 | echo $table[3][0]; |
697 | - sscanf($table[3][0],'%*[^(] (%3[A-Z] / %*4[A-Z])',$DepartureAirportIata); |
|
698 | - sscanf($table[3][1],'%*[^(] (%3[A-Z] / %*4[A-Z])',$ArrivalAirportIata); |
|
699 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightaware'); |
|
697 | + sscanf($table[3][0], '%*[^(] (%3[A-Z] / %*4[A-Z])', $DepartureAirportIata); |
|
698 | + sscanf($table[3][1], '%*[^(] (%3[A-Z] / %*4[A-Z])', $ArrivalAirportIata); |
|
699 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_flightaware'); |
|
700 | 700 | } |
701 | 701 | } |
702 | 702 | return array(); |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | */ |
710 | 710 | public function getCostToTravel($callsign) { |
711 | 711 | $Common = new Common(); |
712 | - $url= "http://www.costtotravel.com/flight-number/".$callsign; |
|
712 | + $url = "http://www.costtotravel.com/flight-number/".$callsign; |
|
713 | 713 | //$check_date = new Datetime($date); |
714 | 714 | //if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
715 | 715 | $data = $Common->getData($url); |
@@ -717,11 +717,11 @@ discard block |
||
717 | 717 | $table = $Common->table2array($data); |
718 | 718 | //print_r($table); |
719 | 719 | if (isset($table[11][1])) { |
720 | - $departureTime = substr($table[11][1],0,5); |
|
721 | - $arrivalTime = substr($table[17][1],0,5); |
|
722 | - $DepartureAirportIata = substr($table[13][1],0,3); |
|
723 | - $ArrivalAirportIata = substr($table[15][1],0,3); |
|
724 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_costtotravel'); |
|
720 | + $departureTime = substr($table[11][1], 0, 5); |
|
721 | + $arrivalTime = substr($table[17][1], 0, 5); |
|
722 | + $DepartureAirportIata = substr($table[13][1], 0, 3); |
|
723 | + $ArrivalAirportIata = substr($table[15][1], 0, 3); |
|
724 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_costtotravel'); |
|
725 | 725 | } |
726 | 726 | } |
727 | 727 | return array(); |
@@ -733,13 +733,13 @@ discard block |
||
733 | 733 | * @param String $date date we want flight number info |
734 | 734 | * @return Flight departure and arrival airports and time |
735 | 735 | */ |
736 | - private function getAirCanada($callsign,$date = 'NOW') { |
|
736 | + private function getAirCanada($callsign, $date = 'NOW') { |
|
737 | 737 | $Common = new Common(); |
738 | 738 | date_default_timezone_set('UTC'); |
739 | 739 | $check_date = new Datetime($date); |
740 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
741 | - $url= "http://services.aircanada.com/portal/rest/getFlightsByFlightNumber?forceTimetable=true&flightNumber=".$numvol."&carrierCode=AC&date=".$check_date->format('m-d-Y')."&app_key=AE919FDCC80311DF9BABC975DFD72085&cache=74249"; |
|
742 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
740 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
741 | + $url = "http://services.aircanada.com/portal/rest/getFlightsByFlightNumber?forceTimetable=true&flightNumber=".$numvol."&carrierCode=AC&date=".$check_date->format('m-d-Y')."&app_key=AE919FDCC80311DF9BABC975DFD72085&cache=74249"; |
|
742 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
743 | 743 | $data = $Common->getData($url); |
744 | 744 | $dom = new DomDocument(); |
745 | 745 | $dom->loadXML($data); |
@@ -747,11 +747,11 @@ discard block |
||
747 | 747 | $departure = $dom->getElementsByTagName('DepartureStationInfo')->item(0); |
748 | 748 | if (isset($departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue)) { |
749 | 749 | $DepartureAirportIata = $departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue; |
750 | - $departureTime = date('H:i',strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
750 | + $departureTime = date('H:i', strtotime($departure->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
751 | 751 | $arrival = $dom->getElementsByTagName('ArrivalStationInfo')->item(0); |
752 | 752 | $ArrivalAirportIata = $arrival->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue; |
753 | - $arrivalTime = date('H:i',strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
754 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_aircanada'); |
|
753 | + $arrivalTime = date('H:i', strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue)); |
|
754 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_aircanada'); |
|
755 | 755 | } else return array(); |
756 | 756 | } |
757 | 757 | |
@@ -763,21 +763,21 @@ discard block |
||
763 | 763 | */ |
764 | 764 | private function getVietnamAirlines($callsign, $date = 'NOW') { |
765 | 765 | $Common = new Common(); |
766 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
766 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
767 | 767 | $check_date = new Datetime($date); |
768 | - $url= "https://cat.sabresonicweb.com/SSWVN/meridia?posid=VNVN&page=flifoFlightInfoDetailsMessage_learn&action=flightInfoDetails&airline=VN&language=fr&depDay=".$check_date->format('j')."&depMonth=".strtoupper($check_date->format('M'))."&=&flight=".$numvol."&"; |
|
769 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
768 | + $url = "https://cat.sabresonicweb.com/SSWVN/meridia?posid=VNVN&page=flifoFlightInfoDetailsMessage_learn&action=flightInfoDetails&airline=VN&language=fr&depDay=".$check_date->format('j')."&depMonth=".strtoupper($check_date->format('M'))."&=&flight=".$numvol."&"; |
|
769 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
770 | 770 | $data = $Common->getData($url); |
771 | 771 | if ($data != '') { |
772 | 772 | $table = $Common->table2array($data); |
773 | 773 | $flight = $table; |
774 | - preg_match('/([A-Z]{3})/',$flight[3][0],$DepartureAirportIataMatch); |
|
775 | - preg_match('/([A-Z]{3})/',$flight[21][0],$ArrivalAirportIataMatch); |
|
774 | + preg_match('/([A-Z]{3})/', $flight[3][0], $DepartureAirportIataMatch); |
|
775 | + preg_match('/([A-Z]{3})/', $flight[21][0], $ArrivalAirportIataMatch); |
|
776 | 776 | $DepartureAirportIata = $DepartureAirportIataMatch[0]; |
777 | 777 | $ArrivalAirportIata = $ArrivalAirportIataMatch[0]; |
778 | 778 | $departureTime = $flight[5][1]; |
779 | 779 | $arrivalTime = $flight[23][1]; |
780 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_vietnamairlines'); |
|
780 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_vietnamairlines'); |
|
781 | 781 | } |
782 | 782 | } |
783 | 783 | |
@@ -788,16 +788,16 @@ discard block |
||
788 | 788 | * @param String $carrier airline code |
789 | 789 | * @return Flight departure and arrival airports and time |
790 | 790 | */ |
791 | - private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') { |
|
791 | + private function getAirBerlin($callsign, $date = 'NOW', $carrier = 'AB') { |
|
792 | 792 | $Common = new Common(); |
793 | 793 | date_default_timezone_set('UTC'); |
794 | 794 | //AB = airberlin, HG/NLY = NIKI, 4T/BHP = Belair |
795 | - $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
|
795 | + $numvol = preg_replace('/^[A-Z]*/', '', $callsign); |
|
796 | 796 | $check_date = new Datetime($date); |
797 | - $url= "http://www.airberlin.com/en-US/site/aims.php"; |
|
798 | - if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
|
799 | - $post = array('type' => 'departure','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => $carrier); |
|
800 | - $data = $Common->getData($url,'post',$post); |
|
797 | + $url = "http://www.airberlin.com/en-US/site/aims.php"; |
|
798 | + if (!filter_var($numvol, FILTER_VALIDATE_INT)) return array(); |
|
799 | + $post = array('type' => 'departure', 'searchFlightNo' => '1', 'requestsent' => 'true', 'flightno' => $numvol, 'date' => $check_date->format('Y-m-d'), 'carrier' => $carrier); |
|
800 | + $data = $Common->getData($url, 'post', $post); |
|
801 | 801 | //echo $data; |
802 | 802 | $DepartureAirportIata = ''; |
803 | 803 | $ArrivalAirportIata = ''; |
@@ -810,8 +810,8 @@ discard block |
||
810 | 810 | if (isset($flight[5][2])) $departureAirport = $flight[5][2]; |
811 | 811 | else $departureAirport = ''; |
812 | 812 | } else return array(); |
813 | - $post = array('type' => 'arrival','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => 'AB'); |
|
814 | - $data = $Common->getData($url,'post',$post); |
|
813 | + $post = array('type' => 'arrival', 'searchFlightNo' => '1', 'requestsent' => 'true', 'flightno' => $numvol, 'date' => $check_date->format('Y-m-d'), 'carrier' => 'AB'); |
|
814 | + $data = $Common->getData($url, 'post', $post); |
|
815 | 815 | if ($data != '') { |
816 | 816 | $table = $Common->table2array($data); |
817 | 817 | $flight = $table; |
@@ -839,13 +839,13 @@ discard block |
||
839 | 839 | } |
840 | 840 | } |
841 | 841 | if (isset($DepartureAirportIata)) { |
842 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airberlin'); |
|
842 | + return array('DepartureAirportIATA' => $DepartureAirportIata, 'DepartureTime' => $departureTime, 'ArrivalAirportIATA' => $ArrivalAirportIata, 'ArrivalTime' => $arrivalTime, 'Source' => 'website_airberlin'); |
|
843 | 843 | } else return array(); |
844 | 844 | } |
845 | 845 | |
846 | 846 | |
847 | 847 | |
848 | - public function fetchSchedule($ident,$date = 'NOW') { |
|
848 | + public function fetchSchedule($ident, $date = 'NOW') { |
|
849 | 849 | global $globalSchedulesSources, $globalSchedulesFetch; |
850 | 850 | //$Common = new Common(); |
851 | 851 | if (!$globalSchedulesFetch) return array(); |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | // Brussels Airlines |
916 | 916 | case "BEL": |
917 | 917 | case "SN": |
918 | - return $this->getBrussels($ident,$date); |
|
918 | + return $this->getBrussels($ident, $date); |
|
919 | 919 | /* |
920 | 920 | // Copa Airlines |
921 | 921 | case "CMP": |
@@ -1000,17 +1000,17 @@ discard block |
||
1000 | 1000 | // Air France |
1001 | 1001 | case "AF": |
1002 | 1002 | case "AFR": |
1003 | - return $this->getAirFrance($ident,$date,'AF'); |
|
1003 | + return $this->getAirFrance($ident, $date, 'AF'); |
|
1004 | 1004 | // HOP |
1005 | 1005 | case "A5": |
1006 | 1006 | case "HOP": |
1007 | - return $this->getAirFrance($ident,$date,'A5'); |
|
1007 | + return $this->getAirFrance($ident, $date, 'A5'); |
|
1008 | 1008 | // EasyJet |
1009 | 1009 | case "U2": |
1010 | 1010 | case "DS": |
1011 | 1011 | case "EZY": |
1012 | 1012 | case "EZS": |
1013 | - return $this->getEasyJet($ident,$date); |
|
1013 | + return $this->getEasyJet($ident, $date); |
|
1014 | 1014 | // Ryanair |
1015 | 1015 | case "FR": |
1016 | 1016 | case "RYR": |
@@ -1060,25 +1060,25 @@ discard block |
||
1060 | 1060 | return $this->getIberia($ident); |
1061 | 1061 | // Vietnam Airlines |
1062 | 1062 | case "HVN": |
1063 | - return $this->getVietnamAirlines($ident,$date); |
|
1063 | + return $this->getVietnamAirlines($ident, $date); |
|
1064 | 1064 | // Air Berlin |
1065 | 1065 | case "AB": |
1066 | 1066 | case "BER": |
1067 | - return $this->getAirBerlin($ident,$date,'AB'); |
|
1067 | + return $this->getAirBerlin($ident, $date, 'AB'); |
|
1068 | 1068 | // NIKI |
1069 | 1069 | case "HG": |
1070 | 1070 | case "NLY": |
1071 | - return $this->getAirBerlin($ident,$date,'HG'); |
|
1071 | + return $this->getAirBerlin($ident, $date, 'HG'); |
|
1072 | 1072 | // BelAir |
1073 | 1073 | case "4T": |
1074 | 1074 | case "BHP": |
1075 | - return $this->getAirBerlin($ident,$date,'4T'); |
|
1075 | + return $this->getAirBerlin($ident, $date, '4T'); |
|
1076 | 1076 | default: |
1077 | 1077 | // Randomly use a generic function to get hours |
1078 | 1078 | if (strlen($airline_icao) == 2) { |
1079 | - if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1079 | + if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1080 | 1080 | if (count($globalSchedulesSources) > 0) { |
1081 | - $rand = mt_rand(0,count($globalSchedulesSources)-1); |
|
1081 | + $rand = mt_rand(0, count($globalSchedulesSources) - 1); |
|
1082 | 1082 | $source = $globalSchedulesSources[$rand]; |
1083 | 1083 | if ($source == 'flightmapper') return $this->getFlightMapper($ident); |
1084 | 1084 | elseif ($source == 'costtotravel') return $this->getCostToTravel($ident); |
@@ -29,18 +29,18 @@ discard block |
||
29 | 29 | $currentdate = date('Y-m-d'); |
30 | 30 | $sourcestat = $Stats->getStatsSource($currentdate); |
31 | 31 | if (!empty($sourcestat)) { |
32 | - foreach($sourcestat as $srcst) { |
|
32 | + foreach ($sourcestat as $srcst) { |
|
33 | 33 | $type = $srcst['stats_type']; |
34 | 34 | if ($type == 'polar' || $type == 'hist') { |
35 | 35 | $source = $srcst['source_name']; |
36 | 36 | $data = $srcst['source_data']; |
37 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
37 | + $this->stats[$currentdate][$source][$type] = json_decode($data, true); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | - public function get_Schedule($id,$ident) { |
|
43 | + public function get_Schedule($id, $ident) { |
|
44 | 44 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
45 | 45 | // Get schedule here, so it's done only one time |
46 | 46 | |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | $schedule = $Schedule->fetchSchedule($operator); |
65 | 65 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
66 | 66 | if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
67 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
68 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
67 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime'])); |
|
68 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
69 | 69 | // Should also check if route schedule = route from DB |
70 | 70 | if ($schedule['DepartureAirportIATA'] != '') { |
71 | 71 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
88 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
88 | + $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
116 | 116 | $Spotter = new Spotter($this->db); |
117 | 117 | $real_arrival = $this->arrival($key); |
118 | - $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
118 | + $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $airport_time = ''; |
129 | 129 | if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
130 | 130 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
131 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
131 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist); |
|
132 | 132 | if (isset($closestAirports[0])) { |
133 | 133 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
134 | 134 | $airport_icao = $closestAirports[0]['icao']; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | break; |
144 | 144 | } |
145 | 145 | } |
146 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
146 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude'] + 5000))) { |
|
147 | 147 | $airport_icao = $closestAirports[0]['icao']; |
148 | 148 | $airport_time = $this->all_flights[$key]['datetime']; |
149 | 149 | } else { |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | } else { |
157 | 157 | if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
158 | 158 | } |
159 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
159 | + return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
168 | 168 | foreach ($this->all_flights as $key => $flight) { |
169 | 169 | if (isset($flight['lastupdate'])) { |
170 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
170 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
171 | 171 | if (isset($this->all_flights[$key]['id'])) { |
172 | 172 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
173 | 173 | /* |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $real_arrival = $this->arrival($key); |
179 | 179 | $Spotter = new Spotter($this->db); |
180 | 180 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
181 | - $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
181 | + $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
182 | 182 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
183 | 183 | } |
184 | 184 | // Put in archive |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $send = false; |
215 | 215 | |
216 | 216 | // SBS format is CSV format |
217 | - if(is_array($line) && isset($line['hex'])) { |
|
217 | + if (is_array($line) && isset($line['hex'])) { |
|
218 | 218 | //print_r($line); |
219 | 219 | if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) { |
220 | 220 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | //print_r($this->all_flights); |
249 | 249 | if (!isset($this->all_flights[$id]['hex']) && ctype_xdigit($hex)) { |
250 | 250 | $this->all_flights[$id] = array('hex' => $hex); |
251 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
251 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
252 | 252 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
253 | 253 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
254 | 254 | //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $Spotter = new Spotter($this->db); |
259 | 259 | $aircraft_icao = $Spotter->getAllAircraftType($hex); |
260 | 260 | $Spotter->db = null; |
261 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
261 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
262 | 262 | |
263 | 263 | if ($aircraft_icao == '' && isset($line['aircraft_type'])) { |
264 | 264 | if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
@@ -266,32 +266,32 @@ discard block |
||
266 | 266 | elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
267 | 267 | elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
268 | 268 | } |
269 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
269 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
270 | 270 | } else if (isset($line['aircraft_name'])) { |
271 | 271 | // Get aircraft ICAO from aircraft name |
272 | 272 | $Spotter = new Spotter($this->db); |
273 | 273 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
274 | 274 | $Spotter->db = null; |
275 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
276 | - else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
277 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
|
278 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true)); |
|
279 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
275 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
276 | + else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA')); |
|
277 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $line['aircraft_icao'])); |
|
278 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'altitude_real' => '', 'heading' => '', 'departure_airport_time' => '', 'arrival_airport_time' => '', 'squawk' => '', 'route_stop' => '', 'registration' => '', 'pilot_id' => '', 'pilot_name' => '', 'waypoints' => '', 'ground' => '0', 'format_source' => '', 'source_name' => '', 'over_country' => '', 'verticalrate' => '', 'noarchive' => false, 'putinarchive' => true)); |
|
279 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time())); |
|
280 | 280 | if (!isset($line['id'])) { |
281 | 281 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
282 | 282 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
283 | 283 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
284 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
284 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
285 | 285 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
286 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
286 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
287 | 287 | |
288 | 288 | if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n"; |
289 | 289 | if ($globalAllFlights !== FALSE) $dataFound = true; |
290 | 290 | } |
291 | 291 | |
292 | - if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
292 | + if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/', $line['datetime'])) { |
|
293 | 293 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
294 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
|
294 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime'])); |
|
295 | 295 | } else { |
296 | 296 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
297 | 297 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
@@ -302,23 +302,23 @@ discard block |
||
302 | 302 | */ |
303 | 303 | return ''; |
304 | 304 | } |
305 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
305 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
306 | 306 | |
307 | 307 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') { |
308 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
308 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration'])); |
|
309 | 309 | } |
310 | 310 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
311 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
311 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints'])); |
|
312 | 312 | } |
313 | 313 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
314 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id'])); |
|
314 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => $line['pilot_id'])); |
|
315 | 315 | } |
316 | 316 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
317 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name'])); |
|
317 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => $line['pilot_name'])); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
321 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
321 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
322 | 322 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
323 | 323 | $timeelapsed = microtime(true); |
324 | 324 | $Spotter = new Spotter($this->db); |
@@ -328,10 +328,10 @@ discard block |
||
328 | 328 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
329 | 329 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
330 | 330 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
331 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
331 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $fromsource); |
|
332 | 332 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
333 | 333 | $Spotter->db = null; |
334 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
334 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /* |
@@ -342,24 +342,24 @@ discard block |
||
342 | 342 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
343 | 343 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
344 | 344 | */ |
345 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
345 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
346 | 346 | |
347 | 347 | //$putinarchive = true; |
348 | 348 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
349 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
|
349 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time'])); |
|
350 | 350 | } |
351 | 351 | if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
352 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
352 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
353 | 353 | } |
354 | 354 | if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
355 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
355 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
356 | 356 | } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
357 | 357 | $timeelapsed = microtime(true); |
358 | 358 | $Spotter = new Spotter($this->db); |
359 | 359 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
360 | 360 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
361 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
362 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
361 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
362 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
363 | 363 | |
364 | 364 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
365 | 365 | $timeelapsed = microtime(true); |
@@ -372,34 +372,34 @@ discard block |
||
372 | 372 | $Translation->db = null; |
373 | 373 | } |
374 | 374 | $Spotter->db = null; |
375 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
375 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
376 | 376 | |
377 | 377 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
378 | 378 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
379 | 379 | if ($route['fromairport_icao'] != $route['toairport_icao']) { |
380 | 380 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
381 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
381 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $route['fromairport_icao'], 'arrival_airport' => $route['toairport_icao'], 'route_stop' => $route['routestop'])); |
|
382 | 382 | } |
383 | 383 | } |
384 | 384 | if (!isset($globalFork)) $globalFork = TRUE; |
385 | 385 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
386 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
386 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id, trim($line['ident'])); |
|
387 | 387 | } |
388 | 388 | } |
389 | 389 | } |
390 | 390 | |
391 | 391 | if (isset($line['speed']) && $line['speed'] != '') { |
392 | 392 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
393 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
394 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
393 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed']))); |
|
394 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true)); |
|
395 | 395 | //$dataFound = true; |
396 | 396 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
397 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
397 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm'); |
|
398 | 398 | if ($distance > 1000 && $distance < 10000) { |
399 | 399 | // use datetime |
400 | 400 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
401 | 401 | $speed = $speed*3.6; |
402 | - if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
402 | + if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed))); |
|
403 | 403 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
404 | 404 | } |
405 | 405 | } |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | |
408 | 408 | |
409 | 409 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
410 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
410 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']); |
|
411 | 411 | else unset($timediff); |
412 | - if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
|
412 | + if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')))) { |
|
413 | 413 | if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) { |
414 | - if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
414 | + if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
415 | 415 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
416 | 416 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
417 | 417 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -419,10 +419,10 @@ discard block |
||
419 | 419 | if ($globalDebug) echo "\n".' ------- Check Country.... '; |
420 | 420 | $timeelapsed = microtime(true); |
421 | 421 | $Spotter = new Spotter($this->db); |
422 | - $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
422 | + $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
423 | 423 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
424 | 424 | $Spotter->db = null; |
425 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
425 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
426 | 426 | $this->tmd = 0; |
427 | 427 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
428 | 428 | } |
@@ -431,13 +431,13 @@ discard block |
||
431 | 431 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
432 | 432 | //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
433 | 433 | if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
434 | - if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
434 | + if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
435 | 435 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
436 | 436 | $dataFound = true; |
437 | 437 | $this->all_flights[$id]['time_last_coord'] = time(); |
438 | 438 | } |
439 | 439 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
440 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
|
440 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude'])); |
|
441 | 441 | /* |
442 | 442 | if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) { |
443 | 443 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -455,13 +455,13 @@ discard block |
||
455 | 455 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
456 | 456 | //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
457 | 457 | if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
458 | - if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
458 | + if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
459 | 459 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
460 | 460 | $dataFound = true; |
461 | 461 | $this->all_flights[$id]['time_last_coord'] = time(); |
462 | 462 | } |
463 | 463 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
464 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
|
464 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude'])); |
|
465 | 465 | /* |
466 | 466 | if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) { |
467 | 467 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -479,45 +479,45 @@ discard block |
||
479 | 479 | } else if ($globalDebug && $timediff > 20) { |
480 | 480 | $this->tmd = $this->tmd + 1; |
481 | 481 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
482 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
|
483 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
482 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')."m -"; |
|
483 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
484 | 484 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
485 | 485 | } |
486 | 486 | } |
487 | 487 | if (isset($line['last_update']) && $line['last_update'] != '') { |
488 | 488 | if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
489 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
489 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('last_update' => $line['last_update'])); |
|
490 | 490 | } |
491 | 491 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
492 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
492 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate'])); |
|
493 | 493 | //$dataFound = true; |
494 | 494 | } |
495 | 495 | if (isset($line['format_source']) && $line['format_source'] != '') { |
496 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
496 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('format_source' => $line['format_source'])); |
|
497 | 497 | } |
498 | 498 | if (isset($line['source_name']) && $line['source_name'] != '') { |
499 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
499 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_name' => $line['source_name'])); |
|
500 | 500 | } |
501 | 501 | if (isset($line['emergency']) && $line['emergency'] != '') { |
502 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
502 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency'])); |
|
503 | 503 | //$dataFound = true; |
504 | 504 | } |
505 | 505 | if (isset($line['ground']) && $line['ground'] != '') { |
506 | 506 | if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
507 | 507 | // Here we force archive of flight because after ground it's a new one (or should be) |
508 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
509 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
510 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
|
511 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
512 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
508 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
509 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
510 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
|
511 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
512 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
513 | 513 | } |
514 | 514 | if ($line['ground'] != 1) $line['ground'] = 0; |
515 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
515 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground'])); |
|
516 | 516 | //$dataFound = true; |
517 | 517 | } |
518 | 518 | if (isset($line['squawk']) && $line['squawk'] != '') { |
519 | 519 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
520 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
520 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
521 | 521 | $highlight = ''; |
522 | 522 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
523 | 523 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
@@ -525,48 +525,48 @@ discard block |
||
525 | 525 | if ($highlight != '') { |
526 | 526 | $timeelapsed = microtime(true); |
527 | 527 | $Spotter = new Spotter($this->db); |
528 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
528 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight); |
|
529 | 529 | $Spotter->db = null; |
530 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
530 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
531 | 531 | |
532 | 532 | $this->all_flights[$id]['putinarchive'] = true; |
533 | 533 | //$putinarchive = true; |
534 | 534 | //$highlight = ''; |
535 | 535 | } |
536 | 536 | |
537 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
537 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
538 | 538 | //$dataFound = true; |
539 | 539 | } |
540 | 540 | |
541 | 541 | if (isset($line['altitude']) && $line['altitude'] != '') { |
542 | 542 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
543 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
544 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
|
545 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
|
543 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
544 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100))); |
|
545 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude'])); |
|
546 | 546 | //$dataFound = true; |
547 | 547 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
548 | 548 | } |
549 | 549 | |
550 | 550 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
551 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
551 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('noarchive' => true)); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | if (isset($line['heading']) && $line['heading'] != '') { |
555 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
556 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
557 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
555 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading'] - round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
556 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($line['heading']))); |
|
557 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading_fromsrc' => true)); |
|
558 | 558 | //$dataFound = true; |
559 | 559 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
560 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
561 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
562 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
560 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
561 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($heading))); |
|
562 | + if (abs($this->all_flights[$id]['heading'] - round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
563 | 563 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
564 | 564 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
565 | 565 | // If not enough messages and ACARS set heading to 0 |
566 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
566 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0)); |
|
567 | 567 | } |
568 | - if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
569 | - elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
568 | + if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
569 | + elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
570 | 570 | |
571 | 571 | // print_r($this->all_flights[$id]); |
572 | 572 | //gets the callsign from the last hour |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | if ($dataFound === true && isset($this->all_flights[$id]['hex'])) { |
577 | 577 | $this->all_flights[$id]['lastupdate'] = time(); |
578 | 578 | if ($this->all_flights[$id]['addedSpotter'] == 0) { |
579 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
579 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
580 | 580 | //print_r($this->all_flights); |
581 | 581 | //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
582 | 582 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
@@ -586,61 +586,61 @@ discard block |
||
586 | 586 | $SpotterLive = new SpotterLive($this->db); |
587 | 587 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) { |
588 | 588 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
589 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
589 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
590 | 590 | } elseif (isset($line['id'])) { |
591 | 591 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
592 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
592 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
593 | 593 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
594 | 594 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
595 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
595 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
596 | 596 | } else $recent_ident = ''; |
597 | - $SpotterLive->db=null; |
|
597 | + $SpotterLive->db = null; |
|
598 | 598 | |
599 | 599 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
600 | 600 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
601 | 601 | } else { |
602 | 602 | $recent_ident = ''; |
603 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
|
603 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0)); |
|
604 | 604 | } |
605 | 605 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
606 | - if($recent_ident == "") |
|
606 | + if ($recent_ident == "") |
|
607 | 607 | { |
608 | 608 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
609 | 609 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
610 | 610 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
611 | 611 | //adds the spotter data for the archive |
612 | 612 | $ignoreImport = false; |
613 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
613 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
614 | 614 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
615 | 615 | $ignoreImport = true; |
616 | 616 | } |
617 | 617 | } |
618 | 618 | if (count($globalAirportAccept) > 0) { |
619 | 619 | $ignoreImport = true; |
620 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
620 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
621 | 621 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
622 | 622 | $ignoreImport = false; |
623 | 623 | } |
624 | 624 | } |
625 | 625 | } |
626 | 626 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
627 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
628 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
627 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
628 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
629 | 629 | $ignoreImport = true; |
630 | 630 | } |
631 | 631 | } |
632 | 632 | } |
633 | 633 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
634 | 634 | $ignoreImport = true; |
635 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
636 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
635 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
636 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
637 | 637 | $ignoreImport = false; |
638 | 638 | } |
639 | 639 | } |
640 | 640 | } |
641 | 641 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
642 | 642 | $ignoreImport = true; |
643 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
643 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
644 | 644 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
645 | 645 | $ignoreImport = false; |
646 | 646 | } |
@@ -652,27 +652,27 @@ discard block |
||
652 | 652 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
653 | 653 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
654 | 654 | if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
655 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
655 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
656 | 656 | $timeelapsed = microtime(true); |
657 | 657 | $Spotter = new Spotter($this->db); |
658 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']); |
|
658 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $highlight, $this->all_flights[$id]['hex'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name']); |
|
659 | 659 | $Spotter->db = null; |
660 | 660 | if ($globalDebug && isset($result)) echo $result."\n"; |
661 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
661 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
662 | 662 | |
663 | 663 | // Add source stat in DB |
664 | 664 | $Stats = new Stats($this->db); |
665 | 665 | if (!empty($this->stats)) { |
666 | 666 | if ($globalDebug) echo 'Add source stats : '; |
667 | - foreach($this->stats as $date => $data) { |
|
668 | - foreach($data as $source => $sourced) { |
|
667 | + foreach ($this->stats as $date => $data) { |
|
668 | + foreach ($data as $source => $sourced) { |
|
669 | 669 | //print_r($sourced); |
670 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
671 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
670 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar', $date); |
|
671 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist', $date); |
|
672 | 672 | if (isset($sourced['msg'])) { |
673 | 673 | if (time() - $sourced['msg']['date'] > 10) { |
674 | 674 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
675 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
675 | + echo $Stats->addStatSource($nbmsg, $source, 'msg', $date); |
|
676 | 676 | unset($this->stats[$date][$source]['msg']); |
677 | 677 | } |
678 | 678 | } |
@@ -708,18 +708,18 @@ discard block |
||
708 | 708 | //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
709 | 709 | $SpotterLive = new SpotterLive($this->db); |
710 | 710 | $SpotterLive->deleteLiveSpotterData(); |
711 | - $SpotterLive->db=null; |
|
711 | + $SpotterLive->db = null; |
|
712 | 712 | if ($globalDebug) echo " Done\n"; |
713 | 713 | $this->last_delete = time(); |
714 | 714 | } |
715 | 715 | } else { |
716 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) { |
|
716 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) { |
|
717 | 717 | $this->all_flights[$id]['id'] = $recent_ident; |
718 | 718 | $this->all_flights[$id]['addedSpotter'] = 1; |
719 | 719 | } |
720 | 720 | if (isset($globalDaemon) && !$globalDaemon) { |
721 | 721 | $Spotter = new Spotter($this->db); |
722 | - $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
722 | + $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time']); |
|
723 | 723 | $Spotter->db = null; |
724 | 724 | } |
725 | 725 | |
@@ -743,37 +743,37 @@ discard block |
||
743 | 743 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
744 | 744 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
745 | 745 | |
746 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
746 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
747 | 747 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
748 | 748 | $ignoreImport = true; |
749 | 749 | } |
750 | 750 | } |
751 | 751 | if (count($globalAirportAccept) > 0) { |
752 | 752 | $ignoreImport = true; |
753 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
753 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
754 | 754 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
755 | 755 | $ignoreImport = false; |
756 | 756 | } |
757 | 757 | } |
758 | 758 | } |
759 | 759 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
760 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
761 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
760 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
761 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
762 | 762 | $ignoreImport = true; |
763 | 763 | } |
764 | 764 | } |
765 | 765 | } |
766 | 766 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
767 | 767 | $ignoreImport = true; |
768 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
769 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
768 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
769 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
770 | 770 | $ignoreImport = false; |
771 | 771 | } |
772 | 772 | } |
773 | 773 | } |
774 | 774 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
775 | 775 | $ignoreImport = true; |
776 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
776 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
777 | 777 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
778 | 778 | $ignoreImport = false; |
779 | 779 | } |
@@ -781,13 +781,13 @@ discard block |
||
781 | 781 | } |
782 | 782 | |
783 | 783 | if (!$ignoreImport) { |
784 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
784 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
785 | 785 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
786 | 786 | $timeelapsed = microtime(true); |
787 | 787 | $SpotterLive = new SpotterLive($this->db); |
788 | - $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
788 | + $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
789 | 789 | $SpotterLive->db = null; |
790 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
790 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
791 | 791 | |
792 | 792 | // Put statistics in $this->stats variable |
793 | 793 | //if ($line['format_source'] != 'aprs') { |
@@ -805,19 +805,19 @@ discard block |
||
805 | 805 | $latitude = $globalCenterLatitude; |
806 | 806 | $longitude = $globalCenterLongitude; |
807 | 807 | } |
808 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
808 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
809 | 809 | } else { |
810 | 810 | $latitude = $this->source_location[$source]['latitude']; |
811 | 811 | $longitude = $this->source_location[$source]['longitude']; |
812 | 812 | } |
813 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
813 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
814 | 814 | //$stats_heading = $stats_heading%22.5; |
815 | 815 | $stats_heading = round($stats_heading/22.5); |
816 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
816 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
817 | 817 | $current_date = date('Y-m-d'); |
818 | 818 | if ($stats_heading == 16) $stats_heading = 0; |
819 | 819 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
820 | - for ($i=0;$i<=15;$i++) { |
|
820 | + for ($i = 0; $i <= 15; $i++) { |
|
821 | 821 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
822 | 822 | } |
823 | 823 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -832,9 +832,9 @@ discard block |
||
832 | 832 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
833 | 833 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
834 | 834 | end($this->stats[$current_date][$source]['hist']); |
835 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
835 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
836 | 836 | } else $mini = 0; |
837 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
837 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
838 | 838 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
839 | 839 | } |
840 | 840 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | if ($this->all_flights[$id]['putinarchive']) $send = true; |
848 | 848 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
849 | 849 | if ($globalDebug) echo $result."\n"; |
850 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
850 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
851 | 851 | //$this->del(); |
852 | 852 | |
853 | 853 |
@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | $title = _("Statistics"); |
8 | 8 | |
9 | 9 | if (!isset($filter_name)) $filter_name = ''; |
10 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
10 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
11 | 11 | if ($airline_icao == 'all') { |
12 | 12 | unset($_COOKIE['stats_airline_icao']); |
13 | - setcookie('stats_airline_icao', '', time()-3600); |
|
13 | + setcookie('stats_airline_icao', '', time() - 3600); |
|
14 | 14 | $airline_icao = ''; |
15 | 15 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
16 | 16 | $airline_icao = $_COOKIE['stats_airline_icao']; |
17 | 17 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
18 | 18 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
19 | 19 | } |
20 | -setcookie('stats_airline_icao',$airline_icao); |
|
20 | +setcookie('stats_airline_icao', $airline_icao); |
|
21 | 21 | require_once('header.php'); |
22 | 22 | |
23 | 23 | ?> |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | date_default_timezone_set('UTC'); |
38 | 38 | $lastupdate = strtotime($last_update[0]['value']); |
39 | 39 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
40 | - print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
|
40 | + print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>'; |
|
41 | 41 | } |
42 | 42 | ?> |
43 | 43 | </div> |
@@ -46,30 +46,30 @@ discard block |
||
46 | 46 | ?> |
47 | 47 | <?php include('statistics-sub-menu.php'); ?> |
48 | 48 | <p class="global-stats"> |
49 | - <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name)); ?></span> <?php echo _("Flights"); ?></span> |
|
50 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
51 | - <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
52 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
49 | + <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name)); ?></span> <?php echo _("Flights"); ?></span> |
|
50 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
51 | + <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
52 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
53 | 53 | <?php |
54 | 54 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
55 | 55 | ?> |
56 | - <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name)); ?></span> <?php echo _("Pilots"); ?></span> |
|
57 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
56 | + <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name)); ?></span> <?php echo _("Pilots"); ?></span> |
|
57 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
58 | 58 | <?php |
59 | 59 | } else { |
60 | 60 | ?> |
61 | - <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name)); ?></span> <?php echo _("Owners"); ?></span> |
|
62 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
61 | + <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name)); ?></span> <?php echo _("Owners"); ?></span> |
|
62 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
63 | 63 | <?php |
64 | 64 | } |
65 | 65 | ?> |
66 | - <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name)); ?></span> <?php echo _("Aircrafts"); ?></span> |
|
67 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
66 | + <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name)); ?></span> <?php echo _("Aircrafts"); ?></span> |
|
67 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
68 | 68 | <?php |
69 | 69 | if ($airline_icao == '') { |
70 | 70 | ?> |
71 | 71 | <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name)); ?></span> <?php echo _("Airlines"); ?></span> |
72 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
72 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
73 | 73 | <?php |
74 | 74 | } |
75 | 75 | ?> |
@@ -77,18 +77,18 @@ discard block |
||
77 | 77 | if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) { |
78 | 78 | ?> |
79 | 79 | <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name)); ?></span> <?php echo _("Military"); ?></span> |
80 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
80 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
81 | 81 | <?php |
82 | 82 | } |
83 | 83 | ?> |
84 | 84 | </p> |
85 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
85 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
86 | 86 | <div class="specific-stats"> |
87 | 87 | <div class="row column"> |
88 | 88 | <div class="col-md-6"> |
89 | 89 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
90 | 90 | <?php |
91 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name); |
|
91 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name); |
|
92 | 92 | if (count($aircraft_array) == 0) print _("No data available"); |
93 | 93 | else { |
94 | 94 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | var data = google.visualization.arrayToDataTable([ |
101 | 101 | ["'._("Aircraft").'", "'._("# of times").'"], '; |
102 | 102 | $aircraft_data = ''; |
103 | - foreach($aircraft_array as $aircraft_item) |
|
103 | + foreach ($aircraft_array as $aircraft_item) |
|
104 | 104 | { |
105 | 105 | $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
106 | 106 | } |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
128 | 128 | </div> |
129 | 129 | </div> |
130 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
130 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
131 | 131 | <?php |
132 | 132 | // echo $airline_icao; |
133 | 133 | if ($airline_icao == '' || $airline_icao == 'all') { |
134 | - $airline_array = $Stats->countAllAirlines(true,$filter_name); |
|
134 | + $airline_array = $Stats->countAllAirlines(true, $filter_name); |
|
135 | 135 | if (count($airline_array) > 0) { |
136 | 136 | print '<div class="col-md-6">'; |
137 | 137 | print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | var data = google.visualization.arrayToDataTable([ |
144 | 144 | ["'._("Airline").'", "'._("# of times").'"], '; |
145 | 145 | $airline_data = ''; |
146 | - foreach($airline_array as $airline_item) |
|
146 | + foreach ($airline_array as $airline_item) |
|
147 | 147 | { |
148 | 148 | $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
149 | 149 | } |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | } |
170 | 170 | ?> |
171 | 171 | </div> |
172 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
172 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
173 | 173 | <?php |
174 | 174 | } |
175 | 175 | ?> |
176 | 176 | <div class="row column"> |
177 | 177 | <?php |
178 | - $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name); |
|
178 | + $flightover_array = $Stats->countAllFlightOverCountries($airline_icao, $filter_name); |
|
179 | 179 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
180 | 180 | if (empty($flightover_array)) { |
181 | 181 | print '<div class="col-md-12">'; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | ?> |
186 | 186 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
187 | 187 | <?php |
188 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name); |
|
188 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name); |
|
189 | 189 | if (count($pilot_array) == 0) print _("No data available"); |
190 | 190 | else { |
191 | 191 | print '<div id="chart7" class="chart" width="100%"></div> |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | var data = google.visualization.arrayToDataTable([ |
197 | 197 | ["'._("Pilots").'", "'._("# of times").'"], '; |
198 | 198 | $pilot_data = ''; |
199 | - foreach($pilot_array as $pilot_item) |
|
199 | + foreach ($pilot_array as $pilot_item) |
|
200 | 200 | { |
201 | 201 | $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
202 | 202 | } |
@@ -224,14 +224,14 @@ discard block |
||
224 | 224 | </div> |
225 | 225 | </div> |
226 | 226 | |
227 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
227 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
228 | 228 | <?php |
229 | 229 | } else { |
230 | 230 | ?> |
231 | 231 | <div class="col-md-6"> |
232 | 232 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
233 | 233 | <?php |
234 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name); |
|
234 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name); |
|
235 | 235 | if (count($owner_array) == 0) print _("No data available"); |
236 | 236 | else { |
237 | 237 | print '<div id="chart7" class="chart" width="100%"></div> |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | var data = google.visualization.arrayToDataTable([ |
243 | 243 | ["'._("Owner").'", "'._("# of times").'"], '; |
244 | 244 | $owner_data = ''; |
245 | - foreach($owner_array as $owner_item) |
|
245 | + foreach ($owner_array as $owner_item) |
|
246 | 246 | { |
247 | 247 | $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
248 | 248 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | </div> |
271 | 271 | </div> |
272 | 272 | |
273 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
273 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
274 | 274 | <?php |
275 | 275 | } |
276 | 276 | if (!empty($flightover_array)) { |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | var data = google.visualization.arrayToDataTable([ |
290 | 290 | ["'._("Country").'", "'._("# of times").'"], '; |
291 | 291 | $flightover_data = ''; |
292 | - foreach($flightover_array as $flightover_item) |
|
292 | + foreach ($flightover_array as $flightover_item) |
|
293 | 293 | { |
294 | 294 | $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],'; |
295 | 295 | } |
@@ -322,14 +322,14 @@ discard block |
||
322 | 322 | } |
323 | 323 | ?> |
324 | 324 | </div> |
325 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
325 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
326 | 326 | |
327 | 327 | |
328 | 328 | </div> |
329 | 329 | <div class="row column"> |
330 | 330 | <div class="col-md-6"> |
331 | 331 | <?php |
332 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name); |
|
332 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name); |
|
333 | 333 | if (count($airport_airport_array) > 0) { |
334 | 334 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
335 | 335 | print '<div id="chart3" class="chart" width="100%"></div> |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | var data = google.visualization.arrayToDataTable([ |
345 | 345 | ["'._("Airport").'", "'._("# of times").'"],'; |
346 | 346 | $airport_data = ''; |
347 | - foreach($airport_airport_array as $airport_item) |
|
347 | + foreach ($airport_airport_array as $airport_item) |
|
348 | 348 | { |
349 | 349 | $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
350 | 350 | $name = str_replace("'", "", $name); |
@@ -371,11 +371,11 @@ discard block |
||
371 | 371 | } |
372 | 372 | ?> |
373 | 373 | </div> |
374 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
374 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
375 | 375 | |
376 | 376 | <div class="col-md-6"> |
377 | 377 | <?php |
378 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name); |
|
378 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name); |
|
379 | 379 | if (count($airport_airport_array2) > 0) { |
380 | 380 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
381 | 381 | print '<div id="chart4" class="chart" width="100%"></div> |
@@ -390,10 +390,10 @@ discard block |
||
390 | 390 | var data = google.visualization.arrayToDataTable([ |
391 | 391 | ["'._("Airport").'", "'._("# of times").'"],'; |
392 | 392 | $airport_data2 = ''; |
393 | - foreach($airport_airport_array2 as $airport_item2) |
|
393 | + foreach ($airport_airport_array2 as $airport_item2) |
|
394 | 394 | { |
395 | 395 | $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')'; |
396 | - $name2 = str_replace(array("'",'"'), '', $name2); |
|
396 | + $name2 = str_replace(array("'", '"'), '', $name2); |
|
397 | 397 | $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],'; |
398 | 398 | } |
399 | 399 | $airport_data2 = substr($airport_data2, 0, -1); |
@@ -417,13 +417,13 @@ discard block |
||
417 | 417 | ?> |
418 | 418 | </div> |
419 | 419 | </div> |
420 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
420 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
421 | 421 | |
422 | 422 | <div class="row column"> |
423 | 423 | <div class="col-md-6"> |
424 | 424 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
425 | 425 | <?php |
426 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
426 | + $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
427 | 427 | if (count($year_array) == 0) print _("No data available"); |
428 | 428 | else { |
429 | 429 | print '<div id="chart8" class="chart" width="100%"></div> |
@@ -434,9 +434,9 @@ discard block |
||
434 | 434 | var data = google.visualization.arrayToDataTable([ |
435 | 435 | ["'._("Month").'", "'._("# of Flights").'"], '; |
436 | 436 | $year_data = ''; |
437 | - foreach($year_array as $year_item) |
|
437 | + foreach ($year_array as $year_item) |
|
438 | 438 | { |
439 | - $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],'; |
|
439 | + $year_data .= '[ "'.date('F, Y', strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],'; |
|
440 | 440 | } |
441 | 441 | $year_data = substr($year_data, 0, -1); |
442 | 442 | print $year_data; |
@@ -464,12 +464,12 @@ discard block |
||
464 | 464 | <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
465 | 465 | </div> |
466 | 466 | </div> |
467 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
467 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
468 | 468 | |
469 | 469 | <div class="col-md-6"> |
470 | 470 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
471 | 471 | <?php |
472 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
472 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
473 | 473 | if (count($month_array) == 0) print _("No data available"); |
474 | 474 | else { |
475 | 475 | print '<div id="chart9" class="chart" width="100%"></div> |
@@ -480,9 +480,9 @@ discard block |
||
480 | 480 | var data = google.visualization.arrayToDataTable([ |
481 | 481 | ["'._("Day").'", "'._("# of Flights").'"], '; |
482 | 482 | $month_data = ''; |
483 | - foreach($month_array as $month_item) |
|
483 | + foreach ($month_array as $month_item) |
|
484 | 484 | { |
485 | - $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],'; |
|
485 | + $month_data .= '[ "'.date('F j, Y', strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],'; |
|
486 | 486 | } |
487 | 487 | $month_data = substr($month_data, 0, -1); |
488 | 488 | print $month_data; |
@@ -510,12 +510,12 @@ discard block |
||
510 | 510 | <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
511 | 511 | </div> |
512 | 512 | </div> |
513 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
513 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
514 | 514 | |
515 | 515 | <div class="col-md-6"> |
516 | 516 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
517 | 517 | <?php |
518 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
518 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
519 | 519 | if (empty($date_array)) print _("No data available"); |
520 | 520 | else { |
521 | 521 | print '<div id="chart5" class="chart" width="100%"></div> |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | ["'._("Date").'", "'._("# of Flights").'"], '; |
528 | 528 | $date_data = ''; |
529 | 529 | |
530 | - foreach($date_array as $date_item) |
|
530 | + foreach ($date_array as $date_item) |
|
531 | 531 | { |
532 | 532 | $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],'; |
533 | 533 | } |
@@ -557,12 +557,12 @@ discard block |
||
557 | 557 | <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
558 | 558 | </div> |
559 | 559 | </div> |
560 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
560 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
561 | 561 | |
562 | 562 | <div class="col-md-6"> |
563 | 563 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
564 | 564 | <?php |
565 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
565 | + $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
566 | 566 | if (empty($hour_array)) print _("No data available"); |
567 | 567 | else { |
568 | 568 | |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | var data = google.visualization.arrayToDataTable([ |
575 | 575 | ["'._("Hour").'", "'._("# of Flights").'"], '; |
576 | 576 | $hour_data = ''; |
577 | - foreach($hour_array as $hour_item) |
|
577 | + foreach ($hour_array as $hour_item) |
|
578 | 578 | { |
579 | 579 | $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],'; |
580 | 580 | } |
@@ -604,21 +604,21 @@ discard block |
||
604 | 604 | <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
605 | 605 | </div> |
606 | 606 | </div> |
607 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
607 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
608 | 608 | </div> |
609 | 609 | <?php |
610 | 610 | if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') { |
611 | 611 | ?> |
612 | 612 | <div class="row column"> |
613 | 613 | <?php |
614 | - $polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
|
614 | + $polar = $Stats->getStatsSource(date('Y-m-d'), 'polar'); |
|
615 | 615 | if (!empty($polar)) { |
616 | 616 | print '<h2>'._("Coverage pattern").'</h2>'; |
617 | 617 | foreach ($polar as $eachpolar) { |
618 | 618 | unset($polar_data); |
619 | 619 | $Spotter = new Spotter(); |
620 | 620 | $data = json_decode($eachpolar['source_data']); |
621 | - foreach($data as $value => $key) { |
|
621 | + foreach ($data as $value => $key) { |
|
622 | 622 | $direction = $Spotter->parseDirection(($value*22.5)); |
623 | 623 | $distance = $key; |
624 | 624 | $unit = 'km'; |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | ?> |
639 | 639 | <div class="col-md-6"> |
640 | 640 | <h4><?php print $eachpolar['source_name']; ?></h4> |
641 | - <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
641 | + <div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
642 | 642 | <script> |
643 | 643 | (function() { |
644 | 644 | var margin = {top: 100, right: 100, bottom: 100, left: 100}, |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | color: color, |
663 | 663 | unit: '<?php echo $unit; ?>' |
664 | 664 | }; |
665 | - RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
665 | + RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
666 | 666 | })(); |
667 | 667 | </script> |
668 | 668 | </div> |
@@ -674,19 +674,19 @@ discard block |
||
674 | 674 | <div class="row column"> |
675 | 675 | <div class="col-md-6"> |
676 | 676 | <?php |
677 | - $msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
|
677 | + $msg = $Stats->getStatsSource(date('Y-m-d'), 'msg'); |
|
678 | 678 | if (!empty($msg)) { |
679 | 679 | print '<h2>'._("Messages received").'</h2>'; |
680 | 680 | foreach ($msg as $eachmsg) { |
681 | 681 | //$eachmsg = $msg[0]; |
682 | 682 | $data = $eachmsg['source_data']; |
683 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
683 | + if ($data > 500) $max = (round(($data + 100)/100))*100; |
|
684 | 684 | else $max = 500; |
685 | 685 | ?> |
686 | - <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
686 | + <div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
687 | 687 | <script> |
688 | 688 | var g = new JustGage({ |
689 | - id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>", |
|
689 | + id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>", |
|
690 | 690 | value: <?php echo $data; ?>, |
691 | 691 | min: 0, |
692 | 692 | max: <?php print $max; ?>, |
@@ -706,12 +706,12 @@ discard block |
||
706 | 706 | <div class="row column"> |
707 | 707 | |
708 | 708 | <?php |
709 | - $hist = $Stats->getStatsSource(date('Y-m-d'),'hist'); |
|
709 | + $hist = $Stats->getStatsSource(date('Y-m-d'), 'hist'); |
|
710 | 710 | foreach ($hist as $hists) { |
711 | 711 | $hist_data = ''; |
712 | 712 | $source = $hists['source_name']; |
713 | 713 | $hist_array = json_decode($hists['source_data']); |
714 | - foreach($hist_array as $distance => $nb) |
|
714 | + foreach ($hist_array as $distance => $nb) |
|
715 | 715 | { |
716 | 716 | $unit = 'km'; |
717 | 717 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -729,13 +729,13 @@ discard block |
||
729 | 729 | $hist_data = substr($hist_data, 0, -1); |
730 | 730 | ?> |
731 | 731 | <div class="col-md-6"> |
732 | - <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2> |
|
732 | + <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2> |
|
733 | 733 | <?php |
734 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div> |
|
734 | + print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div> |
|
735 | 735 | <script> |
736 | 736 | google.load("visualization", "1", {packages:["corechart"]}); |
737 | - google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).'); |
|
738 | - function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() { |
|
737 | + google.setOnLoadCallback(drawCharthist_'.str_replace(' ', '_', strtolower($source)).'); |
|
738 | + function drawCharthist_'.str_replace(' ', '_', strtolower($source)).'() { |
|
739 | 739 | var data = google.visualization.arrayToDataTable([ |
740 | 740 | ["'._("Distance").'", "'._("# of Flights").'"], '; |
741 | 741 | print $hist_data; |
@@ -750,16 +750,16 @@ discard block |
||
750 | 750 | colors: ["#1a3151"] |
751 | 751 | }; |
752 | 752 | |
753 | - var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ','_',strtolower($source)).'")); |
|
753 | + var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ', '_', strtolower($source)).'")); |
|
754 | 754 | chart.draw(data, options); |
755 | 755 | } |
756 | 756 | $(window).resize(function(){ |
757 | - drawCharthist_'.str_replace(' ','_',strtolower($source)).'(); |
|
757 | + drawCharthist_'.str_replace(' ', '_', strtolower($source)).'(); |
|
758 | 758 | }); |
759 | 759 | </script>'; |
760 | 760 | ?> |
761 | 761 | </div> |
762 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
762 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
763 | 763 | <?php |
764 | 764 | } |
765 | 765 | ?> |
@@ -25,22 +25,22 @@ discard block |
||
25 | 25 | $min = false; |
26 | 26 | $allhistory = false; |
27 | 27 | $filter['source'] = array(); |
28 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
29 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
30 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
31 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
32 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
33 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
34 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
35 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
36 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
28 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
29 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
30 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
31 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs')); |
|
32 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
33 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
34 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
35 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
36 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
37 | 37 | |
38 | 38 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
39 | 39 | $min = true; |
40 | 40 | } |
41 | 41 | |
42 | 42 | if (isset($_GET['ident'])) { |
43 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
43 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
44 | 44 | $spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident); |
45 | 45 | if (empty($spotter_array)) { |
46 | 46 | $from_archive = true; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | $allhistory = true; |
50 | 50 | } elseif (isset($_GET['flightaware_id'])) { |
51 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
51 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
52 | 52 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
53 | 53 | if (empty($spotter_array)) { |
54 | 54 | $from_archive = true; |
@@ -57,25 +57,25 @@ discard block |
||
57 | 57 | $allhistory = true; |
58 | 58 | } elseif (isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) { |
59 | 59 | //if (isset($_GET['coord'])) { |
60 | - $coord = explode(',',$_GET['coord']); |
|
61 | - $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter); |
|
60 | + $coord = explode(',', $_GET['coord']); |
|
61 | + $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter); |
|
62 | 62 | |
63 | 63 | #} elseif (isset($globalMapPopup) && !$globalMapPopup) { |
64 | 64 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
65 | 65 | $from_archive = true; |
66 | 66 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
67 | 67 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
68 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
69 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
70 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
71 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
72 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
73 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
68 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
69 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
70 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
71 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
72 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
73 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
74 | 74 | } elseif ($min) { |
75 | 75 | $spotter_array = $SpotterLive->getMinLiveSpotterData($filter); |
76 | 76 | # $min = true; |
77 | 77 | } else { |
78 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
78 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | if (!empty($spotter_array)) { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if ($flightcnt == '') $flightcnt = 0; |
91 | 91 | } else $flightcnt = 0; |
92 | 92 | |
93 | -$sqltime = round(microtime(true)-$begintime,2); |
|
93 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
94 | 94 | |
95 | 95 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
96 | 96 | else $usenextlatlon = true; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | if (!empty($spotter_array) && is_array($spotter_array)) |
108 | 108 | { |
109 | 109 | $output .= '"features": ['; |
110 | - foreach($spotter_array as $spotter_item) |
|
110 | + foreach ($spotter_array as $spotter_item) |
|
111 | 111 | { |
112 | 112 | $j++; |
113 | 113 | date_default_timezone_set('UTC'); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
159 | 159 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
160 | 160 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
161 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
161 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
162 | 162 | } elseif (isset($spotter_item['aircraft_type'])) { |
163 | 163 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
164 | 164 | } elseif (!$min) { |
@@ -227,16 +227,16 @@ discard block |
||
227 | 227 | else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
228 | 228 | |
229 | 229 | if (isset($archivespeed)) { |
230 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
230 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed); |
|
231 | 231 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
232 | 232 | } elseif ($usenextlatlon) { |
233 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
233 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']); |
|
234 | 234 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
235 | 235 | } |
236 | 236 | |
237 | 237 | if (!$min) $output .= '"image": "'.$image.'",'; |
238 | 238 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
239 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
239 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
240 | 240 | } |
241 | 241 | if (isset($spotter_item['image_source_website'])) { |
242 | 242 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
259 | 259 | } |
260 | 260 | if (isset($spotter_item['acars'])) { |
261 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
261 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
262 | 262 | } |
263 | 263 | // type when not aircraft ? |
264 | 264 | if ($compress) $output .= '"t": "aircraft"'; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | |
329 | 329 | } |
330 | 330 | */ |
331 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
331 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
332 | 332 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
333 | 333 | |
334 | 334 | if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -355,9 +355,9 @@ discard block |
||
355 | 355 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
356 | 356 | } |
357 | 357 | $output_history .= '['; |
358 | - $output_history .= $spotter_history['longitude'].', '; |
|
359 | - $output_history .= $spotter_history['latitude'].', '; |
|
360 | - $output_history .= $spotter_history['altitude']*30.48; |
|
358 | + $output_history .= $spotter_history['longitude'].', '; |
|
359 | + $output_history .= $spotter_history['latitude'].', '; |
|
360 | + $output_history .= $spotter_history['altitude']*30.48; |
|
361 | 361 | $output_history .= '],'; |
362 | 362 | $prev_alt = $alt; |
363 | 363 | //} |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | $output = substr($output, 0, -1); |
398 | 398 | $output .= ']'; |
399 | 399 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
400 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
400 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
401 | 401 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
402 | 402 | $output .= '"fc": "'.$j.'"'; |
403 | 403 | } else { |
@@ -16,64 +16,64 @@ 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['airlinestype']) && !empty($filter['airlinestype'])) { |
61 | 61 | $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 "; |
62 | 62 | } |
63 | 63 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
64 | - $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"; |
|
64 | + $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"; |
|
65 | 65 | } |
66 | 66 | if (isset($filter['source']) && !empty($filter['source'])) { |
67 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
67 | + $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')"; |
|
68 | 68 | } |
69 | 69 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
70 | 70 | $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
71 | 71 | } |
72 | 72 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
73 | 73 | if ($filter_query_where == '') { |
74 | - $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
74 | + $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
75 | 75 | } else { |
76 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
76 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | if ($limit != '') |
100 | 100 | { |
101 | 101 | $limit_array = explode(',', $limit); |
102 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
103 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
102 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
103 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
104 | 104 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
105 | 105 | { |
106 | 106 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } else { |
121 | 121 | $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; |
122 | 122 | } |
123 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
123 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
124 | 124 | |
125 | 125 | return $spotter_array; |
126 | 126 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | global $globalDBdriver, $globalLiveInterval; |
137 | 137 | date_default_timezone_set('UTC'); |
138 | 138 | |
139 | - $filter_query = $this->getFilter($filter,true,true); |
|
139 | + $filter_query = $this->getFilter($filter, true, true); |
|
140 | 140 | |
141 | 141 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
142 | 142 | if ($globalDBdriver == 'mysql') { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $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 |
148 | 148 | 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"; |
149 | 149 | */ |
150 | - $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 |
|
150 | + $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 |
|
151 | 151 | 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"; |
152 | 152 | |
153 | 153 | // $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; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | 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'"; |
163 | 163 | */ |
164 | 164 | |
165 | - $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 |
|
165 | + $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 |
|
166 | 166 | 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'"; |
167 | 167 | |
168 | 168 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | try { |
174 | 174 | $sth = $this->db->prepare($query); |
175 | 175 | $sth->execute(); |
176 | - } catch(PDOException $e) { |
|
176 | + } catch (PDOException $e) { |
|
177 | 177 | echo $e->getMessage(); |
178 | 178 | die; |
179 | 179 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | global $globalDBdriver, $globalLiveInterval; |
194 | 194 | date_default_timezone_set('UTC'); |
195 | 195 | |
196 | - $filter_query = $this->getFilter($filter,true,true); |
|
196 | + $filter_query = $this->getFilter($filter, true, true); |
|
197 | 197 | |
198 | 198 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
199 | 199 | if ($globalDBdriver == 'mysql') { |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | 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' |
203 | 203 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
204 | 204 | */ |
205 | - $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 |
|
205 | + $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 |
|
206 | 206 | 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' |
207 | 207 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
208 | 208 | } else { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | 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' |
212 | 212 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
213 | 213 | */ |
214 | - $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 |
|
214 | + $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 |
|
215 | 215 | 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' |
216 | 216 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
217 | 217 | // echo $query; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | try { |
221 | 221 | $sth = $this->db->prepare($query); |
222 | 222 | $sth->execute(); |
223 | - } catch(PDOException $e) { |
|
223 | + } catch (PDOException $e) { |
|
224 | 224 | echo $e->getMessage(); |
225 | 225 | die; |
226 | 226 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | public function getLiveSpotterCount($filter = array()) |
238 | 238 | { |
239 | 239 | global $globalDBdriver, $globalLiveInterval; |
240 | - $filter_query = $this->getFilter($filter,true,true); |
|
240 | + $filter_query = $this->getFilter($filter, true, true); |
|
241 | 241 | |
242 | 242 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
243 | 243 | if ($globalDBdriver == 'mysql') { |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | try { |
251 | 251 | $sth = $this->db->prepare($query); |
252 | 252 | $sth->execute(); |
253 | - } catch(PDOException $e) { |
|
253 | + } catch (PDOException $e) { |
|
254 | 254 | echo $e->getMessage(); |
255 | 255 | die; |
256 | 256 | } |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | $filter_query = $this->getFilter($filter); |
274 | 274 | |
275 | 275 | if (is_array($coord)) { |
276 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
277 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
278 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
279 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
276 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
277 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
278 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
279 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
280 | 280 | } else return array(); |
281 | 281 | if ($globalDBdriver == 'mysql') { |
282 | 282 | //$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.")"; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | if ($interval == '1m') |
330 | 330 | { |
331 | 331 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
332 | - } else if ($interval == '15m'){ |
|
332 | + } else if ($interval == '15m') { |
|
333 | 333 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
334 | 334 | } |
335 | 335 | } |
@@ -337,14 +337,14 @@ discard block |
||
337 | 337 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
338 | 338 | } |
339 | 339 | |
340 | - $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 |
|
340 | + $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 |
|
341 | 341 | WHERE spotter_live.latitude <> '' |
342 | 342 | AND spotter_live.longitude <> '' |
343 | 343 | ".$additional_query." |
344 | 344 | HAVING distance < :radius |
345 | 345 | ORDER BY distance"; |
346 | 346 | |
347 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
347 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
348 | 348 | |
349 | 349 | return $spotter_array; |
350 | 350 | } |
@@ -362,9 +362,9 @@ discard block |
||
362 | 362 | date_default_timezone_set('UTC'); |
363 | 363 | |
364 | 364 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
365 | - $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'; |
|
365 | + $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'; |
|
366 | 366 | |
367 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
367 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
368 | 368 | |
369 | 369 | return $spotter_array; |
370 | 370 | } |
@@ -375,16 +375,16 @@ discard block |
||
375 | 375 | * @return Array the spotter information |
376 | 376 | * |
377 | 377 | */ |
378 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
378 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
379 | 379 | { |
380 | 380 | $Spotter = new Spotter($this->db); |
381 | 381 | date_default_timezone_set('UTC'); |
382 | 382 | |
383 | 383 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
384 | - $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'; |
|
384 | + $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'; |
|
385 | 385 | |
386 | - $date = date('c',$date); |
|
387 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
386 | + $date = date('c', $date); |
|
387 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
388 | 388 | |
389 | 389 | return $spotter_array; |
390 | 390 | } |
@@ -401,9 +401,9 @@ discard block |
||
401 | 401 | date_default_timezone_set('UTC'); |
402 | 402 | |
403 | 403 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
404 | - $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'; |
|
404 | + $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'; |
|
405 | 405 | |
406 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
406 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
407 | 407 | |
408 | 408 | return $spotter_array; |
409 | 409 | } |
@@ -414,15 +414,15 @@ discard block |
||
414 | 414 | * @return Array the spotter information |
415 | 415 | * |
416 | 416 | */ |
417 | - public function getDateLiveSpotterDataById($id,$date) |
|
417 | + public function getDateLiveSpotterDataById($id, $date) |
|
418 | 418 | { |
419 | 419 | $Spotter = new Spotter($this->db); |
420 | 420 | date_default_timezone_set('UTC'); |
421 | 421 | |
422 | 422 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
423 | - $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'; |
|
424 | - $date = date('c',$date); |
|
425 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
423 | + $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'; |
|
424 | + $date = date('c', $date); |
|
425 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
426 | 426 | |
427 | 427 | return $spotter_array; |
428 | 428 | } |
@@ -439,13 +439,13 @@ discard block |
||
439 | 439 | date_default_timezone_set('UTC'); |
440 | 440 | |
441 | 441 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
442 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
442 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
443 | 443 | |
444 | 444 | try { |
445 | 445 | |
446 | 446 | $sth = $this->db->prepare($query); |
447 | 447 | $sth->execute(array(':ident' => $ident)); |
448 | - } catch(PDOException $e) { |
|
448 | + } catch (PDOException $e) { |
|
449 | 449 | echo $e->getMessage(); |
450 | 450 | die; |
451 | 451 | } |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @return Array the spotter information |
461 | 461 | * |
462 | 462 | */ |
463 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
463 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
464 | 464 | { |
465 | 465 | global $globalDBdriver, $globalLiveInterval; |
466 | 466 | date_default_timezone_set('UTC'); |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | try { |
480 | 480 | $sth = $this->db->prepare($query); |
481 | 481 | $sth->execute(array(':id' => $id)); |
482 | - } catch(PDOException $e) { |
|
482 | + } catch (PDOException $e) { |
|
483 | 483 | echo $e->getMessage(); |
484 | 484 | die; |
485 | 485 | } |
@@ -497,12 +497,12 @@ discard block |
||
497 | 497 | { |
498 | 498 | date_default_timezone_set('UTC'); |
499 | 499 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
500 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
500 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
501 | 501 | try { |
502 | 502 | |
503 | 503 | $sth = $this->db->prepare($query); |
504 | 504 | $sth->execute(array(':ident' => $ident)); |
505 | - } catch(PDOException $e) { |
|
505 | + } catch (PDOException $e) { |
|
506 | 506 | echo $e->getMessage(); |
507 | 507 | die; |
508 | 508 | } |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | |
533 | 533 | $sth = $this->db->prepare($query); |
534 | 534 | $sth->execute(); |
535 | - } catch(PDOException $e) { |
|
535 | + } catch (PDOException $e) { |
|
536 | 536 | return "error"; |
537 | 537 | } |
538 | 538 | |
@@ -555,14 +555,14 @@ discard block |
||
555 | 555 | |
556 | 556 | $sth = $this->db->prepare($query); |
557 | 557 | $sth->execute(); |
558 | - } catch(PDOException $e) { |
|
558 | + } catch (PDOException $e) { |
|
559 | 559 | return "error"; |
560 | 560 | } |
561 | 561 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
562 | 562 | $i = 0; |
563 | - $j =0; |
|
563 | + $j = 0; |
|
564 | 564 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
565 | - foreach($all as $row) |
|
565 | + foreach ($all as $row) |
|
566 | 566 | { |
567 | 567 | $i++; |
568 | 568 | $j++; |
@@ -570,9 +570,9 @@ discard block |
||
570 | 570 | if ($globalDebug) echo "."; |
571 | 571 | try { |
572 | 572 | |
573 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
573 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
574 | 574 | $sth->execute(); |
575 | - } catch(PDOException $e) { |
|
575 | + } catch (PDOException $e) { |
|
576 | 576 | return "error"; |
577 | 577 | } |
578 | 578 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -583,9 +583,9 @@ discard block |
||
583 | 583 | if ($i > 0) { |
584 | 584 | try { |
585 | 585 | |
586 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
586 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
587 | 587 | $sth->execute(); |
588 | - } catch(PDOException $e) { |
|
588 | + } catch (PDOException $e) { |
|
589 | 589 | return "error"; |
590 | 590 | } |
591 | 591 | } |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | |
599 | 599 | $sth = $this->db->prepare($query); |
600 | 600 | $sth->execute(); |
601 | - } catch(PDOException $e) { |
|
601 | + } catch (PDOException $e) { |
|
602 | 602 | return "error"; |
603 | 603 | } |
604 | 604 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -646,13 +646,13 @@ discard block |
||
646 | 646 | public function deleteLiveSpotterDataByIdent($ident) |
647 | 647 | { |
648 | 648 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
649 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
649 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
650 | 650 | |
651 | 651 | try { |
652 | 652 | |
653 | 653 | $sth = $this->db->prepare($query); |
654 | 654 | $sth->execute(array(':ident' => $ident)); |
655 | - } catch(PDOException $e) { |
|
655 | + } catch (PDOException $e) { |
|
656 | 656 | return "error"; |
657 | 657 | } |
658 | 658 | |
@@ -668,13 +668,13 @@ discard block |
||
668 | 668 | public function deleteLiveSpotterDataById($id) |
669 | 669 | { |
670 | 670 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
671 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
671 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
672 | 672 | |
673 | 673 | try { |
674 | 674 | |
675 | 675 | $sth = $this->db->prepare($query); |
676 | 676 | $sth->execute(array(':id' => $id)); |
677 | - } catch(PDOException $e) { |
|
677 | + } catch (PDOException $e) { |
|
678 | 678 | return "error"; |
679 | 679 | } |
680 | 680 | |
@@ -692,13 +692,13 @@ discard block |
||
692 | 692 | { |
693 | 693 | global $globalDBdriver, $globalTimezone; |
694 | 694 | if ($globalDBdriver == 'mysql') { |
695 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
695 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
696 | 696 | WHERE spotter_live.ident = :ident |
697 | 697 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
698 | 698 | AND spotter_live.date < UTC_TIMESTAMP()'; |
699 | 699 | $query_data = array(':ident' => $ident); |
700 | 700 | } else { |
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 >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
704 | 704 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -707,8 +707,8 @@ discard block |
||
707 | 707 | |
708 | 708 | $sth = $this->db->prepare($query); |
709 | 709 | $sth->execute($query_data); |
710 | - $ident_result=''; |
|
711 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
710 | + $ident_result = ''; |
|
711 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
712 | 712 | { |
713 | 713 | $ident_result = $row['ident']; |
714 | 714 | } |
@@ -725,13 +725,13 @@ discard block |
||
725 | 725 | { |
726 | 726 | global $globalDBdriver, $globalTimezone; |
727 | 727 | if ($globalDBdriver == 'mysql') { |
728 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
728 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
729 | 729 | WHERE spotter_live.ident = :ident |
730 | 730 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
731 | 731 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
732 | 732 | $query_data = array(':ident' => $ident); |
733 | 733 | } else { |
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 >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
737 | 737 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -740,8 +740,8 @@ discard block |
||
740 | 740 | |
741 | 741 | $sth = $this->db->prepare($query); |
742 | 742 | $sth->execute($query_data); |
743 | - $ident_result=''; |
|
744 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
743 | + $ident_result = ''; |
|
744 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
745 | 745 | { |
746 | 746 | $ident_result = $row['flightaware_id']; |
747 | 747 | } |
@@ -758,13 +758,13 @@ discard block |
||
758 | 758 | { |
759 | 759 | global $globalDBdriver, $globalTimezone; |
760 | 760 | if ($globalDBdriver == 'mysql') { |
761 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
761 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
762 | 762 | WHERE spotter_live.flightaware_id = :id |
763 | 763 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
764 | 764 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
765 | 765 | $query_data = array(':id' => $id); |
766 | 766 | } else { |
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 >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
770 | 770 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -773,8 +773,8 @@ discard block |
||
773 | 773 | |
774 | 774 | $sth = $this->db->prepare($query); |
775 | 775 | $sth->execute($query_data); |
776 | - $ident_result=''; |
|
777 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
776 | + $ident_result = ''; |
|
777 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
778 | 778 | { |
779 | 779 | $ident_result = $row['flightaware_id']; |
780 | 780 | } |
@@ -791,13 +791,13 @@ discard block |
||
791 | 791 | { |
792 | 792 | global $globalDBdriver, $globalTimezone; |
793 | 793 | if ($globalDBdriver == 'mysql') { |
794 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
794 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
795 | 795 | WHERE spotter_live.ModeS = :modes |
796 | 796 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
797 | 797 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
798 | 798 | $query_data = array(':modes' => $modes); |
799 | 799 | } else { |
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 >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'"; |
803 | 803 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -806,8 +806,8 @@ discard block |
||
806 | 806 | |
807 | 807 | $sth = $this->db->prepare($query); |
808 | 808 | $sth->execute($query_data); |
809 | - $ident_result=''; |
|
810 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
809 | + $ident_result = ''; |
|
810 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
811 | 811 | { |
812 | 812 | //$ident_result = $row['spotter_live_id']; |
813 | 813 | $ident_result = $row['flightaware_id']; |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | * @return String success or false |
827 | 827 | * |
828 | 828 | */ |
829 | - 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 = '') |
|
829 | + 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 = '') |
|
830 | 830 | { |
831 | 831 | global $globalURL, $globalArchive, $globalDebug; |
832 | 832 | $Common = new Common(); |
@@ -919,26 +919,26 @@ discard block |
||
919 | 919 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
920 | 920 | |
921 | 921 | |
922 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
923 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
924 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
925 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
926 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
927 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
928 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
929 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
930 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
931 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
932 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
933 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
934 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
935 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
936 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
937 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
938 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
939 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
940 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
941 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
922 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
923 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
924 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
925 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
926 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
927 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
928 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
929 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
930 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
931 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
932 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
933 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
934 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
935 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
936 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
937 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
938 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
939 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
940 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
941 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
942 | 942 | |
943 | 943 | $airline_name = ''; |
944 | 944 | $airline_icao = ''; |
@@ -960,26 +960,26 @@ discard block |
||
960 | 960 | $arrival_airport_country = ''; |
961 | 961 | |
962 | 962 | |
963 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
964 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
965 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
966 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
963 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
964 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
965 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
966 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
967 | 967 | |
968 | - $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) |
|
968 | + $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) |
|
969 | 969 | 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)'; |
970 | 970 | |
971 | - $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); |
|
971 | + $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); |
|
972 | 972 | try { |
973 | 973 | |
974 | 974 | $sth = $this->db->prepare($query); |
975 | 975 | $sth->execute($query_values); |
976 | - } catch(PDOException $e) { |
|
976 | + } catch (PDOException $e) { |
|
977 | 977 | return "error : ".$e->getMessage(); |
978 | 978 | } |
979 | 979 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
980 | 980 | if ($globalDebug) echo '(Add to SBS archive : '; |
981 | 981 | $SpotterArchive = new SpotterArchive($this->db); |
982 | - $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); |
|
982 | + $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); |
|
983 | 983 | if ($globalDebug) echo $result.')'; |
984 | 984 | } |
985 | 985 | return "success"; |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | |
989 | 989 | public function getOrderBy() |
990 | 990 | { |
991 | - $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")); |
|
991 | + $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")); |
|
992 | 992 | return $orderby; |
993 | 993 | } |
994 | 994 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | require_once(dirname(__FILE__).'/class.create_db.php'); |
10 | 10 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
11 | 11 | require_once(dirname(__FILE__).'/class.settings.php'); |
12 | -$title="Install"; |
|
12 | +$title = "Install"; |
|
13 | 13 | require(dirname(__FILE__).'/../require/settings.php'); |
14 | 14 | require(dirname(__FILE__).'/header.php'); |
15 | 15 | |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | if (!extension_loaded('curl')) { |
67 | 67 | $error[] = "Curl is not loaded."; |
68 | 68 | } |
69 | -if(function_exists('apache_get_modules') ){ |
|
70 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
69 | +if (function_exists('apache_get_modules')) { |
|
70 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
71 | 71 | $error[] = "mod_rewrite is not available."; |
72 | 72 | } |
73 | 73 | /* |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | print '<div class="info column"><p><strong>If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some table can fail.</strong></p></div>'; |
84 | 84 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
85 | 85 | if (function_exists('get_headers')) { |
86 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"]))); |
|
87 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
86 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"]))); |
|
87 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
88 | 88 | print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>'; |
89 | 89 | } |
90 | 90 | } |
@@ -424,13 +424,13 @@ discard block |
||
424 | 424 | ?> |
425 | 425 | <tr> |
426 | 426 | <?php |
427 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
427 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
428 | 428 | ?> |
429 | 429 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
430 | 430 | <td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td> |
431 | 431 | <?php |
432 | 432 | } else { |
433 | - $hostport = explode(':',$source['host']); |
|
433 | + $hostport = explode(':', $source['host']); |
|
434 | 434 | if (isset($hostport[1])) { |
435 | 435 | $host = $hostport[0]; |
436 | 436 | $port = $hostport[1]; |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | <br /> |
760 | 760 | <p> |
761 | 761 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
762 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
762 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
763 | 763 | </p> |
764 | 764 | <br /> |
765 | 765 | <p> |
@@ -805,14 +805,14 @@ discard block |
||
805 | 805 | $error = ''; |
806 | 806 | |
807 | 807 | if (isset($_POST['dbtype'])) { |
808 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
809 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
810 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
811 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
812 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
813 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
814 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
815 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
808 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
809 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
810 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
811 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
812 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
813 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
814 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
815 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
816 | 816 | |
817 | 817 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
818 | 818 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -832,48 +832,48 @@ discard block |
||
832 | 832 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
833 | 833 | */ |
834 | 834 | |
835 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
835 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
836 | 836 | |
837 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
838 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
839 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
840 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
841 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
837 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
838 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
839 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
840 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
841 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
842 | 842 | |
843 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
844 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
845 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
846 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
847 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
848 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
849 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
850 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
851 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey)); |
|
843 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
844 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
845 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
846 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
847 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
848 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
849 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
850 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
851 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey)); |
|
852 | 852 | |
853 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
854 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
855 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
856 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
857 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
858 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
853 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
854 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
855 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
856 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
857 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
858 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
859 | 859 | |
860 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
861 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
860 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
861 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
862 | 862 | |
863 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
864 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
865 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
863 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
864 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
865 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
866 | 866 | |
867 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
867 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
868 | 868 | if ($acars == 'acars') { |
869 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
869 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
870 | 870 | } else { |
871 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
871 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
872 | 872 | } |
873 | 873 | |
874 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
875 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
876 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
874 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
875 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
876 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
877 | 877 | |
878 | 878 | $source_name = $_POST['source_name']; |
879 | 879 | $source_latitude = $_POST['source_latitude']; |
@@ -887,8 +887,8 @@ discard block |
||
887 | 887 | |
888 | 888 | $sources = array(); |
889 | 889 | foreach ($source_name as $keys => $name) { |
890 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
891 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
890 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'id' => $source_id[$keys], 'source' => $source_ref[$keys]); |
|
891 | + else $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'source' => $source_ref[$keys]); |
|
892 | 892 | } |
893 | 893 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
894 | 894 | |
@@ -901,13 +901,13 @@ discard block |
||
901 | 901 | $sbsurl = $_POST['sbsurl']; |
902 | 902 | */ |
903 | 903 | |
904 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
905 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
906 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
907 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
908 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
909 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
910 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
904 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
905 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
906 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
907 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
908 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
909 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
910 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
911 | 911 | |
912 | 912 | /* |
913 | 913 | $globalSBS1Hosts = array(); |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | } |
924 | 924 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
925 | 925 | */ |
926 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
926 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
927 | 927 | $host = $_POST['host']; |
928 | 928 | $port = $_POST['port']; |
929 | 929 | $name = $_POST['name']; |
@@ -934,96 +934,96 @@ discard block |
||
934 | 934 | foreach ($host as $key => $h) { |
935 | 935 | if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
936 | 936 | else $cov = 'FALSE'; |
937 | - if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov); |
|
937 | + if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov); |
|
938 | 938 | } |
939 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
939 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
940 | 940 | |
941 | 941 | /* |
942 | 942 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
943 | 943 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
944 | 944 | */ |
945 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
946 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
947 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
945 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
946 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
947 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
948 | 948 | |
949 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
950 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
949 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
950 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
951 | 951 | |
952 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
953 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
954 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
955 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
952 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
953 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
954 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
955 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
956 | 956 | |
957 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
958 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
959 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
957 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
958 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
959 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
960 | 960 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
961 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
962 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
961 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
962 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
963 | 963 | |
964 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
965 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
966 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
967 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
968 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
969 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
970 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
971 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
964 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
965 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
966 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
967 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
968 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
969 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
970 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
971 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
972 | 972 | |
973 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
974 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
973 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
974 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
975 | 975 | |
976 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
977 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
976 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
977 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
978 | 978 | |
979 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
979 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
980 | 980 | if ($archiveyear == "archiveyear") { |
981 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
981 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
982 | 982 | } else { |
983 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
983 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
984 | 984 | } |
985 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
986 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
987 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
988 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
985 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
986 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
987 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
988 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
989 | 989 | |
990 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
991 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
992 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
993 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
990 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
991 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
992 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
993 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
994 | 994 | |
995 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
996 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
997 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
995 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
996 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
997 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
998 | 998 | |
999 | 999 | // Create in settings.php keys not yet configurable if not already here |
1000 | 1000 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1001 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1001 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1002 | 1002 | |
1003 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1003 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1004 | 1004 | if ($resetyearstats == 'resetyearstats') { |
1005 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1005 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1006 | 1006 | } else { |
1007 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1007 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1008 | 1008 | } |
1009 | 1009 | |
1010 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1010 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1011 | 1011 | if ($archive == 'archive') { |
1012 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1012 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1013 | 1013 | } else { |
1014 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1014 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1015 | 1015 | } |
1016 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1016 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1017 | 1017 | if ($daemon == 'daemon') { |
1018 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1018 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1019 | 1019 | } else { |
1020 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1020 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1021 | 1021 | } |
1022 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1022 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1023 | 1023 | if ($schedules == 'schedules') { |
1024 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1024 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1025 | 1025 | } else { |
1026 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1026 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | /* |
@@ -1034,171 +1034,171 @@ discard block |
||
1034 | 1034 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1035 | 1035 | } |
1036 | 1036 | */ |
1037 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1038 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1039 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1040 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1041 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1037 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1038 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1039 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1040 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1041 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1042 | 1042 | if ($globalivao == 'ivao') { |
1043 | 1043 | //$settings = array_merge($settings,array('globalIVAO' => 'TRUE','globalVATSIM' => 'FALSE')); |
1044 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1045 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1044 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1045 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1046 | 1046 | if ($globalvatsim == 'vatsim') { |
1047 | 1047 | //$settings = array_merge($settings,array('globalVATSIM' => 'TRUE','globalIVAO' => 'FALSE')); |
1048 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1049 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1048 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1049 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1050 | 1050 | if ($globalphpvms == 'phpvms') { |
1051 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1052 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1051 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1052 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1053 | 1053 | if ($globalvam == 'vam') { |
1054 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1055 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1054 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1055 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1056 | 1056 | if ($globalvatsim == 'vatsim' || $globalivao == 'ivao' || $globalphpvms == 'phpvms') { |
1057 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1058 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1057 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1058 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1059 | 1059 | |
1060 | 1060 | |
1061 | 1061 | |
1062 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1062 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1063 | 1063 | if ($notam == 'notam') { |
1064 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1064 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1065 | 1065 | } else { |
1066 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1066 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1067 | 1067 | } |
1068 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1068 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1069 | 1069 | if ($owner == 'owner') { |
1070 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1070 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1071 | 1071 | } else { |
1072 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1072 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1073 | 1073 | } |
1074 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1074 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1075 | 1075 | if ($map3d == 'map3d') { |
1076 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1076 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1077 | 1077 | } else { |
1078 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1078 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1079 | 1079 | } |
1080 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1080 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1081 | 1081 | if ($mapsatellites == 'mapsatellites') { |
1082 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1082 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1083 | 1083 | } else { |
1084 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1084 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1085 | 1085 | } |
1086 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1086 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1087 | 1087 | if ($map3ddefault == 'map3ddefault') { |
1088 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1088 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1089 | 1089 | } else { |
1090 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1090 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1091 | 1091 | } |
1092 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1092 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1093 | 1093 | if ($translate == 'translate') { |
1094 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1094 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1095 | 1095 | } else { |
1096 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1096 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1097 | 1097 | } |
1098 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1098 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1099 | 1099 | if ($realairlines == 'realairlines') { |
1100 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1100 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1101 | 1101 | } else { |
1102 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1102 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1103 | 1103 | } |
1104 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1104 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1105 | 1105 | if ($estimation == 'estimation') { |
1106 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1106 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1107 | 1107 | } else { |
1108 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1108 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1109 | 1109 | } |
1110 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1110 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1111 | 1111 | if ($metar == 'metar') { |
1112 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1112 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1113 | 1113 | } else { |
1114 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1114 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1115 | 1115 | } |
1116 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1116 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1117 | 1117 | if ($metarcycle == 'metarcycle') { |
1118 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1118 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1119 | 1119 | } else { |
1120 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1120 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1121 | 1121 | } |
1122 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1122 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1123 | 1123 | if ($fork == 'fork') { |
1124 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1124 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1125 | 1125 | } else { |
1126 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1126 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1127 | 1127 | } |
1128 | 1128 | |
1129 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1129 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1130 | 1130 | if ($colormap == 'colormap') { |
1131 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1131 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1132 | 1132 | } else { |
1133 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1133 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1134 | 1134 | } |
1135 | 1135 | |
1136 | 1136 | if (isset($_POST['aircrafticoncolor'])) { |
1137 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1138 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1137 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1138 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1139 | 1139 | } |
1140 | 1140 | |
1141 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1142 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1141 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1142 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1143 | 1143 | |
1144 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1145 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1146 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1147 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1148 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1149 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1144 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1145 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1146 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1147 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1148 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1149 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1150 | 1150 | |
1151 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1151 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1152 | 1152 | if ($mappopup == 'mappopup') { |
1153 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1153 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1154 | 1154 | } else { |
1155 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1155 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1156 | 1156 | } |
1157 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1157 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1158 | 1158 | if ($airportpopup == 'airportpopup') { |
1159 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1159 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1160 | 1160 | } else { |
1161 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1161 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1162 | 1162 | } |
1163 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1163 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1164 | 1164 | if ($maphistory == 'maphistory') { |
1165 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1165 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1166 | 1166 | } else { |
1167 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1167 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1168 | 1168 | } |
1169 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1169 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1170 | 1170 | if ($flightroute == 'flightroute') { |
1171 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1171 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1172 | 1172 | } else { |
1173 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1173 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1174 | 1174 | } |
1175 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1175 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1176 | 1176 | if ($allflights == 'allflights') { |
1177 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1177 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1178 | 1178 | } else { |
1179 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1179 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1180 | 1180 | } |
1181 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1181 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1182 | 1182 | if ($waypoints == 'waypoints') { |
1183 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1183 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1184 | 1184 | } else { |
1185 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1185 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1186 | 1186 | } |
1187 | 1187 | |
1188 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1188 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1189 | 1189 | |
1190 | 1190 | // Set some defaults values... |
1191 | 1191 | if (!isset($globalAircraftImageSources)) { |
1192 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1193 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1192 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1193 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1194 | 1194 | } |
1195 | 1195 | |
1196 | 1196 | if (!isset($globalSchedulesSources)) { |
1197 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1198 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1197 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1198 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1199 | 1199 | } |
1200 | 1200 | |
1201 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1201 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1202 | 1202 | |
1203 | 1203 | if ($error == '') settings::modify_settings($settings); |
1204 | 1204 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | $this->db = $Connection->db(); |
18 | 18 | } |
19 | 19 | |
20 | - public function addLastStatsUpdate($type,$stats_date) { |
|
20 | + public function addLastStatsUpdate($type, $stats_date) { |
|
21 | 21 | $query = "DELETE FROM config WHERE name = :type; |
22 | 22 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
23 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
23 | + $query_values = array('type' => $type, ':stats_date' => $stats_date); |
|
24 | 24 | try { |
25 | 25 | $sth = $this->db->prepare($query); |
26 | 26 | $sth->execute($query_values); |
27 | - } catch(PDOException $e) { |
|
27 | + } catch (PDOException $e) { |
|
28 | 28 | return "error : ".$e->getMessage(); |
29 | 29 | } |
30 | 30 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | try { |
35 | 35 | $sth = $this->db->prepare($query); |
36 | 36 | $sth->execute(array(':type' => $type)); |
37 | - } catch(PDOException $e) { |
|
37 | + } catch (PDOException $e) { |
|
38 | 38 | echo "error : ".$e->getMessage(); |
39 | 39 | } |
40 | 40 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | try { |
55 | 55 | $sth = $this->db->prepare($query); |
56 | 56 | $sth->execute(array(':filter_name' => $filter_name)); |
57 | - } catch(PDOException $e) { |
|
57 | + } catch (PDOException $e) { |
|
58 | 58 | return "error : ".$e->getMessage(); |
59 | 59 | } |
60 | 60 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | try { |
65 | 65 | $sth = $this->db->prepare($query); |
66 | 66 | $sth->execute(); |
67 | - } catch(PDOException $e) { |
|
67 | + } catch (PDOException $e) { |
|
68 | 68 | return "error : ".$e->getMessage(); |
69 | 69 | } |
70 | 70 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | try { |
73 | 73 | $sth = $this->db->prepare($query); |
74 | 74 | $sth->execute(array(':filter_name' => $filter_name)); |
75 | - } catch(PDOException $e) { |
|
75 | + } catch (PDOException $e) { |
|
76 | 76 | return "error : ".$e->getMessage(); |
77 | 77 | } |
78 | 78 | } |
@@ -82,43 +82,43 @@ discard block |
||
82 | 82 | try { |
83 | 83 | $sth = $this->db->prepare($query); |
84 | 84 | $sth->execute(array(':filter_name' => $filter_name)); |
85 | - } catch(PDOException $e) { |
|
85 | + } catch (PDOException $e) { |
|
86 | 86 | echo "error : ".$e->getMessage(); |
87 | 87 | } |
88 | 88 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
89 | 89 | return $all; |
90 | 90 | } |
91 | - public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
|
91 | + public function getAllAircraftTypes($stats_airline = '', $filter_name = '') { |
|
92 | 92 | if ($filter_name == '') $filter_name = $this->filter_name; |
93 | 93 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
94 | 94 | try { |
95 | 95 | $sth = $this->db->prepare($query); |
96 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
97 | - } catch(PDOException $e) { |
|
96 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
97 | + } catch (PDOException $e) { |
|
98 | 98 | echo "error : ".$e->getMessage(); |
99 | 99 | } |
100 | 100 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
101 | 101 | return $all; |
102 | 102 | } |
103 | - public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
|
103 | + public function getAllManufacturers($stats_airline = '', $filter_name = '') { |
|
104 | 104 | if ($filter_name == '') $filter_name = $this->filter_name; |
105 | 105 | $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
106 | 106 | try { |
107 | 107 | $sth = $this->db->prepare($query); |
108 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
109 | - } catch(PDOException $e) { |
|
108 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
109 | + } catch (PDOException $e) { |
|
110 | 110 | echo "error : ".$e->getMessage(); |
111 | 111 | } |
112 | 112 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
113 | 113 | return $all; |
114 | 114 | } |
115 | - public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
115 | + public function getAllAirportNames($stats_airline = '', $filter_name = '') { |
|
116 | 116 | if ($filter_name == '') $filter_name = $this->filter_name; |
117 | 117 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
118 | 118 | try { |
119 | 119 | $sth = $this->db->prepare($query); |
120 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
121 | - } catch(PDOException $e) { |
|
120 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
121 | + } catch (PDOException $e) { |
|
122 | 122 | echo "error : ".$e->getMessage(); |
123 | 123 | } |
124 | 124 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -133,22 +133,22 @@ discard block |
||
133 | 133 | else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
134 | 134 | try { |
135 | 135 | $sth = $this->db->prepare($query); |
136 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
137 | - } catch(PDOException $e) { |
|
136 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
137 | + } catch (PDOException $e) { |
|
138 | 138 | echo "error : ".$e->getMessage(); |
139 | 139 | } |
140 | 140 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
141 | 141 | if (empty($all)) { |
142 | 142 | $filters = array('airlines' => array($stats_airline)); |
143 | 143 | if ($filter_name != '') { |
144 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
144 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
145 | 145 | } |
146 | 146 | $Spotter = new Spotter($this->db); |
147 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
147 | + $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters); |
|
148 | 148 | } |
149 | 149 | return $all; |
150 | 150 | } |
151 | - public function countAllAirlineCountries($limit = true,$filter_name = '') { |
|
151 | + public function countAllAirlineCountries($limit = true, $filter_name = '') { |
|
152 | 152 | global $globalStatsFilters; |
153 | 153 | if ($filter_name == '') $filter_name = $this->filter_name; |
154 | 154 | if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | try { |
157 | 157 | $sth = $this->db->prepare($query); |
158 | 158 | $sth->execute(array(':filter_name' => $filter_name)); |
159 | - } catch(PDOException $e) { |
|
159 | + } catch (PDOException $e) { |
|
160 | 160 | echo "error : ".$e->getMessage(); |
161 | 161 | } |
162 | 162 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -164,28 +164,28 @@ discard block |
||
164 | 164 | $Spotter = new Spotter($this->db); |
165 | 165 | $filters = array(); |
166 | 166 | if ($filter_name != '') { |
167 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
167 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
168 | 168 | } |
169 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
169 | + $all = $Spotter->countAllAirlineCountries($limit, $filters); |
|
170 | 170 | } |
171 | 171 | return $all; |
172 | 172 | } |
173 | - public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') { |
|
173 | + public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '') { |
|
174 | 174 | global $globalStatsFilters; |
175 | 175 | if ($filter_name == '') $filter_name = $this->filter_name; |
176 | 176 | if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
177 | 177 | else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
178 | 178 | try { |
179 | 179 | $sth = $this->db->prepare($query); |
180 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
181 | - } catch(PDOException $e) { |
|
180 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
181 | + } catch (PDOException $e) { |
|
182 | 182 | echo "error : ".$e->getMessage(); |
183 | 183 | } |
184 | 184 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
185 | 185 | if (empty($all)) { |
186 | 186 | $filters = array('airlines' => array($stats_airline)); |
187 | 187 | if ($filter_name != '') { |
188 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
188 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
189 | 189 | } |
190 | 190 | $Spotter = new Spotter($this->db); |
191 | 191 | $all = $Spotter->countAllAircraftManufacturers($filters); |
@@ -200,18 +200,18 @@ discard block |
||
200 | 200 | else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
201 | 201 | try { |
202 | 202 | $sth = $this->db->prepare($query); |
203 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
204 | - } catch(PDOException $e) { |
|
203 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
204 | + } catch (PDOException $e) { |
|
205 | 205 | echo "error : ".$e->getMessage(); |
206 | 206 | } |
207 | 207 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
208 | 208 | if (empty($all)) { |
209 | 209 | $filters = array('airlines' => array($stats_airline)); |
210 | 210 | if ($filter_name != '') { |
211 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
211 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
212 | 212 | } |
213 | 213 | $Spotter = new Spotter($this->db); |
214 | - $all = $Spotter->countAllArrivalCountries($limit,$filters); |
|
214 | + $all = $Spotter->countAllArrivalCountries($limit, $filters); |
|
215 | 215 | } |
216 | 216 | return $all; |
217 | 217 | } |
@@ -222,15 +222,15 @@ discard block |
||
222 | 222 | else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
223 | 223 | try { |
224 | 224 | $sth = $this->db->prepare($query); |
225 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
226 | - } catch(PDOException $e) { |
|
225 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
226 | + } catch (PDOException $e) { |
|
227 | 227 | echo "error : ".$e->getMessage(); |
228 | 228 | } |
229 | 229 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
230 | 230 | if (empty($all)) { |
231 | 231 | $filters = array('airlines' => array($stats_airline)); |
232 | 232 | if ($filter_name != '') { |
233 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
233 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
234 | 234 | } |
235 | 235 | $Spotter = new Spotter($this->db); |
236 | 236 | $all = $Spotter->countAllDepartureCountries($filters); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | return $all; |
239 | 239 | } |
240 | 240 | |
241 | - public function countAllAirlines($limit = true,$filter_name = '') { |
|
241 | + public function countAllAirlines($limit = true, $filter_name = '') { |
|
242 | 242 | global $globalStatsFilters; |
243 | 243 | if ($filter_name == '') $filter_name = $this->filter_name; |
244 | 244 | if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | try { |
247 | 247 | $sth = $this->db->prepare($query); |
248 | 248 | $sth->execute(array(':filter_name' => $filter_name)); |
249 | - } catch(PDOException $e) { |
|
249 | + } catch (PDOException $e) { |
|
250 | 250 | echo "error : ".$e->getMessage(); |
251 | 251 | } |
252 | 252 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -254,58 +254,58 @@ discard block |
||
254 | 254 | $Spotter = new Spotter($this->db); |
255 | 255 | $filters = array(); |
256 | 256 | if ($filter_name != '') { |
257 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
257 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
258 | 258 | } |
259 | 259 | |
260 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
260 | + $all = $Spotter->countAllAirlines($limit, 0, '', $filters); |
|
261 | 261 | } |
262 | 262 | return $all; |
263 | 263 | } |
264 | - public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') { |
|
264 | + public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '') { |
|
265 | 265 | global $globalStatsFilters; |
266 | 266 | if ($filter_name == '') $filter_name = $this->filter_name; |
267 | 267 | if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
268 | 268 | else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
269 | 269 | try { |
270 | 270 | $sth = $this->db->prepare($query); |
271 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
272 | - } catch(PDOException $e) { |
|
271 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
272 | + } catch (PDOException $e) { |
|
273 | 273 | echo "error : ".$e->getMessage(); |
274 | 274 | } |
275 | 275 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
276 | 276 | if (empty($all)) { |
277 | 277 | $filters = array('airlines' => array($stats_airline)); |
278 | 278 | if ($filter_name != '') { |
279 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
279 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
280 | 280 | } |
281 | 281 | $Spotter = new Spotter($this->db); |
282 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
282 | + $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters); |
|
283 | 283 | } |
284 | 284 | return $all; |
285 | 285 | } |
286 | - public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') { |
|
286 | + public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '') { |
|
287 | 287 | global $globalStatsFilters; |
288 | 288 | if ($filter_name == '') $filter_name = $this->filter_name; |
289 | 289 | if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
290 | 290 | else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
291 | 291 | try { |
292 | 292 | $sth = $this->db->prepare($query); |
293 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
294 | - } catch(PDOException $e) { |
|
293 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
294 | + } catch (PDOException $e) { |
|
295 | 295 | echo "error : ".$e->getMessage(); |
296 | 296 | } |
297 | 297 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
298 | 298 | if (empty($all)) { |
299 | 299 | $filters = array('airlines' => array($stats_airline)); |
300 | 300 | if ($filter_name != '') { |
301 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
301 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
302 | 302 | } |
303 | 303 | $Spotter = new Spotter($this->db); |
304 | - $all = $Spotter->countAllCallsigns($limit,0,'',$filters); |
|
304 | + $all = $Spotter->countAllCallsigns($limit, 0, '', $filters); |
|
305 | 305 | } |
306 | 306 | return $all; |
307 | 307 | } |
308 | - public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') { |
|
308 | + public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '') { |
|
309 | 309 | $Connection = new Connection(); |
310 | 310 | if ($filter_name == '') $filter_name = $this->filter_name; |
311 | 311 | if ($Connection->tableExists('countries')) { |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
314 | 314 | try { |
315 | 315 | $sth = $this->db->prepare($query); |
316 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
317 | - } catch(PDOException $e) { |
|
316 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
317 | + } catch (PDOException $e) { |
|
318 | 318 | echo "error : ".$e->getMessage(); |
319 | 319 | } |
320 | 320 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -329,70 +329,70 @@ discard block |
||
329 | 329 | return array(); |
330 | 330 | } |
331 | 331 | } |
332 | - public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') { |
|
332 | + public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '') { |
|
333 | 333 | global $globalStatsFilters; |
334 | 334 | if ($filter_name == '') $filter_name = $this->filter_name; |
335 | 335 | if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
336 | 336 | else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
337 | 337 | try { |
338 | 338 | $sth = $this->db->prepare($query); |
339 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
340 | - } catch(PDOException $e) { |
|
339 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
340 | + } catch (PDOException $e) { |
|
341 | 341 | echo "error : ".$e->getMessage(); |
342 | 342 | } |
343 | 343 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
344 | 344 | if (empty($all)) { |
345 | 345 | $filters = array('airlines' => array($stats_airline)); |
346 | 346 | if ($filter_name != '') { |
347 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
347 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
348 | 348 | } |
349 | 349 | $Spotter = new Spotter($this->db); |
350 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
350 | + $all = $Spotter->countAllPilots($limit, 0, '', $filters); |
|
351 | 351 | } |
352 | 352 | return $all; |
353 | 353 | } |
354 | - public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') { |
|
354 | + public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '') { |
|
355 | 355 | global $globalStatsFilters; |
356 | 356 | if ($filter_name == '') $filter_name = $this->filter_name; |
357 | 357 | if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
358 | 358 | else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
359 | 359 | try { |
360 | 360 | $sth = $this->db->prepare($query); |
361 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
362 | - } catch(PDOException $e) { |
|
361 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
362 | + } catch (PDOException $e) { |
|
363 | 363 | echo "error : ".$e->getMessage(); |
364 | 364 | } |
365 | 365 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
366 | 366 | if (empty($all)) { |
367 | 367 | $filters = array('airlines' => array($stats_airline)); |
368 | 368 | if ($filter_name != '') { |
369 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
369 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
370 | 370 | } |
371 | 371 | $Spotter = new Spotter($this->db); |
372 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
372 | + $all = $Spotter->countAllOwners($limit, 0, '', $filters); |
|
373 | 373 | } |
374 | 374 | return $all; |
375 | 375 | } |
376 | - public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') { |
|
376 | + public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '') { |
|
377 | 377 | global $globalStatsFilters; |
378 | 378 | if ($filter_name == '') $filter_name = $this->filter_name; |
379 | 379 | if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
380 | 380 | else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
381 | 381 | try { |
382 | 382 | $sth = $this->db->prepare($query); |
383 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
384 | - } catch(PDOException $e) { |
|
383 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
384 | + } catch (PDOException $e) { |
|
385 | 385 | echo "error : ".$e->getMessage(); |
386 | 386 | } |
387 | 387 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
388 | 388 | if (empty($all)) { |
389 | 389 | $filters = array('airlines' => array($stats_airline)); |
390 | 390 | if ($filter_name != '') { |
391 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
391 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
392 | 392 | } |
393 | 393 | $Spotter = new Spotter($this->db); |
394 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
395 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
394 | + $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters); |
|
395 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters); |
|
396 | 396 | $all = array(); |
397 | 397 | foreach ($pall as $value) { |
398 | 398 | $icao = $value['airport_departure_icao']; |
@@ -409,30 +409,30 @@ discard block |
||
409 | 409 | foreach ($all as $key => $row) { |
410 | 410 | $count[$key] = $row['airport_departure_icao_count']; |
411 | 411 | } |
412 | - array_multisort($count,SORT_DESC,$all); |
|
412 | + array_multisort($count, SORT_DESC, $all); |
|
413 | 413 | } |
414 | 414 | return $all; |
415 | 415 | } |
416 | - public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') { |
|
416 | + public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '') { |
|
417 | 417 | global $globalStatsFilters; |
418 | 418 | if ($filter_name == '') $filter_name = $this->filter_name; |
419 | 419 | if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
420 | 420 | else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
421 | 421 | try { |
422 | 422 | $sth = $this->db->prepare($query); |
423 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
424 | - } catch(PDOException $e) { |
|
423 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
424 | + } catch (PDOException $e) { |
|
425 | 425 | echo "error : ".$e->getMessage(); |
426 | 426 | } |
427 | 427 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
428 | 428 | if (empty($all)) { |
429 | 429 | $filters = array('airlines' => array($stats_airline)); |
430 | 430 | if ($filter_name != '') { |
431 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
431 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
432 | 432 | } |
433 | 433 | $Spotter = new Spotter($this->db); |
434 | - $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
|
435 | - $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
|
434 | + $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters); |
|
435 | + $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters); |
|
436 | 436 | $all = array(); |
437 | 437 | foreach ($pall as $value) { |
438 | 438 | $icao = $value['airport_arrival_icao']; |
@@ -449,12 +449,12 @@ discard block |
||
449 | 449 | foreach ($all as $key => $row) { |
450 | 450 | $count[$key] = $row['airport_arrival_icao_count']; |
451 | 451 | } |
452 | - array_multisort($count,SORT_DESC,$all); |
|
452 | + array_multisort($count, SORT_DESC, $all); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | return $all; |
456 | 456 | } |
457 | - public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
457 | + public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
|
458 | 458 | global $globalDBdriver, $globalStatsFilters; |
459 | 459 | if ($filter_name == '') $filter_name = $this->filter_name; |
460 | 460 | if ($globalDBdriver == 'mysql') { |
@@ -464,18 +464,18 @@ discard block |
||
464 | 464 | if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
465 | 465 | else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
466 | 466 | } |
467 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
467 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
468 | 468 | try { |
469 | 469 | $sth = $this->db->prepare($query); |
470 | 470 | $sth->execute($query_data); |
471 | - } catch(PDOException $e) { |
|
471 | + } catch (PDOException $e) { |
|
472 | 472 | echo "error : ".$e->getMessage(); |
473 | 473 | } |
474 | 474 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
475 | 475 | if (empty($all)) { |
476 | 476 | $filters = array('airlines' => array($stats_airline)); |
477 | 477 | if ($filter_name != '') { |
478 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
478 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
479 | 479 | } |
480 | 480 | $Spotter = new Spotter($this->db); |
481 | 481 | $all = $Spotter->countAllMonthsLastYear($filters); |
@@ -484,29 +484,29 @@ discard block |
||
484 | 484 | return $all; |
485 | 485 | } |
486 | 486 | |
487 | - public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
487 | + public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
|
488 | 488 | global $globalStatsFilters; |
489 | 489 | if ($filter_name == '') $filter_name = $this->filter_name; |
490 | 490 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
491 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
491 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
492 | 492 | try { |
493 | 493 | $sth = $this->db->prepare($query); |
494 | 494 | $sth->execute($query_data); |
495 | - } catch(PDOException $e) { |
|
495 | + } catch (PDOException $e) { |
|
496 | 496 | echo "error : ".$e->getMessage(); |
497 | 497 | } |
498 | 498 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
499 | 499 | if (empty($all)) { |
500 | 500 | $filters = array('airlines' => array($stats_airline)); |
501 | 501 | if ($filter_name != '') { |
502 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
502 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
503 | 503 | } |
504 | 504 | $Spotter = new Spotter($this->db); |
505 | 505 | $all = $Spotter->countAllDatesLastMonth($filters); |
506 | 506 | } |
507 | 507 | return $all; |
508 | 508 | } |
509 | - public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
509 | + public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
|
510 | 510 | global $globalDBdriver, $globalStatsFilters; |
511 | 511 | if ($filter_name == '') $filter_name = $this->filter_name; |
512 | 512 | if ($globalDBdriver == 'mysql') { |
@@ -514,40 +514,40 @@ discard block |
||
514 | 514 | } else { |
515 | 515 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
516 | 516 | } |
517 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
517 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
518 | 518 | try { |
519 | 519 | $sth = $this->db->prepare($query); |
520 | 520 | $sth->execute($query_data); |
521 | - } catch(PDOException $e) { |
|
521 | + } catch (PDOException $e) { |
|
522 | 522 | echo "error : ".$e->getMessage(); |
523 | 523 | } |
524 | 524 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
525 | 525 | if (empty($all)) { |
526 | 526 | $filters = array('airlines' => array($stats_airline)); |
527 | 527 | if ($filter_name != '') { |
528 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
528 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
529 | 529 | } |
530 | 530 | $Spotter = new Spotter($this->db); |
531 | 531 | $all = $Spotter->countAllDatesLast7Days($filters); |
532 | 532 | } |
533 | 533 | return $all; |
534 | 534 | } |
535 | - public function countAllDates($stats_airline = '',$filter_name = '') { |
|
535 | + public function countAllDates($stats_airline = '', $filter_name = '') { |
|
536 | 536 | global $globalStatsFilters; |
537 | 537 | if ($filter_name == '') $filter_name = $this->filter_name; |
538 | 538 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
539 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
539 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
540 | 540 | try { |
541 | 541 | $sth = $this->db->prepare($query); |
542 | 542 | $sth->execute($query_data); |
543 | - } catch(PDOException $e) { |
|
543 | + } catch (PDOException $e) { |
|
544 | 544 | echo "error : ".$e->getMessage(); |
545 | 545 | } |
546 | 546 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
547 | 547 | if (empty($all)) { |
548 | 548 | $filters = array('airlines' => array($stats_airline)); |
549 | 549 | if ($filter_name != '') { |
550 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
550 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
551 | 551 | } |
552 | 552 | $Spotter = new Spotter($this->db); |
553 | 553 | $all = $Spotter->countAllDates($filters); |
@@ -562,35 +562,35 @@ discard block |
||
562 | 562 | try { |
563 | 563 | $sth = $this->db->prepare($query); |
564 | 564 | $sth->execute($query_data); |
565 | - } catch(PDOException $e) { |
|
565 | + } catch (PDOException $e) { |
|
566 | 566 | echo "error : ".$e->getMessage(); |
567 | 567 | } |
568 | 568 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
569 | 569 | if (empty($all)) { |
570 | 570 | $filters = array(); |
571 | 571 | if ($filter_name != '') { |
572 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
572 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
573 | 573 | } |
574 | 574 | $Spotter = new Spotter($this->db); |
575 | 575 | $all = $Spotter->countAllDatesByAirlines($filters); |
576 | 576 | } |
577 | 577 | return $all; |
578 | 578 | } |
579 | - public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
579 | + public function countAllMonths($stats_airline = '', $filter_name = '') { |
|
580 | 580 | global $globalStatsFilters; |
581 | 581 | if ($filter_name == '') $filter_name = $this->filter_name; |
582 | 582 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
583 | 583 | try { |
584 | 584 | $sth = $this->db->prepare($query); |
585 | 585 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
586 | - } catch(PDOException $e) { |
|
586 | + } catch (PDOException $e) { |
|
587 | 587 | echo "error : ".$e->getMessage(); |
588 | 588 | } |
589 | 589 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
590 | 590 | if (empty($all)) { |
591 | 591 | $filters = array('airlines' => array($stats_airline)); |
592 | 592 | if ($filter_name != '') { |
593 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
593 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
594 | 594 | } |
595 | 595 | $Spotter = new Spotter($this->db); |
596 | 596 | $all = $Spotter->countAllMonths($filters); |
@@ -604,21 +604,21 @@ discard block |
||
604 | 604 | try { |
605 | 605 | $sth = $this->db->prepare($query); |
606 | 606 | $sth->execute(array(':filter_name' => $filter_name)); |
607 | - } catch(PDOException $e) { |
|
607 | + } catch (PDOException $e) { |
|
608 | 608 | echo "error : ".$e->getMessage(); |
609 | 609 | } |
610 | 610 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
611 | 611 | if (empty($all)) { |
612 | 612 | $filters = array(); |
613 | 613 | if ($filter_name != '') { |
614 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
614 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
615 | 615 | } |
616 | 616 | $Spotter = new Spotter($this->db); |
617 | 617 | $all = $Spotter->countAllMilitaryMonths($filters); |
618 | 618 | } |
619 | 619 | return $all; |
620 | 620 | } |
621 | - public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
621 | + public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
|
622 | 622 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
623 | 623 | if ($filter_name == '') $filter_name = $this->filter_name; |
624 | 624 | if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -635,17 +635,17 @@ discard block |
||
635 | 635 | try { |
636 | 636 | $sth = $this->db->prepare($query); |
637 | 637 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
638 | - } catch(PDOException $e) { |
|
638 | + } catch (PDOException $e) { |
|
639 | 639 | echo "error : ".$e->getMessage(); |
640 | 640 | } |
641 | 641 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
642 | 642 | if (empty($all)) { |
643 | 643 | $filters = array('airlines' => array($stats_airline)); |
644 | 644 | if ($filter_name != '') { |
645 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
645 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
646 | 646 | } |
647 | 647 | $Spotter = new Spotter($this->db); |
648 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
648 | + $all = $Spotter->countAllHours($orderby, $filters); |
|
649 | 649 | } |
650 | 650 | return $all; |
651 | 651 | } |
@@ -653,11 +653,11 @@ discard block |
||
653 | 653 | public function countOverallFlights($stats_airline = '', $filter_name = '') { |
654 | 654 | global $globalStatsFilters; |
655 | 655 | if ($filter_name == '') $filter_name = $this->filter_name; |
656 | - $all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name); |
|
656 | + $all = $this->getSumStats('flights_bymonth', date('Y'), $stats_airline, $filter_name); |
|
657 | 657 | if (empty($all)) { |
658 | 658 | $filters = array('airlines' => array($stats_airline)); |
659 | 659 | if ($filter_name != '') { |
660 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
660 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
661 | 661 | } |
662 | 662 | $Spotter = new Spotter($this->db); |
663 | 663 | $all = $Spotter->countOverallFlights($filters); |
@@ -667,39 +667,39 @@ discard block |
||
667 | 667 | public function countOverallMilitaryFlights($filter_name = '') { |
668 | 668 | global $globalStatsFilters; |
669 | 669 | if ($filter_name == '') $filter_name = $this->filter_name; |
670 | - $all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name); |
|
670 | + $all = $this->getSumStats('military_flights_bymonth', date('Y'), '', $filter_name); |
|
671 | 671 | if (empty($all)) { |
672 | 672 | $filters = array(); |
673 | 673 | if ($filter_name != '') { |
674 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
674 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
675 | 675 | } |
676 | 676 | $Spotter = new Spotter($this->db); |
677 | 677 | $all = $Spotter->countOverallMilitaryFlights($filters); |
678 | 678 | } |
679 | 679 | return $all; |
680 | 680 | } |
681 | - public function countOverallArrival($stats_airline = '',$filter_name = '') { |
|
681 | + public function countOverallArrival($stats_airline = '', $filter_name = '') { |
|
682 | 682 | global $globalStatsFilters; |
683 | 683 | if ($filter_name == '') $filter_name = $this->filter_name; |
684 | - $all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name); |
|
684 | + $all = $this->getSumStats('realarrivals_bymonth', date('Y'), $stats_airline, $filter_name); |
|
685 | 685 | if (empty($all)) { |
686 | 686 | $filters = array('airlines' => array($stats_airline)); |
687 | 687 | if ($filter_name != '') { |
688 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
688 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
689 | 689 | } |
690 | 690 | $Spotter = new Spotter($this->db); |
691 | 691 | $all = $Spotter->countOverallArrival($filters); |
692 | 692 | } |
693 | 693 | return $all; |
694 | 694 | } |
695 | - public function countOverallAircrafts($stats_airline = '',$filter_name = '') { |
|
695 | + public function countOverallAircrafts($stats_airline = '', $filter_name = '') { |
|
696 | 696 | global $globalStatsFilters; |
697 | 697 | if ($filter_name == '') $filter_name = $this->filter_name; |
698 | - $all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name); |
|
698 | + $all = $this->getSumStats('aircrafts_bymonth', date('Y'), $stats_airline, $filter_name); |
|
699 | 699 | if (empty($all)) { |
700 | 700 | $filters = array('airlines' => array($stats_airline)); |
701 | 701 | if ($filter_name != '') { |
702 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
702 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
703 | 703 | } |
704 | 704 | $Spotter = new Spotter($this->db); |
705 | 705 | $all = $Spotter->countOverallAircrafts($filters); |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | try { |
714 | 714 | $sth = $this->db->prepare($query); |
715 | 715 | $sth->execute(array(':filter_name' => $filter_name)); |
716 | - } catch(PDOException $e) { |
|
716 | + } catch (PDOException $e) { |
|
717 | 717 | echo "error : ".$e->getMessage(); |
718 | 718 | } |
719 | 719 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -722,14 +722,14 @@ discard block |
||
722 | 722 | if (empty($all)) { |
723 | 723 | $filters = array(); |
724 | 724 | if ($filter_name != '') { |
725 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
725 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
726 | 726 | } |
727 | 727 | $Spotter = new Spotter($this->db); |
728 | 728 | $all = $Spotter->countOverallAirlines($filters); |
729 | 729 | } |
730 | 730 | return $all; |
731 | 731 | } |
732 | - public function countOverallOwners($stats_airline = '',$filter_name = '') { |
|
732 | + public function countOverallOwners($stats_airline = '', $filter_name = '') { |
|
733 | 733 | global $globalStatsFilters; |
734 | 734 | if ($filter_name == '') $filter_name = $this->filter_name; |
735 | 735 | /* |
@@ -743,25 +743,25 @@ discard block |
||
743 | 743 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
744 | 744 | $all = $result[0]['nb_owner']; |
745 | 745 | */ |
746 | - $all = $this->getSumStats('owners_bymonth',date('Y'),$stats_airline,$filter_name); |
|
746 | + $all = $this->getSumStats('owners_bymonth', date('Y'), $stats_airline, $filter_name); |
|
747 | 747 | if (empty($all)) { |
748 | 748 | $filters = array('airlines' => array($stats_airline)); |
749 | 749 | if ($filter_name != '') { |
750 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
750 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
751 | 751 | } |
752 | 752 | $Spotter = new Spotter($this->db); |
753 | 753 | $all = $Spotter->countOverallOwners($filters); |
754 | 754 | } |
755 | 755 | return $all; |
756 | 756 | } |
757 | - public function countOverallPilots($stats_airline = '',$filter_name = '') { |
|
757 | + public function countOverallPilots($stats_airline = '', $filter_name = '') { |
|
758 | 758 | global $globalStatsFilters; |
759 | 759 | if ($filter_name == '') $filter_name = $this->filter_name; |
760 | - $all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name); |
|
760 | + $all = $this->getSumStats('pilots_bymonth', date('Y'), $stats_airline, $filter_name); |
|
761 | 761 | if (empty($all)) { |
762 | 762 | $filters = array('airlines' => array($stats_airline)); |
763 | 763 | if ($filter_name != '') { |
764 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
764 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
765 | 765 | } |
766 | 766 | $Spotter = new Spotter($this->db); |
767 | 767 | $all = $Spotter->countOverallPilots($filters); |
@@ -769,33 +769,33 @@ discard block |
||
769 | 769 | return $all; |
770 | 770 | } |
771 | 771 | |
772 | - public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
772 | + public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
|
773 | 773 | if ($filter_name == '') $filter_name = $this->filter_name; |
774 | 774 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
775 | - $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
775 | + $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
776 | 776 | try { |
777 | 777 | $sth = $this->db->prepare($query); |
778 | 778 | $sth->execute($query_values); |
779 | - } catch(PDOException $e) { |
|
779 | + } catch (PDOException $e) { |
|
780 | 780 | echo "error : ".$e->getMessage(); |
781 | 781 | } |
782 | 782 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
783 | 783 | return $all; |
784 | 784 | } |
785 | - public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
785 | + public function getStats($type, $stats_airline = '', $filter_name = '') { |
|
786 | 786 | if ($filter_name == '') $filter_name = $this->filter_name; |
787 | 787 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
788 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
788 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
789 | 789 | try { |
790 | 790 | $sth = $this->db->prepare($query); |
791 | 791 | $sth->execute($query_values); |
792 | - } catch(PDOException $e) { |
|
792 | + } catch (PDOException $e) { |
|
793 | 793 | echo "error : ".$e->getMessage(); |
794 | 794 | } |
795 | 795 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
796 | 796 | return $all; |
797 | 797 | } |
798 | - public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') { |
|
798 | + public function getSumStats($type, $year, $stats_airline = '', $filter_name = '') { |
|
799 | 799 | if ($filter_name == '') $filter_name = $this->filter_name; |
800 | 800 | global $globalArchiveMonths, $globalDBdriver; |
801 | 801 | if ($globalDBdriver == 'mysql') { |
@@ -803,11 +803,11 @@ discard block |
||
803 | 803 | } else { |
804 | 804 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
805 | 805 | } |
806 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
806 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
807 | 807 | try { |
808 | 808 | $sth = $this->db->prepare($query); |
809 | 809 | $sth->execute($query_values); |
810 | - } catch(PDOException $e) { |
|
810 | + } catch (PDOException $e) { |
|
811 | 811 | echo "error : ".$e->getMessage(); |
812 | 812 | } |
813 | 813 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | try { |
826 | 826 | $sth = $this->db->prepare($query); |
827 | 827 | $sth->execute($query_values); |
828 | - } catch(PDOException $e) { |
|
828 | + } catch (PDOException $e) { |
|
829 | 829 | echo "error : ".$e->getMessage(); |
830 | 830 | } |
831 | 831 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | try { |
843 | 843 | $sth = $this->db->prepare($query); |
844 | 844 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
845 | - } catch(PDOException $e) { |
|
845 | + } catch (PDOException $e) { |
|
846 | 846 | echo "error : ".$e->getMessage(); |
847 | 847 | } |
848 | 848 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | try { |
860 | 860 | $sth = $this->db->prepare($query); |
861 | 861 | $sth->execute(array(':filter_name' => $filter_name)); |
862 | - } catch(PDOException $e) { |
|
862 | + } catch (PDOException $e) { |
|
863 | 863 | echo "error : ".$e->getMessage(); |
864 | 864 | } |
865 | 865 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | try { |
877 | 877 | $sth = $this->db->prepare($query); |
878 | 878 | $sth->execute(array(':filter_name' => $filter_name)); |
879 | - } catch(PDOException $e) { |
|
879 | + } catch (PDOException $e) { |
|
880 | 880 | echo "error : ".$e->getMessage(); |
881 | 881 | } |
882 | 882 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -893,14 +893,14 @@ discard block |
||
893 | 893 | try { |
894 | 894 | $sth = $this->db->prepare($query); |
895 | 895 | $sth->execute(array(':filter_name' => $filter_name)); |
896 | - } catch(PDOException $e) { |
|
896 | + } catch (PDOException $e) { |
|
897 | 897 | echo "error : ".$e->getMessage(); |
898 | 898 | } |
899 | 899 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
900 | 900 | return $all[0]['total']; |
901 | 901 | } |
902 | 902 | |
903 | - public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
903 | + public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
904 | 904 | global $globalDBdriver; |
905 | 905 | if ($filter_name == '') $filter_name = $this->filter_name; |
906 | 906 | if ($globalDBdriver == 'mysql') { |
@@ -908,15 +908,15 @@ discard block |
||
908 | 908 | } else { |
909 | 909 | $query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
910 | 910 | } |
911 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
911 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
912 | 912 | try { |
913 | 913 | $sth = $this->db->prepare($query); |
914 | 914 | $sth->execute($query_values); |
915 | - } catch(PDOException $e) { |
|
915 | + } catch (PDOException $e) { |
|
916 | 916 | return "error : ".$e->getMessage(); |
917 | 917 | } |
918 | 918 | } |
919 | - public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
919 | + public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
920 | 920 | global $globalDBdriver; |
921 | 921 | if ($filter_name == '') $filter_name = $this->filter_name; |
922 | 922 | if ($globalDBdriver == 'mysql') { |
@@ -925,219 +925,219 @@ discard block |
||
925 | 925 | //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
926 | 926 | $query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
927 | 927 | } |
928 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
928 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
929 | 929 | try { |
930 | 930 | $sth = $this->db->prepare($query); |
931 | 931 | $sth->execute($query_values); |
932 | - } catch(PDOException $e) { |
|
932 | + } catch (PDOException $e) { |
|
933 | 933 | return "error : ".$e->getMessage(); |
934 | 934 | } |
935 | 935 | } |
936 | - public function getStatsSource($date,$stats_type = '') { |
|
936 | + public function getStatsSource($date, $stats_type = '') { |
|
937 | 937 | if ($stats_type == '') { |
938 | 938 | $query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
939 | 939 | $query_values = array(':date' => $date); |
940 | 940 | } else { |
941 | 941 | $query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name"; |
942 | - $query_values = array(':date' => $date,':stats_type' => $stats_type); |
|
942 | + $query_values = array(':date' => $date, ':stats_type' => $stats_type); |
|
943 | 943 | } |
944 | 944 | try { |
945 | 945 | $sth = $this->db->prepare($query); |
946 | 946 | $sth->execute($query_values); |
947 | - } catch(PDOException $e) { |
|
947 | + } catch (PDOException $e) { |
|
948 | 948 | echo "error : ".$e->getMessage(); |
949 | 949 | } |
950 | 950 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
951 | 951 | return $all; |
952 | 952 | } |
953 | 953 | |
954 | - public function addStatSource($data,$source_name,$stats_type,$date) { |
|
954 | + public function addStatSource($data, $source_name, $stats_type, $date) { |
|
955 | 955 | global $globalDBdriver; |
956 | 956 | if ($globalDBdriver == 'mysql') { |
957 | 957 | $query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data"; |
958 | 958 | } else { |
959 | 959 | $query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; |
960 | 960 | } |
961 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
961 | + $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
962 | 962 | try { |
963 | 963 | $sth = $this->db->prepare($query); |
964 | 964 | $sth->execute($query_values); |
965 | - } catch(PDOException $e) { |
|
965 | + } catch (PDOException $e) { |
|
966 | 966 | return "error : ".$e->getMessage(); |
967 | 967 | } |
968 | 968 | } |
969 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
969 | + public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
970 | 970 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
971 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
971 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
972 | 972 | try { |
973 | 973 | $sth = $this->db->prepare($query); |
974 | 974 | $sth->execute($query_values); |
975 | - } catch(PDOException $e) { |
|
975 | + } catch (PDOException $e) { |
|
976 | 976 | return "error : ".$e->getMessage(); |
977 | 977 | } |
978 | 978 | } |
979 | - public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') { |
|
979 | + public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '') { |
|
980 | 980 | global $globalDBdriver; |
981 | 981 | if ($globalDBdriver == 'mysql') { |
982 | 982 | $query = "INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) VALUES (:aircraft_icao,:registration,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
983 | 983 | } else { |
984 | 984 | $query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
985 | 985 | } |
986 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
986 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
987 | 987 | try { |
988 | 988 | $sth = $this->db->prepare($query); |
989 | 989 | $sth->execute($query_values); |
990 | - } catch(PDOException $e) { |
|
990 | + } catch (PDOException $e) { |
|
991 | 991 | return "error : ".$e->getMessage(); |
992 | 992 | } |
993 | 993 | } |
994 | - public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') { |
|
994 | + public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '') { |
|
995 | 995 | global $globalDBdriver; |
996 | 996 | if ($globalDBdriver == 'mysql') { |
997 | 997 | $query = "INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) VALUES (:callsign_icao,:airline_icao,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
998 | 998 | } else { |
999 | 999 | $query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; |
1000 | 1000 | } |
1001 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1001 | + $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1002 | 1002 | try { |
1003 | 1003 | $sth = $this->db->prepare($query); |
1004 | 1004 | $sth->execute($query_values); |
1005 | - } catch(PDOException $e) { |
|
1005 | + } catch (PDOException $e) { |
|
1006 | 1006 | return "error : ".$e->getMessage(); |
1007 | 1007 | } |
1008 | 1008 | } |
1009 | - public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') { |
|
1009 | + public function addStatCountry($iso2, $iso3, $name, $cnt, $filter_name = '') { |
|
1010 | 1010 | global $globalDBdriver; |
1011 | 1011 | if ($globalDBdriver == 'mysql') { |
1012 | 1012 | $query = "INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) VALUES (:iso2,:iso3,:name,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
1013 | 1013 | } else { |
1014 | 1014 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; |
1015 | 1015 | } |
1016 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1016 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1017 | 1017 | try { |
1018 | 1018 | $sth = $this->db->prepare($query); |
1019 | 1019 | $sth->execute($query_values); |
1020 | - } catch(PDOException $e) { |
|
1020 | + } catch (PDOException $e) { |
|
1021 | 1021 | return "error : ".$e->getMessage(); |
1022 | 1022 | } |
1023 | 1023 | } |
1024 | - public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') { |
|
1024 | + public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') { |
|
1025 | 1025 | global $globalDBdriver; |
1026 | 1026 | if ($globalDBdriver == 'mysql') { |
1027 | 1027 | $query = "INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline, filter_name) VALUES (:aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, stats_airline = :stats_airline"; |
1028 | 1028 | } else { |
1029 | 1029 | $query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1030 | 1030 | } |
1031 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1031 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1032 | 1032 | try { |
1033 | 1033 | $sth = $this->db->prepare($query); |
1034 | 1034 | $sth->execute($query_values); |
1035 | - } catch(PDOException $e) { |
|
1035 | + } catch (PDOException $e) { |
|
1036 | 1036 | return "error : ".$e->getMessage(); |
1037 | 1037 | } |
1038 | 1038 | } |
1039 | - public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') { |
|
1039 | + public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '') { |
|
1040 | 1040 | global $globalDBdriver; |
1041 | 1041 | if ($globalDBdriver == 'mysql') { |
1042 | 1042 | $query = "INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) VALUES (:airline_icao,:airline_name,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt,airline_name = :airline_name"; |
1043 | 1043 | } else { |
1044 | 1044 | $query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; |
1045 | 1045 | } |
1046 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1046 | + $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1047 | 1047 | try { |
1048 | 1048 | $sth = $this->db->prepare($query); |
1049 | 1049 | $sth->execute($query_values); |
1050 | - } catch(PDOException $e) { |
|
1050 | + } catch (PDOException $e) { |
|
1051 | 1051 | return "error : ".$e->getMessage(); |
1052 | 1052 | } |
1053 | 1053 | } |
1054 | - public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') { |
|
1054 | + public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
1055 | 1055 | global $globalDBdriver; |
1056 | 1056 | if ($globalDBdriver == 'mysql') { |
1057 | 1057 | $query = "INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) VALUES (:owner_name,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
1058 | 1058 | } else { |
1059 | 1059 | $query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1060 | 1060 | } |
1061 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1061 | + $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1062 | 1062 | try { |
1063 | 1063 | $sth = $this->db->prepare($query); |
1064 | 1064 | $sth->execute($query_values); |
1065 | - } catch(PDOException $e) { |
|
1065 | + } catch (PDOException $e) { |
|
1066 | 1066 | return "error : ".$e->getMessage(); |
1067 | 1067 | } |
1068 | 1068 | } |
1069 | - public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '') { |
|
1069 | + public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '') { |
|
1070 | 1070 | global $globalDBdriver; |
1071 | 1071 | if ($globalDBdriver == 'mysql') { |
1072 | 1072 | $query = "INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) VALUES (:pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, pilot_name = :pilot_name"; |
1073 | 1073 | } else { |
1074 | 1074 | $query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; |
1075 | 1075 | } |
1076 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source); |
|
1076 | + $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':format_source' => $format_source); |
|
1077 | 1077 | try { |
1078 | 1078 | $sth = $this->db->prepare($query); |
1079 | 1079 | $sth->execute($query_values); |
1080 | - } catch(PDOException $e) { |
|
1080 | + } catch (PDOException $e) { |
|
1081 | 1081 | return "error : ".$e->getMessage(); |
1082 | 1082 | } |
1083 | 1083 | } |
1084 | - public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
1084 | + public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
1085 | 1085 | global $globalDBdriver; |
1086 | 1086 | if ($globalDBdriver == 'mysql') { |
1087 | 1087 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE departure = departure+:departure"; |
1088 | 1088 | } else { |
1089 | 1089 | $query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
1090 | 1090 | } |
1091 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1091 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1092 | 1092 | try { |
1093 | 1093 | $sth = $this->db->prepare($query); |
1094 | 1094 | $sth->execute($query_values); |
1095 | - } catch(PDOException $e) { |
|
1095 | + } catch (PDOException $e) { |
|
1096 | 1096 | return "error : ".$e->getMessage(); |
1097 | 1097 | } |
1098 | 1098 | } |
1099 | - public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
1099 | + public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
1100 | 1100 | global $globalDBdriver; |
1101 | 1101 | if ($globalDBdriver == 'mysql') { |
1102 | 1102 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE departure = :departure"; |
1103 | 1103 | } else { |
1104 | 1104 | $query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1105 | 1105 | } |
1106 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1106 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1107 | 1107 | try { |
1108 | 1108 | $sth = $this->db->prepare($query); |
1109 | 1109 | $sth->execute($query_values); |
1110 | - } catch(PDOException $e) { |
|
1110 | + } catch (PDOException $e) { |
|
1111 | 1111 | return "error : ".$e->getMessage(); |
1112 | 1112 | } |
1113 | 1113 | } |
1114 | - public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1114 | + public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1115 | 1115 | global $globalDBdriver; |
1116 | 1116 | if ($globalDBdriver == 'mysql') { |
1117 | 1117 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE arrival = arrival+:arrival"; |
1118 | 1118 | } else { |
1119 | 1119 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
1120 | 1120 | } |
1121 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1121 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1122 | 1122 | try { |
1123 | 1123 | $sth = $this->db->prepare($query); |
1124 | 1124 | $sth->execute($query_values); |
1125 | - } catch(PDOException $e) { |
|
1125 | + } catch (PDOException $e) { |
|
1126 | 1126 | return "error : ".$e->getMessage(); |
1127 | 1127 | } |
1128 | 1128 | } |
1129 | - public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1129 | + public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1130 | 1130 | global $globalDBdriver; |
1131 | 1131 | if ($globalDBdriver == 'mysql') { |
1132 | 1132 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE arrival = :arrival"; |
1133 | 1133 | } else { |
1134 | 1134 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1135 | 1135 | } |
1136 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1136 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1137 | 1137 | try { |
1138 | 1138 | $sth = $this->db->prepare($query); |
1139 | 1139 | $sth->execute($query_values); |
1140 | - } catch(PDOException $e) { |
|
1140 | + } catch (PDOException $e) { |
|
1141 | 1141 | return "error : ".$e->getMessage(); |
1142 | 1142 | } |
1143 | 1143 | } |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | try { |
1149 | 1149 | $sth = $this->db->prepare($query); |
1150 | 1150 | $sth->execute($query_values); |
1151 | - } catch(PDOException $e) { |
|
1151 | + } catch (PDOException $e) { |
|
1152 | 1152 | return "error : ".$e->getMessage(); |
1153 | 1153 | } |
1154 | 1154 | } |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | try { |
1159 | 1159 | $sth = $this->db->prepare($query); |
1160 | 1160 | $sth->execute($query_values); |
1161 | - } catch(PDOException $e) { |
|
1161 | + } catch (PDOException $e) { |
|
1162 | 1162 | return "error : ".$e->getMessage(); |
1163 | 1163 | } |
1164 | 1164 | } |
@@ -1168,13 +1168,13 @@ discard block |
||
1168 | 1168 | try { |
1169 | 1169 | $sth = $this->db->prepare($query); |
1170 | 1170 | $sth->execute($query_values); |
1171 | - } catch(PDOException $e) { |
|
1171 | + } catch (PDOException $e) { |
|
1172 | 1172 | return "error : ".$e->getMessage(); |
1173 | 1173 | } |
1174 | 1174 | } |
1175 | 1175 | |
1176 | 1176 | public function addOldStats() { |
1177 | - global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats; |
|
1177 | + global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats; |
|
1178 | 1178 | $Common = new Common(); |
1179 | 1179 | $Connection = new Connection(); |
1180 | 1180 | date_default_timezone_set('UTC'); |
@@ -1407,40 +1407,40 @@ discard block |
||
1407 | 1407 | $last_update_day = $last_update[0]['value']; |
1408 | 1408 | } else $last_update_day = '2012-12-12 12:12:12'; |
1409 | 1409 | $Spotter = new Spotter($this->db); |
1410 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
1410 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
1411 | 1411 | foreach ($alldata as $number) { |
1412 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']); |
|
1412 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer']); |
|
1413 | 1413 | } |
1414 | 1414 | if ($globalDebug) echo 'Count all airlines...'."\n"; |
1415 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
1415 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
1416 | 1416 | foreach ($alldata as $number) { |
1417 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']); |
|
1417 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name']); |
|
1418 | 1418 | } |
1419 | 1419 | if ($globalDebug) echo 'Count all registrations...'."\n"; |
1420 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
1420 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
1421 | 1421 | foreach ($alldata as $number) { |
1422 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']); |
|
1422 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao']); |
|
1423 | 1423 | } |
1424 | 1424 | if ($globalDebug) echo 'Count all callsigns...'."\n"; |
1425 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
1425 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
1426 | 1426 | foreach ($alldata as $number) { |
1427 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']); |
|
1427 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']); |
|
1428 | 1428 | } |
1429 | 1429 | if ($globalDebug) echo 'Count all owners...'."\n"; |
1430 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
1430 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
1431 | 1431 | foreach ($alldata as $number) { |
1432 | - $this->addStatOwner($number['owner_name'],$number['owner_count']); |
|
1432 | + $this->addStatOwner($number['owner_name'], $number['owner_count']); |
|
1433 | 1433 | } |
1434 | 1434 | if ($globalDebug) echo 'Count all pilots...'."\n"; |
1435 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
1435 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
1436 | 1436 | foreach ($alldata as $number) { |
1437 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source']); |
|
1437 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source']); |
|
1438 | 1438 | } |
1439 | 1439 | |
1440 | 1440 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
1441 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
1441 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
1442 | 1442 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
1443 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
1443 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
1444 | 1444 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
1445 | 1445 | $alldata = array(); |
1446 | 1446 | |
@@ -1458,14 +1458,14 @@ discard block |
||
1458 | 1458 | foreach ($alldata as $key => $row) { |
1459 | 1459 | $count[$key] = $row['airport_departure_icao_count']; |
1460 | 1460 | } |
1461 | - array_multisort($count,SORT_DESC,$alldata); |
|
1461 | + array_multisort($count, SORT_DESC, $alldata); |
|
1462 | 1462 | foreach ($alldata as $number) { |
1463 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']); |
|
1463 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count']); |
|
1464 | 1464 | } |
1465 | 1465 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
1466 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
1466 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
1467 | 1467 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
1468 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
1468 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
1469 | 1469 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
1470 | 1470 | $alldata = array(); |
1471 | 1471 | foreach ($pall as $value) { |
@@ -1482,16 +1482,16 @@ discard block |
||
1482 | 1482 | foreach ($alldata as $key => $row) { |
1483 | 1483 | $count[$key] = $row['airport_arrival_icao_count']; |
1484 | 1484 | } |
1485 | - array_multisort($count,SORT_DESC,$alldata); |
|
1485 | + array_multisort($count, SORT_DESC, $alldata); |
|
1486 | 1486 | foreach ($alldata as $number) { |
1487 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']); |
|
1487 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count']); |
|
1488 | 1488 | } |
1489 | 1489 | if ($Connection->tableExists('countries')) { |
1490 | 1490 | if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
1491 | 1491 | $SpotterArchive = new SpotterArchive(); |
1492 | - $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
|
1492 | + $alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day); |
|
1493 | 1493 | foreach ($alldata as $number) { |
1494 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count']); |
|
1494 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count']); |
|
1495 | 1495 | } |
1496 | 1496 | } |
1497 | 1497 | |
@@ -1505,37 +1505,37 @@ discard block |
||
1505 | 1505 | $lastyear = false; |
1506 | 1506 | foreach ($alldata as $number) { |
1507 | 1507 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1508 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1508 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1509 | 1509 | } |
1510 | 1510 | if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
1511 | 1511 | $alldata = $Spotter->countAllMilitaryMonths(); |
1512 | 1512 | foreach ($alldata as $number) { |
1513 | - $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1513 | + $this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1514 | 1514 | } |
1515 | 1515 | if ($globalDebug) echo 'Count all owners by months...'."\n"; |
1516 | 1516 | $alldata = $Spotter->countAllMonthsOwners(); |
1517 | 1517 | foreach ($alldata as $number) { |
1518 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1518 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1519 | 1519 | } |
1520 | 1520 | if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
1521 | 1521 | $alldata = $Spotter->countAllMonthsPilots(); |
1522 | 1522 | foreach ($alldata as $number) { |
1523 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1523 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1524 | 1524 | } |
1525 | 1525 | if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
1526 | 1526 | $alldata = $Spotter->countAllMonthsAirlines(); |
1527 | 1527 | foreach ($alldata as $number) { |
1528 | - $this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1528 | + $this->addStat('airlines_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1529 | 1529 | } |
1530 | 1530 | if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
1531 | 1531 | $alldata = $Spotter->countAllMonthsAircrafts(); |
1532 | 1532 | foreach ($alldata as $number) { |
1533 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1533 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1534 | 1534 | } |
1535 | 1535 | if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
1536 | 1536 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
1537 | 1537 | foreach ($alldata as $number) { |
1538 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1538 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1539 | 1539 | } |
1540 | 1540 | if ($globalDebug) echo 'Airports data...'."\n"; |
1541 | 1541 | if ($globalDebug) echo '...Departure'."\n"; |
@@ -1580,7 +1580,7 @@ discard block |
||
1580 | 1580 | } |
1581 | 1581 | $alldata = $pall; |
1582 | 1582 | foreach ($alldata as $number) { |
1583 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
1583 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
1584 | 1584 | } |
1585 | 1585 | echo '...Arrival'."\n"; |
1586 | 1586 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
@@ -1622,7 +1622,7 @@ discard block |
||
1622 | 1622 | } |
1623 | 1623 | $alldata = $pall; |
1624 | 1624 | foreach ($alldata as $number) { |
1625 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
1625 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
1626 | 1626 | } |
1627 | 1627 | |
1628 | 1628 | echo 'Flights data...'."\n"; |
@@ -1630,28 +1630,28 @@ discard block |
||
1630 | 1630 | echo '-> countAllDatesLastMonth...'."\n"; |
1631 | 1631 | $alldata = $Spotter->countAllDatesLastMonth(); |
1632 | 1632 | foreach ($alldata as $number) { |
1633 | - $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
1633 | + $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
1634 | 1634 | } |
1635 | 1635 | echo '-> countAllDates...'."\n"; |
1636 | 1636 | $previousdata = $this->countAllDates(); |
1637 | 1637 | $previousdatabyairlines = $this->countAllDatesByAirlines(); |
1638 | 1638 | $this->deleteStatFlight('date'); |
1639 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates()); |
|
1639 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates()); |
|
1640 | 1640 | $values = array(); |
1641 | 1641 | foreach ($alldata as $cnt) { |
1642 | 1642 | $values[] = $cnt['date_count']; |
1643 | 1643 | } |
1644 | - array_multisort($values,SORT_DESC,$alldata); |
|
1645 | - array_splice($alldata,11); |
|
1644 | + array_multisort($values, SORT_DESC, $alldata); |
|
1645 | + array_splice($alldata, 11); |
|
1646 | 1646 | foreach ($alldata as $number) { |
1647 | - $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
1647 | + $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
1648 | 1648 | } |
1649 | 1649 | |
1650 | 1650 | $this->deleteStatFlight('hour'); |
1651 | 1651 | echo '-> countAllHours...'."\n"; |
1652 | 1652 | $alldata = $Spotter->countAllHours('hour'); |
1653 | 1653 | foreach ($alldata as $number) { |
1654 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
1654 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
1655 | 1655 | } |
1656 | 1656 | |
1657 | 1657 | |
@@ -1660,34 +1660,34 @@ discard block |
||
1660 | 1660 | echo '--- Stats by airlines ---'."\n"; |
1661 | 1661 | if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
1662 | 1662 | $Spotter = new Spotter($this->db); |
1663 | - $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
1663 | + $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
1664 | 1664 | foreach ($alldata as $number) { |
1665 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']); |
|
1665 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao']); |
|
1666 | 1666 | } |
1667 | 1667 | if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
1668 | - $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
1668 | + $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
1669 | 1669 | foreach ($alldata as $number) { |
1670 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']); |
|
1670 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao']); |
|
1671 | 1671 | } |
1672 | 1672 | if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
1673 | - $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
1673 | + $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
1674 | 1674 | foreach ($alldata as $number) { |
1675 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']); |
|
1675 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']); |
|
1676 | 1676 | } |
1677 | 1677 | if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
1678 | - $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
1678 | + $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
1679 | 1679 | foreach ($alldata as $number) { |
1680 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']); |
|
1680 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao']); |
|
1681 | 1681 | } |
1682 | 1682 | if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
1683 | - $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
1683 | + $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
1684 | 1684 | foreach ($alldata as $number) { |
1685 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source']); |
|
1685 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source']); |
|
1686 | 1686 | } |
1687 | 1687 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
1688 | - $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1688 | + $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1689 | 1689 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
1690 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1690 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1691 | 1691 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
1692 | 1692 | //$alldata = array(); |
1693 | 1693 | foreach ($dall as $value) { |
@@ -1707,12 +1707,12 @@ discard block |
||
1707 | 1707 | } |
1708 | 1708 | $alldata = $pall; |
1709 | 1709 | foreach ($alldata as $number) { |
1710 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao']); |
|
1710 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], $number['airline_icao']); |
|
1711 | 1711 | } |
1712 | 1712 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
1713 | - $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1713 | + $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1714 | 1714 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
1715 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1715 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1716 | 1716 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
1717 | 1717 | //$alldata = array(); |
1718 | 1718 | foreach ($dall as $value) { |
@@ -1732,7 +1732,7 @@ discard block |
||
1732 | 1732 | } |
1733 | 1733 | $alldata = $pall; |
1734 | 1734 | foreach ($alldata as $number) { |
1735 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao']); |
|
1735 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], $number['airline_icao']); |
|
1736 | 1736 | } |
1737 | 1737 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
1738 | 1738 | $Spotter = new Spotter($this->db); |
@@ -1740,27 +1740,27 @@ discard block |
||
1740 | 1740 | $lastyear = false; |
1741 | 1741 | foreach ($alldata as $number) { |
1742 | 1742 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1743 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
1743 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
1744 | 1744 | } |
1745 | 1745 | if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
1746 | 1746 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
1747 | 1747 | foreach ($alldata as $number) { |
1748 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
1748 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
1749 | 1749 | } |
1750 | 1750 | if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
1751 | 1751 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
1752 | 1752 | foreach ($alldata as $number) { |
1753 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
1753 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
1754 | 1754 | } |
1755 | 1755 | if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
1756 | 1756 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
1757 | 1757 | foreach ($alldata as $number) { |
1758 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
1758 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
1759 | 1759 | } |
1760 | 1760 | if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
1761 | 1761 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
1762 | 1762 | foreach ($alldata as $number) { |
1763 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
1763 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
1764 | 1764 | } |
1765 | 1765 | if ($globalDebug) echo '...Departure'."\n"; |
1766 | 1766 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
@@ -1783,7 +1783,7 @@ discard block |
||
1783 | 1783 | } |
1784 | 1784 | $alldata = $pall; |
1785 | 1785 | foreach ($alldata as $number) { |
1786 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
|
1786 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], $number['airline_icao']); |
|
1787 | 1787 | } |
1788 | 1788 | if ($globalDebug) echo '...Arrival'."\n"; |
1789 | 1789 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
@@ -1806,32 +1806,32 @@ discard block |
||
1806 | 1806 | } |
1807 | 1807 | $alldata = $pall; |
1808 | 1808 | foreach ($alldata as $number) { |
1809 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
|
1809 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], $number['airline_icao']); |
|
1810 | 1810 | } |
1811 | 1811 | |
1812 | 1812 | if ($globalDebug) echo 'Flights data...'."\n"; |
1813 | 1813 | if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
1814 | 1814 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
1815 | 1815 | foreach ($alldata as $number) { |
1816 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
1816 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1817 | 1817 | } |
1818 | 1818 | if ($globalDebug) echo '-> countAllDates...'."\n"; |
1819 | 1819 | //$previousdata = $this->countAllDatesByAirlines(); |
1820 | - $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines()); |
|
1820 | + $alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines()); |
|
1821 | 1821 | $values = array(); |
1822 | 1822 | foreach ($alldata as $cnt) { |
1823 | 1823 | $values[] = $cnt['date_count']; |
1824 | 1824 | } |
1825 | - array_multisort($values,SORT_DESC,$alldata); |
|
1826 | - array_splice($alldata,11); |
|
1825 | + array_multisort($values, SORT_DESC, $alldata); |
|
1826 | + array_splice($alldata, 11); |
|
1827 | 1827 | foreach ($alldata as $number) { |
1828 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
1828 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1829 | 1829 | } |
1830 | 1830 | |
1831 | 1831 | if ($globalDebug) echo '-> countAllHours...'."\n"; |
1832 | 1832 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
1833 | 1833 | foreach ($alldata as $number) { |
1834 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
1834 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
1835 | 1835 | } |
1836 | 1836 | |
1837 | 1837 | |
@@ -1848,32 +1848,32 @@ discard block |
||
1848 | 1848 | // Count by filter |
1849 | 1849 | if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
1850 | 1850 | $Spotter = new Spotter($this->db); |
1851 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
1851 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
|
1852 | 1852 | foreach ($alldata as $number) { |
1853 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name); |
|
1853 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name); |
|
1854 | 1854 | } |
1855 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
|
1855 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter); |
|
1856 | 1856 | foreach ($alldata as $number) { |
1857 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name); |
|
1857 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name); |
|
1858 | 1858 | } |
1859 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
1859 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
|
1860 | 1860 | foreach ($alldata as $number) { |
1861 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name); |
|
1861 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name); |
|
1862 | 1862 | } |
1863 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
1863 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
|
1864 | 1864 | foreach ($alldata as $number) { |
1865 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name); |
|
1865 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name); |
|
1866 | 1866 | } |
1867 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
1867 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
|
1868 | 1868 | foreach ($alldata as $number) { |
1869 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name); |
|
1869 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name); |
|
1870 | 1870 | } |
1871 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
1871 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
|
1872 | 1872 | foreach ($alldata as $number) { |
1873 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source']); |
|
1873 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source']); |
|
1874 | 1874 | } |
1875 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
1876 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
1875 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
1876 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
|
1877 | 1877 | $alldata = array(); |
1878 | 1878 | foreach ($pall as $value) { |
1879 | 1879 | $icao = $value['airport_departure_icao']; |
@@ -1889,12 +1889,12 @@ discard block |
||
1889 | 1889 | foreach ($alldata as $key => $row) { |
1890 | 1890 | $count[$key] = $row['airport_departure_icao_count']; |
1891 | 1891 | } |
1892 | - array_multisort($count,SORT_DESC,$alldata); |
|
1892 | + array_multisort($count, SORT_DESC, $alldata); |
|
1893 | 1893 | foreach ($alldata as $number) { |
1894 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name); |
|
1894 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', $filter_name); |
|
1895 | 1895 | } |
1896 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,$filter); |
|
1897 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter); |
|
1896 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, $filter); |
|
1897 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, $filter); |
|
1898 | 1898 | $alldata = array(); |
1899 | 1899 | foreach ($pall as $value) { |
1900 | 1900 | $icao = $value['airport_arrival_icao']; |
@@ -1910,40 +1910,40 @@ discard block |
||
1910 | 1910 | foreach ($alldata as $key => $row) { |
1911 | 1911 | $count[$key] = $row['airport_arrival_icao_count']; |
1912 | 1912 | } |
1913 | - array_multisort($count,SORT_DESC,$alldata); |
|
1913 | + array_multisort($count, SORT_DESC, $alldata); |
|
1914 | 1914 | foreach ($alldata as $number) { |
1915 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name); |
|
1915 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', $filter_name); |
|
1916 | 1916 | } |
1917 | 1917 | $Spotter = new Spotter($this->db); |
1918 | 1918 | $alldata = $Spotter->countAllMonths($filter); |
1919 | 1919 | $lastyear = false; |
1920 | 1920 | foreach ($alldata as $number) { |
1921 | 1921 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1922 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
1922 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
1923 | 1923 | } |
1924 | 1924 | $alldata = $Spotter->countAllMonthsOwners($filter); |
1925 | 1925 | foreach ($alldata as $number) { |
1926 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
1926 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
1927 | 1927 | } |
1928 | 1928 | $alldata = $Spotter->countAllMonthsPilots($filter); |
1929 | 1929 | foreach ($alldata as $number) { |
1930 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
1930 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
1931 | 1931 | } |
1932 | 1932 | $alldata = $Spotter->countAllMilitaryMonths($filter); |
1933 | 1933 | foreach ($alldata as $number) { |
1934 | - $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
1934 | + $this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
1935 | 1935 | } |
1936 | 1936 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
1937 | 1937 | foreach ($alldata as $number) { |
1938 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
1938 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
1939 | 1939 | } |
1940 | 1940 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
1941 | 1941 | foreach ($alldata as $number) { |
1942 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
1942 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
1943 | 1943 | } |
1944 | 1944 | echo '...Departure'."\n"; |
1945 | - $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
|
1946 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
1945 | + $pall = $Spotter->getLast7DaysAirportsDeparture('', $filter); |
|
1946 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter); |
|
1947 | 1947 | foreach ($dall as $value) { |
1948 | 1948 | $icao = $value['departure_airport_icao']; |
1949 | 1949 | $ddate = $value['date']; |
@@ -1961,11 +1961,11 @@ discard block |
||
1961 | 1961 | } |
1962 | 1962 | $alldata = $pall; |
1963 | 1963 | foreach ($alldata as $number) { |
1964 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name); |
|
1964 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], '', $filter_name); |
|
1965 | 1965 | } |
1966 | 1966 | echo '...Arrival'."\n"; |
1967 | - $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
|
1968 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
1967 | + $pall = $Spotter->getLast7DaysAirportsArrival('', $filter); |
|
1968 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter); |
|
1969 | 1969 | foreach ($dall as $value) { |
1970 | 1970 | $icao = $value['arrival_airport_icao']; |
1971 | 1971 | $ddate = $value['date']; |
@@ -1983,40 +1983,40 @@ discard block |
||
1983 | 1983 | } |
1984 | 1984 | $alldata = $pall; |
1985 | 1985 | foreach ($alldata as $number) { |
1986 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name); |
|
1986 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], '', $filter_name); |
|
1987 | 1987 | } |
1988 | 1988 | |
1989 | 1989 | echo 'Flights data...'."\n"; |
1990 | 1990 | echo '-> countAllDatesLastMonth...'."\n"; |
1991 | 1991 | $alldata = $Spotter->countAllDatesLastMonth($filter); |
1992 | 1992 | foreach ($alldata as $number) { |
1993 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
1993 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
|
1994 | 1994 | } |
1995 | 1995 | echo '-> countAllDates...'."\n"; |
1996 | - $previousdata = $this->countAllDates('',$filter_name); |
|
1997 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
1996 | + $previousdata = $this->countAllDates('', $filter_name); |
|
1997 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
|
1998 | 1998 | $values = array(); |
1999 | 1999 | foreach ($alldata as $cnt) { |
2000 | 2000 | $values[] = $cnt['date_count']; |
2001 | 2001 | } |
2002 | - array_multisort($values,SORT_DESC,$alldata); |
|
2003 | - array_splice($alldata,11); |
|
2002 | + array_multisort($values, SORT_DESC, $alldata); |
|
2003 | + array_splice($alldata, 11); |
|
2004 | 2004 | foreach ($alldata as $number) { |
2005 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
2005 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
|
2006 | 2006 | } |
2007 | 2007 | |
2008 | 2008 | echo '-> countAllHours...'."\n"; |
2009 | - $alldata = $Spotter->countAllHours('hour',$filter); |
|
2009 | + $alldata = $Spotter->countAllHours('hour', $filter); |
|
2010 | 2010 | foreach ($alldata as $number) { |
2011 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
2011 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
|
2012 | 2012 | } |
2013 | 2013 | echo 'Insert last stats update date...'."\n"; |
2014 | 2014 | date_default_timezone_set('UTC'); |
2015 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s')); |
|
2015 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s')); |
|
2016 | 2016 | if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) { |
2017 | - if (date('Y',strtotime($last_update_day)) != date('Y')) { |
|
2017 | + if (date('Y', strtotime($last_update_day)) != date('Y')) { |
|
2018 | 2018 | $this->deleteOldStats($filter_name); |
2019 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00'); |
|
2019 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00'); |
|
2020 | 2020 | } |
2021 | 2021 | } |
2022 | 2022 | |
@@ -2029,16 +2029,16 @@ discard block |
||
2029 | 2029 | // SUM all previous month to put as year |
2030 | 2030 | $previous_year = date('Y'); |
2031 | 2031 | $previous_year--; |
2032 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2033 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2034 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2035 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2032 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2033 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2034 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2035 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2036 | 2036 | $allairlines = $this->getAllAirlineNames(); |
2037 | 2037 | foreach ($allairlines as $data) { |
2038 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2039 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2040 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2041 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2038 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2039 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2040 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2041 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2042 | 2042 | } |
2043 | 2043 | |
2044 | 2044 | if (isset($globalArchiveYear) && $globalArchiveYear) { |
@@ -2047,7 +2047,7 @@ discard block |
||
2047 | 2047 | try { |
2048 | 2048 | $sth = $this->db->prepare($query); |
2049 | 2049 | $sth->execute(); |
2050 | - } catch(PDOException $e) { |
|
2050 | + } catch (PDOException $e) { |
|
2051 | 2051 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2052 | 2052 | } |
2053 | 2053 | } |
@@ -2056,15 +2056,15 @@ discard block |
||
2056 | 2056 | try { |
2057 | 2057 | $sth = $this->db->prepare($query); |
2058 | 2058 | $sth->execute(); |
2059 | - } catch(PDOException $e) { |
|
2059 | + } catch (PDOException $e) { |
|
2060 | 2060 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2061 | 2061 | } |
2062 | 2062 | } |
2063 | 2063 | if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) { |
2064 | 2064 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
2065 | - if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) { |
|
2065 | + if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) { |
|
2066 | 2066 | $this->deleteOldStats(); |
2067 | - $this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00'); |
|
2067 | + $this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00'); |
|
2068 | 2068 | $lastyearupdate = true; |
2069 | 2069 | } |
2070 | 2070 | } |
@@ -2086,7 +2086,7 @@ discard block |
||
2086 | 2086 | try { |
2087 | 2087 | $sth = $this->db->prepare($query); |
2088 | 2088 | $sth->execute(); |
2089 | - } catch(PDOException $e) { |
|
2089 | + } catch (PDOException $e) { |
|
2090 | 2090 | return "error : ".$e->getMessage(); |
2091 | 2091 | } |
2092 | 2092 | } |
@@ -2100,14 +2100,14 @@ discard block |
||
2100 | 2100 | try { |
2101 | 2101 | $sth = $this->db->prepare($query); |
2102 | 2102 | $sth->execute(); |
2103 | - } catch(PDOException $e) { |
|
2103 | + } catch (PDOException $e) { |
|
2104 | 2104 | return "error : ".$e->getMessage(); |
2105 | 2105 | } |
2106 | 2106 | } |
2107 | 2107 | if (!isset($lastyearupdate)) { |
2108 | 2108 | echo 'Insert last stats update date...'."\n"; |
2109 | 2109 | date_default_timezone_set('UTC'); |
2110 | - $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
2110 | + $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
2111 | 2111 | } |
2112 | 2112 | //} |
2113 | 2113 | } |