Completed
Push — master ( d652ce...4d5be8 )
by Yannick
23:18
created
statistics.php 3 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -81,23 +81,23 @@  discard block
 block discarded – undo
81 81
         <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
82 82
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
83 83
 	<?php
84
-	    if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
84
+		if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
85 85
 	?>
86 86
     	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
87 87
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
88 88
         <?php
89
-    	    } else {
90
-    	?>
89
+			} else {
90
+		?>
91 91
     	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
92 92
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
93 93
     	<?php
94
-    	    }
95
-    	?>
94
+			}
95
+		?>
96 96
         <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
97 97
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
98 98
         <?php
99
-    		if ($airline_icao == '') {
100
-    	?>
99
+			if ($airline_icao == '') {
100
+		?>
101 101
         <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
102 102
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
103 103
 	<?php
@@ -136,38 +136,38 @@  discard block
 block discarded – undo
136 136
             <div class="col-md-6">
137 137
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
138 138
                  <?php
139
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
140
-		    if (count($aircraft_array) == 0) print _("No data available");
141
-		    else {
142
-                    print '<div id="chart1" class="chart" width="100%"></div><script>';
143
-                    $aircraft_data = '';
144
-                    foreach($aircraft_array as $aircraft_item)
145
-                    {
146
-                        $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
147
-                    }
148
-                    $aircraft_data = substr($aircraft_data, 0, -1);
149
-		    print 'var series = ['.$aircraft_data.'];';
150
-		    print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
151
-		    print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
152
-		    print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
153
-                    print 'var aircraftype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
154
-                    print 'dataset';
155
-                    print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
156
-                    print '</script>';
157
-                  }
158
-                  ?>
139
+				  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
140
+			if (count($aircraft_array) == 0) print _("No data available");
141
+			else {
142
+					print '<div id="chart1" class="chart" width="100%"></div><script>';
143
+					$aircraft_data = '';
144
+					foreach($aircraft_array as $aircraft_item)
145
+					{
146
+						$aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
147
+					}
148
+					$aircraft_data = substr($aircraft_data, 0, -1);
149
+			print 'var series = ['.$aircraft_data.'];';
150
+			print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
151
+			print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
152
+			print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
153
+					print 'var aircraftype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
154
+					print 'dataset';
155
+					print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
156
+					print '</script>';
157
+				  }
158
+				  ?>
159 159
                 <div class="more">
160 160
             	    <?php
161
-            		if ($year != '' && $month != '') {
162
-            	    ?>
161
+					if ($year != '' && $month != '') {
162
+					?>
163 163
             	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
164 164
             	    <?php
165
-            		} else {
166
-            	    ?>
165
+					} else {
166
+					?>
167 167
             	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?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>
168 168
             	    <?php
169
-            		}
170
-            	    ?>
169
+					}
170
+					?>
171 171
                 </div>
172 172
             </div>
173 173
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
Please login to merge, or discard this patch.
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 }
20 20
 
21 21
 if (!isset($filter_name)) $filter_name = '';
22
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
22
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
23 23
 if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) {
24 24
 	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
25 25
 }
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	$title = _("Statistics");
35 35
 }
36 36
 
37
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
38
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
37
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
38
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
39 39
 
40 40
 require_once('header.php');
41 41
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 			date_default_timezone_set('UTC');
63 63
 			$lastupdate = strtotime($last_update[0]['value']);
64 64
 			if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
65
-			print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
65
+			print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
66 66
 		}
67 67
 	}
68 68
 ?>
@@ -76,30 +76,30 @@  discard block
 block discarded – undo
76 76
 <?php
77 77
 	if ($type == 'aircraft') {
78 78
 ?>
79
-        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span>
80
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
81
-        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
82
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
79
+        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span>
80
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
81
+        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
82
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
83 83
 	<?php
84
-	    if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
84
+	    if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
85 85
 	?>
86
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
87
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
86
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span>
87
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
88 88
         <?php
89 89
     	    } else {
90 90
     	?>
91
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
92
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
91
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span>
92
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
93 93
     	<?php
94 94
     	    }
95 95
     	?>
96
-        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
97
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
96
+        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
97
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
98 98
         <?php
