Completed
Push — master ( 078d82...094023 )
by Yannick
06:07
created
index.php 1 patch
Braces   +357 added lines, -95 removed lines patch added patch discarded remove patch
@@ -135,11 +135,26 @@  discard block
 block discarded – undo
135 135
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
136 136
 				<li><?php echo _("NOTAM scope:"); ?>
137 137
 					<select class="selectpicker" onchange="notamscope(this);">
138
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
139
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
140
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
141
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
142
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
138
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
139
+	print ' selected';
140
+}
141
+?>>All</option>
142
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
143
+	print ' selected';
144
+}
145
+?>>Airport/Enroute warning</option>
146
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
147
+	print ' selected';
148
+}
149
+?>>Airport warning</option>
150
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
151
+	print ' selected';
152
+}
153
+?>>Navigation warning</option>
154
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
155
+	print ' selected';
156
+}
157
+?>>Enroute warning</option>
143 158
 					</select
144 159
 				</li>
145 160
 			</ul>
@@ -167,7 +182,12 @@  discard block
 block discarded – undo
167 182
 		        <div class="form-group">
168 183
 			    <label>From (UTC):</label>
169 184
 		            <div class='input-group date' id='datetimepicker1'>
170
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
185
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
186
+	print $_POST['start_date'];
187
+} elseif (isset($_COOKIE['archive_begin'])) {
188
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
189
+}
190
+?>" required />
171 191
 		                <span class="input-group-addon">
172 192
             			    <span class="glyphicon glyphicon-calendar"></span>
173 193
 		                </span>
@@ -176,7 +196,12 @@  discard block
 block discarded – undo
176 196
 		        <div class="form-group">
177 197
 			    <label>To (UTC):</label>
178 198
 		            <div class='input-group date' id='datetimepicker2'>
179
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
199
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
200
+	print $_POST['end_date'];
201
+} elseif (isset($_COOKIE['archive_end'])) {
202
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
203
+}
204
+?>" />
180 205
             			<span class="input-group-addon">
181 206
 		                    <span class="glyphicon glyphicon-calendar"></span>
182 207
             			</span>
@@ -202,8 +227,20 @@  discard block
 block discarded – undo
202 227
 
203 228
 		    <li><?php echo _("Playback speed:"); ?>
204 229
 			<div class="range">
205
-			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
206
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
230
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
231
+	print $_POST['archivespeed'];
232
+} elseif (isset($_COOKIE['archive_speed'])) {
233
+	print $_COOKIE['archive_speed'];
234
+} else {
235
+	print '1';
236
+}
237
+?>">
238
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
239
+	print $_COOKIE['archive_speed'];
240
+} else {
241
+	print '1';
242
+}
243
+?></output>
207 244
 			</div>
208 245
 		    </li>
209 246
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -225,15 +262,27 @@  discard block
 block discarded – undo
225 262
 		    <li><?php echo _("Type of Map:"); ?>
226 263
 			<select  class="selectpicker" onchange="mapType(this);">
227 264
 			    <?php
228
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
229
-				else $MapType = $_COOKIE['MapType'];
265
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
266
+					$MapType = $globalMapProvider;
267
+				} else {
268
+					$MapType = $_COOKIE['MapType'];
269
+				}
230 270
 			    ?>
231 271
 			    <?php
232 272
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
233 273
 			    ?>
234
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
235
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
236
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
274
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
275
+	print ' selected';
276
+}
277
+?>>Bing-Aerial</option>
278
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
279
+	print ' selected';
280
+}
281
+?>>Bing-Hybrid</option>
282
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
283
+	print ' selected';
284
+}
285
+?>>Bing-Road</option>
237 286
 			    <?php
238 287
 				}
239 288
 			    ?>
@@ -243,56 +292,131 @@  discard block
 block discarded – undo
243 292
 			    <?php
244 293
 				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
245 294
 			    ?>
246
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
247
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
248
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
295
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
296
+	print ' selected';
297
+}
298
+?>>Here-Aerial</option>
299
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
300
+	print ' selected';
301
+}
302
+?>>Here-Hybrid</option>
303
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
304
+	print ' selected';
305
+}
306
+?>>Here-Road</option>
249 307
 			    <?php
250 308
 				    }
251 309
 			    ?>
252 310
 			    <?php
253 311
 				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
254 312
 			    ?>
255
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
256
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
257
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
258
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
313
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
314
+	print ' selected';
315
+}
316
+?>>Google Roadmap</option>
317
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
318
+	print ' selected';
319
+}
320
+?>>Google Satellite</option>
321
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
322
+	print ' selected';
323
+}
324
+?>>Google Hybrid</option>
325
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
326
+	print ' selected';
327
+}
328
+?>>Google Terrain</option>
259 329
 			    <?php
260 330
 				    }
261 331
 			    ?>
262 332
 			    <?php
263 333
 				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
264 334
 			    ?>
265
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
266
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
267
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
335
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
336
+	print ' selected';
337
+}
338
+?>>MapQuest-OSM</option>
339
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
340
+	print ' selected';
341
+}
342
+?>>MapQuest-Aerial</option>
343
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
344
+	print ' selected';
345
+}
346
+?>>MapQuest-Hybrid</option>
268 347
 			    <?php
269 348
 				    }
270 349
 			    ?>
271
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
350
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
351
+	print ' selected';
352
+}
353
+?>>Yandex</option>
272 354
 			    <?php
273 355
 				}
274 356
 			    ?>
275 357
 			    <?php
276 358
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
277
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
278
-					else $MapBoxId = $_COOKIE['MapTypeId'];
359
+					if (!isset($_COOKIE['MapTypeId'])) {
360
+						$MapBoxId = 'default';
361
+					} else {
362
+						$MapBoxId = $_COOKIE['MapTypeId'];
363
+					}
279 364
 			    ?>
280
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
281
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
282
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
283
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
284
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
285
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
286
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
287
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
288
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
289
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
290
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
291
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
365
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
366
+	print ' selected';
367
+}
368
+?>>Mapbox default</option>
369
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
370
+	print ' selected';
371
+}
372
+?>>Mapbox streets</option>
373
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
374
+	print ' selected';
375
+}
376
+?>>Mapbox light</option>
377
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
378
+	print ' selected';
379
+}
380
+?>>Mapbox dark</option>
381
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
382
+	print ' selected';
383
+}
384
+?>>Mapbox satellite</option>
385
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
386
+	print ' selected';
387
+}
388
+?>>Mapbox streets-satellite</option>
389
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
390
+	print ' selected';
391
+}
392
+?>>Mapbox streets-basic</option>
393
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
394
+	print ' selected';
395
+}
396
+?>>Mapbox comic</option>
397
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
398
+	print ' selected';
399
+}
400
+?>>Mapbox outdoors</option>
401
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
402
+	print ' selected';
403
+}
404
+?>>Mapbox pencil</option>
405
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
406
+	print ' selected';
407
+}
408
+?>>Mapbox pirates</option>
409
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
410
+	print ' selected';
411
+}
412
+?>>Mapbox emerald</option>
292 413
 			    <?php
293 414
 				    }
294 415
 			    ?>
295
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
416
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
417
+	print ' selected';
418
+}
419
+?>>OpenStreetMap</option>
296 420
 			</select>
297 421
 		    </li>
298 422
 <?php
@@ -300,9 +424,18 @@  discard block
 block discarded – undo
300 424
 ?>
301 425
 		    <li><?php echo _("Type of Terrain:"); ?>
302 426
 			<select  class="selectpicker" onchange="terrainType(this);">
303
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
304
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
305
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
427
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
428
+	print ' selected';
429
+}
430
+?>>stk terrain</option>
431
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
432
+	print ' selected';
433
+}
434
+?>>ellipsoid</option>
435
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
436
+	print ' selected';
437
+}
438
+?>>vr terrain</option>
306 439
 			</select>
307 440
 		    </li>
308 441
 <?php
@@ -312,18 +445,36 @@  discard block
 block discarded – undo
