Completed
Push — master ( b37cbb...d3bd74 )
by Yannick
06:46
created
statistics.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 $Stats = new Stats();
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 == '' && isset($globalFilter)) {
12 12
 	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 	$title = _("Statistics");
23 23
 }
24 24
 
25
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
26
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
25
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
26
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
27 27
 
28 28
 require_once('header.php');
29 29
 
@@ -49,36 +49,36 @@  discard block
 block discarded – undo
49 49
 		date_default_timezone_set('UTC');
50 50
 		$lastupdate = strtotime($last_update[0]['value']);
51 51
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
52
-		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
52
+		print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
53 53
 	}
54 54
     ?>
55 55
     </div>
56 56
     <?php include('statistics-sub-menu.php'); ?>
57 57
     <p class="global-stats">
58
-        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span>
59
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
60
-        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
61
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
58
+        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span>
59
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
60
+        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
61
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
62 62
 	<?php
63 63
 	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
64 64
 	?>
65
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
66
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
65
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span>
66
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
67 67
         <?php
68 68
     	    } else {
69 69
     	?>
70
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
71
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
70
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span>
71
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
72 72
     	<?php
73 73
     	    }
74 74
     	?>
75
-        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
76
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
75
+        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
76
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
77 77
         <?php
78 78
     		if ($airline_icao == '') {
79 79
     	?>
80
-        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
81
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
80
+        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span>
81
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
82 82
 	<?php
83 83
 		}
84 84
 	?>
@@ -86,25 +86,25 @@  discard block
 block discarded – undo
86 86
 		if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) {
87 87
 			if ($airline_icao == '' || $airline_icao == 'all') {
88 88
 	?>
89
-        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span>
90
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
89
+        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span>
90
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
91 91
 	<?php
92 92
 			}
93 93
 		}
94 94
 	?>
95 95
     </p>
96
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
96
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
97 97
     <div class="specific-stats">
98 98
         <div class="row column">
99 99
             <div class="col-md-6">
100 100
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
101 101
                  <?php
102
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
102
+                  $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month);
103 103
 		    if (count($aircraft_array) == 0) print _("No data available");
104 104
 		    else {
105 105
                     print '<div id="chart1" class="chart" width="100%"></div><script>';
106 106
                     $aircraft_data = '';
107
-                    foreach($aircraft_array as $aircraft_item)
107
+                    foreach ($aircraft_array as $aircraft_item)
108 108
                     {
109 109
                         $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
110 110
                     }
@@ -133,17 +133,17 @@  discard block
 block discarded – undo
133 133
             	    ?>
134 134
                 </div>
135 135
             </div>
136
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
136
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
137 137
 <?php
138 138
 //    echo $airline_icao;
139 139
     if ($airline_icao == '' || $airline_icao == 'all') {
140
-	$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
140
+	$airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month);
141 141
 	if (count($airline_array) > 0) {
142 142
             print '<div class="col-md-6">';
143 143
 	    print '<h2>'._("Top 10 Most Common Airline").'</h2>';
144 144
 	    print '<div id="chart2" class="chart" width="100%"></div><script>';
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
 block discarded – undo
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(false,$airline_icao,$filter_name,$year,$month);
178
+    $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month);
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,12 +185,12 @@  discard block
 block discarded – undo
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,$year,$month);
188
+	$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month);
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><script>';
192 192
 	    $pilot_data = '';
193
-	    foreach($pilot_array as $pilot_item)
193
+	    foreach ($pilot_array as $pilot_item)
194 194
 	    {
195 195
 		$pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
196 196
 	    }
@@ -212,19 +212,19 @@  discard block
 block discarded – undo
212 212
 ?>
213 213
             </div>
214 214
         
215
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
215
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
216 216
 <?php
217 217
     } else {
218 218
 ?>
219 219
             <div class="col-md-6">
220 220
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
221 221
 <?php
222
-	$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
222
+	$owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month);
223 223
 	if (count($owner_array) == 0) print _("No data available");
