@@ -3,8 +3,8 @@ |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | if (!isset($_GET['airport'])) { |
6 | - header('Location: '.$globalURL.'/airport'); |
|
7 | - die(); |
|
6 | + header('Location: '.$globalURL.'/airport'); |
|
7 | + die(); |
|
8 | 8 | } |
9 | 9 | $airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
10 | 10 | $Spotter = new Spotter(); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
26 | 26 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
27 | 27 | } |
28 | - ?> |
|
28 | + ?> |
|
29 | 29 | </div> |
30 | 30 | |
31 | 31 | <?php include('statistics-sub-menu.php'); ?> |
@@ -35,18 +35,18 @@ discard block |
||
35 | 35 | <div class="col-md-2"><span class="type"><?php echo _("Arrivals seen"); ?></span><span><?php print number_format($Stats->countOverallArrival()); ?></span></div> |
36 | 36 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
37 | 37 | <?php |
38 | - if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
38 | + if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
39 | 39 | ?> |
40 | 40 | <div class="col-md-2"><span class="type"><?php echo _("Pilots"); ?></span><span><?php print number_format($Stats->countOverallPilots()); ?></span></div> |
41 | 41 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
42 | 42 | <?php |
43 | - } else { |
|
44 | - ?> |
|
43 | + } else { |
|
44 | + ?> |
|
45 | 45 | <div class="col-md-2"><span class="type"><?php echo _("Owners"); ?></span><span><?php print number_format($Stats->countOverallOwners()); ?></span></div> |
46 | 46 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
47 | 47 | <?php |
48 | - } |
|
49 | - ?> |
|
48 | + } |
|
49 | + ?> |
|
50 | 50 | <div class="col-md-2"><span class="type"><?php echo _("Aircrafts"); ?></span><span><?php print number_format($Stats->countOverallAircrafts()); ?></span></div> |
51 | 51 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
52 | 52 | <div class="col-md-2"><span class="type"><?php echo _("Airlines"); ?></span><span><?php print number_format($Stats->countOverallAirlines()); ?></span></div> |
@@ -66,25 +66,25 @@ discard block |
||
66 | 66 | <div class="col-md-6"> |
67 | 67 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
68 | 68 | <?php |
69 | - $aircraft_array = $Stats->countAllAircraftTypes(); |
|
70 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
71 | - else { |
|
69 | + $aircraft_array = $Stats->countAllAircraftTypes(); |
|
70 | + if (count($aircraft_array) == 0) print _("No data available"); |
|
71 | + else { |
|
72 | 72 | |
73 | - print '<div id="chart1" class="chart" width="100%"></div> |
|
73 | + print '<div id="chart1" class="chart" width="100%"></div> |
|
74 | 74 | <script> |
75 | 75 | google.load("visualization", "1", {packages:["corechart"]}); |
76 | 76 | google.setOnLoadCallback(drawChart1); |
77 | 77 | function drawChart1() { |
78 | 78 | var data = google.visualization.arrayToDataTable([ |
79 | 79 | ["'._("Aircraft").'", "'._("# of times").'"], '; |
80 | - $aircraft_data = ''; |
|
81 | - foreach($aircraft_array as $aircraft_item) |
|
82 | - { |
|
83 | - $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
84 | - } |
|
85 | - $aircraft_data = substr($aircraft_data, 0, -1); |
|
86 | - print $aircraft_data; |
|
87 | - print ']); |
|
80 | + $aircraft_data = ''; |
|
81 | + foreach($aircraft_array as $aircraft_item) |
|
82 | + { |
|
83 | + $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
84 | + } |
|
85 | + $aircraft_data = substr($aircraft_data, 0, -1); |
|
86 | + print $aircraft_data; |
|
87 | + print ']); |
|
88 | 88 | |
89 | 89 | var options = { |
90 | 90 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | drawChart1(); |
100 | 100 | }); |
101 | 101 | </script>'; |
102 | - } |
|
103 | - ?> |
|
102 | + } |
|
103 | + ?> |
|
104 | 104 | <div class="more"> |
105 | 105 | <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
106 | 106 | </div> |
@@ -110,25 +110,25 @@ discard block |
||
110 | 110 | <div class="col-md-6"> |
111 | 111 | <h2><?php echo _("Top 10 Most Common Airline"); ?></h2> |
112 | 112 | <?php |
113 | - $airline_array = $Stats->countAllAirlines(); |
|
114 | - if (count($airline_array) == 0) print _("No data available"); |
|
115 | - else { |
|
113 | + $airline_array = $Stats->countAllAirlines(); |
|
114 | + if (count($airline_array) == 0) print _("No data available"); |
|
115 | + else { |
|
116 | 116 | |
117 | - print '<div id="chart2" class="chart" width="100%"></div> |
|
117 | + print '<div id="chart2" class="chart" width="100%"></div> |
|
118 | 118 | <script> |
119 | 119 | google.load("visualization", "1", {packages:["corechart"]}); |
120 | 120 | google.setOnLoadCallback(drawChart2); |
121 | 121 | function drawChart2() { |
122 | 122 | var data = google.visualization.arrayToDataTable([ |
123 | 123 | ["'._("Airline").'", "'._("# of times").'"], '; |
124 | - $airline_data = ''; |
|
125 | - foreach($airline_array as $airline_item) |
|
126 | - { |
|
127 | - $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
|
128 | - } |
|
129 | - $airline_data = substr($airline_data, 0, -1); |
|
130 | - print $airline_data; |
|
131 | - print ']); |
|
124 | + $airline_data = ''; |
|
125 | + foreach($airline_array as $airline_item) |
|
126 | + { |
|
127 | + $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
|
128 | + } |
|
129 | + $airline_data = substr($airline_data, 0, -1); |
|
130 | + print $airline_data; |
|
131 | + print ']); |
|
132 | 132 | |
133 | 133 | var options = { |
134 | 134 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | drawChart2(); |
144 | 144 | }); |
145 | 145 | </script>'; |
146 | - } |
|
147 | - ?> |
|
146 | + } |
|
147 | + ?> |
|
148 | 148 | <div class="more"> |
149 | 149 | <a href="<?php print $globalURL; ?>/statistics/airline" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
150 | 150 | </div> |
@@ -154,40 +154,40 @@ discard block |
||
154 | 154 | <div class="row column"> |
155 | 155 | |
156 | 156 | <?php |
157 | - $flightover_array = $Stats->countAllFlightOverCountries(); |
|
157 | + $flightover_array = $Stats->countAllFlightOverCountries(); |
|
158 | 158 | |
159 | 159 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
160 | - if (empty($flightover_array)) { |
|
161 | - ?> |
|
160 | + if (empty($flightover_array)) { |
|
161 | + ?> |
|
162 | 162 | <div class="col-md-12"> |
163 | 163 | <?php |
164 | - } else { |
|
165 | - ?> |
|
164 | + } else { |
|
165 | + ?> |
|
166 | 166 | <div class="col-md-6"> |
167 | 167 | <?php |
168 | - } |
|
169 | - ?> |
|
168 | + } |
|
169 | + ?> |
|
170 | 170 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
171 | 171 | <?php |
172 | - $pilot_array = $Stats->countAllPilots(); |
|
173 | - if (count($pilot_array) == 0) print _("No data available"); |
|
174 | - else { |
|
172 | + $pilot_array = $Stats->countAllPilots(); |
|
173 | + if (count($pilot_array) == 0) print _("No data available"); |
|
174 | + else { |
|
175 | 175 | |
176 | - print '<div id="chart7" class="chart" width="100%"></div> |
|
176 | + print '<div id="chart7" class="chart" width="100%"></div> |
|
177 | 177 | <script> |
178 | 178 | google.load("visualization", "1", {packages:["corechart"]}); |
179 | 179 | google.setOnLoadCallback(drawChart7); |
180 | 180 | function drawChart7() { |
181 | 181 | var data = google.visualization.arrayToDataTable([ |
182 | 182 | ["'._("Pilots").'", "'._("# of times").'"], '; |
183 | - $pilot_data = ''; |
|
184 | - foreach($pilot_array as $pilot_item) |
|
185 | - { |
|
186 | - $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
|
187 | - } |
|
188 | - $pilot_data = substr($pilot_data, 0, -1); |
|
189 | - print $pilot_data; |
|
190 | - print ']); |
|
183 | + $pilot_data = ''; |
|
184 | + foreach($pilot_array as $pilot_item) |
|
185 | + { |
|
186 | + $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
|
187 | + } |
|
188 | + $pilot_data = substr($pilot_data, 0, -1); |
|
189 | + print $pilot_data; |
|
190 | + print ']); |
|
191 | 191 | |
192 | 192 | var options = { |
193 | 193 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | drawChart7(); |
203 | 203 | }); |
204 | 204 | </script>'; |
205 | - } |
|
206 | - ?> |
|
205 | + } |
|
206 | + ?> |
|
207 | 207 | <div class="more"> |
208 | 208 | <a href="<?php print $globalURL; ?>/statistics/pilot" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
209 | 209 | </div> |
@@ -211,30 +211,30 @@ discard block |
||
211 | 211 | |
212 | 212 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
213 | 213 | <?php |
214 | - } else { |
|
215 | - ?> |
|
214 | + } else { |
|
215 | + ?> |
|
216 | 216 | <div class="col-md-6"> |
217 | 217 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
218 | 218 | <?php |
219 | - $owner_array = $Stats->countAllOwners(); |
|
220 | - if (count($owner_array) == 0) print _("No data available"); |
|
221 | - else { |
|
219 | + $owner_array = $Stats->countAllOwners(); |
|
220 | + if (count($owner_array) == 0) print _("No data available"); |
|
221 | + else { |
|
222 | 222 | |
223 | - print '<div id="chart7" class="chart" width="100%"></div> |
|
223 | + print '<div id="chart7" class="chart" width="100%"></div> |
|
224 | 224 | <script> |
225 | 225 | google.load("visualization", "1", {packages:["corechart"]}); |
226 | 226 | google.setOnLoadCallback(drawChart7); |
227 | 227 | function drawChart7() { |
228 | 228 | var data = google.visualization.arrayToDataTable([ |
229 | 229 | ["'._("Owner").'", "'._("# of times").'"], '; |
230 | - $owner_data = ''; |
|
231 | - foreach($owner_array as $owner_item) |
|
232 | - { |
|
233 | - $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
|
234 | - } |
|
235 | - $owner_data = substr($owner_data, 0, -1); |
|
236 | - print $owner_data; |
|
237 | - print ']); |
|
230 | + $owner_data = ''; |
|
231 | + foreach($owner_array as $owner_item) |
|
232 | + { |
|
233 | + $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
|
234 | + } |
|
235 | + $owner_data = substr($owner_data, 0, -1); |
|
236 | + print $owner_data; |
|
237 | + print ']); |
|
238 | 238 | |
239 | 239 | var options = { |
240 | 240 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -249,8 +249,8 @@ discard block |
||
249 | 249 | drawChart7(); |
250 | 250 | }); |
251 | 251 | </script>'; |
252 | - } |
|
253 | - ?> |
|
252 | + } |
|
253 | + ?> |
|
254 | 254 | <div class="more"> |
255 | 255 | <a href="<?php print $globalURL; ?>/statistics/owner" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
256 | 256 | </div> |
@@ -258,32 +258,32 @@ discard block |
||
258 | 258 | |
259 | 259 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
260 | 260 | <?php |
261 | - } |
|
262 | - if (!empty($flightover_array)) { |
|
263 | - ?> |
|
261 | + } |
|
262 | + if (!empty($flightover_array)) { |
|
263 | + ?> |
|
264 | 264 | |
265 | 265 | <div class="col-md-6"> |
266 | 266 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
267 | 267 | <?php |
268 | - //$flightover_array = $Stats->countAllFlightOverCountries(); |
|
269 | - if (count($flightover_array) == 0) print _("No data available"); |
|
270 | - else { |
|
268 | + //$flightover_array = $Stats->countAllFlightOverCountries(); |
|
269 | + if (count($flightover_array) == 0) print _("No data available"); |
|
270 | + else { |
|
271 | 271 | |
272 | - print '<div id="chart10" class="chart" width="100%"></div> |
|
272 | + print '<div id="chart10" class="chart" width="100%"></div> |
|
273 | 273 | <script> |
274 | 274 | google.load("visualization", "1", {packages:["corechart"]}); |
275 | 275 | google.setOnLoadCallback(drawChart10); |
276 | 276 | function drawChart10() { |
277 | 277 | var data = google.visualization.arrayToDataTable([ |
278 | 278 | ["'._("Country").'", "'._("# of times").'"], '; |
279 | - $flightover_data = ''; |
|
280 | - foreach($flightover_array as $flightover_item) |
|
281 | - { |
|
282 | - $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],'; |
|
283 | - } |
|
284 | - $flightover_data = substr($flightover_data, 0, -1); |
|
285 | - print $flightover_data; |
|
286 | - print ']); |
|
279 | + $flightover_data = ''; |
|
280 | + foreach($flightover_array as $flightover_item) |
|
281 | + { |
|
282 | + $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],'; |
|
283 | + } |
|
284 | + $flightover_data = substr($flightover_data, 0, -1); |
|
285 | + print $flightover_data; |
|
286 | + print ']); |
|
287 | 287 | |
288 | 288 | var options = { |
289 | 289 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -300,15 +300,15 @@ discard block |
||
300 | 300 | drawChart10(); |
301 | 301 | }); |
302 | 302 | </script>'; |
303 | - } |
|
304 | - ?> |
|
303 | + } |
|
304 | + ?> |
|
305 | 305 | <div class="more"> |
306 | 306 | <a href="<?php print $globalURL; ?>/statistics/country" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
307 | 307 | </div> |
308 | 308 | </div> |
309 | 309 | <?php |
310 | - } |
|
311 | - ?> |
|
310 | + } |
|
311 | + ?> |
|
312 | 312 | </div> |
313 | 313 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
314 | 314 | |
@@ -318,11 +318,11 @@ discard block |
||
318 | 318 | <div class="col-md-6"> |
319 | 319 | <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2> |
320 | 320 | <?php |
321 | - $airport_airport_array = $Stats->countAllDepartureAirports(); |
|
322 | - if (count($airport_airport_array) == 0) print _("No data available"); |
|
323 | - else { |
|
321 | + $airport_airport_array = $Stats->countAllDepartureAirports(); |
|
322 | + if (count($airport_airport_array) == 0) print _("No data available"); |
|
323 | + else { |
|
324 | 324 | |
325 | - print '<div id="chart3" class="chart" width="100%"></div> |
|
325 | + print '<div id="chart3" class="chart" width="100%"></div> |
|
326 | 326 | <script> |
327 | 327 | google.load("visualization", "1", {packages:["geochart"]}); |
328 | 328 | google.setOnLoadCallback(drawCharts3); |
@@ -333,17 +333,17 @@ discard block |
||
333 | 333 | |
334 | 334 | var data = google.visualization.arrayToDataTable([ |
335 | 335 | ["'._("Airport").'", "'._("# of times").'"],'; |
336 | - $airport_data = ''; |
|
337 | - foreach($airport_airport_array as $airport_item) |
|
338 | - { |
|
339 | - $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
|
340 | - $name = str_replace("'", "", $name); |
|
341 | - $name = str_replace('"', "", $name); |
|
342 | - $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],'; |
|
343 | - } |
|
344 | - $airport_data = substr($airport_data, 0, -1); |
|
345 | - print $airport_data; |
|
346 | - print ']); |
|
336 | + $airport_data = ''; |
|
337 | + foreach($airport_airport_array as $airport_item) |
|
338 | + { |
|
339 | + $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
|
340 | + $name = str_replace("'", "", $name); |
|
341 | + $name = str_replace('"', "", $name); |
|
342 | + $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],'; |
|
343 | + } |
|
344 | + $airport_data = substr($airport_data, 0, -1); |
|
345 | + print $airport_data; |
|
346 | + print ']); |
|
347 | 347 | |
348 | 348 | var options = { |
349 | 349 | legend: {position: "none"}, |
@@ -357,8 +357,8 @@ discard block |
||
357 | 357 | chart.draw(data, options); |
358 | 358 | } |
359 | 359 | </script>'; |
360 | - } |
|
361 | - ?> |
|
360 | + } |
|
361 | + ?> |
|
362 | 362 | <div class="more"> |
363 | 363 | <a href="<?php print $globalURL; ?>/statistics/airport-departure" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
364 | 364 | </div> |
@@ -368,11 +368,11 @@ discard block |
||
368 | 368 | <div class="col-md-6"> |
369 | 369 | <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2> |
370 | 370 | <?php |
371 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(); |
|
372 | - if (count($airport_airport_array2) == 0) print _("No data available"); |
|
373 | - else { |
|
371 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(); |
|
372 | + if (count($airport_airport_array2) == 0) print _("No data available"); |
|
373 | + else { |
|
374 | 374 | |
375 | - print '<div id="chart4" class="chart" width="100%"></div> |
|
375 | + print '<div id="chart4" class="chart" width="100%"></div> |
|
376 | 376 | <script> |
377 | 377 | google.load("visualization", "1", {packages:["geochart"]}); |
378 | 378 | google.setOnLoadCallback(drawCharts4); |
@@ -383,17 +383,17 @@ discard block |
||
383 | 383 | |
384 | 384 | var data = google.visualization.arrayToDataTable([ |
385 | 385 | ["'._("Airport").'", "'._("# of times").'"],'; |
386 | - $airport_data2 = ''; |
|
387 | - foreach($airport_airport_array2 as $airport_item2) |
|
388 | - { |
|
389 | - $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')'; |
|
390 | - $name2 = str_replace("'", "", $name2); |
|
391 | - $name2 = str_replace('"', "", $name2); |
|
392 | - $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],'; |
|
393 | - } |
|
394 | - $airport_data2 = substr($airport_data2, 0, -1); |
|
395 | - print $airport_data2; |
|
396 | - print ']); |
|
386 | + $airport_data2 = ''; |
|
387 | + foreach($airport_airport_array2 as $airport_item2) |
|
388 | + { |
|
389 | + $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')'; |
|
390 | + $name2 = str_replace("'", "", $name2); |
|
391 | + $name2 = str_replace('"', "", $name2); |
|
392 | + $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],'; |
|
393 | + } |
|
394 | + $airport_data2 = substr($airport_data2, 0, -1); |
|
395 | + print $airport_data2; |
|
396 | + print ']); |
|
397 | 397 | |
398 | 398 | var options = { |
399 | 399 | legend: {position: "none"}, |
@@ -407,8 +407,8 @@ discard block |
||
407 | 407 | chart.draw(data, options); |
408 | 408 | } |
409 | 409 | </script>'; |
410 | - } |
|
411 | - ?> |
|
410 | + } |
|
411 | + ?> |
|
412 | 412 | <div class="more"> |
413 | 413 | <a href="<?php print $globalURL; ?>/statistics/airport-arrival" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
414 | 414 | </div> |
@@ -420,24 +420,24 @@ discard block |
||
420 | 420 | <div class="col-md-6"> |
421 | 421 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
422 | 422 | <?php |
423 | - $year_array = $Stats->countAllMonthsLastYear(); |
|
424 | - if (count($year_array) == 0) print _("No data available"); |
|
425 | - else { |
|
426 | - print '<div id="chart8" class="chart" width="100%"></div> |
|
423 | + $year_array = $Stats->countAllMonthsLastYear(); |
|
424 | + if (count($year_array) == 0) print _("No data available"); |
|
425 | + else { |
|
426 | + print '<div id="chart8" class="chart" width="100%"></div> |
|
427 | 427 | <script> |
428 | 428 | google.load("visualization", "1", {packages:["corechart"]}); |
429 | 429 | google.setOnLoadCallback(drawChart8); |
430 | 430 | function drawChart8() { |
431 | 431 | var data = google.visualization.arrayToDataTable([ |
432 | 432 | ["'._("Month").'", "'._("# of Flights").'"], '; |
433 | - $year_data = ''; |
|
434 | - foreach($year_array as $year_item) |
|
435 | - { |
|
436 | - $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],'; |
|
437 | - } |
|
438 | - $year_data = substr($year_data, 0, -1); |
|
439 | - print $year_data; |
|
440 | - print ']); |
|
433 | + $year_data = ''; |
|
434 | + foreach($year_array as $year_item) |
|
435 | + { |
|
436 | + $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],'; |
|
437 | + } |
|
438 | + $year_data = substr($year_data, 0, -1); |
|
439 | + print $year_data; |
|
440 | + print ']); |
|
441 | 441 | |
442 | 442 | var options = { |
443 | 443 | legend: {position: "none"}, |
@@ -455,8 +455,8 @@ discard block |
||
455 | 455 | drawChart8(); |
456 | 456 | }); |
457 | 457 | </script>'; |
458 | - } |
|
459 | - ?> |
|
458 | + } |
|
459 | + ?> |
|
460 | 460 | <div class="more"> |
461 | 461 | <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
462 | 462 | </div> |
@@ -466,24 +466,24 @@ discard block |
||
466 | 466 | <div class="col-md-6"> |
467 | 467 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
468 | 468 | <?php |
469 | - $month_array = $Stats->countAllDatesLastMonth(); |
|
470 | - if (count($month_array) == 0) print _("No data available"); |
|
471 | - else { |
|
472 | - print '<div id="chart9" class="chart" width="100%"></div> |
|
469 | + $month_array = $Stats->countAllDatesLastMonth(); |
|
470 | + if (count($month_array) == 0) print _("No data available"); |
|
471 | + else { |
|
472 | + print '<div id="chart9" class="chart" width="100%"></div> |
|
473 | 473 | <script> |
474 | 474 | google.load("visualization", "1", {packages:["corechart"]}); |
475 | 475 | google.setOnLoadCallback(drawChart9); |
476 | 476 | function drawChart9() { |
477 | 477 | var data = google.visualization.arrayToDataTable([ |
478 | 478 | ["'._("Day").'", "'._("# of Flights").'"], '; |
479 | - $month_data = ''; |
|
480 | - foreach($month_array as $month_item) |
|
481 | - { |
|
482 | - $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],'; |
|
483 | - } |
|
484 | - $month_data = substr($month_data, 0, -1); |
|
485 | - print $month_data; |
|
486 | - print ']); |
|
479 | + $month_data = ''; |
|
480 | + foreach($month_array as $month_item) |
|
481 | + { |
|
482 | + $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],'; |
|
483 | + } |
|
484 | + $month_data = substr($month_data, 0, -1); |
|
485 | + print $month_data; |
|
486 | + print ']); |
|
487 | 487 | |
488 | 488 | var options = { |
489 | 489 | legend: {position: "none"}, |
@@ -501,8 +501,8 @@ discard block |
||
501 | 501 | drawChart9(); |
502 | 502 | }); |
503 | 503 | </script>'; |
504 | - } |
|
505 | - ?> |
|
504 | + } |
|
505 | + ?> |
|
506 | 506 | <div class="more"> |
507 | 507 | <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
508 | 508 | </div> |
@@ -512,25 +512,25 @@ discard block |
||
512 | 512 | <div class="col-md-6"> |
513 | 513 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
514 | 514 | <?php |
515 | - $date_array = $Stats->countAllDatesLast7Days(); |
|
516 | - if (empty($date_array)) print _("No data available"); |
|
517 | - else { |
|
518 | - print '<div id="chart5" class="chart" width="100%"></div> |
|
515 | + $date_array = $Stats->countAllDatesLast7Days(); |
|
516 | + if (empty($date_array)) print _("No data available"); |
|
517 | + else { |
|
518 | + print '<div id="chart5" class="chart" width="100%"></div> |
|
519 | 519 | <script> |
520 | 520 | google.load("visualization", "1", {packages:["corechart"]}); |
521 | 521 | google.setOnLoadCallback(drawChart5); |
522 | 522 | function drawChart5() { |
523 | 523 | var data = google.visualization.arrayToDataTable([ |
524 | 524 | ["'._("Date").'", "'._("# of Flights").'"], '; |
525 | - $date_data = ''; |
|
525 | + $date_data = ''; |
|
526 | 526 | |
527 | - foreach($date_array as $date_item) |
|
528 | - { |
|
529 | - $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],'; |
|
530 | - } |
|
531 | - $date_data = substr($date_data, 0, -1); |
|
532 | - print $date_data; |
|
533 | - print ']); |
|
527 | + foreach($date_array as $date_item) |
|
528 | + { |
|
529 | + $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],'; |
|
530 | + } |
|
531 | + $date_data = substr($date_data, 0, -1); |
|
532 | + print $date_data; |
|
533 | + print ']); |
|
534 | 534 | |
535 | 535 | var options = { |
536 | 536 | legend: {position: "none"}, |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | drawChart5(); |
549 | 549 | }); |
550 | 550 | </script>'; |
551 | - } |
|
552 | - ?> |
|
551 | + } |
|
552 | + ?> |
|
553 | 553 | <div class="more"> |
554 | 554 | <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
555 | 555 | </div> |
@@ -559,25 +559,25 @@ discard block |
||
559 | 559 | <div class="col-md-6"> |
560 | 560 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
561 | 561 | <?php |
562 | - $hour_array = $Stats->countAllHours('hour'); |
|
563 | - if (empty($hour_array)) print _("No data available"); |
|
564 | - else { |
|
562 | + $hour_array = $Stats->countAllHours('hour'); |
|
563 | + if (empty($hour_array)) print _("No data available"); |
|
564 | + else { |
|
565 | 565 | |
566 | - print '<div id="chart6" class="chart" width="100%"></div> |
|
566 | + print '<div id="chart6" class="chart" width="100%"></div> |
|
567 | 567 | <script> |
568 | 568 | google.load("visualization", "1", {packages:["corechart"]}); |
569 | 569 | google.setOnLoadCallback(drawChart6); |
570 | 570 | function drawChart6() { |
571 | 571 | var data = google.visualization.arrayToDataTable([ |
572 | 572 | ["'._("Hour").'", "'._("# of Flights").'"], '; |
573 | - $hour_data = ''; |
|
574 | - foreach($hour_array as $hour_item) |
|
575 | - { |
|
576 | - $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],'; |
|
577 | - } |
|
578 | - $hour_data = substr($hour_data, 0, -1); |
|
579 | - print $hour_data; |
|
580 | - print ']); |
|
573 | + $hour_data = ''; |
|
574 | + foreach($hour_array as $hour_item) |
|
575 | + { |
|
576 | + $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],'; |
|
577 | + } |
|
578 | + $hour_data = substr($hour_data, 0, -1); |
|
579 | + print $hour_data; |
|
580 | + print ']); |
|
581 | 581 | |
582 | 582 | var options = { |
583 | 583 | legend: {position: "none"}, |
@@ -595,8 +595,8 @@ discard block |
||
595 | 595 | drawChart6(); |
596 | 596 | }); |
597 | 597 | </script>'; |
598 | - } |
|
599 | - ?> |
|
598 | + } |
|
599 | + ?> |
|
600 | 600 | <div class="more"> |
601 | 601 | <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
602 | 602 | </div> |
@@ -605,17 +605,17 @@ discard block |
||
605 | 605 | </div> |
606 | 606 | <div class="row column"> |
607 | 607 | <?php |
608 | - $polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
|
609 | - if (!empty($polar)) { |
|
610 | - print '<h2>'._("Coverage pattern").'</h2>'; |
|
611 | - foreach ($polar as $eachpolar) { |
|
612 | - unset($polar_data); |
|
613 | - $Spotter = new Spotter(); |
|
614 | - $data = json_decode($eachpolar['source_data']); |
|
615 | - foreach($data as $value => $key) { |
|
616 | - $direction = $Spotter->parseDirection(($value*22.5)); |
|
617 | - $distance = $key; |
|
618 | - $unit = 'km'; |
|
608 | + $polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
|
609 | + if (!empty($polar)) { |
|
610 | + print '<h2>'._("Coverage pattern").'</h2>'; |
|
611 | + foreach ($polar as $eachpolar) { |
|
612 | + unset($polar_data); |
|
613 | + $Spotter = new Spotter(); |
|
614 | + $data = json_decode($eachpolar['source_data']); |
|
615 | + foreach($data as $value => $key) { |
|
616 | + $direction = $Spotter->parseDirection(($value*22.5)); |
|
617 | + $distance = $key; |
|
618 | + $unit = 'km'; |
|
619 | 619 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
620 | 620 | $distance = round($distance*0.539957); |
621 | 621 | $unit = 'nm'; |
@@ -626,10 +626,10 @@ discard block |
||
626 | 626 | $distance = $distance; |
627 | 627 | $unit = 'km'; |
628 | 628 | } |
629 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
630 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
631 | - } |
|
632 | - ?> |
|
629 | + if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
630 | + else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
631 | + } |
|
632 | + ?> |
|
633 | 633 | <div class="col-md-6"> |
634 | 634 | <h4><?php print $eachpolar['source_name']; ?></h4> |
635 | 635 | <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
@@ -661,22 +661,22 @@ discard block |
||
661 | 661 | </script> |
662 | 662 | </div> |
663 | 663 | <?php |
664 | - } |
|
665 | - } |
|
666 | - ?> |
|
664 | + } |
|
665 | + } |
|
666 | + ?> |
|
667 | 667 | </div> |
668 | 668 | <div class="row column"> |
669 | 669 | <div class="col-md-6"> |
670 | 670 | <?php |
671 | - $msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
|
672 | - if (!empty($msg)) { |
|
673 | - print '<h2>'._("Messages received").'</h2>'; |
|
674 | - foreach ($msg as $eachmsg) { |
|
675 | - //$eachmsg = $msg[0]; |
|
676 | - $data = $eachmsg['source_data']; |
|
677 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
678 | - else $max = 500; |
|
679 | - ?> |
|
671 | + $msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
|
672 | + if (!empty($msg)) { |
|
673 | + print '<h2>'._("Messages received").'</h2>'; |
|
674 | + foreach ($msg as $eachmsg) { |
|
675 | + //$eachmsg = $msg[0]; |
|
676 | + $data = $eachmsg['source_data']; |
|
677 | + if ($data > 500) $max = (round(($data+100)/100))*100; |
|
678 | + else $max = 500; |
|
679 | + ?> |
|
680 | 680 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
681 | 681 | <script> |
682 | 682 | var g = new JustGage({ |
@@ -692,9 +692,9 @@ discard block |
||
692 | 692 | }); |
693 | 693 | </script> |
694 | 694 | <?php |
695 | - } |
|
696 | - } |
|
697 | - ?> |
|
695 | + } |
|
696 | + } |
|
697 | + ?> |
|
698 | 698 | </div> |
699 | 699 | </div> |
700 | 700 | <div class="row column"> |
@@ -721,19 +721,19 @@ discard block |
||
721 | 721 | $hist_data .= '[ "'.$distance.'",'.$nb.'],'; |
722 | 722 | } |
723 | 723 | $hist_data = substr($hist_data, 0, -1); |
724 | - ?> |
|
724 | + ?> |
|
725 | 725 | <div class="col-md-6"> |
726 | 726 | <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2> |
727 | 727 | <?php |
728 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div> |
|
728 | + print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div> |
|
729 | 729 | <script> |
730 | 730 | google.load("visualization", "1", {packages:["corechart"]}); |
731 | 731 | google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).'); |
732 | 732 | function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() { |
733 | 733 | var data = google.visualization.arrayToDataTable([ |
734 | 734 | ["'._("Distance").'", "'._("# of Flights").'"], '; |
735 | - print $hist_data; |
|
736 | - print ']); |
|
735 | + print $hist_data; |
|
736 | + print ']); |
|
737 | 737 | |
738 | 738 | var options = { |
739 | 739 | legend: {position: "none"}, |
@@ -751,12 +751,12 @@ discard block |
||
751 | 751 | drawCharthist_'.str_replace(' ','_',strtolower($source)).'(); |
752 | 752 | }); |
753 | 753 | </script>'; |
754 | - ?> |
|
754 | + ?> |
|
755 | 755 | </div> |
756 | 756 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
757 | 757 | <?php |
758 | - } |
|
759 | - ?> |
|
758 | + } |
|
759 | + ?> |
|
760 | 760 | </div> |
761 | 761 | </div> |
762 | 762 | </div> |
@@ -3,8 +3,8 @@ |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | if (!isset($_GET['airline'])) { |
6 | - header('Location: '.$globalURL.'/airline'); |
|
7 | - die(); |
|
6 | + header('Location: '.$globalURL.'/airline'); |
|
7 | + die(); |
|
8 | 8 | } |
9 | 9 | $airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 10 | $Spotter = new Spotter(); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | print '<div class="select-item">'; |
42 | 42 | print '<form action="'.$globalURL.'/aircraft" method="post">'; |
43 | 43 | print '<select name="aircraft_type" class="selectpicker" data-live-search="true">'; |
44 | - print '<option></option>'; |
|
44 | + print '<option></option>'; |
|
45 | 45 | $aircraft_types = $Spotter->getAllAircraftTypes(); |
46 | 46 | foreach($aircraft_types as $aircrafttype) |
47 | 47 | { |
@@ -51,20 +51,20 @@ discard block |
||
51 | 51 | } else { |
52 | 52 | print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_manufacturer'].' '.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
53 | 53 | } |
54 | - } |
|
55 | - print '</select>'; |
|
56 | - print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
|
54 | + } |
|
55 | + print '</select>'; |
|
56 | + print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
|
57 | 57 | print '</form>'; |
58 | 58 | print '</div>'; |
59 | 59 | |
60 | 60 | if ($aircraft_type != "NA") |
61 | 61 | { |
62 | - print '<div class="info column">'; |
|
63 | - print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>'; |
|
64 | - print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>'; |
|
65 | - print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; |
|
66 | - if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>'; |
|
67 | - print '</div>'; |
|
62 | + print '<div class="info column">'; |
|
63 | + print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>'; |
|
64 | + print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>'; |
|
65 | + print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; |
|
66 | + if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>'; |
|
67 | + print '</div>'; |
|
68 | 68 | } else { |
69 | 69 | print '<div class="alert alert-warning">'._("This special aircraft profile shows all flights in where the aircraft type is unknown.").'</div>'; |
70 | 70 | } |
@@ -22,14 +22,14 @@ |
||
22 | 22 | function drawChart() { |
23 | 23 | var data = google.visualization.arrayToDataTable([ |
24 | 24 | ["'._("Pilot").'", "'._("# of times").'"], '; |
25 | - $pilot_data = ''; |
|
25 | + $pilot_data = ''; |
|
26 | 26 | foreach($pilot_array as $pilot_item) |
27 | 27 | { |
28 | 28 | $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
29 | 29 | } |
30 | 30 | $pilot_data = substr($pilot_data, 0, -1); |
31 | 31 | print $pilot_data; |
32 | - print ']); |
|
32 | + print ']); |
|
33 | 33 | |
34 | 34 | var options = { |
35 | 35 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -7,11 +7,11 @@ |
||
7 | 7 | { |
8 | 8 | $spotter_id = $Spotter->getSpotterIDBasedOnFlightAwareID($_GET['flightaware_id']); |
9 | 9 | |
10 | - if ($spotter_id != "") |
|
11 | - { |
|
12 | - header('Location: '.$globalURL.'/flightid/'.$spotter_id); |
|
13 | - } else { |
|
10 | + if ($spotter_id != "") |
|
11 | + { |
|
12 | + header('Location: '.$globalURL.'/flightid/'.$spotter_id); |
|
13 | + } else { |
|
14 | 14 | header('Location: '.$globalURL); |
15 | - } |
|
15 | + } |
|
16 | 16 | } |
17 | 17 | ?> |
18 | 18 | \ No newline at end of file |
@@ -11,12 +11,12 @@ |
||
11 | 11 | //checks to see if FlightAware import is set |
12 | 12 | if ($globalFlightAware == TRUE) |
13 | 13 | { |
14 | - $SpotterLive = new SpotterLive(); |
|
15 | - $Spotter = new Spotter(); |
|
16 | - //deletes the spotter LIVE data |
|
17 | - $SpotterLive->deleteLiveSpotterData(); |
|
14 | + $SpotterLive = new SpotterLive(); |
|
15 | + $Spotter = new Spotter(); |
|
16 | + //deletes the spotter LIVE data |
|
17 | + $SpotterLive->deleteLiveSpotterData(); |
|
18 | 18 | |
19 | - //imports the new data from FlightAware |
|
20 | - $Spotter->importFromFlightAware(); |
|
19 | + //imports the new data from FlightAware |
|
20 | + $Spotter->importFromFlightAware(); |
|
21 | 21 | } |
22 | 22 | ?> |
23 | 23 | \ No newline at end of file |
@@ -5,8 +5,8 @@ |
||
5 | 5 | */ |
6 | 6 | require_once(dirname(__FILE__).'/../require/settings.php'); |
7 | 7 | if ($globalInstalled) { |
8 | - echo '$globalInstalled must be set to FALSE in require/settings.php'; |
|
9 | - exit; |
|
8 | + echo '$globalInstalled must be set to FALSE in require/settings.php'; |
|
9 | + exit; |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | require_once('../require/class.Connection.php'); |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
12 | 12 | $schema = new Connection(); |
13 | 13 | if ($schema->latest() === false) { |
14 | - echo "You MUST update to latest schema. Run install/index.php"; |
|
15 | - exit(); |
|
14 | + echo "You MUST update to latest schema. Run install/index.php"; |
|
15 | + exit(); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | $debug = true; |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | date_default_timezone_set('UTC'); |
22 | 22 | // signal handler - playing nice with sockets and dump1090 |
23 | 23 | pcntl_signal(SIGINT, function($signo) { |
24 | - global $sock; |
|
25 | - echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
26 | - socket_shutdown($sock, 0); |
|
27 | - socket_close($sock); |
|
28 | - die("Bye!\n"); |
|
24 | + global $sock; |
|
25 | + echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
26 | + socket_shutdown($sock, 0); |
|
27 | + socket_close($sock); |
|
28 | + die("Bye!\n"); |
|
29 | 29 | }); |
30 | 30 | pcntl_signal_dispatch(); |
31 | 31 | |
@@ -38,24 +38,24 @@ discard block |
||
38 | 38 | // Bind the source address |
39 | 39 | if( !socket_bind($sock, $globalACARSHost , $globalACARSPort) ) |
40 | 40 | { |
41 | - $errorcode = socket_last_error(); |
|
42 | - $errormsg = socket_strerror($errorcode); |
|
41 | + $errorcode = socket_last_error(); |
|
42 | + $errormsg = socket_strerror($errorcode); |
|
43 | 43 | |
44 | - die("Could not bind socket : [$errorcode] $errormsg \n"); |
|
44 | + die("Could not bind socket : [$errorcode] $errormsg \n"); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | echo "LISTEN UDP MODE \n\n"; |
48 | 48 | while(1) { |
49 | - $r = socket_recvfrom($sock, $buffer, 512, 0, $remote_ip, $remote_port); |
|
50 | - |
|
51 | - // lets play nice and handle signals such as ctrl-c/kill properly |
|
52 | - pcntl_signal_dispatch(); |
|
53 | - $dataFound = false; |
|
54 | - // (null) 2 23/02/2015 14:46:06 0 -16 X .D-AIPW ! 1L 7 M82A LH077P 010952342854:VP-MIBI+W+0)-V+(),GB1 |
|
55 | - echo $buffer."\n"; |
|
56 | - $ACARS->add(trim($buffer)); |
|
57 | - socket_sendto($sock, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
58 | - $ACARS->deleteLiveAcarsData(); |
|
49 | + $r = socket_recvfrom($sock, $buffer, 512, 0, $remote_ip, $remote_port); |
|
50 | + |
|
51 | + // lets play nice and handle signals such as ctrl-c/kill properly |
|
52 | + pcntl_signal_dispatch(); |
|
53 | + $dataFound = false; |
|
54 | + // (null) 2 23/02/2015 14:46:06 0 -16 X .D-AIPW ! 1L 7 M82A LH077P 010952342854:VP-MIBI+W+0)-V+(),GB1 |
|
55 | + echo $buffer."\n"; |
|
56 | + $ACARS->add(trim($buffer)); |
|
57 | + socket_sendto($sock, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
58 | + $ACARS->deleteLiveAcarsData(); |
|
59 | 59 | } |
60 | 60 | pcntl_exec($_,$argv); |
61 | 61 | ?> |