99 99
     		if ($airline_icao == '') {
100 100
     	?>
101
-        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
102
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
101
+        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span>
102
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
103 103
 	<?php
104 104
 		}
105 105
 	?>
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 		if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) {
108 108
 			if ($airline_icao == '' || $airline_icao == 'all') {
109 109
 	?>
110
-        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span>
111
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
110
+        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span>
111
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
112 112
 	<?php
113 113
 			}
114 114
 		}
@@ -116,18 +116,18 @@  discard block
 block discarded – undo
116 116
 <?php
117 117
 	} elseif ($type == 'marine') {
118 118
 ?>
119
-	<span><span class="badge"><?php print number_format($Marine->countOverallMarine($filter_name,$year,$month)); ?></span> <?php echo _("Vessels"); ?></span>
120
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
119
+	<span><span class="badge"><?php print number_format($Marine->countOverallMarine($filter_name, $year, $month)); ?></span> <?php echo _("Vessels"); ?></span>
120
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
121 121
 <?php
122 122
 	} elseif ($type == 'tracker') {
123 123
 ?>
124
-	<span><span class="badge"><?php print number_format($Tracker->countOverallTracker($filter_name,$year,$month)); ?></span> <?php echo _("Trackers"); ?></span>
125
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
124
+	<span><span class="badge"><?php print number_format($Tracker->countOverallTracker($filter_name, $year, $month)); ?></span> <?php echo _("Trackers"); ?></span>
125
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
126 126
 <?php
127 127
 	}
128 128
 ?>
129 129
     </p>
130
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
130
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
131 131
     <div class="specific-stats">
132 132
 <?php
133 133
 	if ($type == 'aircraft') {
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
             <div class="col-md-6">
137 137
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
138 138
                  <?php
139
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
139
+                  $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month);
140 140
 		    if (count($aircraft_array) == 0) print _("No data available");
141 141
 		    else {
142 142
                     print '<div id="chart1" class="chart" width="100%"></div><script>';
143 143
                     $aircraft_data = '';
144
-                    foreach($aircraft_array as $aircraft_item)
144
+                    foreach ($aircraft_array as $aircraft_item)
145 145
                     {
146 146
                         $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
147 147
                     }
@@ -170,17 +170,17 @@  discard block
 block discarded – undo
170 170
             	    ?>
171 171
                 </div>
172 172
             </div>
173
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
173
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
174 174
 <?php
175 175
 //    echo $airline_icao;
176 176
 		if ($airline_icao == '' || $airline_icao == 'all') {
177
-			$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
177
+			$airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month);
178 178
 			if (count($airline_array) > 0) {
179 179
 				print '<div class="col-md-6">';
180 180
 				print '<h2>'._("Top 10 Most Common Airline").'</h2>';
181 181
 				print '<div id="chart2" class="chart" width="100%"></div><script>';
182 182
 				$airline_data = '';
183
-				foreach($airline_array as $airline_item)
183
+				foreach ($airline_array as $airline_item)
184 184
 				{
185 185
 					$airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
186 186
 				}
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			}
207 207
 ?>
208 208
         </div>
209
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
209
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
210 210
 <?php
211 211
 		}
212 212
 ?>
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 ?>
219 219
         <div class="row column">
220 220
 <?php
221
-		$flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
222
-		if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
221
+		$flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month);
222
+		if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
223 223
 			if (empty($flightover_array)) {
224 224
 				print '<div class="col-md-12">';
225 225
 			} else {
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
 ?>
229 229
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
230 230
 <?php
231
-			$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
231
+			$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month);
232 232
 			if (count($pilot_array) == 0) print _("No data available");
233 233
 			else {
234 234
 				print '<div id="chart7" class="chart" width="100%"></div><script>';
235 235
 				$pilot_data = '';
236
-				foreach($pilot_array as $pilot_item)
236
+				foreach ($pilot_array as $pilot_item)
237 237
 				{
238 238
 					$pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
239 239
 				}
@@ -255,19 +255,19 @@  discard block
 block discarded – undo
255 255
 ?>
256 256
             </div>
257 257
         
258
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
258
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
259 259
 <?php
260 260
 		} else {
261 261
 ?>
262 262
             <div class="col-md-6">
263 263
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
264 264
 <?php
265
-			$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
265
+			$owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month);
266 266
 			if (count($owner_array) == 0) print _("No data available");
