Completed
Push — master ( d6b14e...e982bb )
by Yannick
54:14 queued 25:57
created
statistics-sub-menu.php 1 patch
Braces   +110 added lines, -27 removed lines patch added patch discarded remove patch
@@ -4,7 +4,13 @@  discard block
 block discarded – undo
4 4
 	<div class="stats_airline">
5 5
 	
6 6
 		<form id="changedate" method="post">
7
-			<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') echo $year.'-'; ?><?php if (isset($month) && $month != '') echo $month; ?>" />
7
+			<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') {
8
+	echo $year.'-';
9
+}
10
+?><?php if (isset($month) && $month != '') {
11
+	echo $month;
12
+}
13
+?>" />
8 14
 		</form>
9 15
 <?php
10 16
 	if (!isset($type) || $type == 'aircraft') {
@@ -33,7 +39,9 @@  discard block
 block discarded – undo
33 39
 						print '<option disabled>──────────</option>';
34 40
 					}
35 41
 					$Stats = new Stats();
36
-					if (!isset($filter_name)) $filter_name = '';
42
+					if (!isset($filter_name)) {
43
+						$filter_name = '';
44
+					}
37 45
 					$airlines = $Stats->getAllAirlineNames($filter_name);
38 46
 					foreach($airlines as $airline) {
39 47
 						if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) {
@@ -62,10 +70,22 @@  discard block
 block discarded – undo
62 70
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
63 71
 		    </a>
64 72
 		    <ul class="dropdown-menu">
65
-			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Aircraft"); ?></a></li>
66
-			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Registration"); ?></a></li>
67
-			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Manufacturer"); ?></a></li>
68
-			<li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Country"); ?></a></li>
73
+			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
74
+	echo '/'.$airline_icao;
75
+}
76
+?>"><?php echo _("Aircraft"); ?></a></li>
77
+			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
78
+	echo '/'.$airline_icao;
79
+}
80
+?>"><?php echo _("Registration"); ?></a></li>
81
+			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
82
+	echo '/'.$airline_icao;
83
+}
84
+?>"><?php echo _("Manufacturer"); ?></a></li>
85
+			<li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
86
+	echo '/'.$airline_icao;
87
+}
88
+?>"><?php echo _("Country"); ?></a></li>
69 89
 		    </ul>
70 90
 		</li>
71 91
 		<li class="dropdown">
@@ -76,12 +96,21 @@  discard block
 block discarded – undo
76 96
 <?php
77 97
 		if (!isset($airline_icao) || $airline_icao == 'all') {
78 98
 ?>
79
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline"); ?></a></li>
80
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline by Country"); ?></a></li>
99
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
100
+	echo '/'.$airline_icao;
101
+}
102
+?>"><?php echo _("Airline"); ?></a></li>
103
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
104
+	echo '/'.$airline_icao;
105
+}
106
+?>"><?php echo _("Airline by Country"); ?></a></li>
81 107
 <?php
82 108
 		}
83 109
 ?>
84
-		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Callsign"); ?></a></li>
110
+		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
111
+	echo '/'.$airline_icao;
112
+}
113
+?>"><?php echo _("Callsign"); ?></a></li>
85 114
 		    </ul>
86 115
 		</li>
87 116
 		<li class="dropdown">
@@ -89,10 +118,22 @@  discard block
 block discarded – undo
89 118
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
90 119
 		    </a>
91 120
 		    <ul class="dropdown-menu" role="menu">
92
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport"); ?></a></li>
93
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
94
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport"); ?></a></li>
95
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
121
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
122
+	echo '/'.$airline_icao;
123
+}
124
+?>"><?php echo _("Departure Airport"); ?></a></li>
125
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
126
+	echo '/'.$airline_icao;
127
+}
128
+?>"><?php echo _("Departure Airport by Country"); ?></a></li>
129
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
130
+	echo '/'.$airline_icao;
131
+}
132
+?>"><?php echo _("Arrival Airport"); ?></a></li>
133
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
134
+	echo '/'.$airline_icao;
135
+}
136
+?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
96 137
 		    </ul>
97 138
 		</li>
98 139
 		<li class="dropdown">
@@ -100,8 +141,14 @@  discard block
 block discarded – undo
100 141
 		      <?php echo _("Route"); ?> <span class="caret"></span>
101 142
 		    </a>
102 143
 		    <ul class="dropdown-menu" role="menu">
103
-		      <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Airport"); ?></a></li>
104
-		      <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Waypoint"); ?></a></li>
144
+		      <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
145
+	echo '/'.$airline_icao;
146
+}
147
+?>"><?php echo _("Route by Airport"); ?></a></li>
148
+		      <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
149
+	echo '/'.$airline_icao;
150
+}
151
+?>"><?php echo _("Route by Waypoint"); ?></a></li>
105 152
 		    </ul>
106 153
 		</li>
107 154
 		<li class="dropdown">
@@ -109,8 +156,14 @@  discard block
 block discarded – undo
109 156
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
110 157
 		    </a>
111 158
 		    <ul class="dropdown-menu" role="menu">
112
-		      <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Date"); ?></a></li>
113
-			  <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Time"); ?></a></li>
159
+		      <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
160
+	echo '/'.$airline_icao;
161
+}
162
+?>"><?php echo _("Date"); ?></a></li>
163
+			  <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
164
+	echo '/'.$airline_icao;
165
+}
166
+?>"><?php echo _("Time"); ?></a></li>
114 167
 		    </ul>
115 168
 		</li>
116 169
 		<?php
@@ -158,9 +211,18 @@  discard block
 block discarded – undo
158 211
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
159 212
 		    </a>
160 213
 		    <ul class="dropdown-menu">
161
-			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li>
162
-			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li>
163
-			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li>
214
+			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
215
+	echo '/'.$airline_icao;
216
+}
217
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li>
218
+			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
219
+	echo '/'.$airline_icao;
220
+}
221
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li>
222
+			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
223
+	echo '/'.$airline_icao;
224
+}
225
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li>
164 226
 			<!-- <li><a href="<?php print $globalURL; ?>/statistics/country"><?php echo _("Country"); ?></a></li> -->
165 227
 		    </ul>
166 228
 		</li>
@@ -172,12 +234,21 @@  discard block
 block discarded – undo
172 234
 <?php
173 235
 		if (!isset($airline_icao) || $airline_icao == 'all') {
174 236
 ?>
175
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li>
176
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li>
237
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
238
+	echo '/'.$airline_icao;
239
+}
240
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li>
241
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
242
+	echo '/'.$airline_icao;
243
+}
244
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li>
177 245
 <?php
178 246
 		}
179 247
 ?>
180
-		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li>
248
+		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
249
+	echo '/'.$airline_icao;
250
+}
251
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li>
181 252
 		    </ul>
182 253
 		</li>
183 254
 		<li class="dropdown">
@@ -185,10 +256,22 @@  discard block
 block discarded – undo
185 256
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
186 257
 		    </a>
187 258
 		    <ul class="dropdown-menu" role="menu">
188
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li>
189
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
190
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li>
191
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
259
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
260
+	echo '/'.$airline_icao;
261
+}
262
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li>
263
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
264
+	echo '/'.$airline_icao;
265
+}
266
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
267
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
268
+	echo '/'.$airline_icao;
269
+}
270
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li>
271
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
272
+	echo '/'.$airline_icao;
273
+}
274
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
192 275
 		    </ul>
193 276
 		</li>
194 277
 		<!--
Please login to merge, or discard this patch.
statistics.php 1 patch
Braces   +142 added lines, -67 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);
@@ -61,7 +65,12 @@  discard block
 block discarded – undo
61 65
 <script type="text/javascript" src="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script>
62 66
 <div class="column">
63 67
     <div class="info">
64
-            <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1>
68
+            <h1><?php if (isset($airline_name)) {
69
+	echo _("Statistics for ").$airline_name;
70
+} else {
71
+	echo _("Statistics");
72
+}
73
+?></h1>
65 74
 <?php 
66 75
 if ($type == 'aircraft') {
67 76
 	$last_update = $Stats->getLastStatsUpdate();
@@ -69,7 +78,9 @@  discard block
 block discarded – undo
69 78
 	if (isset($last_update[0]['value'])) {
70 79
 		date_default_timezone_set('UTC');
71 80
 		$lastupdate = strtotime($last_update[0]['value']);
72
-		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
81
+		if (isset($globalTimezone) && $globalTimezone != '') {
82
+			date_default_timezone_set($globalTimezone);
83
+		}
73 84
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
74 85
 	}
75 86
 }
@@ -154,8 +165,11 @@  discard block
 block discarded – undo
154 165
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
155 166
 		$aircraft_data = '';
156 167
 		foreach($aircraft_array as $aircraft_item) {
157
-			if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
158
-			else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
168
+			if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') {
169
+				$aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
170
+			} else {
171
+				$aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
172
+			}
159 173
 		}
160 174
 		$aircraft_data = substr($aircraft_data, 0, -1);
161 175
 		print 'var series = ['.$aircraft_data.'];';
@@ -172,11 +186,17 @@  discard block
 block discarded – undo
172 186
 <?php
173 187
 	if ($year != '' && $month != '') {
174 188
 ?>
175
-            	    <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>
189
+            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
190
+	echo '/'.$airline_icao;
191
+}
192
+?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
176 193
 <?php
177 194
 	} else {
178 195
 ?>
179
-            	    <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>
196
+            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
197
+	echo '/'.$airline_icao;
198
+}
199
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
180 200
 <?php
181 201
 	}
182 202
 ?>
@@ -205,11 +225,15 @@  discard block
 block discarded – undo
205 225
 			print '</script>';
206 226
 			if ($year != '' && $month != '') {
207 227
 				print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
208
-				if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
228
+				if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
229
+					echo '/'.$airline_icao;
230
+				}
209 231
 				print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
210 232
 			} else {
211 233
 				print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
212
-				if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
234
+				if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
235
+					echo '/'.$airline_icao;
236
+				}
213 237
 				print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
214 238
 			}
215 239
 			print '</div>';
@@ -229,8 +253,9 @@  discard block
 block discarded – undo
229 253
                 <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2>
230 254
 <?php
231 255
 	$marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month);