224 224
 	else {
225 225
 	    print '<div id="chart7" class="chart" width="100%"></div><script>';
226 226
 	    $owner_data = '';
227
-	    foreach($owner_array as $owner_item)
227
+	    foreach ($owner_array as $owner_item)
228 228
 	    {
229 229
 		$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
230 230
 	    }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                 </div>
245 245
             </div>
246 246
         
247
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
247
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
248 248
 <?php
249 249
     }
250 250
     if (!empty($flightover_array)) {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	    print '<div id="chart10" class="chart" width="100%"></div><script>';
259 259
 	    print 'var series = [';
260 260
             $flightover_data = '';
261
-	    foreach($flightover_array as $flightover_item)
261
+	    foreach ($flightover_array as $flightover_item)
262 262
 	    {
263 263
 		$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
264 264
 	    }
@@ -304,21 +304,21 @@  discard block
 block discarded – undo
304 304
     }
305 305
 ?>
306 306
         </div>
307
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
307
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
308 308
 
309 309
     	
310 310
         </div>
311 311
         <div class="row column">
312 312
             <div class="col-md-6">
313 313
 <?php
314
-    $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
314
+    $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month);
315 315
     if (count($airport_airport_array) > 0) {
316 316
 	print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
317 317
 	print '<div id="chart3" class="chart" width="100%"></div><script>';
318 318
         print "\n";
319 319
         print 'var series = [';
320 320
         $airport_data = '';
321
-	foreach($airport_airport_array as $airport_item)
321
+	foreach ($airport_airport_array as $airport_item)
322 322
 	{
323 323
 		$airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],';
324 324
 	}
@@ -369,18 +369,18 @@  discard block
 block discarded – undo
369 369
     }
370 370
 ?>
371 371
             </div>
372
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
372
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
373 373
 
374 374
             <div class="col-md-6">
375 375
 <?php