267 267
 			else {
268 268
 				print '<div id="chart7" class="chart" width="100%"></div><script>';
269 269
 				$owner_data = '';
270
-				foreach($owner_array as $owner_item)
270
+				foreach ($owner_array as $owner_item)
271 271
 				{
272 272
 					$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
273 273
 				}
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
                 </div>
288 288
             </div>
289 289
         
290
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
290
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
291 291
 <?php
292 292
 		}
293 293
 		if (!empty($flightover_array)) {
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 				print '<div id="chart10" class="chart" width="100%"></div><script>';
302 302
 				print 'var series = [';
303 303
 				$flightover_data = '';
304
-				foreach($flightover_array as $flightover_item)
304
+				foreach ($flightover_array as $flightover_item)
305 305
 				{
306 306
 					$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
307 307
 				}
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 		}
348 348
 ?>
349 349
         </div>
350
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
350
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
351 351
 
352 352
     	
353 353
         </div>
@@ -358,14 +358,14 @@  discard block
 block discarded – undo
358 358
         <div class="row column">
359 359
             <div class="col-md-6">
360 360
 <?php
361
-		$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
361
+		$airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month);
362 362
 		if (count($airport_airport_array) > 0) {
363 363
 			print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
364 364
 			print '<div id="chart3" class="chart" width="100%"></div><script>';
365 365
 			print "\n";
366 366
 			print 'var series = [';
367 367
 			$airport_data = '';
368
-			foreach($airport_airport_array as $airport_item)
368
+			foreach ($airport_airport_array as $airport_item)
369 369
 			{
370 370
 				$airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],';
371 371
 			}
@@ -416,18 +416,18 @@  discard block
 block discarded – undo
416 416
 		}
417 417
 ?>
418 418
             </div>
419
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
419
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
420 420
 
421 421
             <div class="col-md-6">
422 422
 <?php
423
-		$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
423
+		$airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month);
424 424
 		if (count($airport_airport_array2) > 0) {
425 425
 			print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
426 426
 			print '<div id="chart4" class="chart" width="100%"></div><script>';
427 427
 			print "\n";
428 428
 			print 'var series = [';
429 429
 			$airport_data = '';
430
-			foreach($airport_airport_array2 as $airport_item)
430
+			foreach ($airport_airport_array2 as $airport_item)
431 431
 			{
432 432
 				$airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
433 433
 			}
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 ?>
480 480
             </div>
481 481
         </div>
482
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
482
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
483 483
 <?php 
484 484
 	}
485 485
 ?>
@@ -493,19 +493,19 @@  discard block
 block discarded – undo
493 493
             <div class="col-md-6">
494 494
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
495 495
 <?php
496
-			$year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
496
+			$year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
497 497
 			if (count($year_array) == 0) print _("No data available");