232
-	if (count($marine_array) == 0) print _("No data available");
233
-	else {
256
+	if (count($marine_array) == 0) {
257
+		print _("No data available");
258
+	} else {
234 259
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
235 260
 		$marine_data = '';
236 261
 		foreach($marine_array as $marine_item) {
@@ -274,8 +299,9 @@  discard block
 block discarded – undo
274 299
                 <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2>
275 300
 <?php
276 301
 	$tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month);
277
-	if (count($tracker_array) == 0) print _("No data available");
278
-	else {
302
+	if (count($tracker_array) == 0) {
303
+		print _("No data available");
304
+	} else {
279 305
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
280 306
 		$tracker_data = '';
281 307
 		foreach($tracker_array as $tracker_item) {
@@ -328,8 +354,9 @@  discard block
 block discarded – undo
328 354
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
329 355
 <?php
330 356
 		$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
331
-		if (count($pilot_array) == 0) print _("No data available");
332
-		else {
357
+		if (count($pilot_array) == 0) {
358
+			print _("No data available");
359
+		} else {
333 360
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
334 361
 			$pilot_data = '';
335 362
 			foreach($pilot_array as $pilot_item) {
@@ -347,7 +374,9 @@  discard block
 block discarded – undo
347 374
 		}
348 375
 		print '<div class="more">';
349 376
 		print '<a href="'.$globalURL.'/statistics/pilot'; 
350
-		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
377
+		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
378
+			echo '/'.$airline_icao;
379
+		}
351 380
 		print'" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a>';
352 381
 		print '</div>';
353 382
 ?>
@@ -363,8 +392,9 @@  discard block
 block discarded – undo
363 392
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
364 393
 <?php
365 394
 		$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
366
-		if (count($owner_array) == 0) print _("No data available");
367
-		else {
395
+		if (count($owner_array) == 0) {
396
+			print _("No data available");
397
+		} else {
368 398
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
369 399
 			$owner_data = '';
370 400
 			foreach($owner_array as $owner_item) {
@@ -382,7 +412,10 @@  discard block
 block discarded – undo
382 412
 		}
383 413
 ?>
384 414
                 <div class="more">
385
-                    <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>
415
+                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
416
+	echo '/'.$airline_icao;
417
+}
418
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
386 419
                 </div>
387 420
             </div>
388 421
         
@@ -395,8 +428,9 @@  discard block
 block discarded – undo
395 428
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
396 429
 <?php
397 430
 	 //$flightover_array = $Stats->countAllFlightOverCountries();
398
-		if (count($flightover_array) == 0) print _("No data available");
399
-		else {
431
+		if (count($flightover_array) == 0) {
432
+			print _("No data available");
433
+		} else {
400 434
 			print '<div id="chart10" class="chart" width="100%"></div><script>';
401 435
 			print 'var series = [';
402 436
 			$flightover_data = '';
@@ -438,7 +472,10 @@  discard block
 block discarded – undo
438 472
 		}
439 473
 ?>
440 474
                 <div class="more">
441
-                    <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>
475
+                    <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
476
+	echo '/'.$airline_icao;
477
+}
478
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
442 479
                 </div>
443 480
             </div>
444 481
 <?php
@@ -456,8 +493,9 @@  discard block
 block discarded – undo
456 493
 	<div class="col-md-6">
457 494
             <h2><?php echo _("Top 20 Most Common Country a Vessel was inside"); ?></h2>
458 495
 <?php
459
-	if (count($flightover_array) == 0) print _("No data available");
460
-	else {
496
+	if (count($flightover_array) == 0) {
497
+		print _("No data available");
498
+	} else {
461 499
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
462 500
 		print 'var series = [';
463 501
 		$flightover_data = '';
@@ -513,8 +551,9 @@  discard block
 block discarded – undo
513 551
 	<div class="col-md-6">
514 552
             <h2><?php echo _("Top 20 Most Common Country a Tracker was inside"); ?></h2>
515 553
 <?php
516
-	if (count($flightover_array) == 0) print _("No data available");
517
-	else {
554
+	if (count($flightover_array) == 0) {
555
+		print _("No data available");
556
+	} else {
518 557
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
519 558
 		print 'var series = [';
520 559
 		$flightover_data = '';
@@ -620,7 +659,9 @@  discard block
 block discarded – undo
620 659
 		});";
621 660
 		print '</script>';
622 661
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; 
623
-		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
662
+		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
663
+			echo '/'.$airline_icao;
664
+		}
624 665
 		print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
625 666
 	}
626 667
 ?>
@@ -682,7 +723,9 @@  discard block
 block discarded – undo
682 723
 		});";
683 724
 		print '</script>';
684 725
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival';
685
-		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
726
+		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
727
+			echo '/'.$airline_icao;
728
+		}
686 729
 		print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
687 730
 	}
688 731
 ?>
@@ -701,8 +744,9 @@  discard block
 block discarded – undo
701 744
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
702 745
 <?php
703 746
 		$year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
704
-		if (count($year_array) == 0) print _("No data available");
705
-		else {
747
+		if (count($year_array) == 0) {
748
+			print _("No data available");
749
+		} else {
706 750
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
707 751
 			$year_data = '';
708 752
 			$year_cnt = '';
@@ -721,7 +765,10 @@  discard block
 block discarded – undo
721 765
 		}
722 766
 ?>
723 767
                 <div class="more">
724
-                    <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>
768
+                    <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
769
+	echo '/'.$airline_icao;
770
+}
771
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
725 772
                 </div>
726 773
             </div>
727 774
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -729,8 +776,9 @@  discard block
 block discarded – undo
729 776
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
730 777
 <?php
731 778
 		$month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
732
-		if (count($month_array) == 0) print _("No data available");
733
-		else {
779
+		if (count($month_array) == 0) {
780
+			print _("No data available");
781
+		} else {
734 782
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
735 783
 			$month_data = '';
736 784
 			$month_cnt = '';
@@ -749,7 +797,10 @@  discard block
 block discarded – undo
749 797
 		}
750 798
 ?>
751 799
                 <div class="more">
752
-                    <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>
800
+                    <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
801
+	echo '/'.$airline_icao;
802
+}
803
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
753 804
                 </div>
754 805
             </div>
755 806
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -758,8 +809,9 @@  discard block
 block discarded – undo
758 809
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
759 810
 <?php
760 811
 		$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
761
-		if (empty($date_array)) print _("No data available");
762
-		else {
812
+		if (empty($date_array)) {
813
+			print _("No data available");
814
+		} else {
763 815
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
764 816
 			$date_data = '';
765 817
 			$date_cnt = '';
@@ -778,7 +830,10 @@  discard block
 block discarded – undo
778 830
 		}
779 831
 ?>
780 832
                 <div class="more">
781
-                    <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>
833
+                    <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
834
+	echo '/'.$airline_icao;
835
+}
836
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
782 837
                 </div>
783 838
             </div>
784 839
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -786,8 +841,9 @@  discard block
 block discarded – undo
786 841
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
787 842
 <?php
788 843
 		$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
789
-		if (empty($hour_array)) print _("No data available");
790
-		else {
844
+		if (empty($hour_array)) {
845
+			print _("No data available");
846
+		} else {
791 847
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
792 848
 			$hour_data = '';
793 849
 			$hour_cnt = '';
@@ -806,7 +862,10 @@  discard block
 block discarded – undo
806 862
 		}
807 863
 ?>
808 864
                 <div class="more">
809
-                    <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>
865
+                    <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
866
+	echo '/'.$airline_icao;
867
+}
868
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
810 869
                 </div>
811 870
             </div>
812 871
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -826,8 +885,9 @@  discard block
 block discarded – undo
826 885
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
827 886
 <?php
828 887
 		$year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name);
829
-		if (count($year_array) == 0) print _("No data available");
830
-		else {
888
+		if (count($year_array) == 0) {
889
+			print _("No data available");
890
+		} else {
831 891
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
832 892
 			$year_data = '';
833 893
 			$year_cnt = '';
@@ -855,8 +915,9 @@  discard block
 block discarded – undo
855 915
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
856 916
 <?php
857 917
 		$month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name);
858
-		if (count($month_array) == 0) print _("No data available");
859
-		else {
918
+		if (count($month_array) == 0) {
919
+			print _("No data available");
920
+		} else {
860 921
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
861 922
 			$month_data = '';
862 923
 			$month_cnt = '';
@@ -884,8 +945,9 @@  discard block
 block discarded – undo
884 945
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
885 946
 <?php
886 947
 		$date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name);
887
-		if (empty($date_array)) print _("No data available");
888
-		else {
948
+		if (empty($date_array)) {
949
+			print _("No data available");
950
+		} else {
889 951
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
890 952
 			$date_data = '';
891 953
 			$date_cnt = '';
@@ -912,8 +974,9 @@  discard block
 block discarded – undo
912 974
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
913 975
 <?php
914 976
 		$hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name);
915
-		if (empty($hour_array)) print _("No data available");
916
-		else {
977
+		if (empty($hour_array)) {
978
+			print _("No data available");
979
+		} else {
917 980
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
918 981
 			$hour_data = '';
919 982
 			$hour_cnt = '';
@@ -952,8 +1015,9 @@  discard block
 block discarded – undo
952 1015
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
953 1016
 <?php
954 1017
 		$year_array = $Tracker->countAllMonthsLastYear(true);
955
-		if (count($year_array) == 0) print _("No data available");
956
-		else {
1018
+		if (count($year_array) == 0) {
1019
+			print _("No data available");
1020
+		} else {
957 1021
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
958 1022
 			$year_data = '';
959 1023
 			$year_cnt = '';
@@ -981,8 +1045,9 @@  discard block
 block discarded – undo
981 1045
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
982 1046
 <?php
983 1047
 		$month_array = $Tracker->countAllDatesLastMonth();
984
-		if (count($month_array) == 0) print _("No data available");
985
-		else {
1048
+		if (count($month_array) == 0) {
1049
+			print _("No data available");
1050
+		} else {
986 1051
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
987 1052
 			$month_data = '';
988 1053
 			$month_cnt = '';
@@ -1010,8 +1075,9 @@  discard block
 block discarded – undo
1010 1075
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
1011 1076
 <?php
1012 1077
 		$date_array = $Tracker->countAllDatesLast7Days();
1013
-		if (empty($date_array)) print _("No data available");
1014
-		else {
1078
+		if (empty($date_array)) {
1079
+			print _("No data available");
1080
+		} else {
1015 1081
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
1016 1082
 			$date_data = '';
1017 1083
 			$date_cnt = '';
@@ -1038,8 +1104,9 @@  discard block
 block discarded – undo
1038 1104
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1039 1105
 <?php
1040 1106
 		$hour_array = $Tracker->countAllHours('hour',true);
1041
-		if (empty($hour_array)) print _("No data available");
1042
-		else {
1107
+		if (empty($hour_array)) {
1108
+			print _("No data available");
1109
+		} else {
1043 1110
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1044 1111
 			$hour_data = '';
1045 1112
 			$hour_cnt = '';
@@ -1078,8 +1145,9 @@  discard block
 block discarded – undo
1078 1145
                 <h2><?php echo _("Fatalities by Years"); ?></h2>
1079 1146
 <?php
1080 1147
 		$year_array = $Stats->countFatalitiesByYear();
1081
-		if (count($year_array) == 0) print _("No data available");
1082
-		else {
1148
+		if (count($year_array) == 0) {
1149
+			print _("No data available");
1150
+		} else {
1083 1151
 			print '<div id="chart32" class="chart" width="100%"></div><script>';
1084 1152
 			$year_data = '';
1085 1153
 			$year_cnt = '';
@@ -1108,8 +1176,9 @@  discard block
 block discarded – undo
1108 1176
                 <h2><?php echo _("Fatalities last 12 Months"); ?></h2>
1109 1177
 <?php
1110 1178
 		$year_array = $Stats->countFatalitiesLast12Months();
1111
-		if (count($year_array) == 0) print _("No data available");
1112
-		else {
1179
+		if (count($year_array) == 0) {
1180
+			print _("No data available");
1181
+		} else {
1113 1182
 			print '<div id="chart33" class="chart" width="100%"></div><script>';
1114 1183
 			$year_data = '';
1115 1184
 			$year_cnt = '';
@@ -1180,8 +1249,11 @@  discard block
 block discarded – undo
1180 1249
 					$distance = $distance;
1181 1250
 					$unit = 'km';
1182 1251
 				}
1183
-				if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1184
-				else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1252
+				if (!isset($polar_data)) {
1253
+					$polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1254
+				} else {
1255
+					$polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1256
+				}
1185 1257
 			}
1186 1258
 ?>
1187 1259
             <div class="col-md-6">
@@ -1245,9 +1317,12 @@  discard block
 block discarded – undo
1245 1317
 		foreach ($msg as $eachmsg) {
1246 1318
 			//$eachmsg = $msg[0];
1247 1319
 			$data = $eachmsg['source_data'];
1248
-			if ($data > 500) $max = (round(($data+100)/100))*100;
1249
-			else $max = 500;
1250
-?>
1320
+			if ($data > 500) {
1321
+				$max = (round(($data+100)/100))*100;
1322
+			} else {
1323
+				$max = 500;
1324
+			}
1325
+			?>
1251 1326
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1252 1327
         	<script>
1253 1328
 		      var g = new JustGage({
Please login to merge, or discard this patch.
require/class.Stats.php 1 patch
Braces   +580 added lines, -204 removed lines patch added patch discarded remove patch
@@ -13,7 +13,9 @@  discard block
 block discarded – undo
13 13
 	
14 14
 	public function __construct($dbc = null) {
15 15
 		global $globalFilterName;
16
-		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
16
+		if (isset($globalFilterName)) {
17
+			$this->filter_name = $globalFilterName;
18
+		}
17 19
 		$Connection = new Connection($dbc);
18 20
 		$this->db = $Connection->db();
19 21
 	}
@@ -83,7 +85,9 @@  discard block
 block discarded – undo
83 85
 
84 86
 	public function getAllAirlineNames($filter_name = '') {
85 87
 		global $globalStatsFilters;
86
-		if ($filter_name == '') $filter_name = $this->filter_name;
88
+		if ($filter_name == '') {
89
+			$filter_name = $this->filter_name;
90
+		}
87 91
 		$query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
88 92
 		 try {
89 93
 			$sth = $this->db->prepare($query);
@@ -103,7 +107,9 @@  discard block
 block discarded – undo
103 107
 		return $all;
104 108
 	}
105 109
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
106
-		if ($filter_name == '') $filter_name = $this->filter_name;
110
+		if ($filter_name == '') {
111
+			$filter_name = $this->filter_name;
112
+		}
107 113
 		$query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
108 114
 		try {
109 115
 			$sth = $this->db->prepare($query);
@@ -115,7 +121,9 @@  discard block
 block discarded – undo
115 121
 		return $all;
116 122
 	}
117 123
 	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
118
-		if ($filter_name == '') $filter_name = $this->filter_name;
124
+		if ($filter_name == '') {
125
+			$filter_name = $this->filter_name;
126
+		}
119 127
 		$query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC";
120 128
 		try {
121 129
 			$sth = $this->db->prepare($query);
@@ -127,7 +135,9 @@  discard block
 block discarded – undo
127 135
 		return $all;
128 136
 	}
129 137
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
130
-		if ($filter_name == '') $filter_name = $this->filter_name;
138
+		if ($filter_name == '') {
139
+			$filter_name = $this->filter_name;
140
+		}
131 141
 		$query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
132 142
 		try {
133 143
 			$sth = $this->db->prepare($query);
@@ -140,7 +150,9 @@  discard block
 block discarded – undo
140 150
 	}
141 151
 
142 152
 	public function getAllOwnerNames($stats_airline = '',$filter_name = '') {
143
-		if ($filter_name == '') $filter_name = $this->filter_name;
153
+		if ($filter_name == '') {
154
+			$filter_name = $this->filter_name;
155
+		}
144 156
 		$query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC";
145 157
 		try {
146 158
 			$sth = $this->db->prepare($query);
@@ -153,7 +165,9 @@  discard block
 block discarded – undo
153 165
 	}
154 166
 
155 167
 	public function getAllPilotNames($stats_airline = '',$filter_name = '') {
156
-		if ($filter_name == '') $filter_name = $this->filter_name;
168
+		if ($filter_name == '') {
169
+			$filter_name = $this->filter_name;
170
+		}
157 171
 		$query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC";
158 172
 		try {
159 173
 			$sth = $this->db->prepare($query);
@@ -168,7 +182,9 @@  discard block
 block discarded – undo
168 182
 
169 183
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') {
170 184
 		global $globalStatsFilters;
171
-		if ($filter_name == '') $filter_name = $this->filter_name;
185
+		if ($filter_name == '') {
186
+			$filter_name = $this->filter_name;
187
+		}
172 188
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
173 189
 			$Spotter = new Spotter($this->db);
174 190
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -177,8 +193,11 @@  discard block
 block discarded – undo
177 193
 				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
178 194
 			}
179 195
 			if ($year == '' && $month == '') {
180
-				if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
181
-				else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
196
+				if ($limit) {
197
+					$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
198
+				} else {
199
+					$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
200
+				}
182 201
 				try {
183 202
 					$sth = $this->db->prepare($query);
184 203
 					$sth->execute(array(':filter_name' => $filter_name));
@@ -186,11 +205,16 @@  discard block
 block discarded – undo
186 205
 					echo "error : ".$e->getMessage();
187 206
 				}
188 207
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
189
-			} else $all = array();
208
+			} else {
209
+				$all = array();
210
+			}
190 211
 		} else {
191 212
 			if ($year == '' && $month == '') {
192
-				if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
193
-				else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
213
+				if ($limit) {
214
+					$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
215
+				} else {
216
+					$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
217
+				}
194 218
 				try {
195 219
 					$sth = $this->db->prepare($query);
196 220
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -198,7 +222,9 @@  discard block
 block discarded – undo
198 222
 					echo "error : ".$e->getMessage();
199 223
 				}
200 224
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
201
-			} else $all = array();
225
+			} else {
226
+				$all = array();
227
+			}
202 228
 		}
203 229
 		if (empty($all)) {
204 230
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -217,10 +243,15 @@  discard block
 block discarded – undo
217 243
 	}
218 244
 	public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') {
219 245
 		global $globalStatsFilters;
220
-		if ($filter_name == '') $filter_name = $this->filter_name;
246
+		if ($filter_name == '') {
247
+			$filter_name = $this->filter_name;
248
+		}
221 249
 		if ($year == '' && $month == '') {
222
-			if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
223
-			else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC";
250
+			if ($limit) {
251
+				$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
252
+			} else {
253
+				$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC";
254
+			}
224 255
 			try {
225 256
 				$sth = $this->db->prepare($query);
226 257
 				$sth->execute(array(':filter_name' => $filter_name));
@@ -228,7 +259,9 @@  discard block
 block discarded – undo
228 259
 				echo "error : ".$e->getMessage();
229 260
 			}
230 261
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
231
-		} else $all = array();
262
+		} else {
263
+			$all = array();
264
+		}
232 265
 		if (empty($all)) {
233 266
 			$Spotter = new Spotter($this->db);
234 267
 			$filters = array();
@@ -243,7 +276,9 @@  discard block
 block discarded – undo
243 276
 	}
244 277
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') {
245 278
 		global $globalStatsFilters;
246
-		if ($filter_name == '') $filter_name = $this->filter_name;
279
+		if ($filter_name == '') {
280
+			$filter_name = $this->filter_name;
281
+		}
247 282
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
248 283
 			$Spotter = new Spotter($this->db);
249 284
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -252,8 +287,11 @@  discard block
 block discarded – undo
252 287
 				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
253 288
 			}
254 289
 			if ($year == '' && $month == '') {
255
-				if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
256
-				else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
290
+				if ($limit) {
291
+					$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
292
+				} else {
293
+					$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
294
+				}
257 295
 				try {
258 296
 					$sth = $this->db->prepare($query);
259 297
 					$sth->execute(array(':filter_name' => $filter_name));
@@ -261,11 +299,16 @@  discard block
 block discarded – undo
261 299
 					echo "error : ".$e->getMessage();
262 300
 				}
263 301
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
264
-			} else $all = array();
302
+			} else {
303
+				$all = array();
304
+			}
265 305
 		} else {
266 306
 			if ($year == '' && $month == '') {
267
-				if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
268
-				else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
307
+				if ($limit) {
308
+					$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
309
+				} else {
310
+					$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
311
+				}
269 312
 				try {
270 313
 					$sth = $this->db->prepare($query);
271 314
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -273,7 +316,9 @@  discard block
 block discarded – undo
273 316
 					echo "error : ".$e->getMessage();
274 317
 				}
275 318
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
276
-			} else $all = array();
319
+			} else {
320
+				$all = array();
321
+			}
277 322
 		}
278 323
 		if (empty($all)) {
279 324
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -293,7 +338,9 @@  discard block
 block discarded – undo
293 338
 
294 339
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') {
295 340
 		global $globalStatsFilters;
296
-		if ($filter_name == '') $filter_name = $this->filter_name;
341
+		if ($filter_name == '') {
342
+			$filter_name = $this->filter_name;
343
+		}
297 344
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
298 345
 			$Spotter = new Spotter($this->db);
299 346
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -302,8 +349,11 @@  discard block
 block discarded – undo
302 349
 				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
303 350
 			}
304 351
 			if ($year == '' && $month == '') {
305
-				if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
306
-				else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC";
352
+				if ($limit) {
353
+					$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
354
+				} else {
355
+					$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC";
356
+				}
307 357
 				try {
308 358
 					$sth = $this->db->prepare($query);
309 359
 					$sth->execute(array(':filter_name' => $filter_name));
@@ -311,11 +361,16 @@  discard block
 block discarded – undo
311 361
 					echo "error : ".$e->getMessage();
312 362
 				}
313 363
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
314
-			} else $all = array();
364
+			} else {
365
+				$all = array();
366
+			}
315 367
 		} else {
316 368
 			if ($year == '' && $month == '') {
317
-				if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
318
-				else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC";
369
+				if ($limit) {
370
+					$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
371
+				} else {
372
+					$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC";
373
+				}
319 374
 				try {
320 375
 					$sth = $this->db->prepare($query);
321 376
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -323,7 +378,9 @@  discard block
 block discarded – undo
323 378
 					echo "error : ".$e->getMessage();
324 379
 				}
325 380
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
326
-			} else $all = array();
381
+			} else {
382
+				$all = array();
383
+			}
327 384
 		}
328 385
 		if (empty($all)) {
329 386
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -342,7 +399,9 @@  discard block
 block discarded – undo
342 399
 	}
343 400
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
344 401
 		global $globalStatsFilters;
345
-		if ($filter_name == '') $filter_name = $this->filter_name;
402
+		if ($filter_name == '') {
403
+			$filter_name = $this->filter_name;
404
+		}
346 405
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
347 406
 			$Spotter = new Spotter($this->db);
348 407
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -350,12 +409,18 @@  discard block
 block discarded – undo
350 409
 			foreach ($airlines as $airline) {
351 410
 				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
352 411
 			}
353
-			if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
354
-			else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC";
412
+			if ($limit) {
413
+				$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
414
+			} else {
415
+				$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC";
416
+			}
355 417
 			$query_values = array(':filter_name' => $filter_name);
356 418
 		} else {
357
-			if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
358
-			else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC";
419
+			if ($limit) {
420
+				$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
421
+			} else {
422
+				$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC";
423
+			}
359 424
 			$query_values = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
360 425
 		}
361 426
 		try {
@@ -383,17 +448,29 @@  discard block
 block discarded – undo
383 448
 
384 449
 	public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') {
385 450
 		global $globalStatsFilters, $globalVATSIM, $globalIVAO;
386
-		if ($filter_name == '') $filter_name = $this->filter_name;
451
+		if ($filter_name == '') {
452
+			$filter_name = $this->filter_name;
453
+		}
387 454
 		if ($year == '' && $month == '') {
388
-			if ($globalVATSIM) $forsource = 'vatsim';
389
-			if ($globalIVAO) $forsource = 'ivao';
455
+			if ($globalVATSIM) {
456
+				$forsource = 'vatsim';
457
+			}
458
+			if ($globalIVAO) {
459
+				$forsource = 'ivao';
460
+			}
390 461
 			if (isset($forsource)) {
391
-				if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
392
-				else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC";
462
+				if ($limit) {
463
+					$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
464
+				} else {
465
+					$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC";
466
+				}
393 467
 				$query_values = array(':filter_name' => $filter_name,':forsource' => $forsource);
394 468
 			} else {
395
-				if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
396
-				else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC";
469
+				if ($limit) {
470
+					$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
471
+				} else {
472
+					$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC";
473
+				}
397 474
 				$query_values = array(':filter_name' => $filter_name);
398 475
 			}
399 476
 			try {
@@ -403,7 +480,9 @@  discard block
 block discarded – undo
403 480
 				echo "error : ".$e->getMessage();
404 481
 			}
405 482
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
406
-		} else $all = array();
483
+		} else {
484
+			$all = array();
485
+		}
407 486
                 if (empty($all)) {
408 487
 	                $Spotter = new Spotter($this->db);
409 488
             		$filters = array();
@@ -418,7 +497,9 @@  discard block
 block discarded – undo
418 497
 	}
419 498
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
420 499
 		global $globalStatsFilters;
421
-		if ($filter_name == '') $filter_name = $this->filter_name;
500
+		if ($filter_name == '') {
501
+			$filter_name = $this->filter_name;
502
+		}
422 503
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
423 504
 			$Spotter = new Spotter($this->db);
424 505
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -427,8 +508,11 @@  discard block
 block discarded – undo
427 508
 				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
428 509
 			}
429 510
 			if ($year == '' && $month == '') {
430
-				if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
431
-				else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
511
+				if ($limit) {
512
+					$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
513
+				} else {
514
+					$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
515
+				}
432 516
 				try {
433 517
 					$sth = $this->db->prepare($query);
434 518
 					$sth->execute(array(':filter_name' => $filter_name));
@@ -436,11 +520,16 @@  discard block
 block discarded – undo
436 520
 					echo "error : ".$e->getMessage();
437 521
 				}
438 522
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
439
-			} else $all = array();
523
+			} else {
524
+				$all = array();
525
+			}
440 526
 		} else {
441 527
 			if ($year == '' && $month == '') {
442
-				if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
443
-				else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
528
+				if ($limit) {
529
+					$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
530
+				} else {
531
+					$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
532
+				}
444 533
 				try {
445 534
 					$sth = $this->db->prepare($query);
446 535
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -448,7 +537,9 @@  discard block
 block discarded – undo
448 537
 					echo "error : ".$e->getMessage();
449 538
 				}
450 539
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
451
-			} else $all = array();
540
+			} else {
541
+				$all = array();
542
+			}
452 543
 		}
453 544
 		if (empty($all)) {
454 545
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -467,7 +558,9 @@  discard block
 block discarded – undo
467 558
 	}
468 559
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
469 560
 		global $globalStatsFilters;
470
-		if ($filter_name == '') $filter_name = $this->filter_name;
561
+		if ($filter_name == '') {
562
+			$filter_name = $this->filter_name;
563
+		}
471 564
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
472 565
 			$Spotter = new Spotter($this->db);
473 566
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -476,8 +569,11 @@  discard block
 block discarded – undo
476 569
 				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
477 570
 			}
478 571
 			if ($year == '' && $month == '') {
479
-				if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
480
-				else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
572
+				if ($limit) {
573
+					$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
574
+				} else {
575
+					$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
576
+				}
481 577
 				 try {
482 578
 					$sth = $this->db->prepare($query);
483 579
 					$sth->execute(array(':filter_name' => $filter_name));
@@ -485,11 +581,16 @@  discard block
 block discarded – undo
485 581
 					echo "error : ".$e->getMessage();
486 582
 				}
487 583
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
488
-			} else $all = array();
584
+			} else {
585
+				$all = array();
586
+			}
489 587
 		} else {
490 588
 			if ($year == '' && $month == '') {
491
-				if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
492
-				else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
589
+				if ($limit) {
590
+					$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
591
+				} else {
592
+					$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
593
+				}
493 594
 				 try {
494 595
 					$sth = $this->db->prepare($query);
495 596
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -497,7 +598,9 @@  discard block
 block discarded – undo
497 598
 					echo "error : ".$e->getMessage();
498 599
 				}
499 600
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
500
-			} else $all = array();
601
+			} else {
602
+				$all = array();
603
+			}
501 604
 		}
502 605
 		if (empty($all)) {
503 606
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -516,7 +619,9 @@  discard block
 block discarded – undo
516 619
 	}
517 620
 	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') {
518 621
 		$Connection = new Connection();
519
-		if ($filter_name == '') $filter_name = $this->filter_name;
622
+		if ($filter_name == '') {
623
+			$filter_name = $this->filter_name;
624
+		}
520 625
 		if ($Connection->tableExists('countries')) {
521 626
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
522 627
 				$Spotter = new Spotter($this->db);
@@ -526,8 +631,11 @@  discard block
 block discarded – undo
526 631
 					foreach ($airlines as $airline) {
527 632
 						$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
528 633
 					}
529
-					if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
530
-					else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC";
634
+					if ($limit) {
635
+						$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
636
+					} else {
637
+						$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC";
638
+					}
531 639
 					 try {
532 640
 						$sth = $this->db->prepare($query);
533 641
 						$sth->execute(array(':filter_name' => $filter_name));
@@ -536,11 +644,16 @@  discard block
 block discarded – undo
536 644
 					}
537 645
 					$all = $sth->fetchAll(PDO::FETCH_ASSOC);
538 646
 					return $all;
539
-				} else return array();
647
+				} else {
648
+					return array();
649
+				}
540 650
 			} else {
541 651
 				if ($year == '' && $month == '') {
542
-					if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
543
-					else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
652
+					if ($limit) {
653
+						$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
654
+					} else {
655
+						$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
656
+					}
544 657
 					 try {
545 658
 						$sth = $this->db->prepare($query);
546 659
 						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -549,7 +662,9 @@  discard block
 block discarded – undo
549 662
 					}
550 663
 					$all = $sth->fetchAll(PDO::FETCH_ASSOC);
551 664
 					return $all;
552
-				} else return array();
665
+				} else {
666
+					return array();
667
+				}
553 668
 			}