312 445
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
313 446
 ?>
314 447
 		    
315
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
316
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
317
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
318
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
448
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
449
+	print 'checked';
450
+}
451
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
452
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) {
453
+	print 'checked';
454
+}
455
+?> ><?php echo _("Display flight path"); ?></label></div></li>
456
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) {
457
+	print 'checked';
458
+}
459
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
460
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
461
+	print 'checked';
462
+}
463
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
319 464
 <?php
320 465
     }
321 466
 ?>
322
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
467
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') {
468
+	print 'checked';
469
+}
470
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
323 471
 <?php
324 472
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
325 473
 ?>
326
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
474
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) {
475
+	print 'checked';
476
+}
477
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
327 478
 <?php
328 479
     }
329 480
 ?>
@@ -332,17 +483,25 @@  discard block
 block discarded – undo
332 483
 			if (function_exists('array_column')) {
333 484
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
334 485
 		    ?>
335
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
486
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
487
+	print 'checked';
488
+}
489
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
336 490
 		    <?php
337 491
 			    }
338 492
 			} elseif (isset($globalSources)) {
339 493
 			    $dispolar = false;
340 494
 			    foreach ($globalSources as $testsource) {
341
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
495
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
496
+			        	$dispolar = true;
497
+			        }
342 498
 			    }
343 499
 			    if ($dispolar) {
344 500
 		    ?>
345
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
501
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
502
+	print 'checked';
503
+}
504
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
346 505
 		    <?php
347 506
 			    }
348 507
 		        }
@@ -354,12 +513,22 @@  discard block
 block discarded – undo
354 513
 		    <?php
355 514
 		        if (extension_loaded('gd') && function_exists('gd_info')) {
356 515
 		    ?>
357
-		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
516
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
517
+	print 'checked';
518
+}
519
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
358 520
 		    <?php 
359 521
 			if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
360 522
 		    ?>
361 523
 		    <li><?php echo _("Aircraft icon color:"); ?>
362
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
524
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
525
+	print $_COOKIE['IconColor'];
526
+} elseif (isset($globalAircraftIconColor)) {
527
+	print $globalAircraftIconColor;
528
+} else {
529
+	print '1a3151';
530
+}
531
+?>">
363 532
 		    </li>
364 533
 		    <?php
365 534
 			    }
@@ -367,8 +536,22 @@  discard block
 block discarded – undo
367 536
 		    ?>
368 537
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
369 538
 			<div class="range">
370
-			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
371
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
539
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
540
+	print $_COOKIE['AirportZoom'];
541
+} elseif (isset($globalAirportZoom)) {
542
+	print $globalAirportZoom;
543
+} else {
544
+	print '7';
545
+}
546
+?>">
547
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
548
+	print $_COOKIE['AirportZoom'];
549
+} elseif (isset($globalAirportZoom)) {
550
+	print $globalAirportZoom;
551
+} else {
552
+	print '7';
553
+}
554
+?></output>
372 555
 			</div>
373 556
 		    </li>
374 557
 <?php
@@ -376,22 +559,46 @@  discard block
 block discarded – undo
376 559
 ?>
377 560
 		    <li><?php echo _("Distance unit:"); ?>
378 561
 			<select class="selectpicker" onchange="unitdistance(this);">
379
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
380
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
381
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
562
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
563
+	echo ' selected';
564
+}
565
+?>>km</option>
566
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
567
+	echo ' selected';
568
+}
569
+?>>nm</option>
570
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
571
+	echo ' selected';
572
+}
573
+?>>mi</option>
382 574
 		        </select>
383 575
 		    </li>
384 576
 		    <li><?php echo _("Altitude unit:"); ?>
385 577
 			<select class="selectpicker" onchange="unitaltitude(this);">
386
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
387
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
578
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
579
+	echo ' selected';
580
+}
581
+?>>m</option>
582
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
583
+	echo ' selected';
584
+}
585
+?>>feet</option>
388 586
 		        </select>
389 587
 		    </li>
390 588
 		    <li><?php echo _("Speed unit:"); ?>
391 589
 			<select class="selectpicker" onchange="unitspeed(this);">
392
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
393
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
394
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
590
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
591
+	echo ' selected';
592
+}
593
+?>>km/h</option>
594
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
595
+	echo ' selected';
596
+}
597
+?>>mph</option>
598
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
599
+	echo ' selected';
600
+}
601
+?>>knots</option>
395 602
 		        </select>
396 603
 		    </li>
397 604
 
@@ -406,9 +613,18 @@  discard block
 block discarded – undo
406 613
 		    <?php
407 614
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
408 615
 		    ?>
409
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
410
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
411
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
616
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) {
617
+	print 'checked';
618
+}
619
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
620
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) {
621
+	print 'checked';
622
+}
623
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
624
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) {
625
+	print 'checked';
626
+}
627
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
412 628
 		    <?php
413 629
 			}
414 630
 		    ?>
@@ -416,10 +632,16 @@  discard block
 block discarded – undo
416 632
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
417 633
 		    ?>
418 634
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
419
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
635
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) {
636
+	print 'checked';
637
+}
638
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
420 639
 			<?php } ?>
421 640
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
422
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
641
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) {
642
+	print 'checked';
643
+}
644
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
423 645
 			<?php } ?>
424 646
 		    <?php
425 647
 			}
@@ -431,7 +653,9 @@  discard block
 block discarded – undo
431 653
 				$Spotter = new Spotter();
432 654
 				foreach($Spotter->getAllAirlineNames() as $airline) {
433 655
 					$airline_name = $airline['airline_name'];
434
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
656
+					if (strlen($airline_name) > 30) {
657
+						$airline_name = substr($airline_name,0,30).'...';
658
+					}
435 659
 					if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['Airlines']))) {
436 660
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
437 661
 					} else {
@@ -466,10 +690,22 @@  discard block
 block discarded – undo
466 690
 		    ?>
467 691
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
468 692
 			<select class="selectpicker" onchange="airlinestype(this);">
469
-			    <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
470
-			    <option value="passenger"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
471
-			    <option value="cargo"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
472
-			    <option value="military"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
693
+			    <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') {
694
+	echo ' selected';
695
+}
696
+?>><?php echo _("All"); ?></option>
697
+			    <option value="passenger"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'passenger') {
698
+	echo ' selected';
699
+}
700
+?>><?php echo _("Passenger"); ?></option>
701
+			    <option value="cargo"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'cargo') {
702
+	echo ' selected';
703
+}
704
+?>><?php echo _("Cargo"); ?></option>
705
+			    <option value="military"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'military') {
706
+	echo ' selected';
707
+}
708
+?>><?php echo _("Military"); ?></option>
473 709
 			</select>
474 710
 		    </li>
475 711
 		    <?php
@@ -477,7 +713,10 @@  discard block
 block discarded – undo
477 713
 		    ?>
478 714
 		    <li>
479 715
 			<?php echo _("Display flight with ident:"); ?>
480
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['identfilter'])) print $_COOKIE['identfilter']; ?>" />
716
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['identfilter'])) {
717
+	print $_COOKIE['identfilter'];
718
+}
719
+?>" />
481 720
 		    </li>
482 721
 		</ul>
483 722
 	    </form>
@@ -493,7 +732,10 @@  discard block
 block discarded – undo
493 732
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
494 733
 	    <form>
495 734
 		<ul>
496
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
735
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') {
736
+	print 'checked';
737
+}
738
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
497 739
 		    <li><?php echo _("Type:"); ?>
498 740
 			<select class="selectpicker" multiple onchange="sattypes(this);">
499 741
 			    <?php
@@ -501,25 +743,45 @@  discard block
 block discarded – undo
501 743
 				$types = $Satellite->get_tle_types();