498 498
 			else {
499 499
 				print '<div id="chart8" class="chart" width="100%"></div><script>';
500 500
 				$year_data = '';
501 501
 				$year_cnt = '';
502
-				foreach($year_array as $year_item)
502
+				foreach ($year_array as $year_item)
503 503
 				{
504 504
 					$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
505 505
 					$year_cnt .= $year_item['date_count'].',';
506 506
 				}
507 507
 				$year_data = "['x',".substr($year_data, 0, -1)."]";
508
-				$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
508
+				$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
509 509
 				print 'c3.generate({
510 510
 				    bindto: "#chart8",
511 511
 				    data: { x: "x",
@@ -518,23 +518,23 @@  discard block
 block discarded – undo
518 518
                     <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>
519 519
                 </div>
520 520
             </div>
521
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
521
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
522 522
             <div class="col-md-6">
523 523
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
524 524
 <?php
525
-			$month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
525
+			$month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name);
526 526
 			if (count($month_array) == 0) print _("No data available");
527 527
 			else {
528 528
 				print '<div id="chart9" class="chart" width="100%"></div><script>';
529 529
 				$month_data = '';
530 530
 				$month_cnt = '';
531
-				foreach($month_array as $month_item)
531
+				foreach ($month_array as $month_item)
532 532
 				{
533 533
 					$month_data .= '"'.$month_item['date_name'].'",';
534 534
 					$month_cnt .= $month_item['date_count'].',';
535 535
 				}
536 536
 				$month_data = "['x',".substr($month_data, 0, -1)."]";
537
-				$month_cnt = "['flights',".substr($month_cnt,0,-1)."]";
537
+				$month_cnt = "['flights',".substr($month_cnt, 0, -1)."]";
538 538
 				print 'c3.generate({
539 539
 				    bindto: "#chart9",
540 540
 				    data: { x: "x",
@@ -547,24 +547,24 @@  discard block
 block discarded – undo
547 547
                     <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>
548 548
                 </div>
549 549
             </div>
550
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
550
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
551 551
 
552 552
             <div class="col-md-6">
553 553
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
554 554
 <?php
555
-			$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
555
+			$date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
556 556
 			if (empty($date_array)) print _("No data available");
557 557
 			else {
558 558
 				print '<div id="chart5" class="chart" width="100%"></div><script>';
559 559
 				$date_data = '';
560 560
 				$date_cnt = '';
561
-				foreach($date_array as $date_item)
561
+				foreach ($date_array as $date_item)
562 562
 				{
563 563
 					$date_data .= '"'.$date_item['date_name'].'",';
564 564
 					$date_cnt .= $date_item['date_count'].',';
565 565
 				}
566 566
 				$date_data = "['x',".substr($date_data, 0, -1)."]";
567
-				$date_cnt = "['flights',".substr($date_cnt,0,-1)."]";
567
+				$date_cnt = "['flights',".substr($date_cnt, 0, -1)."]";
568 568
 				print 'c3.generate({
569 569
 				    bindto: "#chart5",
570 570
 				    data: { x: "x",
@@ -577,23 +577,23 @@  discard block
 block discarded – undo
577 577
                     <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>
578 578
                 </div>
579 579
             </div>
580
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
580
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
581 581
             <div class="col-md-6">
582 582
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
583 583
 <?php
584
-			$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
584
+			$hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
585 585
 			if (empty($hour_array)) print _("No data available");
586 586
 			else {
587 587
 				print '<div id="chart6" class="chart" width="100%"></div><script>';
588 588
 				$hour_data = '';
589 589
 				$hour_cnt = '';
590
-				foreach($hour_array as $hour_item)
590
+				foreach ($hour_array as $hour_item)
591 591
 				{
592 592
 					$hour_data .= '"'.$hour_item['hour_name'].':00",';
593 593
 					$hour_cnt .= $hour_item['hour_count'].',';
594 594
 				}
595 595
 				$hour_data = "[".substr($hour_data, 0, -1)."]";
596
-				$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
596
+				$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]";
597 597
 				print 'c3.generate({
598 598
 				    bindto: "#chart6",
599 599
 				    data: {
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
                     <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>
607 607
                 </div>
608 608
             </div>
609
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
609
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
610 610
         </div>
611 611
 <?php
612 612
 		}
@@ -630,13 +630,13 @@  discard block
 block discarded – undo
630 630
 				print '<div id="chart32" class="chart" width="100%"></div><script>';
631 631
 				$year_data = '';
632 632
 				$year_cnt = '';
633
-				foreach($year_array as $year_item)
633
+				foreach ($year_array as $year_item)
634 634
 				{
635 635
 					$year_data .= '"'.$year_item['year'].'-01-01",';
636 636
 					$year_cnt .= $year_item['count'].',';
637 637
 				}
638 638
 				$year_data = "['x',".substr($year_data, 0, -1)."]";
639
-				$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
639
+				$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
640 640
 				print 'c3.generate({
641 641
 				    bindto: "#chart32",
642 642
 				    data: { x: "x",
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
650 650
                 </div>
651 651
             </div>
652
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
652
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
653 653
 
654 654
         <div class="row column">
655 655
             <div class="col-md-6">
@@ -661,13 +661,13 @@  discard block
 block discarded – undo
661 661
 				print '<div id="chart33" class="chart" width="100%"></div><script>';
662 662
 				$year_data = '';
663 663
 				$year_cnt = '';
664
-				foreach($year_array as $year_item)
664
+				foreach ($year_array as $year_item)
665 665
 				{
666 666
 					$year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",';
667 667
 					$year_cnt .= $year_item['count'].',';
668 668
 				}
669 669
 				$year_data = "['x',".substr($year_data, 0, -1)."]";
670
-				$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
670
+				$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
671 671
 				print 'c3.generate({
672 672
 				    bindto: "#chart33",
673 673
 				    data: { x: "x",
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
681 681
                 </div>
682 682
             </div>
683
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
683
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
684 684
 <br/>
685 685
 <?php
686 686
 		}
@@ -698,9 +698,9 @@  discard block
 block discarded – undo
698 698
 <?php
699 699
 			//$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
700 700
 			if ($year == '' && $month == '') {
701
-				$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
701
+				$polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d'));
702 702
 			} else {
703
-				$polar = $Stats->getStatsSource('polar',$year,$month);
703
+				$polar = $Stats->getStatsSource('polar', $year, $month);
704 704
 			}
705 705
 			if (!empty($polar)) {
706 706
 				print '<h2>'._("Coverage pattern").'</h2>';
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 					unset($polar_data);
709 709
 					$Spotter = new Spotter();
710 710
 					$data = json_decode($eachpolar['source_data']);
711
-					foreach($data as $value => $key) {
711
+					foreach ($data as $value => $key) {
712 712
 						$direction = $Spotter->parseDirection(($value*22.5));
713 713
 						$distance = $key;
714 714
 						$unit = 'km';
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 ?>
729 729
             <div class="col-md-6">
730 730
                 <h4><?php print $eachpolar['source_name']; ?></h4>
731
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
731
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
732 732
         	<script>
733 733
         	    (function() {
734 734
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 		      color: color,
753 753
 		      unit: '<?php echo $unit; ?>'
754 754
 		    };
755
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
755
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
756 756
 		    })();
757 757
 		</script>
758 758
             </div>
@@ -766,22 +766,22 @@  discard block
 block discarded – undo
766 766
 <?php
767 767
 			//$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
768 768
 			if ($year == '' && $month == '') {
769
-				$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
769
+				$msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d'));
770 770
 			} else {
771
-				$msg = $Stats->getStatsSource('msg',$year,$month);
771
+				$msg = $Stats->getStatsSource('msg', $year, $month);
772 772
 			}
773 773
 			if (!empty($msg)) {
774 774
 				print '<h2>'._("Messages received").'</h2>';
775 775
 				foreach ($msg as $eachmsg) {
776 776
 					//$eachmsg = $msg[0];
777 777
 					$data = $eachmsg['source_data'];
778
-					if ($data > 500) $max = (round(($data+100)/100))*100;
778
+					if ($data > 500) $max = (round(($data + 100)/100))*100;
779 779
 					else $max = 500;
780 780
 ?>
781
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
781
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
782 782
         	<script>
783 783
 		      var g = new JustGage({
784
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
784
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
785 785
 			    value: <?php echo $data; ?>,
786 786
 			    min: 0,
787 787
 			    max: <?php print $max; ?>,
@@ -802,9 +802,9 @@  discard block
 block discarded – undo
802 802
 <?php
803 803
 		//$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
804 804
 			if ($year == '' && $month == '') {
805
-				$hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d'));
805
+				$hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d'));
806 806
 			} else {
807
-				$hist = $Stats->getStatsSource('hist',$year,$month);
807
+				$hist = $Stats->getStatsSource('hist', $year, $month);
808 808
 			}
809 809
 			foreach ($hist as $hists) {
810 810
 				//$hist_data = '';
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 				$source = $hists['source_name'];
814 814
 				$hist_array = json_decode($hists['source_data']);
815 815
 				$unit = 'km';
816
-				foreach($hist_array as $distance => $nb)
816
+				foreach ($hist_array as $distance => $nb)
817 817
 				{
818 818
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
819 819
 						$distance = round($distance*0.539957);
@@ -834,18 +834,18 @@  discard block
 block discarded – undo
834 834
 				$nb_data = "['flights',".substr($nb_data, 0, -1)."]";
835 835
 ?>
836 836
             <div class="col-md-6">
837
-                <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
837
+                <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2>
838 838
 <?php
839
-				print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>';
839
+				print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>';
840 840
 				print 'c3.generate({
841
-				    bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'",
841
+				    bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'",
842 842
 				    data: { x: "x",
843 843
 				    columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
844 844
 				    axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});';
845 845
 				print '</script>';
846 846
 ?>
847 847
     	    </div>
848
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
848
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
849 849
 <?php
850 850
 			}
851 851
 ?>
Please login to merge, or discard this patch.
Braces   +104 added lines, -43 removed lines patch added patch discarded remove patch
@@ -18,11 +18,15 @@  discard block
 block discarded – undo
18 18
 	require_once('require/class.Spotter.php');
19 19
 }
20 20
 
21
-if (!isset($filter_name)) $filter_name = '';
21
+if (!isset($filter_name)) {
22
+	$filter_name = '';
23
+}
22 24
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
23 25
 if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) {
24
-	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
25
-}
26
+	if (isset($globalFilter['airline'])) {
27
+		$airline_icao = $globalFilter['airline'][0];
28
+	}
29
+	}
26 30
 if ($type == 'aircraft' && $airline_icao != '' && $airline_icao != 'all') {
27 31
 	$Spotter = new Spotter();
28 32
 	$airline_info = $Spotter->getAllAirlineInfo($airline_icao);
@@ -53,7 +57,12 @@  discard block
 block discarded – undo
53 57
 <script type="text/javascript" src="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script>
54 58
 <div class="column">
55 59
     <div class="info">
56
-            <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1>
60
+            <h1><?php if (isset($airline_name)) {
61
+	echo _("Statistics for ").$airline_name;
62
+} else {
63
+	echo _("Statistics");
64
+}
65
+?></h1>
57 66
 <?php 
58 67
 	if ($type == 'aircraft') {
59 68
 		$last_update = $Stats->getLastStatsUpdate();
@@ -61,7 +70,9 @@  discard block
 block discarded – undo
61 70
 		if (isset($last_update[0]['value'])) {
62 71
 			date_default_timezone_set('UTC');
63 72
 			$lastupdate = strtotime($last_update[0]['value']);
64
-			if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
73
+			if (isset($globalTimezone) && $globalTimezone != '') {
74
+				date_default_timezone_set($globalTimezone);
75
+			}
65 76
 			print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
66 77
 		}
67 78
 	}
@@ -137,8 +148,9 @@  discard block
 block discarded – undo
137 148
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
138 149
                  <?php
139 150
                   $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
140
-		    if (count($aircraft_array) == 0) print _("No data available");
141
-		    else {
151
+		    if (count($aircraft_array) == 0) {
152
+		    	print _("No data available");
153
+		    } else {
142 154
                     print '<div id="chart1" class="chart" width="100%"></div><script>';
143 155
                     $aircraft_data = '';
144 156
                     foreach($aircraft_array as $aircraft_item)
@@ -160,11 +172,17 @@  discard block
 block discarded – undo
160 172
             	    <?php
161 173
             		if ($year != '' && $month != '') {
162 174
             	    ?>
163
-            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
175
+            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
176
+	echo '/'.$airline_icao;
177
+}
178
+?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
164 179
             	    <?php
165 180
             		} else {
166 181
             	    ?>
167
-            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?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>
182
+            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
183
+	echo '/'.$airline_icao;
184
+}
185
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
168 186
             	    <?php
169 187
             		}
170 188
             	    ?>
@@ -195,11 +213,15 @@  discard block
 block discarded – undo
195 213
 				print '</script>';
196 214
 				if ($year != '' && $month != '') {
197 215
 					print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
198
-					if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
216
+					if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
217
+						echo '/'.$airline_icao;
218
+					}
199 219
 					print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
200 220
 				} else {
201 221
 					print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
202
-					if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
222
+					if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
223
+						echo '/'.$airline_icao;
224
+					}
203 225
 					print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
204 226
 				}
205 227
 				print '</div>';
@@ -229,8 +251,9 @@  discard block
 block discarded – undo
229 251
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
230 252
 <?php
231 253
 			$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
232
-			if (count($pilot_array) == 0) print _("No data available");
233
-			else {
254
+			if (count($pilot_array) == 0) {
255
+				print _("No data available");
256
+			} else {
234 257
 				print '<div id="chart7" class="chart" width="100%"></div><script>';
235 258
 				$pilot_data = '';
236 259
 				foreach($pilot_array as $pilot_item)
@@ -249,7 +272,9 @@  discard block
 block discarded – undo
249 272
 			}
250 273
 			print '<div class="more">';
251 274
 			print '<a href="'.$globalURL.'/statistics/pilot'; 
252
-			if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
275
+			if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
276
+				echo '/'.$airline_icao;
277
+			}
253 278
 			print'" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a>';
254 279
 			print '</div>';
255 280
 ?>
@@ -263,8 +288,9 @@  discard block
 block discarded – undo
263 288
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
264 289
 <?php
265 290
 			$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
266
-			if (count($owner_array) == 0) print _("No data available");
267
-			else {
291
+			if (count($owner_array) == 0) {
292
+				print _("No data available");
293
+			} else {
268 294
 				print '<div id="chart7" class="chart" width="100%"></div><script>';
269 295
 				$owner_data = '';
270 296
 				foreach($owner_array as $owner_item)
@@ -283,7 +309,10 @@  discard block
 block discarded – undo
283 309
 			}
284 310
 ?>
285 311
                 <div class="more">
286
-                    <a href="<?php print $globalURL; ?>/statistics/owner<?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>
312
+                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
313
+	echo '/'.$airline_icao;
314
+}
315
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
287 316
                 </div>
288 317
             </div>
289 318
         
@@ -296,8 +325,9 @@  discard block
 block discarded – undo
296 325
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
297 326
 <?php
298 327
 	 //$flightover_array = $Stats->countAllFlightOverCountries();
299
-			if (count($flightover_array) == 0) print _("No data available");
300
-			else {
328
+			if (count($flightover_array) == 0) {
329
+				print _("No data available");
330
+			} else {
301 331
 				print '<div id="chart10" class="chart" width="100%"></div><script>';
302 332
 				print 'var series = [';
303 333
 				$flightover_data = '';
@@ -340,7 +370,10 @@  discard block
 block discarded – undo
340 370
 			}
341 371
 ?>
342 372
                 <div class="more">
343
-                    <a href="<?php print $globalURL; ?>/statistics/country<?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>
373
+                    <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
374
+	echo '/'.$airline_icao;
375
+}
376
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
344 377
                 </div>
345 378
             </div>
346 379
 <?php
@@ -411,7 +444,9 @@  discard block
 block discarded – undo
411 444
 			});";
412 445
 			print '</script>';
413 446
 			print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; 
414
-			if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
447
+			if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
448
+				echo '/'.$airline_icao;
449
+			}
415 450
 			print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
416 451
 		}
417 452
 ?>
@@ -473,7 +508,9 @@  discard block
 block discarded – undo
473 508
 			});";
474 509
 			print '</script>';
475 510
 			print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival';
476
-			if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
511
+			if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
512
+				echo '/'.$airline_icao;
513
+			}
477 514
 			print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
478 515
 		}