376
-    $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
376
+    $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month);
377 377
     if (count($airport_airport_array2) > 0) {
378 378
 	print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
379 379
 	print '<div id="chart4" class="chart" width="100%"></div><script>';
380 380
         print "\n";
381 381
         print 'var series = [';
382 382
         $airport_data = '';
383
-	foreach($airport_airport_array2 as $airport_item)
383
+	foreach ($airport_airport_array2 as $airport_item)
384 384
 	{
385 385
 		$airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
386 386
 	}
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 ?>
434 434
             </div>
435 435
         </div>
436
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
436
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
437 437
 <?php
438 438
     if ($year == '' && $month == '') {
439 439
 ?>
@@ -441,19 +441,19 @@  discard block
 block discarded – undo
441 441
             <div class="col-md-6">
442 442
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
443 443
                 <?php
444
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
444
+                  $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
445 445
 		    if (count($year_array) == 0) print _("No data available");
446 446
 		    else {
447 447
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
448 448
 			$year_data = '';
449 449
 			$year_cnt = '';
450
-			foreach($year_array as $year_item)
450
+			foreach ($year_array as $year_item)
451 451
 			{
452 452
 			    $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
453 453
 			    $year_cnt .= $year_item['date_count'].',';
454 454
 			}
455 455
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
456
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
456
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
457 457
 			print 'c3.generate({
458 458
                 	    bindto: "#chart8",
459 459
                 	    data: { x: "x",
@@ -466,23 +466,23 @@  discard block
 block discarded – undo
466 466
                     <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
467 467
                 </div>
468 468
             </div>
469
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
469
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
470 470
             <div class="col-md-6">
471 471
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
472 472
                 <?php
473
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
473
+                  $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name);
474 474
 		    if (count($month_array) == 0) print _("No data available");
475 475
 		    else {
476 476
                 	print '<div id="chart9" class="chart" width="100%"></div><script>';
477 477
                         $month_data = '';
478 478
 			$month_cnt = '';
479
-			foreach($month_array as $month_item)
479
+			foreach ($month_array as $month_item)
480 480
 			{
481 481
 			    $month_data .= '"'.$month_item['date_name'].'",';
482 482
 			    $month_cnt .= $month_item['date_count'].',';
483 483
 			}
484 484
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
485
-			$month_cnt = "['flights',".substr($month_cnt,0,-1)."]";
485
+			$month_cnt = "['flights',".substr($month_cnt, 0, -1)."]";
486 486
 			print 'c3.generate({
487 487
                 	    bindto: "#chart9",
488 488
                 	    data: { x: "x",
@@ -496,24 +496,24 @@  discard block
 block discarded – undo
496 496
                     <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
497 497
                 </div>
498 498
             </div>
499
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
499
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
500 500
 
501 501
             <div class="col-md-6">
502 502
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
503 503
                 <?php
504
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
504
+                    $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
505 505
 		    if (empty($date_array)) print _("No data available");
506 506
 		    else {
507 507
                 	print '<div id="chart5" class="chart" width="100%"></div><script>';
508 508
                         $date_data = '';
509 509
 			$date_cnt = '';
510
-			foreach($date_array as $date_item)
510
+			foreach ($date_array as $date_item)
511 511
 			{
512 512
 			    $date_data .= '"'.$date_item['date_name'].'",';
513 513
 			    $date_cnt .= $date_item['date_count'].',';
514 514
 			}
515 515
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
516
-			$date_cnt = "['flights',".substr($date_cnt,0,-1)."]";
516
+			$date_cnt = "['flights',".substr($date_cnt, 0, -1)."]";
517 517
 			print 'c3.generate({
518 518
                 	    bindto: "#chart5",
519 519
                 	    data: { x: "x",
@@ -527,23 +527,23 @@  discard block
 block discarded – undo
527 527
                     <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
528 528
                 </div>
529 529
             </div>
530
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
530
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
531 531
             <div class="col-md-6">
532 532
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
533 533
                 <?php
534
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
534
+                  $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
535 535
 		    if (empty($hour_array)) print _("No data available");
536 536
 		    else {
537 537
                 	print '<div id="chart6" class="chart" width="100%"></div><script>';
538 538
                         $hour_data = '';
539 539
 			$hour_cnt = '';
540
-			foreach($hour_array as $hour_item)
540
+			foreach ($hour_array as $hour_item)
541 541
 			{
542 542
 			    $hour_data .= '"'.$hour_item['hour_name'].':00",';
543 543
 			    $hour_cnt .= $hour_item['hour_count'].',';
544 544
 			}
545 545
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
546
-			$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
546
+			$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]";
547 547
 			print 'c3.generate({
548 548
                 	    bindto: "#chart6",
549 549
                 	    data: {
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
                     <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</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
         </div>
562 562
 <?php
563 563
     }
@@ -576,13 +576,13 @@  discard block
 block discarded – undo
576 576
 			print '<div id="chart32" class="chart" width="100%"></div><script>';
577 577
                         $year_data = '';
578 578
 			$year_cnt = '';
579
-			foreach($year_array as $year_item)
579
+			foreach ($year_array as $year_item)
580 580
 			{
581 581
 			    $year_data .= '"'.$year_item['year'].'-01-01",';
582 582
 			    $year_cnt .= $year_item['count'].',';
583 583
 			}
584 584
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
585
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
585
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
586 586
 			print 'c3.generate({
587 587
                 	    bindto: "#chart32",
588 588
                 	    data: { x: "x",
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
597 597
                 </div>
598 598
             </div>
599
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
599
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
600 600
 
601 601
         <div class="row column">
602 602
             <div class="col-md-6">
@@ -608,13 +608,13 @@  discard block
 block discarded – undo
608 608
 			print '<div id="chart33" class="chart" width="100%"></div><script>';
609 609
                         $year_data = '';
610 610
 			$year_cnt = '';
611
-			foreach($year_array as $year_item)
611
+			foreach ($year_array as $year_item)
612 612
 			{
613 613
 			    $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",';
614 614
 			    $year_cnt .= $year_item['count'].',';
615 615
 			}
616 616
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
617
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
617
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
618 618
 			print 'c3.generate({
619 619
                 	    bindto: "#chart33",
620 620
                 	    data: { x: "x",
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
628 628
                 </div>
629 629
             </div>
630
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
630
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
631 631
 <br/>
632 632
 <?php
633 633
     }
@@ -640,9 +640,9 @@  discard block
 block discarded – undo
640 640
         	<?php
641 641
         	    //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
642 642
         	    if ($year == '' && $month == '') {
643
-		        $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
643
+		        $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d'));
644 644
 		    } else {
645
-        		$polar = $Stats->getStatsSource('polar',$year,$month);
645
+        		$polar = $Stats->getStatsSource('polar', $year, $month);
646 646
         	    }
647 647
         	    if (!empty($polar)) {
648 648
             		print '<h2>'._("Coverage pattern").'</h2>';
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
         		    unset($polar_data);
651 651
 	        	    $Spotter = new Spotter();
652 652
         		    $data = json_decode($eachpolar['source_data']);
653
-        		    foreach($data as $value => $key) {
653
+        		    foreach ($data as $value => $key) {
654 654
         			$direction = $Spotter->parseDirection(($value*22.5));
655 655
         			$distance = $key;
656 656
         			$unit = 'km';
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
         	?>
671 671
             <div class="col-md-6">
672 672
                 <h4><?php print $eachpolar['source_name']; ?></h4>
673
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
673
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
674 674
         	<script>
675 675
         	    (function() {
676 676
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 		      color: color,
695 695
 		      unit: '<?php echo $unit; ?>'
696 696
 		    };
697
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
697
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
698 698
 		    })();
699 699
 		</script>
700 700
             </div>
@@ -708,22 +708,22 @@  discard block
 block discarded – undo
708 708
         	<?php
709 709
         	    //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
710 710
         	    if ($year == '' && $month == '') {
711
-        		$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
711
+        		$msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d'));
712 712
         	    } else {
713
-        		$msg = $Stats->getStatsSource('msg',$year,$month);
713
+        		$msg = $Stats->getStatsSource('msg', $year, $month);
714 714
         	    }
715 715
         	    if (!empty($msg)) {
716 716
             		print '<h2>'._("Messages received").'</h2>';
717 717
         		foreach ($msg as $eachmsg) {
718 718
         		    //$eachmsg = $msg[0];
719 719
         		    $data = $eachmsg['source_data'];
720
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
720
+        		    if ($data > 500) $max = (round(($data + 100)/100))*100;
721 721
         		    else $max = 500;
722 722
         	?>
723
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
723
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
724 724
         	<script>
725 725
 		      var g = new JustGage({
726
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
726
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
727 727
 			    value: <?php echo $data; ?>,
728 728
 			    min: 0,
729 729
 			    max: <?php print $max; ?>,
@@ -745,9 +745,9 @@  discard block
 block discarded – undo
745 745
             <?php
746 746
 		//$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
747 747
 		if ($year == '' && $month == '') {
748
-			$hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d'));
748
+			$hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d'));
749 749
 		} else {
750
-			$hist = $Stats->getStatsSource('hist',$year,$month);
750
+			$hist = $Stats->getStatsSource('hist', $year, $month);
751 751
 		}
752 752
 		foreach ($hist as $hists) {
753 753
 			//$hist_data = '';
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 			$source = $hists['source_name'];
757 757
 			$hist_array = json_decode($hists['source_data']);
758 758
 			$unit = 'km';
759
-			foreach($hist_array as $distance => $nb)
759
+			foreach ($hist_array as $distance => $nb)
760 760
 			{
761 761
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
762 762
 					$distance = round($distance*0.539957);
@@ -777,18 +777,18 @@  discard block
 block discarded – undo
777 777
 			$nb_data = "['flights',".substr($nb_data, 0, -1)."]";
778 778
             ?>
779 779
             <div class="col-md-6">
780
-                <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
780
+                <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2>
781 781
                 <?php
782
-                    print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>';
782
+                    print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>';
783 783
 		    print 'c3.generate({
784
-			bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'",
784
+			bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'",
785 785
 			data: { x: "x",
786 786
 			columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
787 787
 			axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});';
788 788
 		    print '</script>';
789 789
         	?>
790 790
     	    </div>
791
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
791
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
792 792
         	<?php
793 793
                   }
794 794
                 ?>
Please login to merge, or discard this patch.