502 744
 				foreach ($types as $type) {
503 745
 					$type_name = $type['tle_type'];
504
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
505
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
506
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
507
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
508
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
509
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
510
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
511
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
512
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
513
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
514
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
515
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
516
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
517
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
518
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
519
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
520
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
521
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
522
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
746
+					if ($type_name == 'musson') {
747
+						$type_name = 'Russian LEO Navigation';
748
+					} else if ($type_name == 'nnss') {
749
+						$type_name = 'Navi Navigation Satellite System';
750
+					} else if ($type_name == 'sbas') {
751
+						$type_name = 'Satellite-Based Augmentation System';
752
+					} else if ($type_name == 'glo-ops') {
753
+						$type_name = 'Glonass Operational';
754
+					} else if ($type_name == 'gps-ops') {
755
+						$type_name = 'GPS Operational';
756
+					} else if ($type_name == 'argos') {
757
+						$type_name = 'ARGOS Data Collection System';
758
+					} else if ($type_name == 'tdrss') {
759
+						$type_name = 'Tracking and Data Relay Satellite System';
760
+					} else if ($type_name == 'sarsat') {
761
+						$type_name = 'Search & Rescue';
762
+					} else if ($type_name == 'dmc') {
763
+						$type_name = 'Disaster Monitoring';
764
+					} else if ($type_name == 'resource') {
765
+						$type_name = 'Earth Resources';
766
+					} else if ($type_name == 'stations') {
767
+						$type_name = 'Space Stations';
768
+					} else if ($type_name == 'geo') {
769
+						$type_name = 'Geostationary';
770
+					} else if ($type_name == 'amateur') {
771
+						$type_name = 'Amateur Radio';
772
+					} else if ($type_name == 'x-comm') {
773
+						$type_name = 'Experimental';
774
+					} else if ($type_name == 'other-comm') {
775
+						$type_name = 'Other Comm';
776
+					} else if ($type_name == 'science') {
777
+						$type_name = 'Space & Earth Science';
778
+					} else if ($type_name == 'military') {
779
+						$type_name = 'Miscellaneous Military';
780
+					} else if ($type_name == 'radar') {
781
+						$type_name = 'Radar Calibration';
782
+					} else if ($type_name == 'tle-new') {
783
+						$type_name = 'Last 30 days launches';
784
+					}
523 785
 					
524 786
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
525 787
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
require/class.Stats.php 1 patch
Braces   +383 added lines, -133 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 	
13 13
 	public function __construct($dbc = null) {
14 14
 		global $globalFilterName;
15
-		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
15
+		if (isset($globalFilterName)) {
16
+			$this->filter_name = $globalFilterName;
17
+		}
16 18
 		$Connection = new Connection($dbc);
17 19
 		$this->db = $Connection->db();
18 20
         }
@@ -41,7 +43,9 @@  discard block
 block discarded – undo
41 43
                 return $all;
42 44
         }