479 516
 ?>
@@ -494,8 +531,9 @@  discard block
 block discarded – undo
494 531
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
495 532
 <?php
496 533
 			$year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
497
-			if (count($year_array) == 0) print _("No data available");
498
-			else {
534
+			if (count($year_array) == 0) {
535
+				print _("No data available");
536
+			} else {
499 537
 				print '<div id="chart8" class="chart" width="100%"></div><script>';
500 538
 				$year_data = '';
501 539
 				$year_cnt = '';
@@ -515,7 +553,10 @@  discard block
 block discarded – undo
515 553
 			}
516 554
 ?>
517 555
                 <div class="more">
518
-                    <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>
556
+                    <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
557
+	echo '/'.$airline_icao;
558
+}
559
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
519 560
                 </div>
520 561
             </div>
521 562
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -523,8 +564,9 @@  discard block
 block discarded – undo
523 564
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
524 565
 <?php
525 566
 			$month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
526
-			if (count($month_array) == 0) print _("No data available");
527
-			else {
567
+			if (count($month_array) == 0) {
568
+				print _("No data available");
569
+			} else {
528 570
 				print '<div id="chart9" class="chart" width="100%"></div><script>';
529 571
 				$month_data = '';
530 572
 				$month_cnt = '';
@@ -544,7 +586,10 @@  discard block
 block discarded – undo
544 586
 			}
545 587
 ?>
546 588
                 <div class="more">
547
-                    <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>
589
+                    <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
590
+	echo '/'.$airline_icao;
591
+}
592
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
548 593
                 </div>