554 669
 		} else {
555 670
 			/*
@@ -563,10 +678,15 @@  discard block
 block discarded – undo
563 678
 	}
564 679
 	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') {
565 680
 		global $globalStatsFilters;
566
-		if ($filter_name == '') $filter_name = $this->filter_name;
681
+		if ($filter_name == '') {
682
+			$filter_name = $this->filter_name;
683
+		}
567 684
 		if ($year == '' && $month == '') {
568
-			if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
569
-			else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
685
+			if ($limit) {
686
+				$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
687
+			} else {
688
+				$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
689
+			}
570 690
 			try {
571 691
 				$sth = $this->db->prepare($query);
572 692
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -574,7 +694,9 @@  discard block
 block discarded – undo
574 694
 				echo "error : ".$e->getMessage();
575 695
 			}
576 696
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
577
-		} else $all = array();
697
+		} else {
698
+			$all = array();
699
+		}
578 700
 		if (empty($all)) {
579 701
 			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
580 702
 			if ($filter_name != '') {
@@ -589,7 +711,9 @@  discard block
 block discarded – undo
589 711
 
590 712
 	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') {
591 713
 		global $globalStatsFilters;
592
-		if ($filter_name == '') $filter_name = $this->filter_name;
714
+		if ($filter_name == '') {
715
+			$filter_name = $this->filter_name;
716
+		}
593 717
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
594 718
 			$Spotter = new Spotter($this->db);
595 719
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -598,8 +722,11 @@  discard block
 block discarded – undo
598 722
 				foreach ($airlines as $airline) {
599 723
 					$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
600 724
 				}
601
-				if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
602
-				else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC";
725
+				if ($limit) {
726
+					$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
727
+				} else {
728
+					$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC";
729
+				}
603 730
 				try {
604 731
 					$sth = $this->db->prepare($query);
605 732
 					$sth->execute(array(':filter_name' => $filter_name));
@@ -607,11 +734,16 @@  discard block
 block discarded – undo
607 734
 					echo "error : ".$e->getMessage();
608 735
 				}
609 736
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
610
-			} else $all = array();
737
+			} else {
738
+				$all = array();
739
+			}
611 740
 		} else {
612 741
 			if ($year == '' && $month == '') {
613
-				if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
614
-				else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
742
+				if ($limit) {
743
+					$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
744
+				} else {
745
+					$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
746
+				}
615 747
 				try {
616 748
 					$sth = $this->db->prepare($query);
617 749
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -619,7 +751,9 @@  discard block
 block discarded – undo
619 751
 					echo "error : ".$e->getMessage();
620 752
 				}
621 753
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
622
-			} else $all = array();
754
+			} else {
755
+				$all = array();
756
+			}
623 757
 		}
624 758
 		if (empty($all)) {
625 759
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -638,7 +772,9 @@  discard block
 block discarded – undo
638 772
 	}
639 773
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
640 774
 		global $globalStatsFilters;
641
-		if ($filter_name == '') $filter_name = $this->filter_name;
775
+		if ($filter_name == '') {
776
+			$filter_name = $this->filter_name;
777
+		}
642 778
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
643 779
 			$Spotter = new Spotter($this->db);
644 780
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -647,8 +783,11 @@  discard block
 block discarded – undo
647 783
 				foreach ($airlines as $airline) {
648 784
 					$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
649 785
 				}
650
-				if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
651
-				else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
786
+				if ($limit) {
787
+					$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
788
+				} else {
789
+					$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
790
+				}
652 791
 				try {
653 792
 					$sth = $this->db->prepare($query);
654 793
 					$sth->execute(array(':filter_name' => $filter_name));
@@ -656,11 +795,16 @@  discard block
 block discarded – undo
656 795
 					echo "error : ".$e->getMessage();
657 796
 				}
658 797
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
659
-			} else $all = array();
798
+			} else {
799
+				$all = array();
800
+			}
660 801
 		} else {
661 802
 			if ($year == '' && $month == '') {
662
-				if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
663
-				else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
803
+				if ($limit) {
804
+					$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
805
+				} else {
806
+					$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
807
+				}
664 808
 				try {
665 809
 					$sth = $this->db->prepare($query);
666 810
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -668,7 +812,9 @@  discard block
 block discarded – undo
668 812
 					echo "error : ".$e->getMessage();
669 813
 				}
670 814
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
671
-			} else $all = array();
815
+			} else {
816
+				$all = array();
817
+			}
672 818
 		}
673 819
 		if (empty($all)) {
674 820
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -693,7 +839,9 @@  discard block
 block discarded – undo
693 839
 				$icao = $value['airport_departure_icao'];
694 840
 				if (isset($all[$icao])) {
695 841
 					$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
696
-				} else $all[$icao] = $value;
842
+				} else {
843
+					$all[$icao] = $value;
844
+				}
697 845
 			}
698 846
 			$count = array();
699 847
 			foreach ($all as $key => $row) {
@@ -705,7 +853,9 @@  discard block
 block discarded – undo
705 853
 	}
706 854
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
707 855
 		global $globalStatsFilters;
708
-		if ($filter_name == '') $filter_name = $this->filter_name;
856
+		if ($filter_name == '') {
857
+			$filter_name = $this->filter_name;
858
+		}
709 859
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
710 860
 			$Spotter = new Spotter($this->db);
711 861
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -714,8 +864,11 @@  discard block
 block discarded – undo
714 864
 				foreach ($airlines as $airline) {
715 865
 					$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
716 866
 				}
717
-				if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
718
-				else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
867
+				if ($limit) {
868
+					$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
869
+				} else {
870
+					$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
871
+				}
719 872
 				try {
720 873
 					$sth = $this->db->prepare($query);
721 874
 					$sth->execute(array(':filter_name' => $filter_name));
@@ -723,11 +876,16 @@  discard block
 block discarded – undo
723 876
 					echo "error : ".$e->getMessage();
724 877
 				}
725 878
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
726
-			} else $all = array();
879
+			} else {
880
+				$all = array();
881
+			}
727 882
 		} else {
728 883
 			if ($year == '' && $month == '') {
729
-				if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
730
-				else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
884
+				if ($limit) {
885
+					$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
886
+				} else {
887
+					$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
888
+				}
731 889
 				try {
732 890
 					$sth = $this->db->prepare($query);
733 891
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -735,7 +893,9 @@  discard block
 block discarded – undo
735 893
 					echo "error : ".$e->getMessage();
736 894
 				}
737 895
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
738
-			} else $all = array();
896
+			} else {
897
+				$all = array();
898
+			}
739 899
 		}
740 900
 		if (empty($all)) {
741 901
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -760,7 +920,9 @@  discard block
 block discarded – undo
760 920
 				$icao = $value['airport_arrival_icao'];
761 921
 				if (isset($all[$icao])) {
762 922
 					$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
763
-				} else $all[$icao] = $value;
923
+				} else {
924
+					$all[$icao] = $value;
925
+				}
764 926
 			}
765 927
 			$count = array();
766 928
 			foreach ($all as $key => $row) {
@@ -772,7 +934,9 @@  discard block
 block discarded – undo
772 934
 	}
773 935
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
774 936
 		global $globalDBdriver, $globalStatsFilters;
775
-		if ($filter_name == '') $filter_name = $this->filter_name;
937
+		if ($filter_name == '') {
938
+			$filter_name = $this->filter_name;
939
+		}
776 940
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
777 941
 			$Spotter = new Spotter($this->db);
778 942
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -781,20 +945,32 @@  discard block
 block discarded – undo
781 945
 				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
782 946
 			}
783 947
 			if ($globalDBdriver == 'mysql') {
784
-				if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
785
-				else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
948
+				if ($limit) {
949
+					$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
950
+				} else {
951
+					$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
952
+				}
786 953
 			} else {
787
-				if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
788
-				else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
954
+				if ($limit) {
955
+					$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
956
+				} else {
957
+					$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
958
+				}
789 959
 			}
790 960
 			$query_data = array(':filter_name' => $filter_name);
791 961
 		} else {
792 962
 			if ($globalDBdriver == 'mysql') {
793
-				if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
794
-				else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
963
+				if ($limit) {
964
+					$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
965
+				} else {
966
+					$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
967
+				}
795 968
 			} else {
796
-				if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
797
-				else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
969
+				if ($limit) {
970
+					$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
971
+				} else {
972
+					$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
973
+				}
798 974
 			}
799 975
 			$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
800 976
 		}
@@ -822,7 +998,9 @@  discard block
 block discarded – undo
822 998
 	
823 999
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
824 1000
 		global $globalStatsFilters;
825
-		if ($filter_name == '') $filter_name = $this->filter_name;
1001
+		if ($filter_name == '') {
1002
+			$filter_name = $this->filter_name;
1003
+		}
826 1004
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
827 1005
 			$Spotter = new Spotter($this->db);
828 1006
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -859,7 +1037,9 @@  discard block
 block discarded – undo
859 1037
 	}
860 1038
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
861 1039
 		global $globalDBdriver, $globalStatsFilters;
862
-		if ($filter_name == '') $filter_name = $this->filter_name;
1040
+		if ($filter_name == '') {
1041
+			$filter_name = $this->filter_name;
1042
+		}
863 1043
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
864 1044
 			$Spotter = new Spotter($this->db);
865 1045
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -904,7 +1084,9 @@  discard block
 block discarded – undo
904 1084
 	}
905 1085
 	public function countAllDates($stats_airline = '',$filter_name = '') {
906 1086
 		global $globalStatsFilters;
907
-		if ($filter_name == '') $filter_name = $this->filter_name;
1087
+		if ($filter_name == '') {
1088
+			$filter_name = $this->filter_name;
1089
+		}
908 1090
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
909 1091
 			$Spotter = new Spotter($this->db);
910 1092
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -941,7 +1123,9 @@  discard block
 block discarded – undo
941 1123
 	}
942 1124
 	public function countAllDatesByAirlines($filter_name = '') {
943 1125
 		global $globalStatsFilters;
944
-		if ($filter_name == '') $filter_name = $this->filter_name;
1126
+		if ($filter_name == '') {
1127
+			$filter_name = $this->filter_name;
1128
+		}
945 1129
 		$query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name";
946 1130
 		$query_data = array('filter_name' => $filter_name);
947 1131
 		try {
@@ -963,7 +1147,9 @@  discard block
 block discarded – undo
963 1147
 	}
964 1148
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
965 1149
 		global $globalStatsFilters, $globalDBdriver;
966
-		if ($filter_name == '') $filter_name = $this->filter_name;
1150
+		if ($filter_name == '') {
1151
+			$filter_name = $this->filter_name;
1152
+		}
967 1153
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
968 1154
 			$Spotter = new Spotter($this->db);
969 1155
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -1048,7 +1234,9 @@  discard block
 block discarded – undo
1048 1234
 	}
1049 1235
 	public function countAllMilitaryMonths($filter_name = '') {
1050 1236
 		global $globalStatsFilters;
1051
-		if ($filter_name == '') $filter_name = $this->filter_name;
1237
+		if ($filter_name == '') {
1238
+			$filter_name = $this->filter_name;
1239
+		}
1052 1240
 		$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
1053 1241
 		try {
1054 1242
 			$sth = $this->db->prepare($query);
@@ -1069,7 +1257,9 @@  discard block
 block discarded – undo
1069 1257
 	}
1070 1258
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
1071 1259
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
1072
-		if ($filter_name == '') $filter_name = $this->filter_name;
1260
+		if ($filter_name == '') {
1261
+			$filter_name = $this->filter_name;
1262
+		}
1073 1263
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
1074 1264
 			$Spotter = new Spotter($this->db);
1075 1265
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -1077,12 +1267,18 @@  discard block
 block discarded – undo
1077 1267
 			foreach ($airlines as $airline) {
1078 1268
 				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1079 1269
 			}
1080
-			if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
1081
-			else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
1270
+			if ($limit) {
1271
+				$query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
1272
+			} else {
1273
+				$query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
1274
+			}
1082 1275
 			$query_data = array(':filter_name' => $filter_name);
1083 1276
 		} else {
1084
-			if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
1085
-			else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
1277
+			if ($limit) {
1278
+				$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
1279
+			} else {
1280
+				$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
1281
+			}
1086 1282
 			$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1087 1283
 		}
1088 1284
 		if ($orderby == 'hour') {
@@ -1092,7 +1288,9 @@  discard block
 block discarded – undo
1092 1288
 				$query .= " ORDER BY CAST(flight_date AS integer) ASC";
1093 1289
 			}
1094 1290
 		}
1095
-		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
1291
+		if ($orderby == 'count') {
1292
+			$query .= " ORDER BY hour_count DESC";
1293
+		}
1096 1294
 		try {
1097 1295
 			$sth = $this->db->prepare($query);
1098 1296
 			$sth->execute($query_data);
@@ -1116,8 +1314,12 @@  discard block
 block discarded – undo
1116 1314
 	}
1117 1315
 	public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') {
1118 1316
 		global $globalStatsFilters;
1119
-		if ($filter_name == '') $filter_name = $this->filter_name;
1120
-		if ($year == '') $year = date('Y');
1317
+		if ($filter_name == '') {
1318
+			$filter_name = $this->filter_name;
1319
+		}
1320
+		if ($year == '') {
1321
+			$year = date('Y');
1322
+		}
1121 1323
 		$all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month);
1122 1324
 		if (empty($all)) {
1123 1325
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -1136,8 +1338,12 @@  discard block
 block discarded – undo
1136 1338
 	}
1137 1339
 	public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') {
1138 1340
 		global $globalStatsFilters;
1139
-		if ($filter_name == '') $filter_name = $this->filter_name;
1140
-		if ($year == '') $year = date('Y');
1341
+		if ($filter_name == '') {
1342
+			$filter_name = $this->filter_name;
1343
+		}
1344
+		if ($year == '') {
1345
+			$year = date('Y');
1346
+		}
1141 1347
 		$all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month);
1142 1348
 		if (empty($all)) {
1143 1349
 			$filters = array();
@@ -1153,8 +1359,12 @@  discard block
 block discarded – undo
1153 1359
 	}
1154 1360
 	public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') {
1155 1361
 		global $globalStatsFilters;
1156
-		if ($filter_name == '') $filter_name = $this->filter_name;
1157
-		if ($year == '') $year = date('Y');
1362
+		if ($filter_name == '') {
1363
+			$filter_name = $this->filter_name;
1364
+		}
1365
+		if ($year == '') {
1366
+			$year = date('Y');
1367
+		}
1158 1368
 		$all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month);
1159 1369
 		if (empty($all)) {
1160 1370
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -1173,7 +1383,9 @@  discard block
 block discarded – undo
1173 1383
 	}
1174 1384
 	public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') {
1175 1385
 		global $globalStatsFilters;
1176
-		if ($filter_name == '') $filter_name = $this->filter_name;
1386
+		if ($filter_name == '') {
1387
+			$filter_name = $this->filter_name;
1388
+		}
1177 1389
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
1178 1390
 			$Spotter = new Spotter($this->db);
1179 1391
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -1191,7 +1403,9 @@  discard block
 block discarded – undo
1191 1403
 				}
1192 1404
 				$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1193 1405
 				$all = $result[0]['nb'];
1194
-			} else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month);
1406
+			} else {
1407
+				$all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month);
1408
+			}
1195 1409
 		} else {
1196 1410
 			if ($year == '' && $month == '') {
1197 1411
 				$query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -1203,7 +1417,9 @@  discard block
 block discarded – undo
1203 1417
 				}
1204 1418
 				$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1205 1419
 				$all = $result[0]['nb'];
1206
-			} else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month);
1420
+			} else {
1421
+				$all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month);
1422
+			}
1207 1423
 		}
1208 1424
 		if (empty($all)) {
1209 1425
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -1222,7 +1438,9 @@  discard block
 block discarded – undo
1222 1438
 	}
1223 1439
 	public function countOverallAirlines($filter_name = '',$year = '',$month = '') {
1224 1440
 		global $globalStatsFilters;
1225
-		if ($filter_name == '') $filter_name = $this->filter_name;
1441
+		if ($filter_name == '') {
1442
+			$filter_name = $this->filter_name;
1443
+		}
1226 1444
 		if ($year == '' && $month == '') {
1227 1445
 			$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
1228 1446
 			try {
@@ -1233,7 +1451,9 @@  discard block
 block discarded – undo
1233 1451
 			}
1234 1452
 			$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1235 1453
 			$all = $result[0]['nb_airline'];
1236
-		} else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month);
1454
+		} else {
1455
+			$all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month);
1456
+		}
1237 1457
 		if (empty($all)) {
1238 1458
 			$filters = array();
1239 1459
 			$filters = array('year' => $year,'month' => $month);
@@ -1248,7 +1468,9 @@  discard block
 block discarded – undo
1248 1468
 	}
1249 1469
 	public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') {
1250 1470
 		global $globalStatsFilters;
1251
-		if ($filter_name == '') $filter_name = $this->filter_name;
1471
+		if ($filter_name == '') {
1472
+			$filter_name = $this->filter_name;
1473
+		}
1252 1474
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
1253 1475
 			$Spotter = new Spotter($this->db);
1254 1476
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -1303,7 +1525,9 @@  discard block
 block discarded – undo
1303 1525
 	}
1304 1526
 	public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') {
1305 1527
 		global $globalStatsFilters;
1306
-		if ($filter_name == '') $filter_name = $this->filter_name;
1528
+		if ($filter_name == '') {
1529
+			$filter_name = $this->filter_name;
1530
+		}
1307 1531
 		//if ($year == '') $year = date('Y');
1308 1532
 		if ($year == '' && $month == '') {
1309 1533
 			$query = "SELECT count(*) as nb FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -1332,7 +1556,9 @@  discard block
 block discarded – undo
1332 1556
 	}
1333 1557
 
1334 1558
 	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
1335
-		if ($filter_name == '') $filter_name = $this->filter_name;
1559
+		if ($filter_name == '') {
1560
+			$filter_name = $this->filter_name;
1561
+		}
1336 1562
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
1337 1563
 			$Spotter = new Spotter($this->db);
1338 1564
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -1356,7 +1582,9 @@  discard block
 block discarded – undo
1356 1582
 		return $all;
1357 1583
 	}
1358 1584
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
1359
-		if ($filter_name == '') $filter_name = $this->filter_name;
1585
+		if ($filter_name == '') {
1586
+			$filter_name = $this->filter_name;
1587
+		}
1360 1588
 		$query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
1361 1589
 		$query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1362 1590
 		try {
@@ -1369,7 +1597,9 @@  discard block
 block discarded – undo
1369 1597
 		return $all;
1370 1598
 	}
1371 1599
 	public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') {
1372
-		if ($filter_name == '') $filter_name = $this->filter_name;
1600
+		if ($filter_name == '') {
1601
+			$filter_name = $this->filter_name;
1602
+		}
1373 1603
 		$query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name";
1374 1604
 		$query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1375 1605
 		try {
@@ -1380,7 +1610,9 @@  discard block
 block discarded – undo
1380 1610
 		}
1381 1611
 	}
1382 1612
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') {
1383
-		if ($filter_name == '') $filter_name = $this->filter_name;
1613
+		if ($filter_name == '') {
1614
+			$filter_name = $this->filter_name;
1615
+		}
1384 1616
 		global $globalArchiveMonths, $globalDBdriver;
1385 1617
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
1386 1618
 			$Spotter = new Spotter($this->db);
@@ -1436,7 +1668,9 @@  discard block
 block discarded – undo
1436 1668
 	}
1437 1669
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
1438 1670
 		global $globalArchiveMonths, $globalDBdriver;
1439
-		if ($filter_name == '') $filter_name = $this->filter_name;
1671
+		if ($filter_name == '') {
1672
+			$filter_name = $this->filter_name;
1673
+		}
1440 1674
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
1441 1675
 			$Spotter = new Spotter($this->db);
1442 1676
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -1469,7 +1703,9 @@  discard block
 block discarded – undo
1469 1703
 	}
1470 1704
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
1471 1705
 		global $globalArchiveMonths, $globalDBdriver;
1472
-		if ($filter_name == '') $filter_name = $this->filter_name;
1706
+		if ($filter_name == '') {
1707
+			$filter_name = $this->filter_name;
1708
+		}
1473 1709
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
1474 1710
 			$Spotter = new Spotter($this->db);
1475 1711
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -1500,7 +1736,9 @@  discard block
 block discarded – undo
1500 1736
 	}
1501 1737
 	public function getStatsAirlineTotal($filter_name = '') {
1502 1738
 		global $globalArchiveMonths, $globalDBdriver;
1503
-		if ($filter_name == '') $filter_name = $this->filter_name;
1739
+		if ($filter_name == '') {
1740
+			$filter_name = $this->filter_name;
1741
+		}
1504 1742
 		if ($globalDBdriver == 'mysql') {
1505 1743
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
1506 1744
 		} else {
@@ -1517,7 +1755,9 @@  discard block
 block discarded – undo
1517 1755
 	}
1518 1756
 	public function getStatsOwnerTotal($filter_name = '') {
1519 1757
 		global $globalArchiveMonths, $globalDBdriver;
1520
-		if ($filter_name == '') $filter_name = $this->filter_name;
1758
+		if ($filter_name == '') {
1759
+			$filter_name = $this->filter_name;
1760
+		}
1521 1761
 		if ($globalDBdriver == 'mysql') {
1522 1762
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
1523 1763
 		} else {
@@ -1534,7 +1774,9 @@  discard block
 block discarded – undo
1534 1774
 	}
1535 1775
 	public function getStatsOwner($owner_name,$filter_name = '') {
1536 1776
 		global $globalArchiveMonths, $globalDBdriver;
1537
-		if ($filter_name == '') $filter_name = $this->filter_name;
1777
+		if ($filter_name == '') {
1778
+			$filter_name = $this->filter_name;
1779
+		}
1538 1780
 		$query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name";
1539 1781
 		try {
1540 1782
 			$sth = $this->db->prepare($query);
@@ -1543,12 +1785,17 @@  discard block
 block discarded – undo
1543 1785
 			echo "error : ".$e->getMessage();
1544 1786
 		}
1545 1787
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1546
-		if (isset($all[0]['cnt'])) return $all[0]['cnt'];
1547
-		else return 0;
1788
+		if (isset($all[0]['cnt'])) {
1789
+			return $all[0]['cnt'];
1790
+		} else {
1791
+			return 0;
1792
+		}
1548 1793
 	}
1549 1794
 	public function getStatsPilotTotal($filter_name = '') {
1550 1795
 		global $globalArchiveMonths, $globalDBdriver;
1551
-		if ($filter_name == '') $filter_name = $this->filter_name;
1796
+		if ($filter_name == '') {
1797
+			$filter_name = $this->filter_name;
1798
+		}
1552 1799
 		if ($globalDBdriver == 'mysql') {
1553 1800
 			$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
1554 1801
 		} else {
@@ -1565,7 +1812,9 @@  discard block
 block discarded – undo
1565 1812
 	}
1566 1813
 	public function getStatsPilot($pilot,$filter_name = '') {
1567 1814
 		global $globalArchiveMonths, $globalDBdriver;
1568
-		if ($filter_name == '') $filter_name = $this->filter_name;
1815
+		if ($filter_name == '') {
1816
+			$filter_name = $this->filter_name;
1817
+		}
1569 1818
 		$query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)";
1570 1819
 		try {
1571 1820
 			$sth = $this->db->prepare($query);
@@ -1574,13 +1823,18 @@  discard block
 block discarded – undo
1574 1823
 			echo "error : ".$e->getMessage();
1575 1824
 		}
1576 1825
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1577
-		if (isset($all[0]['cnt'])) return $all[0]['cnt'];
1578
-		else return 0;
1826
+		if (isset($all[0]['cnt'])) {
1827
+			return $all[0]['cnt'];
1828
+		} else {
1829
+			return 0;
1830
+		}
1579 1831
 	}
1580 1832
 
1581 1833
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
1582 1834
 		global $globalDBdriver;
1583
-		if ($filter_name == '') $filter_name = $this->filter_name;
1835
+		if ($filter_name == '') {
1836
+			$filter_name = $this->filter_name;
1837
+		}
1584 1838
 		if ($globalDBdriver == 'mysql') {
1585 1839
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt";
1586 1840
 		} else {
@@ -1596,7 +1850,9 @@  discard block
 block discarded – undo
1596 1850
 	}
1597 1851
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
1598 1852
 		global $globalDBdriver;
1599
-		if ($filter_name == '') $filter_name = $this->filter_name;
1853
+		if ($filter_name == '') {
1854
+			$filter_name = $this->filter_name;
1855
+		}
1600 1856
 		if ($globalDBdriver == 'mysql') {
1601 1857
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
1602 1858
 		} else {
@@ -1982,10 +2238,14 @@  discard block
 block discarded – undo
1982 2238
 		$Connection = new Connection();
1983 2239
 		date_default_timezone_set('UTC');
1984 2240
 		$last_update = $this->getLastStatsUpdate('last_update_stats');
1985
-			if ($globalDebug) echo 'Update stats !'."\n";
2241
+			if ($globalDebug) {
2242
+				echo 'Update stats !'."\n";
2243
+			}
1986 2244
 			if (isset($last_update[0]['value'])) {
1987 2245
 				$last_update_day = $last_update[0]['value'];
1988
-			} else $last_update_day = '2012-12-12 12:12:12';
2246
+			} else {
2247
+				$last_update_day = '2012-12-12 12:12:12';
2248
+			}
1989 2249
 			$reset = false;
1990 2250
 			//if ($globalStatsResetYear && date('Y',strtotime($last_update_day)) != date('Y')) {
1991 2251
 			if ($globalStatsResetYear) {
@@ -1994,43 +2254,63 @@  discard block
 block discarded – undo
1994 2254
 			}
1995 2255
 			$Spotter = new Spotter($this->db);
1996 2256
 
1997
-			if ($globalDebug) echo 'Count all aircraft types...'."\n";
2257
+			if ($globalDebug) {
2258
+				echo 'Count all aircraft types...'."\n";
2259
+			}
1998 2260
 			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1999 2261
 			foreach ($alldata as $number) {
2000 2262
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset);
2001 2263
 			}
2002
-			if ($globalDebug) echo 'Count all airlines...'."\n";
2264
+			if ($globalDebug) {
2265
+				echo 'Count all airlines...'."\n";
2266
+			}
2003 2267
 			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
2004 2268
 			foreach ($alldata as $number) {
2005 2269
 				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset);
2006 2270
 			}
2007
-			if ($globalDebug) echo 'Count all registrations...'."\n";
2271
+			if ($globalDebug) {
2272
+				echo 'Count all registrations...'."\n";
2273
+			}
2008 2274
 			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
2009 2275
 			foreach ($alldata as $number) {
2010 2276
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset);
2011 2277
 			}
2012
-			if ($globalDebug) echo 'Count all callsigns...'."\n";
2278
+			if ($globalDebug) {
2279
+				echo 'Count all callsigns...'."\n";
2280
+			}
2013 2281
 			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
2014 2282
 			foreach ($alldata as $number) {
2015 2283
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset);
2016 2284
 			}
2017
-			if ($globalDebug) echo 'Count all owners...'."\n";
2285
+			if ($globalDebug) {
2286
+				echo 'Count all owners...'."\n";
2287
+			}
2018 2288
 			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
2019 2289
 			foreach ($alldata as $number) {
2020 2290
 				$this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset);
2021 2291
 			}
2022
-			if ($globalDebug) echo 'Count all pilots...'."\n";
2292
+			if ($globalDebug) {
2293
+				echo 'Count all pilots...'."\n";
2294
+			}
2023 2295
 			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
2024 2296
 			foreach ($alldata as $number) {
2025
-				if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') $number['pilot_id'] = $number['pilot_name'];
2297
+				if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') {
2298
+					$number['pilot_id'] = $number['pilot_name'];
2299
+				}
2026 2300
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset);
2027 2301
 			}
2028 2302
 			
2029
-			if ($globalDebug) echo 'Count all departure airports...'."\n";
2303
+			if ($globalDebug) {
2304
+				echo 'Count all departure airports...'."\n";
2305
+			}
2030 2306
 			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
2031
-			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
2307
+			if ($globalDebug) {
2308
+				echo 'Count all detected departure airports...'."\n";
2309
+			}
2032 2310
 			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
2033
-			if ($globalDebug) echo 'Order departure airports...'."\n";
2311
+			if ($globalDebug) {
2312
+				echo 'Order departure airports...'."\n";
2313
+			}
2034 2314
 			$alldata = array();
2035 2315
 			foreach ($pall as $value) {
2036 2316
 				$icao = $value['airport_departure_icao'];
@@ -2040,7 +2320,9 @@  discard block
 block discarded – undo
2040 2320
 				$icao = $value['airport_departure_icao'];
2041 2321
 				if (isset($alldata[$icao])) {
2042 2322
 					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
2043
-				} else $alldata[$icao] = $value;
2323
+				} else {
2324
+					$alldata[$icao] = $value;
2325
+				}
2044 2326
 			}
2045 2327
 			$count = array();
2046 2328
 			foreach ($alldata as $key => $row) {
@@ -2050,11 +2332,17 @@  discard block
 block discarded – undo
2050 2332
 			foreach ($alldata as $number) {
2051 2333
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset);
2052 2334
 			}
2053
-			if ($globalDebug) echo 'Count all arrival airports...'."\n";
2335
+			if ($globalDebug) {
2336
+				echo 'Count all arrival airports...'."\n";
2337
+			}
2054 2338
 			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
2055
-			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
2339
+			if ($globalDebug) {
2340
+				echo 'Count all detected arrival airports...'."\n";
2341
+			}
2056 2342
 			$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
2057
-			if ($globalDebug) echo 'Order arrival airports...'."\n";
2343
+			if ($globalDebug) {
2344
+				echo 'Order arrival airports...'."\n";
2345
+			}
2058 2346
 			$alldata = array();
2059 2347
 			foreach ($pall as $value) {
2060 2348
 				$icao = $value['airport_arrival_icao'];
@@ -2064,7 +2352,9 @@  discard block
 block discarded – undo
2064 2352
 				$icao = $value['airport_arrival_icao'];
2065 2353
 				if (isset($alldata[$icao])) {
2066 2354
 					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
2067
-				} else $alldata[$icao] = $value;
2355
+				} else {
2356
+					$alldata[$icao] = $value;
2357
+				}
2068 2358
 			}
2069 2359
 			$count = array();
2070 2360
 			foreach ($alldata as $key => $row) {
@@ -2075,7 +2365,9 @@  discard block
 block discarded – undo
2075 2365
 				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset);
2076 2366
 			}
2077 2367
 			if ($Connection->tableExists('countries')) {
2078
-				if ($globalDebug) echo 'Count all flights by countries...'."\n";
2368
+				if ($globalDebug) {
2369
+					echo 'Count all flights by countries...'."\n";
2370
+				}
2079 2371
 				//$SpotterArchive = new SpotterArchive();
2080 2372
 				//$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
2081 2373
 				$Spotter = new Spotter($this->db);
@@ -2086,7 +2378,9 @@  discard block
 block discarded – undo
2086 2378
 			}
2087 2379
 			
2088 2380
 			if (isset($globalAccidents) && $globalAccidents) {
2089
-				if ($globalDebug) echo 'Count fatalities stats...'."\n";
2381
+				if ($globalDebug) {
2382
+					echo 'Count fatalities stats...'."\n";
2383
+				}
2090 2384
 				$Accident = new Accident();
2091 2385
 				$this->deleteStatsByType('fatalities_byyear');
2092 2386
 				$alldata = $Accident->countFatalitiesByYear();
@@ -2102,48 +2396,68 @@  discard block
 block discarded – undo
2102 2396
 
2103 2397
 			// Add by month using getstat if month finish...
2104 2398
 			//if (date('m',strtotime($last_update_day)) != date('m')) {
2105
-			if ($globalDebug) echo 'Count all flights by months...'."\n";
2399
+			if ($globalDebug) {
2400
+				echo 'Count all flights by months...'."\n";
2401
+			}
2106 2402
 			$last_month = date('Y-m-01 00:00:00', strtotime('-1 month', strtotime($last_update_day)));
2107 2403
 			$filter_last_month = array('since_date' => $last_month);
2108 2404
 			$Spotter = new Spotter($this->db);
2109 2405
 			$alldata = $Spotter->countAllMonths($filter_last_month);
2110 2406
 			$lastyear = false;
2111 2407
 			foreach ($alldata as $number) {
2112
-				if ($number['year_name'] != date('Y')) $lastyear = true;
2408
+				if ($number['year_name'] != date('Y')) {
2409
+					$lastyear = true;
2410
+				}
2113 2411
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2114 2412
 			}
2115
-			if ($globalDebug) echo 'Count all military flights by months...'."\n";
2413
+			if ($globalDebug) {
2414
+				echo 'Count all military flights by months...'."\n";
2415
+			}
2116 2416
 			$alldata = $Spotter->countAllMilitaryMonths($filter_last_month);
2117 2417
 			foreach ($alldata as $number) {
2118 2418
 				$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2119 2419
 			}
2120
-			if ($globalDebug) echo 'Count all owners by months...'."\n";
2420
+			if ($globalDebug) {
2421
+				echo 'Count all owners by months...'."\n";
2422
+			}
2121 2423
 			$alldata = $Spotter->countAllMonthsOwners($filter_last_month);
2122 2424
 			foreach ($alldata as $number) {
2123 2425
 				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2124 2426
 			}
2125
-			if ($globalDebug) echo 'Count all pilots by months...'."\n";
2427
+			if ($globalDebug) {
2428
+				echo 'Count all pilots by months...'."\n";
2429
+			}
2126 2430
 			$alldata = $Spotter->countAllMonthsPilots($filter_last_month);
2127 2431
 			foreach ($alldata as $number) {
2128 2432
 				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2129 2433
 			}
2130
-			if ($globalDebug) echo 'Count all airlines by months...'."\n";
2434
+			if ($globalDebug) {
2435
+				echo 'Count all airlines by months...'."\n";
2436
+			}
2131 2437
 			$alldata = $Spotter->countAllMonthsAirlines($filter_last_month);
2132 2438
 			foreach ($alldata as $number) {
2133 2439
 				$this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2134 2440
 			}
2135
-			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
2441
+			if ($globalDebug) {
2442
+				echo 'Count all aircrafts by months...'."\n";
2443
+			}
2136 2444
 			$alldata = $Spotter->countAllMonthsAircrafts($filter_last_month);
2137 2445
 			foreach ($alldata as $number) {
2138 2446
 				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2139 2447
 			}
2140
-			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
2448
+			if ($globalDebug) {
2449
+				echo 'Count all real arrivals by months...'."\n";
2450
+			}
2141 2451
 			$alldata = $Spotter->countAllMonthsRealArrivals($filter_last_month);
2142 2452
 			foreach ($alldata as $number) {
2143 2453
 				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2144 2454
 			}
2145
-			if ($globalDebug) echo 'Airports data...'."\n";
2146
-			if ($globalDebug) echo '...Departure'."\n";
2455
+			if ($globalDebug) {
2456
+				echo 'Airports data...'."\n";
2457
+			}
2458
+			if ($globalDebug) {
2459
+				echo '...Departure'."\n";
2460
+			}
2147 2461
 			$this->deleteStatAirport('daily');
2148 2462
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
2149 2463
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
@@ -2261,7 +2575,9 @@  discard block
 block discarded – undo
2261 2575
 			// Count by airlines
2262 2576
 			echo '--- Stats by airlines ---'."\n";
2263 2577
 			if ($Connection->tableExists('countries')) {
2264
-				if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n";
2578
+				if ($globalDebug) {
2579
+					echo 'Count all flights by countries by airlines...'."\n";
2580
+				}
2265 2581
 				$SpotterArchive = new SpotterArchive();
2266 2582
 				//$Spotter = new Spotter($this->db);
2267 2583
 				$alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day);
@@ -2270,37 +2586,53 @@  discard block
 block discarded – undo
2270 2586
 					$this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset);
2271 2587
 				}
2272 2588
 			}
2273
-			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
2589
+			if ($globalDebug) {
2590
+				echo 'Count all aircraft types by airlines...'."\n";
2591
+			}
2274 2592
 			$Spotter = new Spotter($this->db);
2275 2593
 			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
2276 2594
 			foreach ($alldata as $number) {
2277 2595
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset);
2278 2596
 			}
2279
-			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
2597
+			if ($globalDebug) {
2598
+				echo 'Count all aircraft registrations by airlines...'."\n";
2599
+			}
2280 2600
 			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
2281 2601
 			foreach ($alldata as $number) {
2282 2602
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset);
2283 2603
 			}
2284
-			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
2604
+			if ($globalDebug) {
2605
+				echo 'Count all callsigns by airlines...'."\n";
2606
+			}
2285 2607
 			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
2286 2608
 			foreach ($alldata as $number) {
2287 2609
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset);
2288 2610
 			}
2289
-			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
2611
+			if ($globalDebug) {
2612
+				echo 'Count all owners by airlines...'."\n";
2613
+			}
2290 2614
 			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
2291 2615
 			foreach ($alldata as $number) {
2292 2616
 				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset);
2293 2617
 			}
2294
-			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
2618
+			if ($globalDebug) {
2619
+				echo 'Count all pilots by airlines...'."\n";
2620
+			}
2295 2621
 			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
2296 2622
 			foreach ($alldata as $number) {
2297 2623
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset);
2298 2624
 			}
2299
-			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
2625
+			if ($globalDebug) {
2626
+				echo 'Count all departure airports by airlines...'."\n";
2627
+			}
2300 2628
 			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
2301
-			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
2629
+			if ($globalDebug) {
2630
+				echo 'Count all detected departure airports by airlines...'."\n";
2631
+			}
2302 2632
 			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
2303
-			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
2633
+			if ($globalDebug) {
2634
+				echo 'Order detected departure airports by airlines...'."\n";
2635
+			}
2304 2636
 			//$alldata = array();
2305 2637
 			foreach ($dall as $value) {
2306 2638
 				$icao = $value['airport_departure_icao'];
@@ -2321,11 +2653,17 @@  discard block
 block discarded – undo
2321 2653
 			foreach ($alldata as $number) {
2322 2654
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset);
2323 2655
 			}
2324
-			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
2656
+			if ($globalDebug) {
2657
+				echo 'Count all arrival airports by airlines...'."\n";
2658
+			}
2325 2659
 			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
2326
-			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
2660
+			if ($globalDebug) {
2661
+				echo 'Count all detected arrival airports by airlines...'."\n";
2662
+			}
2327 2663
 			$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
2328
-			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
2664
+			if ($globalDebug) {
2665
+				echo 'Order arrival airports by airlines...'."\n";
2666
+			}
2329 2667
 			//$alldata = array();
2330 2668
 			foreach ($dall as $value) {
2331 2669
 				$icao = $value['airport_arrival_icao'];
@@ -2344,37 +2682,53 @@  discard block
 block discarded – undo
2344 2682
 			}
2345 2683
 			$alldata = $pall;
2346 2684
 			foreach ($alldata as $number) {
2347
-				if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset);
2685
+				if ($number['airline_icao'] != '') {
2686
+					echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset);
2687
+				}
2688
+			}
2689
+			if ($globalDebug) {
2690
+				echo 'Count all flights by months by airlines...'."\n";
2348 2691
 			}
2349
-			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
2350 2692
 			$Spotter = new Spotter($this->db);
2351 2693
 			$alldata = $Spotter->countAllMonthsByAirlines($filter_last_month);
2352 2694
 			$lastyear = false;
2353 2695
 			foreach ($alldata as $number) {
2354
-				if ($number['year_name'] != date('Y')) $lastyear = true;
2696
+				if ($number['year_name'] != date('Y')) {
2697
+					$lastyear = true;
2698
+				}
2355 2699
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2356 2700
 			}
2357
-			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
2701
+			if ($globalDebug) {
2702
+				echo 'Count all owners by months by airlines...'."\n";
2703
+			}
2358 2704
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines($filter_last_month);
2359 2705
 			foreach ($alldata as $number) {
2360 2706
 				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2361 2707
 			}
2362
-			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
2708
+			if ($globalDebug) {
2709
+				echo 'Count all pilots by months by airlines...'."\n";
2710
+			}
2363 2711
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines($filter_last_month);
2364 2712
 			foreach ($alldata as $number) {
2365 2713
 				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2366 2714
 			}
2367
-			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
2715
+			if ($globalDebug) {
2716
+				echo 'Count all aircrafts by months by airlines...'."\n";
2717
+			}
2368 2718
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines($filter_last_month);
2369 2719
 			foreach ($alldata as $number) {
2370 2720
 				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2371 2721
 			}
2372
-			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
2722
+			if ($globalDebug) {
2723
+				echo 'Count all real arrivals by months by airlines...'."\n";
2724
+			}
2373 2725
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines($filter_last_month);
2374 2726
 			foreach ($alldata as $number) {
2375 2727
 				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2376 2728
 			}
2377
-			if ($globalDebug) echo '...Departure'."\n";
2729
+			if ($globalDebug) {
2730
+				echo '...Departure'."\n";
2731
+			}
2378 2732
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
2379 2733
 			$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
2380 2734
 			foreach ($dall as $value) {
@@ -2397,7 +2751,9 @@  discard block
 block discarded – undo
2397 2751
 			foreach ($alldata as $number) {
2398 2752
 				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']);
2399 2753
 			}
2400
-			if ($globalDebug) echo '...Arrival'."\n";
2754
+			if ($globalDebug) {
2755
+				echo '...Arrival'."\n";
2756
+			}
2401 2757
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
2402 2758
 			$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
2403 2759
 			foreach ($dall as $value) {
@@ -2421,13 +2777,19 @@  discard block
 block discarded – undo
2421 2777
 				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']);
2422 2778
 			}
2423 2779
 
2424
-			if ($globalDebug) echo 'Flights data...'."\n";
2425
-			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
2780
+			if ($globalDebug) {
2781
+				echo 'Flights data...'."\n";
2782
+			}
2783
+			if ($globalDebug) {
2784
+				echo '-> countAllDatesLastMonth...'."\n";
2785
+			}
2426 2786
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines($filter_last_month);
2427 2787
 			foreach ($alldata as $number) {
2428 2788
 				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
2429 2789
 			}
2430
-			if ($globalDebug) echo '-> countAllDates...'."\n";
2790
+			if ($globalDebug) {
2791
+				echo '-> countAllDates...'."\n";
2792
+			}
2431 2793
 			//$previousdata = $this->countAllDatesByAirlines();
2432 2794
 			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines($filter_last_month));
2433 2795
 			$values = array();
@@ -2440,21 +2802,27 @@  discard block
 block discarded – undo
2440 2802
 				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
2441 2803
 			}
2442 2804
 			
2443
-			if ($globalDebug) echo '-> countAllHours...'."\n";
2805
+			if ($globalDebug) {
2806
+				echo '-> countAllHours...'."\n";
2807
+			}
2444 2808
 			$alldata = $Spotter->countAllHoursByAirlines('hour',$filter_last_month);
2445 2809
 			foreach ($alldata as $number) {
2446 2810
 				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
2447 2811
 			}
2448 2812
 
2449 2813
 			// Stats by filters
2450
-			if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array();
2814
+			if (!isset($globalStatsFilters) || $globalStatsFilters == '') {
2815
+				$globalStatsFilters = array();
2816
+			}
2451 2817
 			foreach ($globalStatsFilters as $name => $filter) {
2452 2818
 				//$filter_name = $filter['name'];
2453 2819
 				$filter_name = $name;
2454 2820
 				$reset = false;
2455 2821
 				$last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name);
2456 2822
 				if (isset($filter['resetall']) && isset($last_update[0]['value']) && strtotime($filter['resetall']) > strtotime($last_update[0]['value'])) {
2457
-					if ($globalDebug) echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n";
2823
+					if ($globalDebug) {
2824
+						echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n";
2825
+					}
2458 2826
 					$this->deleteOldStats($filter_name);
2459 2827
 					unset($last_update);
2460 2828
 				}
@@ -2473,7 +2841,9 @@  discard block
 block discarded – undo
2473 2841
 				
2474 2842
 
2475 2843
 				// Count by filter
2476
-				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
2844
+				if ($globalDebug) {
2845
+					echo '--- Stats for filter '.$filter_name.' ---'."\n";
2846
+				}
2477 2847
 				$Spotter = new Spotter($this->db);
2478 2848
 				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
2479 2849
 				foreach ($alldata as $number) {
@@ -2510,7 +2880,9 @@  discard block
 block discarded – undo
2510 2880
 					$icao = $value['airport_departure_icao'];
2511 2881
 					if (isset($alldata[$icao])) {
2512 2882
 						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
2513
-					} else $alldata[$icao] = $value;
2883
+					} else {
2884
+						$alldata[$icao] = $value;
2885
+					}
2514 2886
 				}
2515 2887
 				$count = array();
2516 2888
 				foreach ($alldata as $key => $row) {
@@ -2531,7 +2903,9 @@  discard block
 block discarded – undo
2531 2903
 					$icao = $value['airport_arrival_icao'];
2532 2904
 					if (isset($alldata[$icao])) {
2533 2905
 						$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
2534
-					} else $alldata[$icao] = $value;
2906
+					} else {
2907
+						$alldata[$icao] = $value;
2908
+					}
2535 2909
 				}
2536 2910
 				$count = array();
2537 2911
 				foreach ($alldata as $key => $row) {
@@ -2545,7 +2919,9 @@  discard block
 block discarded – undo
2545 2919
 				$alldata = $Spotter->countAllMonths($filter);
2546 2920
 				$lastyear = false;
2547 2921
 				foreach ($alldata as $number) {
2548
-					if ($number['year_name'] != date('Y')) $lastyear = true;
2922
+					if ($number['year_name'] != date('Y')) {
2923
+						$lastyear = true;
2924
+					}
2549 2925
 					$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
2550 2926
 				}
2551 2927
 				$alldata = $Spotter->countAllMonthsOwners($filter);
Please login to merge, or discard this patch.
airline-statistics-registration.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 	}
43 43
 	$Stats = new Stats();
44 44
 	$airline_names = $Stats->getAllAirlineNames();
45
-	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
45
+	if (empty($airline_names)) {
46
+		$airline_names = $Spotter->getAllAirlineNames();
47
+	}
46 48
 	foreach($airline_names as $airline_name)
47 49
 	{
48 50
 		if($airline == $airline_name['airline_icao'])
@@ -65,8 +67,7 @@  discard block
 block discarded – undo
65 67
 			if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif'))
66 68
 			{
67 69
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
68
-			}
69
-			elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
70
+			} elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
70 71
 			{
71 72
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
72 73
 			}
Please login to merge, or discard this patch.
airline-statistics-arrival-airport-country.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
 	}
42 42
 	$Stats = new Stats();
43 43
 	$airline_names = $Stats->getAllAirlineNames();
44
-	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
44
+	if (empty($airline_names)) {
45
+		$airline_names = $Spotter->getAllAirlineNames();
46
+	}
45 47
 	foreach($airline_names as $airline_name)
46 48
 	{
47 49
 		if($_GET['airline'] == $airline_name['airline_icao'])
@@ -64,8 +66,7 @@  discard block
 block discarded – undo
64 66
 			if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif'))
65 67
 			{
66 68
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
67
-			}
68
-			elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
69
+			} elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
69 70
 			{
70 71
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
71 72
 			}
Please login to merge, or discard this patch.
airline-detailed.php 1 patch
Braces   +16 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$limit_start = 0;
15 15
 		$limit_end = 25;
16 16
 		$absolute_difference = 25;
17
-	}  else {
17
+	} else {
18 18
 		$limit_explode = explode(",", $_GET['limit']);
19 19
 		$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
20 20
 		$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -46,7 +46,9 @@  discard block
 block discarded – undo
46 46
 		} else {
47 47
 			if (isset($spotter_array[0]['airline_name']) && isset($spotter_array[0]['airline_icao'])) {
48 48
 				$title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']);
49
-			} else $title = '';
49
+			} else {
50
+				$title = '';
51
+			}
50 52
 		}
51 53
 		require_once('header.php');
52 54
 	  
@@ -67,7 +69,9 @@  discard block
 block discarded – undo
67 69
 		}
68 70
 		$Stats = new Stats();
69 71
 		$airline_names = $Stats->getAllAirlineNames();
70
-		if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
72
+		if (empty($airline_names)) {
73
+			$airline_names = $Spotter->getAllAirlineNames();
74
+		}
71 75
 		foreach($airline_names as $airline_name)
72 76
 		{
73 77
 			if($airline == $airline_name['airline_icao'])
@@ -97,10 +101,16 @@  discard block
 block discarded – undo
97 101
 				print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['airline_name'].'</div>';
98 102
 				print '<div><span class="label">'._("Country").'</span>'.$spotter_array[0]['airline_country'].'</div>';
99 103
 				print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['airline_icao'].'</div>';
100
-				if (isset($spotter_array[0]['airline_iata'])) print '<div><span class="label">'._("IATA").'</span>'.$spotter_array[0]['airline_iata'].'</div>';
101
-				if (isset($spotter_array[0]['airline_callsign'])) print '<div><span class="label">'._("Callsign").'</span>'.$spotter_array[0]['airline_callsign'].'</div>'; 
104
+				if (isset($spotter_array[0]['airline_iata'])) {
105
+					print '<div><span class="label">'._("IATA").'</span>'.$spotter_array[0]['airline_iata'].'</div>';
106
+				}
107
+				if (isset($spotter_array[0]['airline_callsign'])) {
108
+					print '<div><span class="label">'._("Callsign").'</span>'.$spotter_array[0]['airline_callsign'].'</div>';
109
+				}
102 110
 				print '<div><span class="label">'._("Type").'</span>'.ucwords($spotter_array[0]['airline_type']).'</div>';
103
-				if (isset($spotter_array[0]['ban_eu']) && $spotter_array[0]['ban_eu'] == 1) print '<div><img src="'.$globalURL.'/images/baneu.png" alt="'._("This airline is banned in Europe").'" title="'._("This airline is banned in Europe").'" /></div>';
111
+				if (isset($spotter_array[0]['ban_eu']) && $spotter_array[0]['ban_eu'] == 1) {
112
+					print '<div><img src="'.$globalURL.'/images/baneu.png" alt="'._("This airline is banned in Europe").'" title="'._("This airline is banned in Europe").'" /></div>';
113
+				}
104 114
 				print '</div>';
105 115
 			} else {
106 116
 				print '<div class="info column">';
Please login to merge, or discard this patch.
airline.php 1 patch
Braces   +27 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,7 +31,9 @@  discard block
 block discarded – undo
31 31
 			if (@getimagesize('images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png') || @getimagesize($globalURL.'/images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png'))
32 32
 			{
33 33
 				print '<img src="'.$globalURL.'/images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png" alt="'._("Click to see alliance activity").'" title="'._("Click to see alliance activity").'" /> ';
34
-			} else print $alliance['alliance'];
34
+			} else {
35
+				print $alliance['alliance'];
36
+			}
35 37
 			print '</a>';
36 38
 			print '</div>';
37 39
 		}
@@ -40,13 +42,21 @@  discard block
 block discarded – undo
40 42
 	}
41 43
 	print '<div class="select-item"><form action="'.$globalURL.'/airline" method="post"><select name="airline_type" class="selectpicker" data-live-search="true">';
42 44
 	print '<option value="all"';
43
-	if ($airline_type == 'all') print 'selected="selected" ';
45
+	if ($airline_type == 'all') {
46
+		print 'selected="selected" ';
47
+	}
44 48
 	print '>'._("All").'</option><option value="passenger"';
45
-	if ($airline_type == 'passenger') print 'selected="selected" ';
49
+	if ($airline_type == 'passenger') {
50
+		print 'selected="selected" ';
51
+	}
46 52
 	print '>'._("Passenger").'</option><option value="cargo"';
47
-	if ($airline_type == 'cargo') print 'selected="selected" ';
53
+	if ($airline_type == 'cargo') {
54
+		print 'selected="selected" ';
55
+	}
48 56
 	print '>'._("Cargo").'</option><option value="military"';
49
-	if ($airline_type == 'military') print 'selected="selected" ';
57
+	if ($airline_type == 'military') {
58
+		print 'selected="selected" ';
59
+	}
50 60
 	print '>'._("Military").'</option></select>';
51 61
 	print '<button type="submit"><i class="fa fa-angle-double-right"></i></button></form></div>';
52 62
 
@@ -73,7 +83,9 @@  discard block
 block discarded – undo
73 83
 		$firstLetter = mb_strtoupper(mb_substr($value['airline_name'], 0, 1),'UTF-8');
74 84
 		if($previous !== $firstLetter)
75 85
 		{
76
-			if ($previous !== null) print ' | ';
86
+			if ($previous !== null) {
87
+				print ' | ';
88
+			}
77 89
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
78 90
 		}
79 91
 		$previous = $firstLetter;
@@ -86,7 +98,9 @@  discard block
 block discarded – undo
86 98
 		{
87 99
 			if($previous !== $firstLetter)
88 100
 			{
89
-				if ($previous !== null) print '</div>';
101
+				if ($previous !== null) {
102
+					print '</div>';
103
+				}
90 104
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
91 105
 			}
92 106
 			$previous = $firstLetter;
@@ -98,10 +112,14 @@  discard block
 block discarded – undo
98 112
 			} elseif (@getimagesize('images/airlines/'.$value['airline_icao'].'.png') || @getimagesize($globalURL.'/images/airlines/'.$value['airline_icao'].'.png'))
99 113
 			{
100 114
 				print '<img src="'.$globalURL.'/images/airlines/'.$value['airline_icao'].'.png" alt="'._("Click to see airline activity").'" title="'._("Click to see airline activity").'" /> ';
101
-				if (isset($value['ban_eu']) && $value['ban_eu'] == 1) print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> ';
115
+				if (isset($value['ban_eu']) && $value['ban_eu'] == 1) {
116
+					print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> ';
117
+				}
102 118
 			} else {
103 119
 				print $value['airline_name'];
104
-				if (isset($value['ban_eu']) && $value['ban_eu'] == 1) print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> ';
120
+				if (isset($value['ban_eu']) && $value['ban_eu'] == 1) {
121
+					print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> ';
122
+				}
105 123
 			}
106 124
 			print '</a>';
107 125
 			print '</div>';
Please login to merge, or discard this patch.
airline-statistics-arrival-airport.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
 	}
42 42
 	$Stats = new Stats();
43 43
 	$airline_names = $Stats->getAllAirlineNames();
44
-	if (empty($ariline_names)) $airline_names = $Spotter->getAllAirlineNames();
44
+	if (empty($ariline_names)) {
45
+		$airline_names = $Spotter->getAllAirlineNames();
46
+	}
45 47
 	foreach($airline_names as $airline_name)
46 48
 	{
47 49
 		if($_GET['airline'] == $airline_name['airline_icao'])
@@ -64,8 +66,7 @@  discard block
 block discarded – undo
64 66
 			if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif'))
65 67
 			{
66 68
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
67
-			}
68
-			elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
69
+			} elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
69 70
 			{
70 71
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
71 72
 			}
Please login to merge, or discard this patch.
airline-statistics-time.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 	}
43 43
 	$Stats = new Stats();
44 44
 	$airline_names = $Stats->getAllAirlineNames();
45
-	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
45
+	if (empty($airline_names)) {
46
+		$airline_names = $Spotter->getAllAirlineNames();
47
+	}
46 48
 	foreach($airline_names as $airline_name)
47 49
 	{
48 50
 		if($airline == $airline_name['airline_icao'])
@@ -65,8 +67,7 @@  discard block
 block discarded – undo
65 67
 			if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif'))
66 68
 			{
67 69
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
68
-			}
69
-			elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
70
+			} elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
70 71
 			{
71 72
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
72 73
 			}
Please login to merge, or discard this patch.