43 45
 	public function getAllAirlineNames($filter_name = '') {
44
-		if ($filter_name == '') $filter_name = $this->filter_name;
46
+		if ($filter_name == '') {
47
+			$filter_name = $this->filter_name;
48
+		}
45 49
                 $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
46 50
                  try {
47 51
                         $sth = $this->db->prepare($query);
@@ -53,7 +57,9 @@  discard block
 block discarded – undo
53 57
                 return $all;
54 58
         }
55 59
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
56
-		if ($filter_name == '') $filter_name = $this->filter_name;
60
+		if ($filter_name == '') {
61
+			$filter_name = $this->filter_name;
62
+		}
57 63
                 $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
58 64
                  try {
59 65
                         $sth = $this->db->prepare($query);
@@ -65,7 +71,9 @@  discard block
 block discarded – undo
65 71
                 return $all;
66 72
         }
67 73
 	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
68
-		if ($filter_name == '') $filter_name = $this->filter_name;
74
+		if ($filter_name == '') {
75
+			$filter_name = $this->filter_name;
76
+		}
69 77
                 $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";
70 78
                  try {
71 79
                         $sth = $this->db->prepare($query);
@@ -77,7 +85,9 @@  discard block
 block discarded – undo
77 85
                 return $all;
78 86
         }
79 87
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
80
-		if ($filter_name == '') $filter_name = $this->filter_name;
88
+		if ($filter_name == '') {
89
+			$filter_name = $this->filter_name;
90
+		}
81 91
                 $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";
82 92
                  try {
83 93
                         $sth = $this->db->prepare($query);
@@ -92,9 +102,14 @@  discard block
 block discarded – undo
92 102
 
93 103
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') {
94 104
 		global $globalStatsFilters;
95
-		if ($filter_name == '') $filter_name = $this->filter_name;
96
-		if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name 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";
97
-		else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name 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";
105
+		if ($filter_name == '') {
106
+			$filter_name = $this->filter_name;
107
+		}
108
+		if ($limit) {
109
+			$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name 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";
110
+		} else {
111
+			$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name 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";
112
+		}
98 113
                  try {
99 114
                         $sth = $this->db->prepare($query);
100 115
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -114,9 +129,14 @@  discard block
 block discarded – undo
114 129
 	}
115 130
 	public function countAllAirlineCountries($limit = true,$filter_name = '') {
116 131
 		global $globalStatsFilters;
117
-		if ($filter_name == '') $filter_name = $this->filter_name;
118
-		if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
119
-		else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
132
+		if ($filter_name == '') {
133
+			$filter_name = $this->filter_name;
134
+		}
135
+		if ($limit) {
136
+			$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
137
+		} else {
138
+			$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC";
139
+		}
120 140
                  try {
121 141
                         $sth = $this->db->prepare($query);
122 142
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -136,9 +156,14 @@  discard block
 block discarded – undo
136 156
 	}
137 157
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') {
138 158
 		global $globalStatsFilters;
139
-		if ($filter_name == '') $filter_name = $this->filter_name;
140
-		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";
141
-		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";
159
+		if ($filter_name == '') {
160
+			$filter_name = $this->filter_name;
161
+		}
162
+		if ($limit) {
163
+			$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";
164
+		} else {
165
+			$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";
166
+		}
142 167
                  try {
143 168
                         $sth = $this->db->prepare($query);
144 169
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -159,9 +184,14 @@  discard block
 block discarded – undo
159 184
 
160 185
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') {
161 186
 		global $globalStatsFilters;
162
-		if ($filter_name == '') $filter_name = $this->filter_name;
163
-		if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
164
-		else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
187
+		if ($filter_name == '') {
188
+			$filter_name = $this->filter_name;
189
+		}
190
+		if ($limit) {
191
+			$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
192
+		} else {
193
+			$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC";
194
+		}
165 195
                  try {
166 196
                         $sth = $this->db->prepare($query);
167 197
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -181,9 +211,14 @@  discard block
 block discarded – undo
181 211
 	}
182 212
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') {
183 213
 		global $globalStatsFilters;
184
-		if ($filter_name == '') $filter_name = $this->filter_name;
185
-		if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
186
-		else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
214
+		if ($filter_name == '') {
215
+			$filter_name = $this->filter_name;
216
+		}
217
+		if ($limit) {
218
+			$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
219
+		} else {
220
+			$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
221
+		}
187 222
                  try {
188 223
                         $sth = $this->db->prepare($query);
189 224
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -204,9 +239,14 @@  discard block
 block discarded – undo
204 239
 
205 240
 	public function countAllAirlines($limit = true,$filter_name = '') {
206 241
 		global $globalStatsFilters;
207
-		if ($filter_name == '') $filter_name = $this->filter_name;
208
-		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 ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
209
-		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 ORDER BY airline_count DESC";
242
+		if ($filter_name == '') {
243
+			$filter_name = $this->filter_name;
244
+		}
245
+		if ($limit) {
246
+			$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 ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
247
+		} else {
248
+			$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 ORDER BY airline_count DESC";
249
+		}
210 250
                  try {
211 251
                         $sth = $this->db->prepare($query);
212 252
                         $sth->execute(array(':filter_name' => $filter_name));
@@ -227,9 +267,14 @@  discard block
 block discarded – undo
227 267
 	}
228 268
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') {
229 269
 		global $globalStatsFilters;
230
-		if ($filter_name == '') $filter_name = $this->filter_name;
231
-		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";
232
-		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";
270
+		if ($filter_name == '') {
271
+			$filter_name = $this->filter_name;
272
+		}
273
+		if ($limit) {
274
+			$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";
275
+		} else {
276
+			$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";
277
+		}
233 278
                  try {
234 279
                         $sth = $this->db->prepare($query);
235 280
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -249,9 +294,14 @@  discard block
 block discarded – undo
249 294
 	}
250 295
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') {
251 296
 		global $globalStatsFilters;
252
-		if ($filter_name == '') $filter_name = $this->filter_name;
253
-		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";
254
-		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";
297
+		if ($filter_name == '') {
298
+			$filter_name = $this->filter_name;
299
+		}
300
+		if ($limit) {
301
+			$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";
302
+		} else {
303
+			$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";
304
+		}
255 305
 		 try {
256 306
 			$sth = $this->db->prepare($query);
257 307
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -271,10 +321,15 @@  discard block
 block discarded – undo
271 321
 	}
272 322
 	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') {
273 323
 		$Connection = new Connection();
274
-		if ($filter_name == '') $filter_name = $this->filter_name;
324
+		if ($filter_name == '') {
325
+			$filter_name = $this->filter_name;
326
+		}
275 327
 		if ($Connection->tableExists('countries')) {
276
-			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";
277
-			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";
328
+			if ($limit) {
329
+				$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";
330
+			} else {
331
+				$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";
332
+			}
278 333
 			 try {
279 334
 				$sth = $this->db->prepare($query);
280 335
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -295,9 +350,14 @@  discard block
 block discarded – undo
295 350
 	}
296 351
 	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') {
297 352
 		global $globalStatsFilters;
298
-		if ($filter_name == '') $filter_name = $this->filter_name;
299
-		if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
300
-		else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
353
+		if ($filter_name == '') {
354
+			$filter_name = $this->filter_name;
355
+		}
356
+		if ($limit) {
357
+			$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
358
+		} else {
359
+			$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
360
+		}
301 361
                  try {
302 362
                         $sth = $this->db->prepare($query);
303 363
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -317,9 +377,14 @@  discard block
 block discarded – undo
317 377
 	}
318 378
 	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') {
319 379
 		global $globalStatsFilters;
320
-		if ($filter_name == '') $filter_name = $this->filter_name;
321
-		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";
322
-		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";
380
+		if ($filter_name == '') {
381
+			$filter_name = $this->filter_name;
382
+		}
383
+		if ($limit) {
384
+			$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";
385
+		} else {
386
+			$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";
387
+		}
323 388
                  try {
324 389
                         $sth = $this->db->prepare($query);
325 390
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -339,9 +404,14 @@  discard block
 block discarded – undo
339 404
 	}
340 405
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') {
341 406
 		global $globalStatsFilters;
342
-		if ($filter_name == '') $filter_name = $this->filter_name;
343
-		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 FROM stats_airport WHERE 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";
344
-		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 FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
407
+		if ($filter_name == '') {
408
+			$filter_name = $this->filter_name;
409
+		}
410
+		if ($limit) {
411
+			$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 FROM stats_airport WHERE 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";
412
+		} else {
413
+			$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 FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
414
+		}
345 415
                  try {
346 416
                         $sth = $this->db->prepare($query);
347 417
                         $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -367,7 +437,9 @@  discard block
 block discarded – undo
367 437
         			$icao = $value['airport_departure_icao'];
368 438
         			if (isset($all[$icao])) {
369 439
         				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
370
-        			} else $all[$icao] = $value;
440
+        			} else {
441
+        				$all[$icao] = $value;
442
+        			}
371 443
         		}
372 444
         		$count = array();
373 445
         		foreach ($all as $key => $row) {
@@ -379,9 +451,14 @@  discard block
 block discarded – undo
379 451
 	}
380 452
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') {
381 453
 		global $globalStatsFilters;
382
-		if ($filter_name == '') $filter_name = $this->filter_name;
383
-		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 FROM stats_airport WHERE 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";
384
-		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 FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
454
+		if ($filter_name == '') {
455
+			$filter_name = $this->filter_name;
456
+		}
457
+		if ($limit) {
458
+			$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 FROM stats_airport WHERE 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";
459
+		} else {
460
+			$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 FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
461
+		}
385 462
 		try {
386 463
 			$sth = $this->db->prepare($query);
387 464
 			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -407,7 +484,9 @@  discard block
 block discarded – undo
407 484
         			$icao = $value['airport_arrival_icao'];
408 485
         			if (isset($all[$icao])) {
409 486
         				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
410
-        			} else $all[$icao] = $value;
487
+        			} else {
488
+        				$all[$icao] = $value;
489
+        			}
411 490
         		}
412 491
         		$count = array();
413 492
         		foreach ($all as $key => $row) {
@@ -420,13 +499,21 @@  discard block
 block discarded – undo
420 499
 	}
421 500
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
422 501
 		global $globalDBdriver, $globalStatsFilters;
423
-		if ($filter_name == '') $filter_name = $this->filter_name;
502
+		if ($filter_name == '') {
503
+			$filter_name = $this->filter_name;
504
+		}
424 505
 		if ($globalDBdriver == 'mysql') {
425
-			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";
426
-			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";
506
+			if ($limit) {
507
+				$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";
508
+			} else {
509
+				$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";
510
+			}
427 511
 		} else {
428
-			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";
429
-			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";
512
+			if ($limit) {
513
+				$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";
514
+			} else {
515
+				$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";
516
+			}
430 517
 		}
431 518
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
432 519
                  try {
@@ -450,7 +537,9 @@  discard block
 block discarded – undo
450 537
 	
451 538
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
452 539
 		global $globalStatsFilters;
453
-		if ($filter_name == '') $filter_name = $this->filter_name;
540
+		if ($filter_name == '') {
541
+			$filter_name = $this->filter_name;
542
+		}
454 543
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name";
455 544
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
456 545
                  try {
@@ -472,7 +561,9 @@  discard block
 block discarded – undo
472 561
 	}
473 562
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
474 563
 		global $globalDBdriver, $globalStatsFilters;
475
-		if ($filter_name == '') $filter_name = $this->filter_name;
564
+		if ($filter_name == '') {
565
+			$filter_name = $this->filter_name;
566
+		}
476 567
 		if ($globalDBdriver == 'mysql') {
477 568
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline = :stats_airline AND filter_name = :filter_name";
478 569
 		} else {
@@ -498,7 +589,9 @@  discard block
 block discarded – undo
498 589
 	}
499 590
 	public function countAllDates($stats_airline = '',$filter_name = '') {
500 591
 		global $globalStatsFilters;
501
-		if ($filter_name == '') $filter_name = $this->filter_name;
592
+		if ($filter_name == '') {
593
+			$filter_name = $this->filter_name;
594
+		}
502 595
 		$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name";
503 596
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
504 597
                  try {
@@ -520,7 +613,9 @@  discard block
 block discarded – undo
520 613
 	}
521 614
 	public function countAllDatesByAirlines($filter_name = '') {
522 615
 		global $globalStatsFilters;
523
-		if ($filter_name == '') $filter_name = $this->filter_name;
616
+		if ($filter_name == '') {
617
+			$filter_name = $this->filter_name;
618
+		}
524 619
 		$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";
525 620
 		$query_data = array('filter_name' => $filter_name);
526 621
                  try {
@@ -542,7 +637,9 @@  discard block
 block discarded – undo
542 637
 	}
543 638
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
544 639
 		global $globalStatsFilters;
545
-		if ($filter_name == '') $filter_name = $this->filter_name;
640
+		if ($filter_name == '') {
641
+			$filter_name = $this->filter_name;
642
+		}
546 643
 	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
547 644
                  try {
548 645
                         $sth = $this->db->prepare($query);
@@ -563,7 +660,9 @@  discard block
 block discarded – undo
563 660
 	}
564 661
 	public function countAllMilitaryMonths($filter_name = '') {
565 662
 		global $globalStatsFilters;
566
-		if ($filter_name == '') $filter_name = $this->filter_name;
663
+		if ($filter_name == '') {
664
+			$filter_name = $this->filter_name;
665
+		}
567 666
 	    	$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";
568 667
                  try {
569 668
                         $sth = $this->db->prepare($query);
@@ -584,9 +683,14 @@  discard block
 block discarded – undo
584 683
 	}
585 684
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
586 685
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
587
-		if ($filter_name == '') $filter_name = $this->filter_name;
588
-		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";
589
-		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";
686
+		if ($filter_name == '') {
687
+			$filter_name = $this->filter_name;
688
+		}
689
+		if ($limit) {
690
+			$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";
691
+		} else {
692
+			$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";
693
+		}
590 694
 		if ($orderby == 'hour') {
591 695
 			/*
592 696
 			if ($globalDBdriver == 'mysql') {
@@ -595,7 +699,9 @@  discard block
 block discarded – undo
595 699
 			*/
596 700
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
597 701
 		}
598
-		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
702
+		if ($orderby == 'count') {
703
+			$query .= " ORDER BY hour_count DESC";
704
+		}
599 705
                  try {
600 706
                         $sth = $this->db->prepare($query);
601 707
                         $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
@@ -616,7 +722,9 @@  discard block
 block discarded – undo
616 722
 	
617 723
 	public function countOverallFlights($stats_airline = '', $filter_name = '') {
618 724
 		global $globalStatsFilters;
619
-		if ($filter_name == '') $filter_name = $this->filter_name;
725
+		if ($filter_name == '') {
726
+			$filter_name = $this->filter_name;
727
+		}
620 728
 		$all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name);
621 729
 		if (empty($all)) {
622 730
 			$filters = array('airlines' => array($stats_airline));
@@ -630,7 +738,9 @@  discard block
 block discarded – undo
630 738
 	}
631 739
 	public function countOverallMilitaryFlights($filter_name = '') {
632 740
 		global $globalStatsFilters;
633
-		if ($filter_name == '') $filter_name = $this->filter_name;
741
+		if ($filter_name == '') {
742
+			$filter_name = $this->filter_name;
743
+		}
634 744
 		$all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name);
635 745
 		if (empty($all)) {
636 746
 		        $filters = array();
@@ -644,7 +754,9 @@  discard block
 block discarded – undo
644 754
 	}
645 755
 	public function countOverallArrival($stats_airline = '',$filter_name = '') {
646 756
 		global $globalStatsFilters;
647
-		if ($filter_name == '') $filter_name = $this->filter_name;
757
+		if ($filter_name == '') {
758
+			$filter_name = $this->filter_name;
759
+		}
648 760
 		$all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name);
649 761
 		if (empty($all)) {
650 762
 			$filters = array('airlines' => array($stats_airline));
@@ -658,7 +770,9 @@  discard block
 block discarded – undo
658 770
 	}
659 771
 	public function countOverallAircrafts($stats_airline = '',$filter_name = '') {
660 772
 		global $globalStatsFilters;
661
-		if ($filter_name == '') $filter_name = $this->filter_name;
773
+		if ($filter_name == '') {
774
+			$filter_name = $this->filter_name;
775
+		}
662 776
 		$all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name);
663 777
 		if (empty($all)) {
664 778
 			$filters = array('airlines' => array($stats_airline));
@@ -672,7 +786,9 @@  discard block
 block discarded – undo
672 786
 	}
673 787
 	public function countOverallAirlines($filter_name = '') {
674 788
 		global $globalStatsFilters;
675
-		if ($filter_name == '') $filter_name = $this->filter_name;
789
+		if ($filter_name == '') {
790
+			$filter_name = $this->filter_name;
791
+		}
676 792
 		$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
677 793
                  try {
678 794
                         $sth = $this->db->prepare($query);
@@ -695,7 +811,9 @@  discard block
 block discarded – undo
695 811
 	}
696 812
 	public function countOverallOwners($stats_airline = '',$filter_name = '') {
697 813
 		global $globalStatsFilters;
698
-		if ($filter_name == '') $filter_name = $this->filter_name;
814
+		if ($filter_name == '') {
815
+			$filter_name = $this->filter_name;
816
+		}
699 817
 		/*
700 818
 		$query = "SELECT COUNT(*) AS nb_owner FROM stats_owner";
701 819
                  try {
@@ -720,7 +838,9 @@  discard block
 block discarded – undo
720 838
 	}
721 839
 	public function countOverallPilots($stats_airline = '',$filter_name = '') {
722 840
 		global $globalStatsFilters;
723
-		if ($filter_name == '') $filter_name = $this->filter_name;
841
+		if ($filter_name == '') {
842
+			$filter_name = $this->filter_name;
843
+		}
724 844
 		$all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name);
725 845
 		if (empty($all)) {
726 846
 			$filters = array('airlines' => array($stats_airline));
@@ -734,7 +854,9 @@  discard block
 block discarded – undo
734 854
 	}
735 855
 
736 856
 	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
737
-		if ($filter_name == '') $filter_name = $this->filter_name;
857
+		if ($filter_name == '') {
858
+			$filter_name = $this->filter_name;
859
+		}
738 860
 		$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date";
739 861
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
740 862
                  try {
@@ -747,7 +869,9 @@  discard block
 block discarded – undo
747 869
                 return $all;
748 870
 	}
749 871
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
750
-		if ($filter_name == '') $filter_name = $this->filter_name;
872
+		if ($filter_name == '') {
873
+			$filter_name = $this->filter_name;
874
+		}
751 875
                 $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
752 876
                 $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
753 877
                  try {
@@ -760,7 +884,9 @@  discard block
 block discarded – undo
760 884
                 return $all;
761 885
         }
762 886
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') {
763
-		if ($filter_name == '') $filter_name = $this->filter_name;
887
+		if ($filter_name == '') {
888
+			$filter_name = $this->filter_name;
889
+		}
764 890
     		global $globalArchiveMonths, $globalDBdriver;
765 891
     		if ($globalDBdriver == 'mysql') {
766 892
 	                $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -779,7 +905,9 @@  discard block
 block discarded – undo
779 905
         }
780 906
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
781 907
     		global $globalArchiveMonths, $globalDBdriver;
782
-		if ($filter_name == '') $filter_name = $this->filter_name;
908
+		if ($filter_name == '') {
909
+			$filter_name = $this->filter_name;
910
+		}
783 911
     		if ($globalDBdriver == 'mysql') {
784 912
 			$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
785 913
 		} else {
@@ -797,7 +925,9 @@  discard block
 block discarded – undo
797 925
         }
798 926
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
799 927
     		global $globalArchiveMonths, $globalDBdriver;
800
-		if ($filter_name == '') $filter_name = $this->filter_name;
928
+		if ($filter_name == '') {
929
+			$filter_name = $this->filter_name;
930
+		}
801 931
     		if ($globalDBdriver == 'mysql') {
802 932
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
803 933
                 } else {
@@ -814,7 +944,9 @@  discard block
 block discarded – undo
814 944
         }
815 945
 	public function getStatsAirlineTotal($filter_name = '') {
816 946
     		global $globalArchiveMonths, $globalDBdriver;
817
-		if ($filter_name == '') $filter_name = $this->filter_name;
947
+		if ($filter_name == '') {
948
+			$filter_name = $this->filter_name;
949
+		}
818 950
     		if ($globalDBdriver == 'mysql') {
819 951
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
820 952
                 } else {
@@ -831,7 +963,9 @@  discard block
 block discarded – undo
831 963
         }
832 964
 	public function getStatsOwnerTotal($filter_name = '') {
833 965
     		global $globalArchiveMonths, $globalDBdriver;
834
-		if ($filter_name == '') $filter_name = $this->filter_name;
966
+		if ($filter_name == '') {
967
+			$filter_name = $this->filter_name;
968
+		}
835 969
     		if ($globalDBdriver == 'mysql') {
836 970
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
837 971
 		} else {
@@ -848,7 +982,9 @@  discard block
 block discarded – undo
848 982
         }
849 983
 	public function getStatsPilotTotal($filter_name = '') {
850 984
     		global $globalArchiveMonths, $globalDBdriver;
851
-		if ($filter_name == '') $filter_name = $this->filter_name;
985
+		if ($filter_name == '') {
986
+			$filter_name = $this->filter_name;
987
+		}
852 988
     		if ($globalDBdriver == 'mysql') {
853 989
             		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
854 990
             	} else {
@@ -866,7 +1002,9 @@  discard block
 block discarded – undo
866 1002
 
867 1003
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
868 1004
 		global $globalDBdriver;
869
-		if ($filter_name == '') $filter_name = $this->filter_name;
1005
+		if ($filter_name == '') {
1006
+			$filter_name = $this->filter_name;
1007
+		}
870 1008
 		if ($globalDBdriver == 'mysql') {
871 1009
 			$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";
872 1010
                 } else {
@@ -882,7 +1020,9 @@  discard block
 block discarded – undo
882 1020
         }
883 1021
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
884 1022
 		global $globalDBdriver;
885
-		if ($filter_name == '') $filter_name = $this->filter_name;
1023
+		if ($filter_name == '') {
1024
+			$filter_name = $this->filter_name;
1025
+		}
886 1026
 		if ($globalDBdriver == 'mysql') {
887 1027
 			$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";
888 1028
 		} else {
@@ -1365,47 +1505,69 @@  discard block
 block discarded – undo
1365 1505
 			$this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s'));
1366 1506
 		} else {
1367 1507
 		*/
1368
-			if ($globalDebug) echo 'Update stats !'."\n";
1369
-			if ($globalDebug) echo 'Count all aircraft types...'."\n";
1508
+			if ($globalDebug) {
1509
+				echo 'Update stats !'."\n";
1510
+			}
1511
+			if ($globalDebug) {
1512
+				echo 'Count all aircraft types...'."\n";
1513
+			}
1370 1514
 			if (isset($last_update[0]['value'])) {
1371 1515
 				$last_update_day = $last_update[0]['value'];
1372
-			} else $last_update_day = '2012-12-12 12:12:12';
1516
+			} else {
1517
+				$last_update_day = '2012-12-12 12:12:12';
1518
+			}
1373 1519
 			$Spotter = new Spotter($this->db);
1374 1520
 			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1375 1521
 			foreach ($alldata as $number) {
1376 1522
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']);
1377 1523
 			}
1378
-			if ($globalDebug) echo 'Count all airlines...'."\n";
1524
+			if ($globalDebug) {
1525
+				echo 'Count all airlines...'."\n";
1526
+			}
1379 1527
 			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
1380 1528
 			foreach ($alldata as $number) {
1381 1529
 				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']);
1382 1530
 			}
1383
-			if ($globalDebug) echo 'Count all registrations...'."\n";
1531
+			if ($globalDebug) {
1532
+				echo 'Count all registrations...'."\n";
1533
+			}
1384 1534
 			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
1385 1535
 			foreach ($alldata as $number) {
1386 1536
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']);
1387 1537
 			}
1388
-			if ($globalDebug) echo 'Count all callsigns...'."\n";
1538
+			if ($globalDebug) {
1539
+				echo 'Count all callsigns...'."\n";
1540
+			}
1389 1541
 			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
1390 1542
 			foreach ($alldata as $number) {
1391 1543
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1392 1544
 			}
1393
-			if ($globalDebug) echo 'Count all owners...'."\n";
1545
+			if ($globalDebug) {
1546
+				echo 'Count all owners...'."\n";
1547
+			}
1394 1548
 			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
1395 1549
 			foreach ($alldata as $number) {
1396 1550
 				$this->addStatOwner($number['owner_name'],$number['owner_count']);
1397 1551
 			}
1398
-			if ($globalDebug) echo 'Count all pilots...'."\n";
1552
+			if ($globalDebug) {
1553
+				echo 'Count all pilots...'."\n";
1554
+			}
1399 1555
 			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
1400 1556
 			foreach ($alldata as $number) {
1401 1557
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name']);
1402 1558
 			}
1403 1559
 			
1404
-			if ($globalDebug) echo 'Count all departure airports...'."\n";
1560
+			if ($globalDebug) {
1561
+				echo 'Count all departure airports...'."\n";
1562
+			}
1405 1563
 			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1406
-			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1564
+			if ($globalDebug) {
1565
+				echo 'Count all detected departure airports...'."\n";
1566
+			}
1407 1567
         		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1408
-			if ($globalDebug) echo 'Order departure airports...'."\n";
1568
+			if ($globalDebug) {
1569
+				echo 'Order departure airports...'."\n";
1570
+			}
1409 1571
 	        	$alldata = array();
1410 1572
 	        	
1411 1573
     			foreach ($pall as $value) {
@@ -1416,7 +1578,9 @@  discard block
 block discarded – undo
1416 1578
     				$icao = $value['airport_departure_icao'];
1417 1579
         			if (isset($alldata[$icao])) {
1418 1580
     					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1419
-        			} else $alldata[$icao] = $value;
1581
+        			} else {
1582
+        				$alldata[$icao] = $value;
1583
+        			}
1420 1584
 			}
1421 1585
     			$count = array();
1422 1586
     			foreach ($alldata as $key => $row) {
@@ -1426,11 +1590,17 @@  discard block
 block discarded – undo
1426 1590
 			foreach ($alldata as $number) {
1427 1591
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']);
1428 1592
 			}
1429
-			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1593
+			if ($globalDebug) {
1594
+				echo 'Count all arrival airports...'."\n";
1595
+			}
1430 1596
 			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1431
-			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1597
+			if ($globalDebug) {
1598
+				echo 'Count all detected arrival airports...'."\n";
1599
+			}
1432 1600
         		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1433
-			if ($globalDebug) echo 'Order arrival airports...'."\n";
1601
+			if ($globalDebug) {
1602
+				echo 'Order arrival airports...'."\n";
1603
+			}
1434 1604
 	        	$alldata = array();
1435 1605
     			foreach ($pall as $value) {
1436 1606
 	        		$icao = $value['airport_arrival_icao'];
@@ -1440,7 +1610,9 @@  discard block
 block discarded – undo
1440 1610
     				$icao = $value['airport_arrival_icao'];
1441 1611
         			if (isset($alldata[$icao])) {
1442 1612
         				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1443
-	        		} else $alldata[$icao] = $value;
1613
+	        		} else {
1614
+	        			$alldata[$icao] = $value;
1615
+	        		}
1444 1616
     			}
1445 1617
         		$count = array();
1446 1618
         		foreach ($alldata as $key => $row) {
@@ -1451,7 +1623,9 @@  discard block
 block discarded – undo
1451 1623
 				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']);
1452 1624
 			}
1453 1625
 			if ($Connection->tableExists('countries')) {
1454
-				if ($globalDebug) echo 'Count all flights by countries...'."\n";
1626
+				if ($globalDebug) {
1627
+					echo 'Count all flights by countries...'."\n";
1628
+				}
1455 1629
 				$SpotterArchive = new SpotterArchive();
1456 1630
 				$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
1457 1631
 				foreach ($alldata as $number) {
@@ -1463,46 +1637,66 @@  discard block
 block discarded – undo
1463 1637
 			// Add by month using getstat if month finish...
1464 1638
 
1465 1639
 			//if (date('m',strtotime($last_update_day)) != date('m')) {
1466
-			if ($globalDebug) echo 'Count all flights by months...'."\n";
1640
+			if ($globalDebug) {
1641
+				echo 'Count all flights by months...'."\n";
1642
+			}
1467 1643
 			$Spotter = new Spotter($this->db);
1468 1644
 			$alldata = $Spotter->countAllMonths();
1469 1645
 			$lastyear = false;
1470 1646
 			foreach ($alldata as $number) {
1471
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1647
+				if ($number['year_name'] != date('Y')) {
1648
+					$lastyear = true;
1649
+				}
1472 1650
 				$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'])));
1473 1651
 			}
1474
-			if ($globalDebug) echo 'Count all military flights by months...'."\n";
1652
+			if ($globalDebug) {
1653
+				echo 'Count all military flights by months...'."\n";
1654
+			}
1475 1655
 			$alldata = $Spotter->countAllMilitaryMonths();
1476 1656
 			foreach ($alldata as $number) {
1477 1657
 				$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'])));
1478 1658
 			}
1479
-			if ($globalDebug) echo 'Count all owners by months...'."\n";
1659
+			if ($globalDebug) {
1660
+				echo 'Count all owners by months...'."\n";
1661
+			}
1480 1662
 			$alldata = $Spotter->countAllMonthsOwners();
1481 1663
 			foreach ($alldata as $number) {
1482 1664
 				$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'])));
1483 1665
 			}
1484
-			if ($globalDebug) echo 'Count all pilots by months...'."\n";
1666
+			if ($globalDebug) {
1667
+				echo 'Count all pilots by months...'."\n";
1668
+			}
1485 1669
 			$alldata = $Spotter->countAllMonthsPilots();
1486 1670
 			foreach ($alldata as $number) {
1487 1671
 				$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'])));
1488 1672
 			}
1489
-			if ($globalDebug) echo 'Count all airlines by months...'."\n";
1673
+			if ($globalDebug) {
1674
+				echo 'Count all airlines by months...'."\n";
1675
+			}
1490 1676
 			$alldata = $Spotter->countAllMonthsAirlines();
1491 1677
 			foreach ($alldata as $number) {
1492 1678
 				$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'])));
1493 1679
 			}
1494
-			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
1680
+			if ($globalDebug) {
1681
+				echo 'Count all aircrafts by months...'."\n";
1682
+			}
1495 1683
 			$alldata = $Spotter->countAllMonthsAircrafts();
1496 1684
 			foreach ($alldata as $number) {
1497 1685
 				$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'])));
1498 1686
 			}
1499
-			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
1687
+			if ($globalDebug) {
1688
+				echo 'Count all real arrivals by months...'."\n";
1689
+			}
1500 1690
 			$alldata = $Spotter->countAllMonthsRealArrivals();
1501 1691
 			foreach ($alldata as $number) {
1502 1692
 				$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'])));
1503 1693
 			}
1504
-			if ($globalDebug) echo 'Airports data...'."\n";
1505
-			if ($globalDebug) echo '...Departure'."\n";
1694
+			if ($globalDebug) {
1695
+				echo 'Airports data...'."\n";
1696
+			}
1697
+			if ($globalDebug) {
1698
+				echo '...Departure'."\n";
1699
+			}
1506 1700
 			$this->deleteStatAirport('daily');
1507 1701
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
1508 1702
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
@@ -1622,37 +1816,53 @@  discard block
 block discarded – undo
1622 1816
 
1623 1817
 			// Count by airlines
1624 1818
 			echo '--- Stats by airlines ---'."\n";
1625
-			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
1819
+			if ($globalDebug) {
1820
+				echo 'Count all aircraft types by airlines...'."\n";
1821
+			}
1626 1822
 			$Spotter = new Spotter($this->db);
1627 1823
 			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
1628 1824
 			foreach ($alldata as $number) {
1629 1825
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']);
1630 1826
 			}
1631
-			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
1827
+			if ($globalDebug) {
1828
+				echo 'Count all aircraft registrations by airlines...'."\n";
1829
+			}
1632 1830
 			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
1633 1831
 			foreach ($alldata as $number) {
1634 1832
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']);
1635 1833
 			}
1636
-			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
1834
+			if ($globalDebug) {
1835
+				echo 'Count all callsigns by airlines...'."\n";
1836
+			}
1637 1837
 			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
1638 1838
 			foreach ($alldata as $number) {
1639 1839
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']);
1640 1840
 			}
1641
-			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
1841
+			if ($globalDebug) {
1842
+				echo 'Count all owners by airlines...'."\n";
1843
+			}
1642 1844
 			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
1643 1845
 			foreach ($alldata as $number) {
1644 1846
 				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']);
1645 1847
 			}
1646
-			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
1848
+			if ($globalDebug) {
1849
+				echo 'Count all pilots by airlines...'."\n";
1850
+			}
1647 1851
 			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
1648 1852
 			foreach ($alldata as $number) {
1649 1853
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao']);
1650 1854
 			}
1651
-			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1855
+			if ($globalDebug) {
1856
+				echo 'Count all departure airports by airlines...'."\n";
1857
+			}
1652 1858
 			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1653
-			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1859
+			if ($globalDebug) {
1860
+				echo 'Count all detected departure airports by airlines...'."\n";
1861
+			}
1654 1862
        			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1655
-			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1863
+			if ($globalDebug) {
1864
+				echo 'Order detected departure airports by airlines...'."\n";
1865
+			}
1656 1866
 	        	//$alldata = array();
1657 1867
     			foreach ($dall as $value) {
1658 1868
     				$icao = $value['airport_departure_icao'];
@@ -1673,11 +1883,17 @@  discard block
 block discarded – undo
1673 1883
 			foreach ($alldata as $number) {
1674 1884
 				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']);
1675 1885
 			}
1676
-			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1886
+			if ($globalDebug) {
1887
+				echo 'Count all arrival airports by airlines...'."\n";
1888
+			}
1677 1889
 			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1678
-			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1890
+			if ($globalDebug) {
1891
+				echo 'Count all detected arrival airports by airlines...'."\n";
1892
+			}
1679 1893
         		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1680
-			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1894
+			if ($globalDebug) {
1895
+				echo 'Order arrival airports by airlines...'."\n";
1896
+			}
1681 1897
 	        	//$alldata = array();
1682 1898
     			foreach ($dall as $value) {
1683 1899
     				$icao = $value['airport_arrival_icao'];
@@ -1698,35 +1914,49 @@  discard block
 block discarded – undo
1698 1914
                         foreach ($alldata as $number) {
1699 1915
 				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']);
1700 1916
 			}
1701
-			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
1917
+			if ($globalDebug) {
1918
+				echo 'Count all flights by months by airlines...'."\n";
1919
+			}
1702 1920
 			$Spotter = new Spotter($this->db);
1703 1921
 			$alldata = $Spotter->countAllMonthsByAirlines();
1704 1922
 			$lastyear = false;
1705 1923
 			foreach ($alldata as $number) {
1706
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1924
+				if ($number['year_name'] != date('Y')) {
1925
+					$lastyear = true;
1926
+				}
1707 1927
 				$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']);
1708 1928
 			}
1709
-			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
1929
+			if ($globalDebug) {
1930
+				echo 'Count all owners by months by airlines...'."\n";
1931
+			}
1710 1932
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines();
1711 1933
 			foreach ($alldata as $number) {
1712 1934
 				$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']);
1713 1935
 			}
1714
-			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
1936
+			if ($globalDebug) {
1937
+				echo 'Count all pilots by months by airlines...'."\n";
1938
+			}
1715 1939
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines();
1716 1940
 			foreach ($alldata as $number) {
1717 1941
 				$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']);
1718 1942
 			}
1719
-			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
1943
+			if ($globalDebug) {
1944
+				echo 'Count all aircrafts by months by airlines...'."\n";
1945
+			}
1720 1946
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines();
1721 1947
 			foreach ($alldata as $number) {
1722 1948
 				$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']);
1723 1949
 			}
1724
-			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
1950
+			if ($globalDebug) {
1951
+				echo 'Count all real arrivals by months by airlines...'."\n";
1952
+			}
1725 1953
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines();
1726 1954
 			foreach ($alldata as $number) {
1727 1955
 				$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']);
1728 1956
 			}
1729
-			if ($globalDebug) echo '...Departure'."\n";
1957
+			if ($globalDebug) {
1958
+				echo '...Departure'."\n";
1959
+			}
1730 1960
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
1731 1961
         		$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1732 1962
     			foreach ($dall as $value) {
@@ -1749,7 +1979,9 @@  discard block
 block discarded – undo
1749 1979
 			foreach ($alldata as $number) {
1750 1980
 				$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']);
1751 1981
 			}
1752
-			if ($globalDebug) echo '...Arrival'."\n";
1982
+			if ($globalDebug) {
1983
+				echo '...Arrival'."\n";
1984
+			}
1753 1985
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
1754 1986
         		$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1755 1987
     			foreach ($dall as $value) {
@@ -1773,13 +2005,19 @@  discard block
 block discarded – undo
1773 2005
 				$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']);
1774 2006
 			}
1775 2007
 
1776
-			if ($globalDebug) echo 'Flights data...'."\n";
1777
-			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
2008
+			if ($globalDebug) {
2009
+				echo 'Flights data...'."\n";
2010
+			}
2011
+			if ($globalDebug) {
2012
+				echo '-> countAllDatesLastMonth...'."\n";
2013
+			}
1778 2014
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines();
1779 2015
 			foreach ($alldata as $number) {
1780 2016
 				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
1781 2017
 			}
1782
-			if ($globalDebug) echo '-> countAllDates...'."\n";
2018
+			if ($globalDebug) {
2019
+				echo '-> countAllDates...'."\n";
2020
+			}
1783 2021
 			//$previousdata = $this->countAllDatesByAirlines();
1784 2022
 			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines());
1785 2023
 			$values = array();
@@ -1792,19 +2030,25 @@  discard block
 block discarded – undo
1792 2030
 				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
1793 2031
 			}
1794 2032
 			
1795
-			if ($globalDebug) echo '-> countAllHours...'."\n";
2033
+			if ($globalDebug) {
2034
+				echo '-> countAllHours...'."\n";
2035
+			}
1796 2036
 			$alldata = $Spotter->countAllHoursByAirlines('hour');
1797 2037
 			foreach ($alldata as $number) {
1798 2038
 				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
1799 2039
 			}
1800 2040
 			
1801 2041
 
1802
-			if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array();
2042
+			if (!isset($globalStatsFilters) || $globalStatsFilters == '') {
2043
+				$globalStatsFilters = array();
2044
+			}
1803 2045
 			foreach ($globalStatsFilters as $name => $filter) {
1804 2046
 				//$filter_name = $filter['name'];
1805 2047
 				$filter_name = $name;
1806 2048
 				// Count by filter
1807
-				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
2049
+				if ($globalDebug) {
2050
+					echo '--- Stats for filter '.$filter_name.' ---'."\n";
2051
+				}
1808 2052
 				$Spotter = new Spotter($this->db);
1809 2053
 				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
1810 2054
 				foreach ($alldata as $number) {
@@ -1842,7 +2086,9 @@  discard block
 block discarded – undo
1842 2086
 	    				$icao = $value['airport_departure_icao'];
1843 2087
         				if (isset($alldata[$icao])) {
1844 2088
     						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1845
-        				} else $alldata[$icao] = $value;
2089
+        				} else {
2090
+        					$alldata[$icao] = $value;
2091
+        				}
1846 2092
 				}
1847 2093
 	    			$count = array();
1848 2094
     				foreach ($alldata as $key => $row) {
@@ -1863,7 +2109,9 @@  discard block
 block discarded – undo
1863 2109
 	    				$icao = $value['airport_arrival_icao'];
1864 2110
         				if (isset($alldata[$icao])) {
1865 2111
         					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1866
-		        		} else $alldata[$icao] = $value;
2112
+		        		} else {
2113
+		        			$alldata[$icao] = $value;
2114
+		        		}
1867 2115
 	    			}
1868 2116
         			$count = array();
1869 2117
         			foreach ($alldata as $key => $row) {
@@ -1877,7 +2125,9 @@  discard block
 block discarded – undo
1877 2125
 				$alldata = $Spotter->countAllMonths($filter);
1878 2126
 				$lastyear = false;
1879 2127
 				foreach ($alldata as $number) {
1880
-					if ($number['year_name'] != date('Y')) $lastyear = true;
2128
+					if ($number['year_name'] != date('Y')) {
2129
+						$lastyear = true;
2130
+					}
1881 2131
 					$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);
1882 2132
 				}
1883 2133
 				$alldata = $Spotter->countAllMonthsOwners($filter);
Please login to merge, or discard this patch.
manufacturer-detailed.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 		$limit_start = 0;
14 14
 		$limit_end = 25;
15 15
 		$absolute_difference = 25;
16
-	}  else {
16
+	} else {
17 17
 		$limit_explode = explode(",", $_GET['limit']);
18 18
 		$limit_start = $limit_explode[0];
19 19
 		$limit_end = $limit_explode[1];
@@ -47,7 +47,9 @@  discard block
 block discarded – undo
47 47
 		print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
48 48
 		$Stats = new Stats();
49 49
 		$all_manufacturers = $Stats->getAllManufacturers();
50
-		if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
50
+		if (empty($all_manufacturers)) {
51
+			$all_manufacturers = $Spotter->getAllManufacturers();
52
+		}
51 53
 		foreach($all_manufacturers as $all_manufacturer)
52 54
 		{
53 55
 			if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.
manufacturer-statistics-route.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
24 24
 	$Stats = new Stats();
25 25
 	$all_manufacturers = $Stats->getAllManufacturers();
26
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
+	if (empty($all_manufacturers)) {
27
+		$all_manufacturers = $Spotter->getAllManufacturers();
28
+	}
27 29
 	foreach($all_manufacturers as $all_manufacturer)
28 30
 	{
29 31
 		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.
manufacturer-statistics-aircraft.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
24 24
 	$Stats = new Stats();
25 25
 	$all_manufacturers = $Stats->getAllManufacturers();
26
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
+	if (empty($all_manufacturers)) {
27
+		$all_manufacturers = $Spotter->getAllManufacturers();
28
+	}
27 29
 	foreach($all_manufacturers as $all_manufacturer)
28 30
 	{
29 31
 		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.
manufacturer-statistics-arrival-airport.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
24 24
 	$Stats = new Stats();
25 25
 	$all_manufacturers = $Stats->getAllManufacturers();
26
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
+	if (empty($all_manufacturers)) {
27
+		$all_manufacturers = $Spotter->getAllManufacturers();
28
+	}
27 29
 	foreach($all_manufacturers as $all_manufacturer)
28 30
 	{
29 31
 		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.
manufacturer-statistics-registration.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
24 24
 	$Stats = new Stats();
25 25
 	$all_manufacturers = $Stats->getAllManufacturers();
26
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
+	if (empty($all_manufacturers)) {
27
+		$all_manufacturers = $Spotter->getAllManufacturers();
28
+	}
27 29
 	foreach($all_manufacturers as $all_manufacturer)
28 30
 	{
29 31
 		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.
manufacturer-statistics-time.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
24 24
 	$Stats = new Stats();
25 25
 	$all_manufacturers = $Stats->getAllManufacturers();
26
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
+	if (empty($all_manufacturers)) {
27
+		$all_manufacturers = $Spotter->getAllManufacturers();
28
+	}
27 29
 	foreach($all_manufacturers as $all_manufacturer)
28 30
 	{
29 31
 		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.
manufacturer-statistics-airline.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
24 24
 	$Stats = new Stats();
25 25
 	$all_manufacturers = $Stats->getAllManufacturers();
26
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
+	if (empty($all_manufacturers)) {
27
+		$all_manufacturers = $Spotter->getAllManufacturers();
28
+	}
27 29
 	foreach($all_manufacturers as $all_manufacturer)
28 30
 	{
29 31
 		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.