549 594
             </div>
550 595
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -553,8 +598,9 @@  discard block
 block discarded – undo
553 598
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
554 599
 <?php
555 600
 			$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
556
-			if (empty($date_array)) print _("No data available");
557
-			else {
601
+			if (empty($date_array)) {
602
+				print _("No data available");
603
+			} else {
558 604
 				print '<div id="chart5" class="chart" width="100%"></div><script>';
559 605
 				$date_data = '';
560 606
 				$date_cnt = '';
@@ -574,7 +620,10 @@  discard block
 block discarded – undo
574 620
 			}
575 621
 ?>
576 622
                 <div class="more">
577
-                    <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>
623
+                    <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
624
+	echo '/'.$airline_icao;
625
+}
626
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
578 627
                 </div>
579 628
             </div>
580 629
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -582,8 +631,9 @@  discard block
 block discarded – undo
582 631
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
583 632
 <?php
584 633
 			$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
585
-			if (empty($hour_array)) print _("No data available");
586
-			else {
634
+			if (empty($hour_array)) {
635
+				print _("No data available");
636
+			} else {
587 637
 				print '<div id="chart6" class="chart" width="100%"></div><script>';
588 638
 				$hour_data = '';
589 639
 				$hour_cnt = '';
@@ -603,7 +653,10 @@  discard block
 block discarded – undo
603 653
 			}
604 654
 ?>
605 655
                 <div class="more">
606
-                    <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>
656
+                    <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
657
+	echo '/'.$airline_icao;
658
+}
659
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
607 660
                 </div>
