Completed
Push — master ( 17d606...695884 )
by Yannick
08:21 queued 01:45
created
statistics.php 1 patch
Braces   +50 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
 $Stats = new Stats();
7 7
 $title = _("Statistics");
8 8
 
9
-if (!isset($filter_name)) $filter_name = '';
9
+if (!isset($filter_name)) {
10
+	$filter_name = '';
11
+}
10 12
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
11 13
 if ($airline_icao == 'all') {
12 14
 	unset($_COOKIE['stats_airline_icao']);
@@ -15,8 +17,10 @@  discard block
 block discarded – undo
15 17
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
16 18
 	$airline_icao = $_COOKIE['stats_airline_icao'];
17 19
 } elseif ($airline_icao == '' && isset($globalFilter)) {
18
-	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
19
-}
20
+	if (isset($globalFilter['airline'])) {
21
+		$airline_icao = $globalFilter['airline'][0];
22
+	}
23
+	}
20 24
 setcookie('stats_airline_icao',$airline_icao);
21 25
 require_once('header.php');
22 26
 
@@ -36,7 +40,9 @@  discard block
 block discarded – undo
36 40
 	if (isset($last_update[0]['value'])) {
37 41
 		date_default_timezone_set('UTC');
38 42
 		$lastupdate = strtotime($last_update[0]['value']);
39
-		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
43
+		if (isset($globalTimezone) && $globalTimezone != '') {
44
+			date_default_timezone_set($globalTimezone);
45
+		}
40 46
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
41 47
 	}
42 48
     ?>
@@ -89,8 +95,9 @@  discard block
 block discarded – undo
89 95
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
90 96
                  <?php
91 97
                   $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name);
92
-		    if (count($aircraft_array) == 0) print _("No data available");
93
-		    else {
98
+		    if (count($aircraft_array) == 0) {
99
+		    	print _("No data available");
100
+		    } else {
94 101
 
95 102
                     print '<div id="chart1" class="chart" width="100%"></div>
96 103
                     <script> 
@@ -191,8 +198,9 @@  discard block
 block discarded – undo
191 198
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
192 199
                  <?php
193 200
                   $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name);
194
-		    if (count($pilot_array) == 0) print _("No data available");
195
-		    else {
201
+		    if (count($pilot_array) == 0) {
202
+		    	print _("No data available");
203
+		    } else {
196 204
 
197 205
                   print '<div id="chart7" class="chart" width="100%"></div>
198 206
                     <script> 
@@ -238,8 +246,9 @@  discard block
 block discarded – undo
238 246
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
239 247
                  <?php
240 248
                   $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name);
241
-		    if (count($owner_array) == 0) print _("No data available");
242
-		    else {
249
+		    if (count($owner_array) == 0) {
250
+		    	print _("No data available");
251
+		    } else {
243 252
 
244 253
                   print '<div id="chart7" class="chart" width="100%"></div>
245 254
                     <script> 
@@ -287,8 +296,9 @@  discard block
 block discarded – undo
287 296
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
288 297
                  <?php
289 298
                   //$flightover_array = $Stats->countAllFlightOverCountries();
290
-		    if (count($flightover_array) == 0) print _("No data available");
291
-		    else {
299
+		    if (count($flightover_array) == 0) {
300
+		    	print _("No data available");
301
+		    } else {
292 302
 
293 303
                   print '<div id="chart10" class="chart" width="100%"></div>
294 304
                     <script> 
@@ -340,8 +350,9 @@  discard block
 block discarded – undo
340 350
                 <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2>
341 351
                 <?php
342 352
                 $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name);
343
-		    if (count($airport_airport_array) == 0) print _("No data available");
344
-		    else {
353
+		    if (count($airport_airport_array) == 0) {
354
+		    	print _("No data available");
355
+		    } else {
345 356
 
346 357
                  print '<div id="chart3" class="chart" width="100%"></div>
347 358
                 <script>
@@ -390,8 +401,9 @@  discard block
 block discarded – undo
390 401
                 <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2>
391 402
                 <?php
392 403
                 $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name);
393
-		    if (count($airport_airport_array2) == 0) print _("No data available");
394
-		    else {
404
+		    if (count($airport_airport_array2) == 0) {
405
+		    	print _("No data available");
406
+		    } else {
395 407
 
396 408
                 print '<div id="chart4" class="chart" width="100%"></div>
397 409
                 <script>
@@ -442,8 +454,9 @@  discard block
 block discarded – undo
442 454
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
443 455
                 <?php
444 456
                   $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
445
-		    if (count($year_array) == 0) print _("No data available");
446
-		    else {
457
+		    if (count($year_array) == 0) {
458
+		    	print _("No data available");
459
+		    } else {
447 460
                   print '<div id="chart8" class="chart" width="100%"></div>
448 461
                     <script> 
449 462
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -488,8 +501,9 @@  discard block
 block discarded – undo
488 501
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
489 502
                 <?php
490 503
                   $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
491
-		    if (count($month_array) == 0) print _("No data available");
492
-		    else {
504
+		    if (count($month_array) == 0) {
505
+		    	print _("No data available");
506
+		    } else {
493 507
                   print '<div id="chart9" class="chart" width="100%"></div>
494 508
                     <script> 
495 509
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -534,8 +548,9 @@  discard block
 block discarded – undo
534 548
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
535 549
                 <?php
536 550
                     $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
537
-		    if (empty($date_array)) print _("No data available");
538
-		    else {
551
+		    if (empty($date_array)) {
552
+		    	print _("No data available");
553
+		    } else {
539 554
                   print '<div id="chart5" class="chart" width="100%"></div>
540 555
                     <script> 
541 556
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -581,8 +596,9 @@  discard block
 block discarded – undo
581 596
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
582 597
                 <?php
583 598
                   $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
584
-		    if (empty($hour_array)) print _("No data available");
585
-		    else {
599
+		    if (empty($hour_array)) {
600
+		    	print _("No data available");
601
+		    } else {
586 602
 
587 603
                   print '<div id="chart6" class="chart" width="100%"></div>
588 604
                     <script> 
@@ -650,8 +666,11 @@  discard block
 block discarded – undo
650 666
 					$distance = $distance;
651 667
 					$unit = 'km';
652 668
 				}
653
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
654
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
669
+        			if (!isset($polar_data)) {
670
+        				$polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
671
+        			} else {
672
+        	    			$polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
673
+        	    		}
655 674
         		    }
656 675
         	?>
657 676
             <div class="col-md-6">
@@ -698,8 +717,11 @@  discard block
 block discarded – undo
698 717
         		foreach ($msg as $eachmsg) {
699 718
         		    //$eachmsg = $msg[0];
700 719
         		    $data = $eachmsg['source_data'];
701
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
702
-        		    else $max = 500;
720
+        		    if ($data > 500) {
721
+        		    	$max = (round(($data+100)/100))*100;
722
+        		    } else {
723
+        		    	$max = 500;
724
+        		    }
703 725
         	?>
704 726
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
705 727
         	<script>
Please login to merge, or discard this patch.