608 661
             </div>
609 662
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -625,8 +678,9 @@  discard block
 block discarded – undo
625 678
                 <h2><?php echo _("Fatalities by Years"); ?></h2>
626 679
 <?php
627 680
 			$year_array = $Stats->countFatalitiesByYear();
628
-			if (count($year_array) == 0) print _("No data available");
629
-			else {
681
+			if (count($year_array) == 0) {
682
+				print _("No data available");
683
+			} else {
630 684
 				print '<div id="chart32" class="chart" width="100%"></div><script>';
631 685
 				$year_data = '';
632 686
 				$year_cnt = '';
@@ -656,8 +710,9 @@  discard block
 block discarded – undo
656 710
                 <h2><?php echo _("Fatalities last 12 Months"); ?></h2>
657 711
 <?php
658 712
 			$year_array = $Stats->countFatalitiesLast12Months();
659
-			if (count($year_array) == 0) print _("No data available");
660
-			else {
713
+			if (count($year_array) == 0) {
714
+				print _("No data available");
715
+			} else {
661 716
 				print '<div id="chart33" class="chart" width="100%"></div><script>';
662 717
 				$year_data = '';
663 718
 				$year_cnt = '';
@@ -722,8 +777,11 @@  discard block
 block discarded – undo
722 777
 							$distance = $distance;
723 778
 							$unit = 'km';
724 779
 						}
725
-						if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
726
-						else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
780
+						if (!isset($polar_data)) {
781
+							$polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
782
+						} else {
783
+							$polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
784
+						}
727 785
 					}
728 786
 ?>
729 787
             <div class="col-md-6">
@@ -775,9 +833,12 @@  discard block
 block discarded – undo
775 833
 				foreach ($msg as $eachmsg) {
776 834
 					//$eachmsg = $msg[0];
777 835
 					$data = $eachmsg['source_data'];
778
-					if ($data > 500) $max = (round(($data+100)/100))*100;
779
-					else $max = 500;
780
-?>
836
+					if ($data > 500) {
837
+						$max = (round(($data+100)/100))*100;
838
+					} else {
839
+						$max = 500;
840
+					}
841
+					?>
781 842
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
782 843
         	<script>
783 844
 		      var g = new JustGage({
Please login to merge, or discard this patch.